mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 16:19:35 -05:00
Misc sprintf/snprintf cleanup
This commit is contained in:
parent
b6bbc69e2f
commit
e6460769ab
8 changed files with 22 additions and 22 deletions
|
|
@ -106,7 +106,7 @@ int lutil_mnem2level( const char *level )
|
||||||
|
|
||||||
static int addSubsys( const char *subsys, int level )
|
static int addSubsys( const char *subsys, int level )
|
||||||
{
|
{
|
||||||
int i, j, subsys_num;
|
int subsys_num;
|
||||||
|
|
||||||
if ( !strcasecmp( subsys, "backend" ) )
|
if ( !strcasecmp( subsys, "backend" ) )
|
||||||
{
|
{
|
||||||
|
|
@ -152,8 +152,7 @@ void lutil_log_int(
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *today;
|
struct tm *today;
|
||||||
#endif
|
#endif
|
||||||
int i;
|
size_t i;
|
||||||
char data[4096];
|
|
||||||
char * t_subsys;
|
char * t_subsys;
|
||||||
char * tmp;
|
char * tmp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,10 @@ SOURCE=.\bprint.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\debug.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\decode.c
|
SOURCE=.\decode.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ static void openldap_ldap_init_w_userconf(const char *file)
|
||||||
Debug(LDAP_DEBUG_TRACE, "ldap_init: HOME env is %s\n",
|
Debug(LDAP_DEBUG_TRACE, "ldap_init: HOME env is %s\n",
|
||||||
home, 0, 0);
|
home, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
path = LDAP_MALLOC(strlen(home) + strlen(file) + 3);
|
path = LDAP_MALLOC(strlen(home) + strlen(file) + sizeof( LDAP_DIRSEP "."));
|
||||||
} else {
|
} else {
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG ( CONFIG, ARGS, "openldap_init_w_userconf: HOME env is NULL\n",
|
LDAP_LOG ( CONFIG, ARGS, "openldap_init_w_userconf: HOME env is NULL\n",
|
||||||
|
|
@ -282,11 +282,11 @@ static void openldap_ldap_init_w_userconf(const char *file)
|
||||||
/* we assume UNIX path syntax is used... */
|
/* we assume UNIX path syntax is used... */
|
||||||
|
|
||||||
/* try ~/file */
|
/* try ~/file */
|
||||||
sprintf(path, "%s%s%s", home, LDAP_DIRSEP, file);
|
sprintf(path, "%s" LDAP_DIRSEP "%s", home, file);
|
||||||
openldap_ldap_init_w_conf(path, 1);
|
openldap_ldap_init_w_conf(path, 1);
|
||||||
|
|
||||||
/* try ~/.file */
|
/* try ~/.file */
|
||||||
sprintf(path, "%s%s.%s", home, LDAP_DIRSEP, file);
|
sprintf(path, "%s" LDAP_DIRSEP ".%s", home, file);
|
||||||
openldap_ldap_init_w_conf(path, 1);
|
openldap_ldap_init_w_conf(path, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ print_noidlen(safe_string *ss, char *s, int l)
|
||||||
|
|
||||||
ret = print_numericoid(ss,s);
|
ret = print_numericoid(ss,s);
|
||||||
if ( l ) {
|
if ( l ) {
|
||||||
sprintf(buf,"{%d}",l);
|
snprintf(buf, sizeof buf, "{%d}",l);
|
||||||
ret = print_literal(ss,buf);
|
ret = print_literal(ss,buf);
|
||||||
}
|
}
|
||||||
return(ret);
|
return(ret);
|
||||||
|
|
|
||||||
|
|
@ -1229,7 +1229,7 @@ write_cdata(char *opath)
|
||||||
/*
|
/*
|
||||||
* Open the ctype.dat file.
|
* Open the ctype.dat file.
|
||||||
*/
|
*/
|
||||||
sprintf(path, "%s%sctype.dat", opath, LDAP_DIRSEP);
|
snprintf(path, sizeof path, "%s%sctype.dat", opath, LDAP_DIRSEP);
|
||||||
if ((out = fopen(path, "wb")) == 0)
|
if ((out = fopen(path, "wb")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1300,7 +1300,7 @@ write_cdata(char *opath)
|
||||||
/*
|
/*
|
||||||
* Open the case.dat file.
|
* Open the case.dat file.
|
||||||
*/
|
*/
|
||||||
sprintf(path, "%s%scase.dat", opath, LDAP_DIRSEP);
|
snprintf(path, sizeof path, "%s%scase.dat", opath, LDAP_DIRSEP);
|
||||||
if ((out = fopen(path, "wb")) == 0)
|
if ((out = fopen(path, "wb")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1355,7 +1355,7 @@ write_cdata(char *opath)
|
||||||
/*
|
/*
|
||||||
* Open the comp.dat file.
|
* Open the comp.dat file.
|
||||||
*/
|
*/
|
||||||
sprintf(path, "%s%scomp.dat", opath, LDAP_DIRSEP);
|
sprintf(path, sizeof path, "%s%scomp.dat", opath, LDAP_DIRSEP);
|
||||||
if ((out = fopen(path, "wb")) == 0)
|
if ((out = fopen(path, "wb")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1393,7 +1393,7 @@ write_cdata(char *opath)
|
||||||
/*
|
/*
|
||||||
* Open the decomp.dat file.
|
* Open the decomp.dat file.
|
||||||
*/
|
*/
|
||||||
sprintf(path, "%s%sdecomp.dat", opath, LDAP_DIRSEP);
|
snprintf(path, sizeof path, "%s%sdecomp.dat", opath, LDAP_DIRSEP);
|
||||||
if ((out = fopen(path, "wb")) == 0)
|
if ((out = fopen(path, "wb")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1447,7 +1447,7 @@ write_cdata(char *opath)
|
||||||
/*
|
/*
|
||||||
* Open the kdecomp.dat file.
|
* Open the kdecomp.dat file.
|
||||||
*/
|
*/
|
||||||
sprintf(path, "%s%skdecomp.dat", opath, LDAP_DIRSEP);
|
snprintf(path, sizeof path, "%s%skdecomp.dat", opath, LDAP_DIRSEP);
|
||||||
if ((out = fopen(path, "wb")) == 0)
|
if ((out = fopen(path, "wb")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1507,7 +1507,7 @@ write_cdata(char *opath)
|
||||||
/*
|
/*
|
||||||
* Open the cmbcl.dat file.
|
* Open the cmbcl.dat file.
|
||||||
*/
|
*/
|
||||||
sprintf(path, "%s%scmbcl.dat", opath, LDAP_DIRSEP);
|
snprintf(path, sizeof path, "%s%scmbcl.dat", opath, LDAP_DIRSEP);
|
||||||
if ((out = fopen(path, "wb")) == 0)
|
if ((out = fopen(path, "wb")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1545,7 +1545,7 @@ write_cdata(char *opath)
|
||||||
/*
|
/*
|
||||||
* Open the num.dat file.
|
* Open the num.dat file.
|
||||||
*/
|
*/
|
||||||
sprintf(path, "%s%snum.dat", opath, LDAP_DIRSEP);
|
snprintf(path, sizeof path, "%s%snum.dat", opath, LDAP_DIRSEP);
|
||||||
if ((out = fopen(path, "wb")) == 0)
|
if ((out = fopen(path, "wb")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,10 +144,6 @@ SOURCE=.\csn.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\debug.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\entropy.c
|
SOURCE=.\entropy.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ int srv_install(LPCTSTR lpszServiceName, LPCTSTR lpszDisplayName,
|
||||||
CloseServiceHandle(schService);
|
CloseServiceHandle(schService);
|
||||||
CloseServiceHandle(schSCManager);
|
CloseServiceHandle(schSCManager);
|
||||||
|
|
||||||
sprintf( regpath, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s",
|
snprintf( regpath, sizeof regpath,
|
||||||
|
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s",
|
||||||
lpszServiceName );
|
lpszServiceName );
|
||||||
/* Create the registry key for event logging to the Windows NT event log. */
|
/* Create the registry key for event logging to the Windows NT event log. */
|
||||||
if ( RegCreateKeyEx(HKEY_LOCAL_MACHINE,
|
if ( RegCreateKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
|
|
@ -357,9 +358,9 @@ void *getRegParam( char *svc, char *value )
|
||||||
DWORD valLen = sizeof( vValue );
|
DWORD valLen = sizeof( vValue );
|
||||||
|
|
||||||
if ( svc != NULL )
|
if ( svc != NULL )
|
||||||
sprintf ( path, "SOFTWARE\\%s", svc );
|
snprintf ( path, sizeof path, "SOFTWARE\\%s", svc );
|
||||||
else
|
else
|
||||||
strcpy (path, "SOFTWARE\\OpenLDAP\\Parameters" );
|
snprintf ( path, sizeof path, "SOFTWARE\\OpenLDAP\\Parameters" );
|
||||||
|
|
||||||
if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, path, 0, KEY_READ, &hkey ) != ERROR_SUCCESS )
|
if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, path, 0, KEY_READ, &hkey ) != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ static int interaction(
|
||||||
fprintf( stderr, "Default: %s\n", dflt );
|
fprintf( stderr, "Default: %s\n", dflt );
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( input, "%s: ",
|
snprintf( input, sizeof input, "%s: ",
|
||||||
interact->prompt ? interact->prompt : "Interact" );
|
interact->prompt ? interact->prompt : "Interact" );
|
||||||
|
|
||||||
if( noecho ) {
|
if( noecho ) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue