svn rev #22434: trunk/src/ kadmin/dbutil/ kadmin/server/ kadmin/testing/scripts/ ...

tlyu@MIT.EDU tlyu at MIT.EDU
Fri Jul 10 15:20:26 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22434
Commit By: tlyu
Log Message:
ticket: 1233

Add a new '-W' option to kadmind and kdb5_util create to allow reading
weak random numbers on startup, to avoid long delays in testing
situations.  Use only for testing.

Update testing scripts accordingly.


Changed Files:
U   trunk/src/kadmin/dbutil/kdb5_create.c
U   trunk/src/kadmin/server/ovsec_kadmd.c
U   trunk/src/kadmin/testing/scripts/start_servers_local
U   trunk/src/tests/dejagnu/config/default.exp
Modified: trunk/src/kadmin/dbutil/kdb5_create.c
===================================================================
--- trunk/src/kadmin/dbutil/kdb5_create.c	2009-07-10 19:13:17 UTC (rev 22433)
+++ trunk/src/kadmin/dbutil/kdb5_create.c	2009-07-10 19:20:26 UTC (rev 22434)
@@ -167,8 +167,9 @@
     krb5_data pwd, seed;
     kdb_log_context *log_ctx;
     krb5_kvno mkey_kvno;
+    int strong_random = 1;
 	   
-    while ((optchar = getopt(argc, argv, "s")) != -1) {
+    while ((optchar = getopt(argc, argv, "sW")) != -1) {
 	switch(optchar) {
 	case 's':
 	    do_stash++;
@@ -179,6 +180,9 @@
 		exit(1);
 	    }
 	    break;
+	case 'W':
+	    strong_random = 0;
+	    break;
 	case '?':
 	default:
 	    usage();
@@ -196,7 +200,7 @@
     log_ctx = util_context->kdblog_context;
 
     printf ("Loading random data\n");
-    retval = krb5_c_random_os_entropy (util_context, 1, NULL);
+    retval = krb5_c_random_os_entropy (util_context, strong_random, NULL);
     if (retval) {
       com_err (progname, retval, "Loading random data");
       exit_status++; return;

Modified: trunk/src/kadmin/server/ovsec_kadmd.c
===================================================================
--- trunk/src/kadmin/server/ovsec_kadmd.c	2009-07-10 19:13:17 UTC (rev 22433)
+++ trunk/src/kadmin/server/ovsec_kadmd.c	2009-07-10 19:20:26 UTC (rev 22434)
@@ -222,6 +222,7 @@
      int    db_args_size = 0;
      char *errmsg;
      int i;
+     int strong_random = 1;
 
      kdb_log_context *log_ctx;
 
@@ -292,6 +293,8 @@
 	      usage();
 	    params.kadmind_port = atoi(*argv);
 	    params.mask |= KADM5_CONFIG_KADMIND_PORT;
+	  } else if (strcmp(*argv, "-W") == 0) {
+	      strong_random = 0;
 	  } else
 	       break;
 	  argc--; argv++;
@@ -490,7 +493,7 @@
      }
      
      krb5_klog_syslog(LOG_INFO, "Seeding random number generator");
-     ret = krb5_c_random_os_entropy(context, 1, NULL);
+     ret = krb5_c_random_os_entropy(context, strong_random, NULL);
      if (ret) {
 	  krb5_klog_syslog(LOG_ERR, "Error getting random seed: %s, aborting",
 			   krb5_get_error_message(context, ret));

Modified: trunk/src/kadmin/testing/scripts/start_servers_local
===================================================================
--- trunk/src/kadmin/testing/scripts/start_servers_local	2009-07-10 19:13:17 UTC (rev 22433)
+++ trunk/src/kadmin/testing/scripts/start_servers_local	2009-07-10 19:20:26 UTC (rev 22434)
@@ -121,6 +121,8 @@
 sofar_s=0
 timewait_s=300
 
+ovadm_args=-W
+
 while true; do
 	rm -f $adm_start_file
 

Modified: trunk/src/tests/dejagnu/config/default.exp
===================================================================
--- trunk/src/tests/dejagnu/config/default.exp	2009-07-10 19:13:17 UTC (rev 22433)
+++ trunk/src/tests/dejagnu/config/default.exp	2009-07-10 19:20:26 UTC (rev 22434)
@@ -1224,7 +1224,7 @@
 	}
 	#exec xterm
 	verbose "starting $test"
-	spawn $KDB5_UTIL -r $REALMNAME create
+	spawn $KDB5_UTIL -r $REALMNAME create -W
 	expect_after $def_exp_after
 
 	expect "Enter KDC database master key:"
@@ -1775,7 +1775,7 @@
     # removed when this is fixed
     envstack_push
     setup_kerberos_env kdc
-    spawn $BINSH -c "exec $KADMIND -r $REALMNAME -nofork 2>>$kadmind_lfile"
+    spawn $BINSH -c "exec $KADMIND -r $REALMNAME -W -nofork 2>>$kadmind_lfile"
     envstack_pop
     set kadmind_pid [exp_pid]
     set kadmind_spawn_id $spawn_id




More information about the cvs-krb5 mailing list