Double logs from the KDC

Fredrik Tolf fredrik at dolda2000.com
Wed Jun 21 23:07:30 EDT 2006


On Thu, 2005-12-01 at 09:16 +1100, Jeremy Hunt wrote:
> Fredrik Tolf wrote:
> > I checked the code you mention, but as far as I am able to tell, the
> > first one only runs in case no log specifications have been loaded
> > (if(log_control.log_nentries == 0)). Therefore, I cannot see that being
> > the cause for double messages. It also doesn't explain why the ordinary
> > logfile receives double messages. Unless I've missed something, that is?
> >
> > I guess I'll recompile the KDC with debug support and see what I can
> > find.
> >
> > Fredrik Tolf
> >   
> Yes, you are absolutely right. My fix makes no difference. But in my 
> "new" development environment the problem has gone away anyway.
> 
> Until I can get access to our test production environment I cannot say 
> it has gone away with any certainty. If it helps you, I have moved from 
> version 1.3.5 to 1.4.3, and assumed I had the same problem. If there is 
> a version issue, this alone may have fixed it. If it is something to do 
> with the environment in production (production test setup has the same 
> problem) then I won't know until late this week or early next week.
> 
> Good luck with your investigations anyway.

I was almost sure that I sent this patch to the list back when it was
current, but now I can't find it in the archives, so I'm sending it now,
just to be sure that anyone else who encounters the same problem won't
miss it. I'm attaching it as MIME, hoping noone minds.

The problem with double logs is that the /etc/krb5.conf file is read
twice (and this was, for reasons I no longer remember, inappropriate
and/or hard to fix), and therefore the logging sinks are registered
twice. The patch I devised simply checks so that no distinct logging
sink is added twice.

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