{"action":"created","issue":{"url":"https://api.github.com/repos/OpenSMTPD/libasr/issues/8","labels_url":"https://api.github.com/repos/OpenSMTPD/libasr/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/OpenSMTPD/libasr/issues/8/comments","events_url":"https://api.github.com/repos/OpenSMTPD/libasr/issues/8/events","html_url":"https://github.com/OpenSMTPD/libasr/issues/8","id":89348222,"number":8,"title":"Add res_randomid","user":{"login":"doughdemon","id":1036802,"avatar_url":"https://avatars.githubusercontent.com/u/1036802?v=3","gravatar_id":"","url":"https://api.github.com/users/doughdemon","html_url":"https://github.com/doughdemon","followers_url":"https://api.github.com/users/doughdemon/followers","following_url":"https://api.github.com/users/doughdemon/following{/other_user}","gists_url":"https://api.github.com/users/doughdemon/gists{/gist_id}","starred_url":"https://api.github.com/users/doughdemon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doughdemon/subscriptions","organizations_url":"https://api.github.com/users/doughdemon/orgs","repos_url":"https://api.github.com/users/doughdemon/repos","events_url":"https://api.github.com/users/doughdemon/events{/privacy}","received_events_url":"https://api.github.com/users/doughdemon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"poolpOrg","id":895503,"avatar_url":"https://avatars.githubusercontent.com/u/895503?v=3","gravatar_id":"","url":"https://api.github.com/users/poolpOrg","html_url":"https://github.com/poolpOrg","followers_url":"https://api.github.com/users/poolpOrg/followers","following_url":"https://api.github.com/users/poolpOrg/following{/other_user}","gists_url":"https://api.github.com/users/poolpOrg/gists{/gist_id}","starred_url":"https://api.github.com/users/poolpOrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poolpOrg/subscriptions","organizations_url":"https://api.github.com/users/poolpOrg/orgs","repos_url":"https://api.github.com/users/poolpOrg/repos","events_url":"https://api.github.com/users/poolpOrg/events{/privacy}","received_events_url":"https://api.github.com/users/poolpOrg/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-06-18T17:19:43Z","updated_at":"2015-06-19T14:28:23Z","closed_at":null,"body":"libasr has copied many resolver functions from OpenBSD. However the function res_randomid(), which is used in res_send_async() and res_mkquery() seems to have been forgotten.\r\n\r\nBecause of this libasr currently only works with glibc and uclibc>=0.9.33 as these libc's provide the function. It however seems to be a non-standard function with no real documentation.\r\n\r\nCould res_randomid() be provided, inclusion possibly depending on a configure test?"},"comment":{"url":"https://api.github.com/repos/OpenSMTPD/libasr/issues/comments/113531155","html_url":"https://github.com/OpenSMTPD/libasr/issues/8#issuecomment-113531155","issue_url":"https://api.github.com/repos/OpenSMTPD/libasr/issues/8","id":113531155,"user":{"login":"ncopa","id":66357,"avatar_url":"https://avatars.githubusercontent.com/u/66357?v=3","gravatar_id":"","url":"https://api.github.com/users/ncopa","html_url":"https://github.com/ncopa","followers_url":"https://api.github.com/users/ncopa/followers","following_url":"https://api.github.com/users/ncopa/following{/other_user}","gists_url":"https://api.github.com/users/ncopa/gists{/gist_id}","starred_url":"https://api.github.com/users/ncopa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncopa/subscriptions","organizations_url":"https://api.github.com/users/ncopa/orgs","repos_url":"https://api.github.com/users/ncopa/repos","events_url":"https://api.github.com/users/ncopa/events{/privacy}","received_events_url":"https://api.github.com/users/ncopa/received_events","type":"User","site_admin":false},"created_at":"2015-06-19T14:28:23Z","updated_at":"2015-06-19T14:28:23Z","body":"Quick and dirty hack. We probably want something better though.\r\n\r\n```diff\r\ndiff --git a/configure.ac b/configure.ac\r\nindex 10aff04..07e149f 100644\r\n--- a/configure.ac\r\n+++ b/configure.ac\r\n@@ -456,6 +456,7 @@ AC_CHECK_FUNCS([ \\\r\n        issetugid \\\r\n        memmove \\\r\n        reallocarray \\\r\n+       res_randomid \\\r\n        snprintf \\\r\n        strdup \\\r\n        strerror \\\r\ndiff --git a/src/asr_private.h b/src/asr_private.h\r\nindex 0960e37..254e83e 100644\r\n--- a/src/asr_private.h\r\n+++ b/src/asr_private.h\r\n@@ -365,3 +365,7 @@ extern FILE * asr_debug;\r\n                asr_statestr((a)->as_state),    \\\r\n                asr_statestr((s)));             \\\r\n        (a)->as_state = (s); } while (0)\r\n+\r\n+#ifndef HAVE_RES_RANDOMID\r\n+#define res_randomid(x) (0xfff & getpid())\r\n+#endif\r\n```"}}