Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2012-03-10 21:57:41 +0100
committerArthur de Jong <arthur@arthurdejong.org>2012-03-10 21:57:41 +0100
commit4e15284d7689115aa8b13e4f43fabcd669adcf8e (patch)
tree2e0468677f1afa951674366f69645a96040c9883 /nslcd
parentf584f55587dad7f02478d6b74b113fd5d592176a (diff)
when doing DNS queries for SRV records recognise default ldap and ldaps ports
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1632 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd')
-rw-r--r--nslcd/cfg.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index ab1bb1f..809dc41 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -5,7 +5,7 @@
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2007 West Consulting
- Copyright (C) 2007, 2008, 2009, 2010, 2011 Arthur de Jong
+ Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -214,8 +214,19 @@ static void add_uris_from_dns(const char *filename,int lnr,
*nxt='\0';
nxt++;
}
- /* add the URI */
- mysnprintf(buf,sizeof(buf),"ldap://%s",hostlist);
+ /* if port is 636, use ldaps:// URI */
+ if ((strlen(hostlist)>4)&&(strcmp(hostlist+strlen(hostlist)-4,":636")==0))
+ {
+ hostlist[strlen(hostlist)-4]='\0';
+ mysnprintf(buf,sizeof(buf),"ldaps://%s",hostlist);
+ }
+ else
+ {
+ /* strip default port number */
+ if ((strlen(hostlist)>4)&&(strcmp(hostlist+strlen(hostlist)-4,":389")==0))
+ hostlist[strlen(hostlist)-4]='\0';
+ mysnprintf(buf,sizeof(buf),"ldap://%s",hostlist);
+ }
log_log(LOG_DEBUG,"add_uris_from_dns(): found uri: %s",buf);
add_uri(filename,lnr,cfg,buf);
/* get next entry from list */