summaryrefslogtreecommitdiffstats
path: root/ldap/admin
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2006-04-11 02:14:54 +0000
committerRich Megginson <rmeggins@redhat.com>2006-04-11 02:14:54 +0000
commite8c67e58c2faa3e3f5d328a92391a5a6a4569620 (patch)
tree7e16092b4dfb0106f446bb6a79552004399f7155 /ldap/admin
parent9545e36805201ac0e3172b762373c6df741c2721 (diff)
downloadds-e8c67e58c2faa3e3f5d328a92391a5a6a4569620.tar.gz
ds-e8c67e58c2faa3e3f5d328a92391a5a6a4569620.tar.xz
ds-e8c67e58c2faa3e3f5d328a92391a5a6a4569620.zip
Bug(s) fixed: 186280
Bug Description: ldapserver: Close potential security vulnerabilities in CGI code Reviewed by: Nathan, Noriko, and Pete (Thanks!) Fix Description: Clean up usage of sprintf, strcpy, fgets instead of gets, fixed buffer usage, etc., mostly in the CGI code and other user facing code (i.e. setup). Also, Steve Grubb told me about a GCC trick to force it to check printf style varargs functions, to check the format string against the argument string, for type mismatches, missing arguments, and too many arguments. In the CGI form argument parsing code, we needed to be more careful about checking for bad input - good input is supposed to look like this: name=value&name=value&..... &name=value. I don't think the original code was checking properly for something like name&name=value. There was another place where we were not checking to see if a buffer had enough room before appending a string to it. I had to change a couple of functions to allow passing in the size of the buffer. Fixed some issues raised by Noriko and Nathan. Platforms tested: RHEL4 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
Diffstat (limited to 'ldap/admin')
-rw-r--r--ldap/admin/src/cfg_sspt.c12
-rw-r--r--ldap/admin/src/create_instance.c22
-rw-r--r--ldap/admin/src/ds_remove_uninst.cpp7
-rw-r--r--ldap/admin/src/init_ds_env.c1
-rw-r--r--ldap/admin/src/instindex.cpp3
5 files changed, 42 insertions, 3 deletions
diff --git a/ldap/admin/src/cfg_sspt.c b/ldap/admin/src/cfg_sspt.c
index 7cd85f98..c25c7b97 100644
--- a/ldap/admin/src/cfg_sspt.c
+++ b/ldap/admin/src/cfg_sspt.c
@@ -239,6 +239,12 @@ is_root_user(const char *name, QUERY_VARS* query)
#ifdef CGI_DEBUG
#include <stdarg.h>
+static void debug_log (const char* file, const char* format, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 2, 3)));
+#else
+ ;
+#endif
static void
debug_log (const char* file, const char* format, ...)
@@ -375,6 +381,12 @@ add_aci(LDAP* ld, char* DN, char* privilege)
list of strings to substitute in the format; basically just constructs
the correct aci string and passes it to add_aci
*/
+int add_aci_v(LDAP* ld, char* DN, char* format, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 3, 4)));
+#else
+ ;
+#endif
int
add_aci_v(LDAP* ld, char* DN, char* format, ...)
{
diff --git a/ldap/admin/src/create_instance.c b/ldap/admin/src/create_instance.c
index f599c299..4f718ae3 100644
--- a/ldap/admin/src/create_instance.c
+++ b/ldap/admin/src/create_instance.c
@@ -145,6 +145,13 @@ static int init_presence(char *sroot, server_config_s *cf, char *cs_path);
#endif
static char *make_error(char *fmt, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 1, 2)));
+#else
+ ;
+#endif
+
+static char *make_error(char *fmt, ...)
{
static char errbuf[ERR_SIZE];
va_list args;
@@ -661,6 +668,12 @@ char *chownconfig(char *sroot, char *user)
#define chownsearch(a, b)
#endif
+char *gen_script(char *s_root, char *name, char *fmt, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 3, 4)));
+#else
+ ;
+#endif
char *gen_script(char *s_root, char *name, char *fmt, ...)
{
@@ -715,6 +728,12 @@ char *gen_script(char *s_root, char *name, char *fmt, ...)
}
char *gen_perl_script(char *s_root, char *cs_path, char *name, char *fmt, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 4, 5)));
+#else
+ ;
+#endif
+char *gen_perl_script(char *s_root, char *cs_path, char *name, char *fmt, ...)
{
char myperl[PATH_SIZE];
char fn[PATH_SIZE];
@@ -1356,8 +1375,7 @@ create_scripts(server_config_s *cf, char *param_name)
/* ---------------------- Update server script files ---------------------- */
int update_server(server_config_s *cf)
{
- char line[PATH_SIZE], *t, *sroot = cf->sroot;
- char subdir[PATH_SIZE];
+ char *t;
char error_param[BIG_LINE] = {0};
#if defined( SOLARIS )
diff --git a/ldap/admin/src/ds_remove_uninst.cpp b/ldap/admin/src/ds_remove_uninst.cpp
index 79fef790..118c5d55 100644
--- a/ldap/admin/src/ds_remove_uninst.cpp
+++ b/ldap/admin/src/ds_remove_uninst.cpp
@@ -80,6 +80,13 @@ extern "C" {
#include "setupapi.h"
#define MAX_STR_SIZE 512
+static void dsLogMessage(const char *level, const char *which,
+ const char *format, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 3, 4)));
+#else
+ ;
+#endif
static InstallLog *installLog = NULL;
diff --git a/ldap/admin/src/init_ds_env.c b/ldap/admin/src/init_ds_env.c
index f291041c..c4a1ce49 100644
--- a/ldap/admin/src/init_ds_env.c
+++ b/ldap/admin/src/init_ds_env.c
@@ -48,6 +48,7 @@
#include "libadminutil/distadm.h"
#include "init_ds_env.h"
#include "dsalib.h"
+#include "prprf.h"
int init_ds_env()
{
diff --git a/ldap/admin/src/instindex.cpp b/ldap/admin/src/instindex.cpp
index 6821ec8a..83ebe45a 100644
--- a/ldap/admin/src/instindex.cpp
+++ b/ldap/admin/src/instindex.cpp
@@ -55,7 +55,7 @@
#include <string.h>
/* --------------------------------- main --------------------------------- */
-
+#if NEEDED_FOR_DEBUGGING
static void
printInfo(int argc, char *argv[], char *envp[], FILE* fp)
{
@@ -76,6 +76,7 @@ printInfo(int argc, char *argv[], char *envp[], FILE* fp)
fprintf(fp, "#####################################\n");
}
+#endif
#if defined (__hpux) && defined (__ia64)
int main(int argc, char *argv[], char *envp[])