svn rev #22071: trunk/src/ include/ lib/kdb/ plugins/kdb/ldap/ldap_util/

ghudson@MIT.EDU ghudson at MIT.EDU
Mon Mar 9 21:28:13 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22071
Commit By: ghudson
Log Message:
ticket: 6403

Rename kdb_setup_lib_handle to krb5_db_setup_lib_handle and export it.
Make kdb5_ldap_util work again by calling this function to set up
dal_handle instead of using one with an uninitialized lib_handle.

It is likely that kdb5_ldap_util will only function given a krb5.conf
which specifies a realm with an LDAP database module as the default
realm.  Not sure if that was the case before.



Changed Files:
U   trunk/src/include/kdb.h
U   trunk/src/lib/kdb/kdb5.c
U   trunk/src/lib/kdb/libkdb5.exports
U   trunk/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c
Modified: trunk/src/include/kdb.h
===================================================================
--- trunk/src/include/kdb.h	2009-03-09 14:23:31 UTC (rev 22070)
+++ trunk/src/include/kdb.h	2009-03-10 01:28:12 UTC (rev 22071)
@@ -266,6 +266,7 @@
 #define KRB5_DB_LOCKMODE_PERMANENT    0x0008
 
 /* libkdb.spec */
+krb5_error_code krb5_db_setup_lib_handle(krb5_context kcontext);
 krb5_error_code krb5_db_open( krb5_context kcontext, char **db_args, int mode );
 krb5_error_code krb5_db_init  ( krb5_context kcontext );
 krb5_error_code krb5_db_create ( krb5_context kcontext, char **db_args );

Modified: trunk/src/lib/kdb/kdb5.c
===================================================================
--- trunk/src/lib/kdb/kdb5.c	2009-03-09 14:23:31 UTC (rev 22070)
+++ trunk/src/lib/kdb/kdb5.c	2009-03-10 01:28:12 UTC (rev 22071)
@@ -616,8 +616,8 @@
     return status;
 }
 
-static krb5_error_code
-kdb_setup_lib_handle(krb5_context kcontext)
+krb5_error_code
+krb5_db_setup_lib_handle(krb5_context kcontext)
 {
     char   *library = NULL;
     krb5_error_code status = 0;
@@ -714,7 +714,7 @@
     }
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -763,7 +763,7 @@
     }
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -836,7 +836,7 @@
     }
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -866,7 +866,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -893,7 +893,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -921,7 +921,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -951,7 +951,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -983,7 +983,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1017,7 +1017,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1047,7 +1047,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1189,7 +1189,7 @@
     log_ctx = kcontext->kdblog_context;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1306,7 +1306,7 @@
     log_ctx = kcontext->kdblog_context;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1378,7 +1378,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1407,7 +1407,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1435,7 +1435,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1465,7 +1465,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1500,7 +1500,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-        status = kdb_setup_lib_handle(kcontext);
+        status = krb5_db_setup_lib_handle(kcontext);
         if (status) {
             goto clean_n_exit;
         }
@@ -1528,7 +1528,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1557,7 +1557,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-        status = kdb_setup_lib_handle(kcontext);
+        status = krb5_db_setup_lib_handle(kcontext);
         if (status) {
             goto clean_n_exit;
         }
@@ -1590,7 +1590,7 @@
     krb5_error_code status = 0;
 
     if (context->dal_handle == NULL) {
-        status = kdb_setup_lib_handle(context);
+        status = krb5_db_setup_lib_handle(context);
         if (status) {
             goto clean_n_exit;
         }
@@ -1645,7 +1645,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1680,7 +1680,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -1778,7 +1778,7 @@
 	kdb5_dal_handle *dal_handle;
 
 	if (context->dal_handle == NULL) {
-	    retval = kdb_setup_lib_handle(context);
+	    retval = krb5_db_setup_lib_handle(context);
 	    if (retval) {
 		goto clean_n_exit;
 	    }
@@ -1835,7 +1835,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2030,7 +2030,7 @@
     void   *new_ptr = NULL;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2051,7 +2051,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2091,7 +2091,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2758,7 +2758,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2792,7 +2792,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2820,7 +2820,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2849,7 +2849,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2877,7 +2877,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2906,7 +2906,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2933,7 +2933,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -2970,7 +2970,7 @@
     }
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -3004,7 +3004,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -3037,7 +3037,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}
@@ -3087,7 +3087,7 @@
     kdb5_dal_handle *dal_handle;
 
     if (kcontext->dal_handle == NULL) {
-	status = kdb_setup_lib_handle(kcontext);
+	status = krb5_db_setup_lib_handle(kcontext);
 	if (status) {
 	    goto clean_n_exit;
 	}

Modified: trunk/src/lib/kdb/libkdb5.exports
===================================================================
--- trunk/src/lib/kdb/libkdb5.exports	2009-03-09 14:23:31 UTC (rev 22070)
+++ trunk/src/lib/kdb/libkdb5.exports	2009-03-10 01:28:12 UTC (rev 22071)
@@ -1,3 +1,4 @@
+krb5_db_setup_lib_handle
 krb5_db_open
 krb5_db_inited
 krb5_db_alloc

Modified: trunk/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c
===================================================================
--- trunk/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c	2009-03-09 14:23:31 UTC (rev 22070)
+++ trunk/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c	2009-03-10 01:28:12 UTC (rev 22071)
@@ -297,7 +297,6 @@
     unsigned int ldapmask = 0;
     unsigned int passwd_len = 0;
     char *prompt = NULL;
-    kdb5_dal_handle *dal_handle = NULL;
     krb5_ldap_context *ldap_context=NULL;
     char *value = NULL, *conf_section = NULL;
     krb5_boolean realm_name_required = TRUE;
@@ -587,12 +586,13 @@
     cmd = cmd_lookup(cmd_argv[0]);
 
     /* Setup DAL handle to access the database */
-    dal_handle = calloc((size_t)1, sizeof(kdb5_dal_handle));
-    if (dal_handle == NULL) {
+    db_retval = krb5_db_setup_lib_handle(util_context);
+    if (db_retval) {
+	com_err(progname, db_retval, "while setting up lib handle");
+	exit_status++;
 	goto cleanup;
     }
-    dal_handle->db_context = ldap_context;
-    util_context->dal_handle = dal_handle;
+    util_context->dal_handle->db_context = ldap_context;
     ldap_context = NULL;
 
     db_retval = krb5_ldap_read_server_params(util_context, conf_section, KRB5_KDB_SRV_TYPE_OTHER);
@@ -603,7 +603,7 @@
     }
 
     if (cmd->opendb) {
-	db_retval = krb5_ldap_db_init(util_context, (krb5_ldap_context *)dal_handle->db_context);
+	db_retval = krb5_ldap_db_init(util_context, (krb5_ldap_context *)util_context->dal_handle->db_context);
 	if (db_retval) {
 	    com_err(progname, db_retval, "while initializing database");
 	    exit_status++;
@@ -639,8 +639,6 @@
 	free(prompt);
     if (conf_section)
 	free(conf_section);
-    if (dal_handle)
-	free(dal_handle);
 
     if (usage_print) {
 	usage();




More information about the cvs-krb5 mailing list