diff options
author | Rich Megginson <rmeggins@redhat.com> | 2005-03-05 04:29:24 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2005-03-05 04:29:24 +0000 |
commit | b352660e243c7b9b7d050f1c38cff1c9faf278b1 (patch) | |
tree | ede08019beb931c3206609ab2377a015d510bdb4 /ldap/servers/slapd/dse.c | |
parent | f08951680ddfebc3f3df07e720ad0650fe473c0f (diff) | |
download | ds-b352660e243c7b9b7d050f1c38cff1c9faf278b1.tar.gz ds-b352660e243c7b9b7d050f1c38cff1c9faf278b1.tar.xz ds-b352660e243c7b9b7d050f1c38cff1c9faf278b1.zip |
clean up sprintf usage and many other flawfinder issues; clean up compiler warnings on Linux; remove pam_passthru from DS 7.1
Diffstat (limited to 'ldap/servers/slapd/dse.c')
-rw-r--r-- | ldap/servers/slapd/dse.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c index 4ce9063e..2c47bcd5 100644 --- a/ldap/servers/slapd/dse.c +++ b/ldap/servers/slapd/dse.c @@ -327,11 +327,9 @@ dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfil char *realconfigdir = NULL; if (configdir!=NULL) { - realconfigdir = slapi_ch_malloc(strlen(configdir)+1); - strcpy(realconfigdir, configdir); + realconfigdir = slapi_ch_strdup(configdir); } else if (id!=NULL) { - realconfigdir = slapi_ch_malloc(strlen(id)+strlen(config_sub_dir)+3); - sprintf(realconfigdir, "%s/%s", id, config_sub_dir); + realconfigdir = slapi_ch_smprintf("%s/%s", id, config_sub_dir); } if(realconfigdir!=NULL) { @@ -342,17 +340,13 @@ dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfil /* Set the full path name for the config DSE entry */ if (!strstr(filename, realconfigdir)) { - pdse->dse_filename = slapi_ch_malloc( strlen( realconfigdir ) + - strlen( filename ) + 3 ); - sprintf( pdse->dse_filename, "%s/%s", realconfigdir, filename ); + pdse->dse_filename = slapi_ch_smprintf("%s/%s", realconfigdir, filename ); } else pdse->dse_filename = slapi_ch_strdup(filename); if (!strstr(tmpfilename, realconfigdir)) { - pdse->dse_tmpfile = slapi_ch_malloc( strlen( realconfigdir ) + - strlen( tmpfilename ) + 3 ); - sprintf( pdse->dse_tmpfile, "%s/%s", realconfigdir, tmpfilename ); + pdse->dse_tmpfile = slapi_ch_smprintf("%s/%s", realconfigdir, tmpfilename ); } else pdse->dse_tmpfile = slapi_ch_strdup(tmpfilename); @@ -360,9 +354,7 @@ dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfil if ( backfilename != NULL ) { if (!strstr(backfilename, realconfigdir)) { - pdse->dse_fileback = slapi_ch_malloc( strlen( realconfigdir ) + - strlen( backfilename ) + 3 ); - sprintf( pdse->dse_fileback, "%s/%s", realconfigdir, backfilename ); + pdse->dse_fileback = slapi_ch_smprintf("%s/%s", realconfigdir, backfilename ); } else pdse->dse_fileback = slapi_ch_strdup(backfilename); @@ -373,9 +365,7 @@ dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfil if ( startokfilename != NULL ) { if (!strstr(startokfilename, realconfigdir)) { - pdse->dse_filestartOK = slapi_ch_malloc( strlen( realconfigdir ) + - strlen( startokfilename ) + 3 ); - sprintf( pdse->dse_filestartOK, "%s/%s", realconfigdir, startokfilename ); + pdse->dse_filestartOK = slapi_ch_smprintf("%s/%s", realconfigdir, startokfilename ); } else pdse->dse_filestartOK = slapi_ch_strdup(startokfilename); @@ -1343,8 +1333,8 @@ dse_delete_entry(struct dse* pdse, Slapi_PBlock *pb, const Slapi_Entry *e) /* keep write lock for both tree deleting and file writing */ PR_RWLock_Wlock(pdse->dse_rwlock); - if (deleted_node = (struct dse_node *)avl_delete(&pdse->dse_tree, - n, entry_dn_cmp)) + if ((deleted_node = (struct dse_node *)avl_delete(&pdse->dse_tree, + n, entry_dn_cmp))) dse_node_delete(&deleted_node); dse_node_delete(&n); |