diff -up ./man/nslcd.conf.5.xml.dnssrv ./man/nslcd.conf.5.xml --- ./man/nslcd.conf.5.xml.dnssrv 2012-04-28 21:22:26.327729809 +0200 +++ ./man/nslcd.conf.5.xml 2012-04-28 21:22:26.330729794 +0200 @@ -127,9 +127,14 @@ LDAP over TCP, ICP or SSL respectively (if supported by the LDAP library). + + Alternatively, the value DNS may be used to try to lookup the server using DNS SRV records. + By default the current domain is used but another domain can + be queried by using the + DNS:DOMAIN syntax. When using the ldapi scheme, %2f should be used to escape slashes diff -up ./nslcd/cfg.c.dnssrv ./nslcd/cfg.c --- ./nslcd/cfg.c.dnssrv 2012-04-28 21:22:26.326729814 +0200 +++ ./nslcd/cfg.c 2012-04-28 21:22:26.330729794 +0200 @@ -224,13 +224,13 @@ static char *cfg_getdomainname(const cha /* 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, + char *domain) { int rc; - char *domain; char *hostlist=NULL,*nxt; char buf[HOST_NAME_MAX+sizeof("ldap://")]; - domain=cfg_getdomainname(filename,lnr); + log_log(LOG_DEBUG,"query %s for SRV records",domain); rc=ldap_domain2hostlist(domain,&hostlist); if (rc!=LDAP_SUCCESS) { @@ -848,7 +848,16 @@ static void cfg_read(const char *filenam if (strcasecmp(token,"dns")==0) { #ifdef HAVE_LDAP_DOMAIN2HOSTLIST - add_uris_from_dns(filename,lnr,cfg); + add_uris_from_dns(filename,lnr,cfg,cfg_getdomainname(filename,lnr)); +#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 + add_uris_from_dns(filename,lnr,cfg,strdup(token+sizeof("dns"))); #else /* not HAVE_LDAP_DOMAIN2HOSTLIST */ log_log(LOG_ERR,"%s:%d: value %s not supported on platform",filename,lnr,token); exit(EXIT_FAILURE);