[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with multiple realms/databases



Hi,

Replying to myself: the following patch fixes the problem, now both the
kdc & kadmind are happy to serve two databases simultaneously.
kpasswdd still has problems: although it opens both databases according
to strace, it seems to always look for the principal in the first
database only regardless the principal's realm.

Gabor

--- lib/krb5/config_file.c.orig	2004-09-30 13:22:48.000000000 +0200
+++ lib/krb5/config_file.c	2006-05-05 11:23:06.000000000 +0200
@@ -102,6 +102,26 @@
     return *q;
 }
 
+static krb5_config_section *
+get_new_entry(krb5_config_section **parent, const char *name, int type)
+{
+    krb5_config_section **q;
+
+    for(q = parent; *q != NULL; q = &(*q)->next)
+	/* Nothing */;
+    *q = calloc(1, sizeof(**q));
+    if(*q == NULL)
+	return NULL;
+    (*q)->name = strdup(name);
+    (*q)->type = type;
+    if((*q)->name == NULL) {
+	free(*q);
+	*q = NULL;
+	return NULL;
+    }
+    return *q;
+}
+
 /*
  * Parse a section:
  *
@@ -212,7 +232,7 @@
 	++p;
     *p2 = '\0';
     if (*p == '{') {
-	tmp = get_entry(parent, p1, krb5_config_list);
+	tmp = get_new_entry(parent, p1, krb5_config_list);
 	if (tmp == NULL) {
 	    *error_message = "out of memory";
 	    return KRB5_CONFIG_BADFORMAT;

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------