From: Jeffrey Altman Date: Tue, 26 Apr 2011 01:40:28 +0000 (-0400) Subject: Windows: build afskfw.c without leashw32.dll X-Git-Tag: upstream/1.6.0.pre5^2~22 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=6c1c8477f97b79404dd4a057c39df57215cffb4f;p=packages%2Fo%2Fopenafs.git Windows: build afskfw.c without leashw32.dll remove our dependency on mit kfw leashw32.dll Change-Id: Ibb5bc58dc6bf250d50ae8bd884a08449a356b6e2 Reviewed-on: http://gerrit.openafs.org/4559 Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman Tested-by: BuildBot Reviewed-on: http://gerrit.openafs.org/4567 --- diff --git a/src/WINNT/afsd/afskfw.c b/src/WINNT/afsd/afskfw.c index 9b97acd33..d2b3e9a59 100644 --- a/src/WINNT/afsd/afskfw.c +++ b/src/WINNT/afsd/afskfw.c @@ -55,13 +55,11 @@ * */ - #undef USE_KRB4 #ifndef _WIN64 #define USE_KRB524 1 #endif #define USE_MS2MIT 1 -#define USE_LEASH 1 /* Prevent inclusion of des.h to avoid conflicts with des types */ #define NO_DES_H_INCLUDE @@ -423,6 +421,12 @@ static HINSTANCE hCCAPI = 0; static struct principal_ccache_data * princ_cc_data = NULL; static struct cell_principal_map * cell_princ_map = NULL; +#ifdef USE_LEASH +#define DEFAULT_LIFETIME pLeash_get_default_lifetime() +#else +#define DEFAULT_LIFETIME (24 * 60) +#endif + void KFW_initialize(void) { @@ -1067,7 +1071,11 @@ KFW_import_windows_lsa(void) code = pkrb5_cc_get_principal(ctx, cc, &princ); if ( code ) goto cleanup; +#ifdef USE_LEASH dwMsLsaImport = pLeash_get_default_mslsa_import ? pLeash_get_default_mslsa_import() : 1; +#else + dwMsLsaImport = 1; +#endif switch ( dwMsLsaImport ) { case 0: /* do not import */ goto cleanup; @@ -1104,7 +1112,7 @@ KFW_import_windows_lsa(void) cell[i] = '\0'; realm[i] = '\0'; - code = KFW_AFS_klog(ctx, cc, "afs", cell, realm, pLeash_get_default_lifetime(),NULL); + code = KFW_AFS_klog(ctx, cc, "afs", cell, realm, DEFAULT_LIFETIME, NULL); if ( IsDebuggerPresent() ) { char message[256]; StringCbPrintf(message, sizeof(message), "KFW_AFS_klog() returns: %d\n", code); @@ -1281,13 +1289,7 @@ KFW_import_ccache_data(void) OutputDebugString("Calling KFW_AFS_klog() to obtain token\n"); } - code = KFW_AFS_klog(ctx, cc, "afs", cell->data, realm->data, -#ifndef USE_LEASH - 600, -#else - pLeash_get_default_lifetime(), -#endif /* USE_LEASH */ - NULL); + code = KFW_AFS_klog(ctx, cc, "afs", cell->data, realm->data, DEFAULT_LIFETIME, NULL); if ( IsDebuggerPresent() ) { char message[256]; StringCbPrintf(message, sizeof(message), "KFW_AFS_klog() returns: %d\n", code); @@ -1422,19 +1424,22 @@ KFW_AFS_get_cred( char * username, if ( code ) goto cleanup; if ( lifetime == 0 ) -#ifndef USE_LEASH - lifetime = 600; -#else - lifetime = pLeash_get_default_lifetime(); -#endif + lifetime = DEFAULT_LIFETIME; - if ( password && password[0] ) { + code = KFW_AFS_klog(ctx, cc, "afs", cell, realm, lifetime, smbname); + if ( IsDebuggerPresent() ) { + char message[256]; + StringCbPrintf(message, sizeof(message), "KFW_AFS_klog() returns: %d\n", code); + OutputDebugString(message); + } + + if (code && password && password[0] ) { code = KFW_kinit( ctx, cc, HWND_DESKTOP, pname, password, lifetime, #ifndef USE_LEASH - 1, /* forwardable */ + 0, /* forwardable */ 0, /* not proxiable */ 1, /* renewable */ 1, /* noaddresses */ @@ -1648,7 +1653,7 @@ KFW_AFS_destroy_tickets_for_principal(char * user) } if (ctx) - pkrb5_free_context(ctx); + pkrb5_free_context(ctx); return 0; } @@ -2076,11 +2081,7 @@ KFW_kinit( krb5_context alt_ctx, goto cleanup; if (lifetime == 0) -#ifndef USE_LEASH - lifetime = 600; -#else - lifetime = pLeash_get_default_lifetime(); -#endif /* USE_LEASH */ + lifetime = DEFAULT_LIFETIME; lifetime *= 60; if (renew_life > 0)