summaryrefslogtreecommitdiffstats
path: root/ldap/admin
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2007-02-23 18:40:27 +0000
committerRich Megginson <rmeggins@redhat.com>2007-02-23 18:40:27 +0000
commit7fe10d998fdef38f0b6a2f701a89a68cad4bbe31 (patch)
treedbc3b2be341fdd0553f9501971fbb2596a2ade75 /ldap/admin
parent545e9a6936cbd280eb767e3b41897f3ad812c66b (diff)
downloadds-7fe10d998fdef38f0b6a2f701a89a68cad4bbe31.tar.gz
ds-7fe10d998fdef38f0b6a2f701a89a68cad4bbe31.tar.xz
ds-7fe10d998fdef38f0b6a2f701a89a68cad4bbe31.zip
Resolves: bug 229825
Bug Description: aci with bogus uid= dn created by ds_newinst Reviewed by: nhosoi (Thanks!) Fix Description: Unknown to me until just now, PL_strdup(NULL) will return "" - the empty string. The code in config_suitespot() expects that empty or unused fields are NULL. The solution is to create a create_instance_strdup() wrapper around PL_strdup() and use that in cases where the argument may be NULL. I checked create_instance.c. Every other place where PL_strdup is used, the argument is checked for NULL first. So these are the only places affected. Instance creation works fine after this change and does not create the offending aci. Platforms tested: RHEL4 Flag Day: no Doc impact: no
Diffstat (limited to 'ldap/admin')
-rw-r--r--ldap/admin/src/create_instance.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/ldap/admin/src/create_instance.c b/ldap/admin/src/create_instance.c
index 620ab4a8..3439dc61 100644
--- a/ldap/admin/src/create_instance.c
+++ b/ldap/admin/src/create_instance.c
@@ -338,6 +338,7 @@ char *create_instance_copy(char *, char *, int, int);
char *create_instance_concatenate(char *, char *, int);
int create_instance_mkdir(char *, int);
char *create_instance_mkdir_p(char *, char *, int, struct passwd *);
+static char *create_instance_strdup(const char *);
#if defined( SOLARIS )
/*
@@ -1311,6 +1312,16 @@ int create_instance_numbers(char *target)
return 1;
}
+static char *create_instance_strdup(const char *s)
+{
+ char *result = NULL;
+ if (s) {
+ result = PL_strdup(s);
+ }
+
+ return result;
+}
+
#if defined( SOLARIS )
/*
* Solaris 9+ specific installation
@@ -4063,23 +4074,23 @@ static char *install_ds(char *sroot, server_config_s *cf, char *param_name)
memset( &query_vars, 0, sizeof(query_vars) );
if (!cf->use_existing_user_ds)
- query_vars.suffix = PL_strdup( cf->suffix );
- query_vars.ssAdmID = PL_strdup( cf->cfg_sspt_uid );
- query_vars.ssAdmPW1 = PL_strdup( cf->cfg_sspt_uidpw );
- query_vars.ssAdmPW2 = PL_strdup( cf->cfg_sspt_uidpw );
- query_vars.rootDN = PL_strdup( cf->rootdn );
- query_vars.rootPW = PL_strdup( cf->rootpw );
- query_vars.admin_domain = PL_strdup( cf->admin_domain );
- query_vars.netscaperoot = PL_strdup( cf->netscaperoot );
- query_vars.testconfig = PL_strdup( cf->testconfig );
- query_vars.consumerDN = PL_strdup(cf->consumerdn);
- query_vars.consumerPW = PL_strdup(cf->consumerhashedpw);
+ query_vars.suffix = create_instance_strdup( cf->suffix );
+ query_vars.ssAdmID = create_instance_strdup( cf->cfg_sspt_uid );
+ query_vars.ssAdmPW1 = create_instance_strdup( cf->cfg_sspt_uidpw );
+ query_vars.ssAdmPW2 = create_instance_strdup( cf->cfg_sspt_uidpw );
+ query_vars.rootDN = create_instance_strdup( cf->rootdn );
+ query_vars.rootPW = create_instance_strdup( cf->rootpw );
+ query_vars.admin_domain = create_instance_strdup( cf->admin_domain );
+ query_vars.netscaperoot = create_instance_strdup( cf->netscaperoot );
+ query_vars.testconfig = create_instance_strdup( cf->testconfig );
+ query_vars.consumerDN = create_instance_strdup(cf->consumerdn);
+ query_vars.consumerPW = create_instance_strdup(cf->consumerhashedpw);
if (cf->cfg_sspt && !strcmp(cf->cfg_sspt, "1"))
query_vars.cfg_sspt = 1;
else
query_vars.cfg_sspt = 0;
- query_vars.config_admin_uid = PL_strdup(cf->cfg_sspt_uid);
+ query_vars.config_admin_uid = create_instance_strdup(cf->cfg_sspt_uid);
memset(&slapd_conf, 0, sizeof(SLAPD_CONFIG));
if (sroot)