[PATCH] DNS SRV Support
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[PATCH] DNS SRV Support
- From: James M Leddy <james.leddy [at] redhat.com>
- To: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Cc: subu.ayyagari [at] gmail.com, nalin [at] redhat.com
- Subject: [PATCH] DNS SRV Support
- Date: Tue, 23 Aug 2011 17:55:57 -0400
Resending since I'm now subbed to the ML:
Hi,
This patch implements DNS SRV support for SRV records from different
domains, of the format
uri DNS:DOMAINNAME
Please consider including.
--
James M. Leddy
Technical Account Manager
Red Hat Inc.
Index: nslcd/cfg.c
===================================================================
--- nslcd/cfg.c (revision 1511)
+++ nslcd/cfg.c (working copy)
@@ -184,13 +184,22 @@
/* add URIs by doing DNS queries for SRV records */
static void add_uris_from_dns(const char *filename,int lnr,
- struct ldap_config *cfg)
+ struct ldap_config *cfg,
+ const char *ldap_srv_domain)
{
int rc;
const char *domain;
char *hostlist=NULL,*nxt;
char buf[HOST_NAME_MAX+sizeof("ldap://")];
- domain=cfg_getdomainname(filename,lnr);
+ if (ldap_srv_domain==NULL)
+ {
+ domain=cfg_getdomainname(filename,lnr);
+ }
+ else
+ {
+ domain=strdup(ldap_srv_domain);
+ }
+ log_log(LOG_DEBUG,"domain to use %s",domain);
rc=ldap_domain2hostlist(domain,&hostlist);
/* FIXME: have better error handling */
if ((hostlist==NULL)||(*hostlist=='\0'))
@@ -799,6 +808,7 @@
char keyword[32];
char token[64];
int i;
+ char ldap_srv_domain[HOST_NAME_MAX];
#ifdef LDAP_OPT_X_TLS
int rc;
char *value;
@@ -856,12 +866,22 @@
if (strcasecmp(token,"dns")==0)
{
#ifdef HAVE_LDAP_DOMAIN2HOSTLIST
- add_uris_from_dns(filename,lnr,cfg);
+ add_uris_from_dns(filename,lnr,cfg,NULL);
#else /* not HAVE_LDAP_DOMAIN2HOSTLIST */
log_log(LOG_ERR,"%s:%d: value %s not supported on
platform",filename,lnr,token);
exit(EXIT_FAILURE);
#endif /* not HAVE_LDAP_DOMAIN2HOSTLIST */
}
+ else if (strncasecmp(token, "dns:", 4)==0)
+ {
+#ifdef HAVE_LDAP_DOMAIN2HOSTLIST
+ strncpy(ldap_srv_domain,token+sizeof("dns"),HOST_NAME_MAX);
+ add_uris_from_dns(filename,lnr,cfg,ldap_srv_domain);
+#else /* not HAVE_LDAP_DOMAIN2HOSTLIST */
+ log_log(LOG_ERR,"%s:%d: value %s not supported on
platform",filename,lnr,token);
+ exit(EXIT_FAILURE);
+#endif /* not HAVE_LDAP_DOMAIN2HOSTLIST */
+ }
else
add_uri(filename,lnr,cfg,token);
}
Index: man/nslcd.conf.5.xml
===================================================================
--- man/nslcd.conf.5.xml (revision 1511)
+++ man/nslcd.conf.5.xml (working copy)
@@ -132,6 +132,13 @@
<acronym>SRV</acronym> records.
</para>
<para>
+ Alternately, you can get <acronym>DNS</acronym>
+ <acronym>SRV</acronym> records from another domain by using
+ <literal>DNS:</literal><replaceable>DOMAIN</replaceable> syntax
+ where <replaceable>DOMAIN</replaceable> is the domain to query
+ the <acronym>DNS</acronym> <acronym>SRV</acronym> records.
+ </para>
+ <para>
When using the ldapi scheme, %2f should be used to escape slashes
(e.g. ldapi://%2fvar%2frun%2fslapd%2fldapi/), although most of the
time this should not be needed.
--
To unsubscribe send an email to
nss-pam-ldapd-users-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-users
- [PATCH] DNS SRV Support,
James M Leddy