summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/passthru
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2007-11-14 17:53:44 +0000
committerRich Megginson <rmeggins@redhat.com>2007-11-14 17:53:44 +0000
commitb0b81ec8ce6496d205ddc02b0c26aac19b4af828 (patch)
tree6f21b21dfda3c2ba35c7c563a676cf6094b6a6f2 /ldap/servers/plugins/passthru
parentbc83e3255b4b0ebe31d9f42ad57fbea0bc49e056 (diff)
downloadds-b0b81ec8ce6496d205ddc02b0c26aac19b4af828.tar.gz
ds-b0b81ec8ce6496d205ddc02b0c26aac19b4af828.tar.xz
ds-b0b81ec8ce6496d205ddc02b0c26aac19b4af828.zip
Resolves: bug 197997
Bug Description: PTA config parsing broken Reviewed by: nhosoi (Thanks!) Fix Description: The problem is that it is very difficult to use a comma as a delimiter between the url and the optional settings. This is because the suffix may contain many commas. The argument string may look like this: ldap://host1:port1 host2:port2 .... hostN:portN/a,long,suffix1:a,long,suffix2;....;a,long,suffixN optional,numeric,settings The ldap url may not contain any spaces after the hostlist - the suffixlist part must contain only url encoded spaces if the suffix actually has a space in it. So the solution is to use a space to separate the url from the options list. The parser looks for the first space after the last "/" in the url. This should be ok - at least it will not break the most common use of pta, which is to allow the config DS admin user to log into servers that do not have the o=NetscapeRoot. setup will use something like this: ldap://configdshost:configdsport/o=NetscapeRoot with not optional settings - this should parse just fine with the new code. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
Diffstat (limited to 'ldap/servers/plugins/passthru')
-rw-r--r--ldap/servers/plugins/passthru/ptconfig.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/ldap/servers/plugins/passthru/ptconfig.c b/ldap/servers/plugins/passthru/ptconfig.c
index 272e653b..e929483b 100644
--- a/ldap/servers/plugins/passthru/ptconfig.c
+++ b/ldap/servers/plugins/passthru/ptconfig.c
@@ -131,10 +131,29 @@ passthru_config( int argc, char **argv )
*/
prevsrvr = NULL;
for ( i = 0; i < argc; ++i ) {
+ char *p = NULL;
srvr = (PassThruServer *)slapi_ch_calloc( 1, sizeof( PassThruServer ));
srvr->ptsrvr_url = slapi_ch_strdup( argv[i] );
- if (( p = strchr( srvr->ptsrvr_url, ',' )) == NULL ) {
+ /* since the ldap url may contain both spaces (to delimit multiple hosts)
+ and commas (in suffixes), we have to search for the first space
+ after the last /, then look for any commas after that
+ This assumes the ldap url looks like this:
+ ldap(s)://host:port host:port .... host:port/suffixes
+ That is, it assumes there is always a trailing slash on the ldapurl
+ and that the url does not look like this: ldap://host
+ also assumes suffixes do not have any / in them
+ */
+ if (p = strrchr(srvr->ptsrvr_url, '/')) { /* look for last / */
+ p = strchr(p, ' '); /* look for first space after last / */
+ if (p) {
+ if (!strchr(p, ',')) { /* no comma */
+ p = NULL; /* just use defaults */
+ }
+ }
+ }
+
+ if (!p) {
/*
* use defaults for maxconnections, maxconcurrency, timeout,
* LDAP version, and connlifetime.
@@ -152,7 +171,7 @@ passthru_config( int argc, char **argv )
* maxconnections,maxconcurrency,timeout,ldapversion
* OR maxconnections,maxconcurrency,timeout,ldapversion,lifetime
*/
- *p++ = '\0';
+ *p++ = '\0'; /* p points at space preceding optional arguments */
rc = sscanf( p, "%d,%d,%d,%d,%d", &srvr->ptsrvr_maxconnections,
&srvr->ptsrvr_maxconcurrency, &tosecs,
&srvr->ptsrvr_ldapversion, &srvr->ptsrvr_connlifetime );