svn rev #23962: trunk/src/kadmin/dbutil/

ghudson@MIT.EDU ghudson at MIT.EDU
Mon May 3 15:02:16 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=23962
Commit By: ghudson
Log Message:
ticket: 6714
status: open

Eliminate the use of variables for format strings in kdb5_util.  Many
were unused, and localization will probably be done through _()
macros, not collecting all the strings together.  Elminates a number
of format-security static analysis defects.



Changed Files:
U   trunk/src/kadmin/dbutil/Makefile.in
U   trunk/src/kadmin/dbutil/deps
U   trunk/src/kadmin/dbutil/dump.c
U   trunk/src/kadmin/dbutil/kadm5_create.c
U   trunk/src/kadmin/dbutil/kdb5_util.c
U   trunk/src/kadmin/dbutil/kdb5_util.h
D   trunk/src/kadmin/dbutil/string_table.c
D   trunk/src/kadmin/dbutil/string_table.h
Modified: trunk/src/kadmin/dbutil/Makefile.in
===================================================================
--- trunk/src/kadmin/dbutil/Makefile.in	2010-05-01 17:53:04 UTC (rev 23961)
+++ trunk/src/kadmin/dbutil/Makefile.in	2010-05-03 19:02:16 UTC (rev 23962)
@@ -8,10 +8,10 @@
 
 PROG = kdb5_util
 
-SRCS = kdb5_util.c kdb5_create.c kadm5_create.c string_table.c kdb5_destroy.c \
+SRCS = kdb5_util.c kdb5_create.c kadm5_create.c kdb5_destroy.c \
 	   kdb5_stash.c import_err.c strtok.c dump.c ovload.c kdb5_mkey.c
 
-OBJS = kdb5_util.o kdb5_create.o kadm5_create.o string_table.o kdb5_destroy.o \
+OBJS = kdb5_util.o kdb5_create.o kadm5_create.o kdb5_destroy.o \
 	   kdb5_stash.o import_err.o strtok.o dump.o ovload.o kdb5_mkey.o
 
 GETDATE = ../cli/getdate.o

Modified: trunk/src/kadmin/dbutil/deps
===================================================================
--- trunk/src/kadmin/dbutil/deps	2010-05-01 17:53:04 UTC (rev 23961)
+++ trunk/src/kadmin/dbutil/deps	2010-05-03 19:02:16 UTC (rev 23962)
@@ -63,8 +63,7 @@
   $(top_srcdir)/include/krb5.h $(top_srcdir)/include/krb5/authdata_plugin.h \
   $(top_srcdir)/include/krb5/locate_plugin.h $(top_srcdir)/include/krb5/preauth_plugin.h \
   $(top_srcdir)/include/port-sockets.h $(top_srcdir)/include/socket-utils.h \
-  kadm5_create.c kdb5_util.h string_table.h
-$(OUTPRE)string_table.$(OBJEXT): string_table.c
+  kadm5_create.c kdb5_util.h
 $(OUTPRE)kdb5_destroy.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
   $(BUILDTOP)/include/gssapi/gssapi.h $(BUILDTOP)/include/gssrpc/types.h \
   $(BUILDTOP)/include/kadm5/admin.h $(BUILDTOP)/include/kadm5/chpass_util_strings.h \

Modified: trunk/src/kadmin/dbutil/dump.c
===================================================================
--- trunk/src/kadmin/dbutil/dump.c	2010-05-01 17:53:04 UTC (rev 23961)
+++ trunk/src/kadmin/dbutil/dump.c	2010-05-03 19:02:16 UTC (rev 23962)
@@ -1180,7 +1180,7 @@
      * to be opened if we try a dump that uses it.
      */
     if (!dbactive) {
-        com_err(progname, 0, Err_no_database);
+        com_err(progname, 0, "Database not currently opened!");
         exit_status++;
         return;
     }

Modified: trunk/src/kadmin/dbutil/kadm5_create.c
===================================================================
--- trunk/src/kadmin/dbutil/kadm5_create.c	2010-05-01 17:53:04 UTC (rev 23961)
+++ trunk/src/kadmin/dbutil/kadm5_create.c	2010-05-03 19:02:16 UTC (rev 23962)
@@ -31,8 +31,6 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#include "string_table.h"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -288,7 +286,7 @@
     fullname = build_name_with_realm(name, realm);
     ret = krb5_parse_name(context, fullname, &ent.principal);
     if (ret) {
-        com_err(progname, ret, str_PARSE_NAME);
+        com_err(progname, ret, "while parsing admin principal name");
         return(ERR);
     }
     ent.max_life = lifetime;
@@ -300,7 +298,7 @@
                                  "to-be-random");
     if (ret) {
         if (ret != KADM5_DUP) {
-            com_err(progname, ret, str_PUT_PRINC, fullname);
+            com_err(progname, ret, "while creating principal %s", fullname);
             krb5_free_principal(context, ent.principal);
             free(fullname);
             return ERR;
@@ -309,7 +307,7 @@
         /* only randomize key if we created the principal */
         ret = kadm5_randkey_principal(handle, ent.principal, NULL, NULL);
         if (ret) {
-            com_err(progname, ret, str_RANDOM_KEY, fullname);
+            com_err(progname, ret, "while randomizing principal %s", fullname);
             krb5_free_principal(context, ent.principal);
             free(fullname);
             return ERR;
@@ -318,7 +316,7 @@
         ent.attributes = attrs;
         ret = kadm5_modify_principal(handle, &ent, KADM5_ATTRIBUTES);
         if (ret) {
-            com_err(progname, ret, str_PUT_PRINC, fullname);
+            com_err(progname, ret, "while setting attributes on %s", fullname);
             krb5_free_principal(context, ent.principal);
             free(fullname);
             return ERR;

Modified: trunk/src/kadmin/dbutil/kdb5_util.c
===================================================================
--- trunk/src/kadmin/dbutil/kdb5_util.c	2010-05-01 17:53:04 UTC (rev 23961)
+++ trunk/src/kadmin/dbutil/kdb5_util.c	2010-05-03 19:02:16 UTC (rev 23962)
@@ -66,9 +66,6 @@
 #include <time.h>
 #include "kdb5_util.h"
 
-char    *Err_no_master_msg = "Master key not entered!\n";
-char    *Err_no_database = "Database not currently opened!\n";
-
 /*
  * XXX Ick, ick, ick.  These global variables shouldn't be global....
  */

Modified: trunk/src/kadmin/dbutil/kdb5_util.h
===================================================================
--- trunk/src/kadmin/dbutil/kdb5_util.h	2010-05-01 17:53:04 UTC (rev 23961)
+++ trunk/src/kadmin/dbutil/kdb5_util.h	2010-05-03 19:02:16 UTC (rev 23962)
@@ -33,7 +33,6 @@
 #define REALM_SEP_STR   "@"
 
 extern char *progname;
-extern char *Err_no_database;
 #ifndef V4_DECLARES_STATIC
 extern krb5_keyblock master_keyblock;
 extern krb5_principal master_princ;




More information about the cvs-krb5 mailing list