summaryrefslogtreecommitdiffstats
path: root/ldap/libraries
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/libraries
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/libraries')
-rw-r--r--ldap/libraries/Makefile4
-rw-r--r--ldap/libraries/libavl/Makefile3
-rw-r--r--ldap/libraries/libldif/Makefile3
-rw-r--r--ldap/libraries/libldif/line64.c26
-rw-r--r--ldap/libraries/liblitekey/Makefile3
-rw-r--r--ldap/libraries/liblitekey/keycheck.c70
-rw-r--r--ldap/libraries/libutil/ntdebug.c2
-rw-r--r--ldap/libraries/libutil/ntevent.c8
8 files changed, 20 insertions, 99 deletions
diff --git a/ldap/libraries/Makefile b/ldap/libraries/Makefile
index ff1099d8..d003d24c 100644
--- a/ldap/libraries/Makefile
+++ b/ldap/libraries/Makefile
@@ -283,10 +283,6 @@ FORCE:
$(LDAP_OUT_DIR):
$(MKDIR) $(LDAP_OUT_DIR)
-$(LDAP_LIBDIR):
- $(MKDIR) $(LDAP_LIBDIR)
-
-
GENEXPORTS=$(PERL) $(LDAP_SRC)/build/genexports.pl
# WINDEFDIR is now defined below via a recursive make. This is a
# bit of a hack to avoid collisions with SDK_EXPORT_DEFS (defined above).
diff --git a/ldap/libraries/libavl/Makefile b/ldap/libraries/libavl/Makefile
index 8ead01dc..3bc05225 100644
--- a/ldap/libraries/libavl/Makefile
+++ b/ldap/libraries/libavl/Makefile
@@ -35,9 +35,6 @@ clientSDK: all
all: $(OBJDEST) $(LIBDIR) $(LIBAVL)
-$(LIBDIR):
- $(MKDIR) $(LIBDIR)
-
$(LIBAVL): $(OBJS)
$(LINK_LIB)
diff --git a/ldap/libraries/libldif/Makefile b/ldap/libraries/libldif/Makefile
index 0ec8cddb..7037cade 100644
--- a/ldap/libraries/libldif/Makefile
+++ b/ldap/libraries/libldif/Makefile
@@ -35,9 +35,6 @@ clientSDK: all
all: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLDIF)
-$(LIBDIR):
- $(MKDIR) $(LIBDIR)
-
$(LIBLDIF): $(OBJS)
$(LINK_LIB)
diff --git a/ldap/libraries/libldif/line64.c b/ldap/libraries/libldif/line64.c
index ade33a91..e09d8250 100644
--- a/ldap/libraries/libldif/line64.c
+++ b/ldap/libraries/libldif/line64.c
@@ -36,6 +36,8 @@
#include <sys/stat.h>
#include "fileurl.h"
+#include "nspr.h"
+
#ifndef isascii
#define isascii( c ) (!((c) & ~0177))
#endif
@@ -194,32 +196,28 @@ ldif_parse_line(
bv.bv_val = NULL;
- if (( *errmsg = (char *)malloc( strlen(s) + 1024 )) == NULL ) {
- return (-1);
- }
-
/*
* We only support file:// URLs for now.
*/
switch( ldif_fileurl2path( s, &path )) {
case LDIF_FILEURL_NOTAFILEURL:
- sprintf(*errmsg,
- "ldif_parse_line: unsupported URL \"%S\";"
+ *errmsg = PR_smprintf(
+ "ldif_parse_line: unsupported URL \"%s\";"
" use a file:// URL instead.\n", s);
rc = -1;
break;
case LDIF_FILEURL_MISSINGPATH:
- sprintf(*errmsg,
- "ldif_parse_line: unable to process URL \"%S\" --"
+ *errmsg = PR_smprintf(
+ "ldif_parse_line: unable to process URL \"%s\" --"
" missing path..\n", s);
rc = -1;
break;
case LDIF_FILEURL_NONLOCAL:
- sprintf(*errmsg,
- "ldif_parse_line: unable to process URL \"%S\" --"
+ *errmsg = PR_smprintf(
+ "ldif_parse_line: unable to process URL \"%s\" --"
" only local file:// URLs are supported.\n", s);
rc = -1;
break;
@@ -234,11 +232,11 @@ ldif_parse_line(
perror( path );
rc = -1;
} else if ( fstats.st_mode & S_IFDIR ) {
- sprintf(*errmsg,
+ *errmsg = PR_smprintf(
"ldif_parse_line: %s is a directory, not a file.\n", path);
rc = -1;
} else if ( ldif_fromfile( path, &bv ) < 0 ) {
- sprintf(*errmsg,
+ *errmsg = PR_smprintf(
"ldif_parse_line: unable to retrieve information"
" from file %s.\n", path);
rc = -1;
@@ -247,8 +245,8 @@ ldif_parse_line(
break;
default:
- sprintf(*errmsg,
- "ldif_parse_line: unable to process URL \"%S\" --"
+ *errmsg = PR_smprintf(
+ "ldif_parse_line: unable to process URL \"%s\" --"
" unknown error.\n", s);
rc = -1;
}
diff --git a/ldap/libraries/liblitekey/Makefile b/ldap/libraries/liblitekey/Makefile
index ac926410..2fbc5916 100644
--- a/ldap/libraries/liblitekey/Makefile
+++ b/ldap/libraries/liblitekey/Makefile
@@ -33,9 +33,6 @@ LIBLITEKEY = $(addprefix $(LIBDIR)/, liblitekey.$(LIB_SUFFIX))
all: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLITEKEY)
-$(LIBDIR):
- $(MKDIR) $(LIBDIR)
-
$(LIBLITEKEY): $(OBJS)
$(LINK_LIB)
diff --git a/ldap/libraries/liblitekey/keycheck.c b/ldap/libraries/liblitekey/keycheck.c
index 16fed899..0231c5f5 100644
--- a/ldap/libraries/liblitekey/keycheck.c
+++ b/ldap/libraries/liblitekey/keycheck.c
@@ -14,7 +14,6 @@
#include <litekey.h>
#define DS_NORMAL_MAGIC_KEY 119
-#define DS_LITE_MAGIC_KEY 326
#define FILE_PATHSEP '/'
#define BUFSIZE 800
@@ -33,63 +32,7 @@
*/
int is_directory_lite( char *root)
{
-
- char buf[40];
- char *bufp = buf;
- FILE *fp = NULL;
- int key =0;
- char *nsroot;
- char pathname[BUFSIZE];
-
return DS_NORMAL_TYPE; /* richm: no more lite mode in DS 5.0 */
-#if 0 /* no more lite mode */
- /* There are 3 ways to determine if the server is FULL or LITE.
- * 1) Use NETSITE_ROOT variable
- * 2) Use the root path provided
- * 3) Look at the current directory
- *
- * If all of them fails, then it's LITE.
- */
- nsroot = getenv("NETSITE_ROOT");
-
- if ( (NULL == root) && (NULL == nsroot)) {
- /* case 3 */
- sprintf ( pathname, "slapd.key" );
- } else if (NULL == nsroot) {
- /* case 2 */
- sprintf ( pathname, "%s%cbin%cslapd%cserver%cslapd.key",
- root, FILE_PATHSEP,FILE_PATHSEP,
- FILE_PATHSEP, FILE_PATHSEP);
- } else {
- /* case 1 */
- sprintf ( pathname, "%s%cbin%cslapd%cserver%cslapd.key",
- nsroot, FILE_PATHSEP,FILE_PATHSEP,
- FILE_PATHSEP, FILE_PATHSEP);
- }
-
-
- /* First read from the key file */
- if ((fp = fopen ( pathname, "r")) == NULL )
- return DS_LITE_TYPE;
-
- if ( fgets(buf, 40, fp) == NULL)
- return DS_LITE_TYPE;
-
- fclose (fp );
-
- /* The key is in the format: "key:123456" */
- bufp +=4;
- key = atoi ( (const char *) bufp );
-
- /* Now we have the key. Determine which one it is */
- if ( 0 == (key % DS_NORMAL_MAGIC_KEY))
- return DS_NORMAL_TYPE;
- else if ( 0 == (key % DS_LITE_MAGIC_KEY) )
- return DS_LITE_TYPE;
-
- /* By defualt, it's lite */
- return DS_LITE_TYPE;
-#endif /* no more lite mode */
}
/*
@@ -111,10 +54,7 @@ int generate_directory_key( int type)
val = rand();
- if (type == DS_NORMAL_TYPE )
- key = val * DS_NORMAL_MAGIC_KEY;
- else if (type == DS_LITE_TYPE )
- key = val * DS_LITE_MAGIC_KEY;
+ key = val * DS_NORMAL_MAGIC_KEY;
return key;
}
@@ -127,11 +67,5 @@ int generate_directory_key( int type)
int
is_key_validNormalKey ( int key )
{
-
- if (key <= 0 ) return 0;
-
- if (0 == ( key % DS_NORMAL_MAGIC_KEY ))
- return 1;
-
- return 0;
+ return 1;
}
diff --git a/ldap/libraries/libutil/ntdebug.c b/ldap/libraries/libutil/ntdebug.c
index 50b7ea1a..c51f7848 100644
--- a/ldap/libraries/libutil/ntdebug.c
+++ b/ldap/libraries/libutil/ntdebug.c
@@ -31,7 +31,7 @@ void LDAPDebug( int level, char *fmt, ... )
if ( slapd_ldap_debug & level )
{
char szFormattedString[512];
- _vsnprintf( szFormattedString, sizeof( szFormattedString ), fmt, arg_ptr );
+ PR_vsnprintf( szFormattedString, sizeof( szFormattedString ), fmt, arg_ptr );
#if defined( LDAP_DEBUG )
/* Send to debug window ...*/
diff --git a/ldap/libraries/libutil/ntevent.c b/ldap/libraries/libutil/ntevent.c
index 2ace2979..2240936a 100644
--- a/ldap/libraries/libutil/ntevent.c
+++ b/ldap/libraries/libutil/ntevent.c
@@ -10,6 +10,8 @@
#include <stdio.h>
#include "ldap.h"
#include "regparms.h"
+#include "nspr.h"
+#include "plstr.h"
HANDLE hSlapdEventSource;
LPTSTR pszServerName;
@@ -89,7 +91,7 @@ MultipleInstances()
if( !pszServerName )
return FALSE;
- sprintf(szDoneEvent, "NS_%s", pszServerName);
+ PR_snprintf(szDoneEvent, sizeof(szDoneEvent), "NS_%s", pszServerName);
hServDoneSemaphore = CreateSemaphore(
NULL, // security attributes
@@ -102,7 +104,7 @@ MultipleInstances()
result = GetLastError();
if (result == ERROR_INVALID_HANDLE) {
- sprintf(ErrMsg, "Netscape Server %s is already"
+ PR_snprintf(ErrMsg, sizeof(ErrMsg), "Netscape Server %s is already"
" running. Terminating this instance.", pszServerName);
MessageBox(GetDesktopWindow(), ErrMsg,
@@ -136,7 +138,7 @@ BOOL SlapdGetServerNameFromCmdline(char *szServerName, char *szCmdLine, int dirn
if( szCmdLine )
{
memset(szCmdCopy, 0, _MAX_PATH );
- strcpy( szCmdCopy, szCmdLine );
+ PL_strncpyz( szCmdCopy, szCmdLine , sizeof(szCmdCopy) );
}
else
return(bReturn);