[PATCH] Fix double logs from the KDC

Fredrik Tolf fredrik at dolda2000.com
Fri Dec 2 19:13:00 EST 2005


I managed to track down my previous problem with getting every log
message twice from the KDC.

The root of the problem is in include/krb5/stock/osconf.h, on this line:

#define DEFAULT_SECURE_PROFILE_PATH \
"/etc/krb5.conf:@SYSCONFDIR/krb5.conf"

When configure is run with --sysconfdir=/etc, this reduces
to /etc/krb5.conf:/etc/krb5.conf, which means that the default profile
file will be read twice. Surely, this cannot be the intention, right?
I'm not immediately sure what this might affect other than logging.

I'm not sure what the most proper fix to this is, but I patched my
Kerberos library with a little snippet that eliminates recurring file
names when resolving the profile files to read.

I'm attaching the patch if the Kerberos team wants it.

Fredrik Tolf

-------------- next part --------------
--- src/lib/krb5/os/init_os_ctx.c~	2004-07-15 19:42:07.000000000 +0200
+++ src/lib/krb5/os/init_os_ctx.c	2005-12-03 00:53:05.000000000 +0100
@@ -234,7 +234,7 @@
     files[1] = 0;
 #else /* !_WIN32 */
     char* filepath = 0;
-    int n_entries, i;
+    int n_entries, i, o;
     unsigned int ent_len;
     const char *s, *t;
 
@@ -275,6 +275,12 @@
         }
         strncpy(files[i], s, ent_len);
         files[i][ent_len] = 0;
+	for(o = 0; o < i; o++) {
+	    if(!strcmp(files[o], files[i])) {
+		free(files[i--]);
+		continue;
+	    }
+	}
         if (*t == 0) {
             i++;
             break;


More information about the Kerberos mailing list