dns_lookup: Let make test override the resolv.conf location
authorVolker Lendecke <vl@samba.org>
Thu, 4 Jan 2018 19:58:05 +0000 (20:58 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 15 Jan 2019 06:53:21 +0000 (07:53 +0100)
Make this a separate commit: That is the feature that libc unfortunately does
not give us.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/dns/dns_lookup.c

index 6fc912cb8f3a09a902bbd457f38af87b92ec83ee..b99ab426e1018fa9aa567f218185b68532dd3fc3 100644 (file)
@@ -68,7 +68,18 @@ struct tevent_req *dns_lookup_send(TALLOC_CTX *mem_ctx,
        state->qtype = qtype;
 
        if (resolv_conf_fp == NULL) {
-               fp = fopen("/etc/resolv.conf", "r");
+               const char *resolvconf = "/etc/resolv.conf";
+
+#ifdef DEVELOPER
+               {
+                       const char *envvar = getenv("RESOLV_CONF");
+                       if (envvar != NULL) {
+                               resolvconf = envvar;
+                       }
+               }
+#endif
+
+               fp = fopen(resolvconf, "r");
                if (fp == NULL) {
                        tevent_req_error(req, errno);
                        return tevent_req_post(req, ev);