git.samba.org
/
obnox
/
samba
/
samba-obnox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
917c3f0
)
rwrap: CNAME record can recurse into A, AAAA or CNAME
author
Jakub Hrozek
<jakub.hrozek@gmail.com>
Wed, 3 Dec 2014 14:45:05 +0000
(15:45 +0100)
committer
Andrew Bartlett
<abartlet@samba.org>
Fri, 5 Dec 2014 22:32:06 +0000
(23:32 +0100)
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/resolv_wrapper/resolv_wrapper.c
patch
|
blob
|
history
diff --git
a/lib/resolv_wrapper/resolv_wrapper.c
b/lib/resolv_wrapper/resolv_wrapper.c
index 99c091d0de08e784d1471d0f8f584462cf2a5816..75439fac6cb61f08d0665d29fbf4580bdbb77c26 100644
(file)
--- a/
lib/resolv_wrapper/resolv_wrapper.c
+++ b/
lib/resolv_wrapper/resolv_wrapper.c
@@
-677,6
+677,23
@@
static int rwrap_srv_recurse(const char *hostfile, unsigned recursion,
return rc;
}
return rc;
}
+static int rwrap_cname_recurse(const char *hostfile, unsigned recursion,
+ const char *query, struct rwrap_fake_rr *rr)
+{
+ int rc;
+
+ rc = rwrap_get_record(hostfile, recursion, query, ns_t_a, rr);
+ if (rc == 0) return 0;
+
+ rc = rwrap_get_record(hostfile, recursion, query, ns_t_aaaa, rr);
+ if (rc == 0) return 0;
+
+ rc = rwrap_get_record(hostfile, recursion, query, ns_t_cname, rr);
+ if (rc == ENOENT) rc = 0;
+
+ return rc;
+}
+
static int rwrap_get_record(const char *hostfile, unsigned recursion,
const char *query, int type,
struct rwrap_fake_rr *rr)
static int rwrap_get_record(const char *hostfile, unsigned recursion,
const char *query, int type,
struct rwrap_fake_rr *rr)
@@
-749,6
+766,10
@@
static int rwrap_get_record(const char *hostfile, unsigned recursion,
} else if (TYPE_MATCH(type, ns_t_cname,
rec_type, "CNAME", key, query)) {
rc = rwrap_create_fake_cname_rr(key, value, rr);
} else if (TYPE_MATCH(type, ns_t_cname,
rec_type, "CNAME", key, query)) {
rc = rwrap_create_fake_cname_rr(key, value, rr);
+ if (rc == 0) {
+ rc = rwrap_cname_recurse(hostfile, recursion+1,
+ value, rr + 1);
+ }
break;
}
}
break;
}
}