From 565931a9c9d805ca50461ad4296d33cdd693349d Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 28 Aug 2004 00:00:53 +0000 Subject: [PATCH] * sendto_kdc.c (start_connection) [DEBUG]: Log the local socket address git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16694 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/ChangeLog | 5 +++++ src/lib/krb5/os/sendto_kdc.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 52db164ff..fd50036ee 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,8 @@ +2004-08-27 Ken Raeburn + + * sendto_kdc.c (start_connection) [DEBUG]: Log the local socket + address. + 2004-08-12 Alexandra Ellwood * ccdefname.c (krb5_cc_set_default_name, krb5_cc_default_name): diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c index 3f8eb777f..47cc2bce8 100644 --- a/src/lib/krb5/os/sendto_kdc.c +++ b/src/lib/krb5/os/sendto_kdc.c @@ -67,8 +67,17 @@ int krb5int_debug_sendto_kdc = 0; static void default_debug_handler (const void *data, size_t len) { +#if 0 + FILE *logfile; + logfile = fopen("/tmp/sendto_kdc.log", "a"); + if (logfile == NULL) + return; + fwrite(data, 1, len, logfile); + fclose(logfile); +#else fwrite(data, 1, len, stderr); /* stderr is unbuffered */ +#endif } void (*krb5int_sendtokdc_debug_handler) (const void *, size_t) = default_debug_handler; @@ -623,6 +632,19 @@ start_connection (struct conn_state *state, struct select_state *selstate) state->state = FAILED; return -3; } else { +#ifdef DEBUG + struct sockaddr_storage ss; + socklen_t sslen = sizeof(ss); + if (0 == getsockname(state->fd, (struct sockaddr *) &ss, &sslen)) { + struct addrinfo hack_ai; + memset(&hack_ai, 0, sizeof(hack_ai)); + hack_ai.ai_addr = (struct sockaddr *) &ss; + hack_ai.ai_addrlen = sslen; + hack_ai.ai_socktype = SOCK_DGRAM; + hack_ai.ai_family = ai->ai_family; + dprint("local address used was %A\n", &hack_ai); + } +#endif state->state = READING; } } -- 2.26.2