summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/shared/utils.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2005-03-05 04:29:24 +0000
committerRich Megginson <rmeggins@redhat.com>2005-03-05 04:29:24 +0000
commitb352660e243c7b9b7d050f1c38cff1c9faf278b1 (patch)
treeede08019beb931c3206609ab2377a015d510bdb4 /ldap/servers/plugins/shared/utils.c
parentf08951680ddfebc3f3df07e720ad0650fe473c0f (diff)
downloadds-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/plugins/shared/utils.c')
-rw-r--r--ldap/servers/plugins/shared/utils.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ldap/servers/plugins/shared/utils.c b/ldap/servers/plugins/shared/utils.c
index 93bbed3a..cd9efc6c 100644
--- a/ldap/servers/plugins/shared/utils.c
+++ b/ldap/servers/plugins/shared/utils.c
@@ -21,6 +21,7 @@
***********************************************************************/
#include "plugin-utils.h"
+#include "nspr.h"
static char *plugin_name = "utils";
@@ -129,17 +130,17 @@ entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e,
Slapi_PBlock *
dnHasObjectClass( const char *baseDN, const char *objectClass ) {
int result = 0;
+ char *filter = NULL;
Slapi_PBlock *spb = NULL;
BEGIN
Slapi_Entry **entries;
- char filter[1024];
char *attrs[2];
/* Perform the search - the new pblock needs to be freed */
attrs[0] = "objectclass";
attrs[1] = NULL;
- sprintf( filter, "objectclass=%s", objectClass );
+ filter = PR_smprintf("objectclass=%s", objectClass );
if ( !(spb = readPblockAndEntry( baseDN, filter, attrs) ) ) {
break;
}
@@ -161,6 +162,9 @@ dnHasObjectClass( const char *baseDN, const char *objectClass ) {
}
END
+ if (filter) {
+ PR_smprintf_free(filter);
+ }
return spb;
}
@@ -174,17 +178,17 @@ Slapi_PBlock *
dnHasAttribute( const char *baseDN, const char *attrName ) {
int result = 0;
Slapi_PBlock *spb = NULL;
+ char *filter = NULL;
BEGIN
int sres;
Slapi_Entry **entries;
- char filter[1024];
char *attrs[2];
/* Perform the search - the new pblock needs to be freed */
attrs[0] = (char *)attrName;
attrs[1] = NULL;
- sprintf( filter, "%s=*", attrName );
+ filter = PR_smprintf( "%s=*", attrName );
spb = slapi_search_internal((char *)baseDN, LDAP_SCOPE_BASE,
filter, NULL, attrs, 0);
if ( !spb ) {
@@ -217,6 +221,9 @@ dnHasAttribute( const char *baseDN, const char *attrName ) {
}
END
+ if (filter) {
+ PR_smprintf_free(filter);
+ }
return spb;
}