svn commit: lorikeet r742 - in trunk/heimdal/kdc: .

abartlet at samba.org abartlet at samba.org
Mon Jun 11 09:24:53 GMT 2007


Author: abartlet
Date: 2007-06-11 09:24:53 +0000 (Mon, 11 Jun 2007)
New Revision: 742

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=742

Log:
It is easier for Samba4 if we don't setup hdb in default_config.c

Andrew Bartlett

Modified:
   trunk/heimdal/kdc/config.c
   trunk/heimdal/kdc/default_config.c


Changeset:
Modified: trunk/heimdal/kdc/config.c
===================================================================
--- trunk/heimdal/kdc/config.c	2007-06-10 19:15:09 UTC (rev 741)
+++ trunk/heimdal/kdc/config.c	2007-06-11 09:24:53 UTC (rev 742)
@@ -145,6 +145,51 @@
     krb5_free_addresses (context, &tmp);
 }
 
+static void
+get_dbinfo(krb5_context context, struct krb5_kdc_configuration *c)
+{
+    struct hdb_dbinfo *info, *d;
+    krb5_error_code ret;
+
+    /* fetch the databases */
+    ret = hdb_get_dbinfo(context, &info);
+    if (ret)
+	krb5_err(context, 1, ret, "hdb_get_dbinfo");
+    
+    d = NULL;
+    while ((d = hdb_dbinfo_get_next(info, d)) != NULL) {
+	void *ptr;
+	
+	ptr = realloc(c->db, (c->num_db + 1) * sizeof(*c->db));
+	if (ptr == NULL)
+	    krb5_err(context, 1, ret, "out of memory");
+	c->db = ptr;
+	
+	ret = hdb_create(context, &c->db[c->num_db], 
+			 hdb_dbinfo_get_dbname(context, d));
+	if(ret)
+	    krb5_err(context, 1, ret, "hdb_create %s", 
+		     hdb_dbinfo_get_dbname(context, d));
+	
+	ret = hdb_set_master_keyfile(context, c->db[c->num_db], 
+				     hdb_dbinfo_get_mkey_file(context, d));
+	if (ret)
+	    krb5_err(context, 1, ret, "hdb_set_master_keyfile");
+	
+	c->num_db++;
+
+	kdc_log(context, c, 0, "label: %s\n",
+		hdb_dbinfo_get_label(context, d));
+	kdc_log(context, c, 0, "\trealm: %s\n",
+		hdb_dbinfo_get_realm(context, d));
+	kdc_log(context, c, 0, "\tdbname: %s\n",
+		hdb_dbinfo_get_dbname(context, d));
+	kdc_log(context, c, 0, "\tmkey_file: %s\n",
+		hdb_dbinfo_get_mkey_file(context, d));
+    }
+    hdb_free_dbinfo(context, &info);
+}
+
 krb5_kdc_configuration *
 configure(krb5_context context, int argc, char **argv)
 {
@@ -200,8 +245,10 @@
     if (ret)
 	krb5_err(context, 1, ret, "krb5_kdc_default_config");
 
-    kdc_openlog(context, config);
+    get_dbinfo(context, config);
 
+   kdc_openlog(context, config);
+
     if(max_request_str)
 	max_request = parse_bytes(max_request_str, NULL);
 

Modified: trunk/heimdal/kdc/default_config.c
===================================================================
--- trunk/heimdal/kdc/default_config.c	2007-06-10 19:15:09 UTC (rev 741)
+++ trunk/heimdal/kdc/default_config.c	2007-06-11 09:24:53 UTC (rev 742)
@@ -38,52 +38,7 @@
 
 RCSID("$Id: default_config.c 20532 2007-04-23 07:46:57Z lha $");
 
-static void
-get_dbinfo(krb5_context context, struct krb5_kdc_configuration *c)
-{
-    struct hdb_dbinfo *info, *d;
-    krb5_error_code ret;
 
-    /* fetch the databases */
-    ret = hdb_get_dbinfo(context, &info);
-    if (ret)
-	krb5_err(context, 1, ret, "hdb_get_dbinfo");
-    
-    d = NULL;
-    while ((d = hdb_dbinfo_get_next(info, d)) != NULL) {
-	void *ptr;
-	
-	ptr = realloc(c->db, (c->num_db + 1) * sizeof(*c->db));
-	if (ptr == NULL)
-	    krb5_err(context, 1, ret, "out of memory");
-	c->db = ptr;
-	
-	ret = hdb_create(context, &c->db[c->num_db], 
-			 hdb_dbinfo_get_dbname(context, d));
-	if(ret)
-	    krb5_err(context, 1, ret, "hdb_create %s", 
-		     hdb_dbinfo_get_dbname(context, d));
-	
-	ret = hdb_set_master_keyfile(context, c->db[c->num_db], 
-				     hdb_dbinfo_get_mkey_file(context, d));
-	if (ret)
-	    krb5_err(context, 1, ret, "hdb_set_master_keyfile");
-	
-	c->num_db++;
-
-	kdc_log(context, c, 0, "label: %s\n",
-		hdb_dbinfo_get_label(context, d));
-	kdc_log(context, c, 0, "\trealm: %s\n",
-		hdb_dbinfo_get_realm(context, d));
-	kdc_log(context, c, 0, "\tdbname: %s\n",
-		hdb_dbinfo_get_dbname(context, d));
-	kdc_log(context, c, 0, "\tmkey_file: %s\n",
-		hdb_dbinfo_get_mkey_file(context, d));
-    }
-    hdb_free_dbinfo(context, &info);
-}
-
-
 int
 krb5_kdc_get_config(krb5_context context, krb5_kdc_configuration **config)
 {
@@ -112,8 +67,6 @@
     c->num_db = 0;
     c->logf = NULL;
 
-    get_dbinfo(context, c);
-
     c->require_preauth =
 	krb5_config_get_bool_default(context, NULL, 
 				     c->require_preauth,



More information about the samba-cvs mailing list