From: Jeffrey Altman Date: Tue, 26 Jul 2011 21:37:37 +0000 (-0400) Subject: Windows: add debugging to afskfw X-Git-Tag: upstream/1.8.0_pre1^2~3465 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b61bd99bce68055dc0dd53b82d1d5318c25d9051;p=packages%2Fo%2Fopenafs.git Windows: add debugging to afskfw More debugging output added when a debugger is present. Change-Id: I22698ebaf3c950a5b9c9b7d6746af45603b5acf9 Reviewed-on: http://gerrit.openafs.org/5112 Tested-by: BuildBot Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/afskfw.c b/src/WINNT/afsd/afskfw.c index 5037026d9..57918bb0a 100644 --- a/src/WINNT/afsd/afskfw.c +++ b/src/WINNT/afsd/afskfw.c @@ -3201,9 +3201,16 @@ KFW_AFS_klog( * commented out in the code below */ if (KFW_use_krb524() || - k5creds->ticket.length > MAXKTCTICKETLEN) + k5creds->ticket.length > MAXKTCTICKETLEN) { + if ( IsDebuggerPresent() ) { + char message[256]; + StringCbPrintf(message, sizeof(message), + "switching to krb524 .. ticket length %u\n", + k5creds->ticket.length); + OutputDebugString(message); + } goto try_krb524d; - + } memset(&aserver, '\0', sizeof(aserver)); StringCbCopyN(aserver.name, sizeof(aserver.name), ServiceName, sizeof(aserver.name) - 1); @@ -3220,6 +3227,11 @@ KFW_AFS_klog( retry_gettoken5: rc = ktc_GetToken(&aserver, &btoken, sizeof(btoken), &aclient); + if ( IsDebuggerPresent() ) { + char message[256]; + StringCbPrintf(message, sizeof(message), "ktc_GetToken returns: %d\n", rc); + OutputDebugString(message); + } if (rc != 0 && rc != KTC_NOENT && rc != KTC_NOCELL) { if ( rc == KTC_NOCM && retry < 20 ) { Sleep(500); @@ -3273,8 +3285,20 @@ KFW_AFS_klog( } else { aclient.smbname[0] = '\0'; } + if ( IsDebuggerPresent() ) { + char message[256]; + StringCbPrintf(message, sizeof(message), "aclient.name: %s\n", aclient.name); + OutputDebugString(message); + StringCbPrintf(message, sizeof(message), "aclient.smbname: %s\n", aclient.smbname); + OutputDebugString(message); + } rc = ktc_SetToken(&aserver, &atoken, &aclient, (aclient.smbname[0]?AFS_SETTOK_LOGON:0)); + if ( IsDebuggerPresent() ) { + char message[256]; + StringCbPrintf(message, sizeof(message), "ktc_SetToken returns: %d\n", rc); + OutputDebugString(message); + } if (!rc) goto cleanup; /* We have successfully inserted the token */ @@ -3349,6 +3373,11 @@ KFW_AFS_klog( retry_gettoken: rc = ktc_GetToken(&aserver, &btoken, sizeof(btoken), &aclient); + if ( IsDebuggerPresent() ) { + char message[256]; + StringCbPrintf(message, sizeof(message), "ktc_GetToken returns: %d\n", rc); + OutputDebugString(message); + } if (rc != 0 && rc != KTC_NOENT && rc != KTC_NOCELL) { if ( rc == KTC_NOCM && retry < 20 ) { Sleep(500); @@ -3399,6 +3428,14 @@ KFW_AFS_klog( aclient.smbname[0] = '\0'; } + if ( IsDebuggerPresent() ) { + char message[256]; + StringCbPrintf(message, sizeof(message), "aclient.name: %s\n", aclient.name); + OutputDebugString(message); + StringCbPrintf(message, sizeof(message), "aclient.smbname: %s\n", aclient.smbname); + OutputDebugString(message); + } + if (rc = ktc_SetToken(&aserver, &atoken, &aclient, (aclient.smbname[0]?AFS_SETTOK_LOGON:0))) { KFW_AFS_error(rc, "ktc_SetToken()");