From 16125086891f14efb1618e2d5ac30697518007db Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 20 Mar 2004 01:01:07 +0000 Subject: [PATCH] non-kfw-probe-fix-20040319 Fix the non-KFW case of the KDC Probe. Prevent infinite loop. --- src/WINNT/client_creds/afskfw-int.h | 14 ++++++++++++++ src/WINNT/client_creds/afskfw.c | 18 ++++++++++++++---- src/WINNT/client_creds/afswiz.cpp | 2 +- src/WINNT/client_creds/creds.cpp | 4 ++-- src/WINNT/client_creds/creds.h | 2 +- src/WINNT/client_creds/credstab.cpp | 2 +- 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/WINNT/client_creds/afskfw-int.h b/src/WINNT/client_creds/afskfw-int.h index 828724d43e..139bceb93b 100644 --- a/src/WINNT/client_creds/afskfw-int.h +++ b/src/WINNT/client_creds/afskfw-int.h @@ -275,4 +275,18 @@ int KFW_AFS_klog(krb5_context, krb5_ccache, char*, char*, char*, int); void KFW_import_ccache_data(void); void KFW_import_windows_lsa(void); BOOL MSLSA_IsKerberosLogon(); + +/* From afs/krb_prot.h */ +/* values for kerb error codes */ +#define KERB_ERR_OK 0 +#define KERB_ERR_NAME_EXP 1 +#define KERB_ERR_SERVICE_EXP 2 +#define KERB_ERR_AUTH_EXP 3 +#define KERB_ERR_PKT_VER 4 +#define KERB_ERR_NAME_MAST_KEY_VER 5 +#define KERB_ERR_SERV_MAST_KEY_VER 6 +#define KERB_ERR_BYTE_ORDER 7 +#define KERB_ERR_PRINCIPAL_UNKNOWN 8 +#define KERB_ERR_PRINCIPAL_NOT_UNIQUE 9 +#define KERB_ERR_NULL_KEY 10 #endif /* AFSKFW_INT_H */ diff --git a/src/WINNT/client_creds/afskfw.c b/src/WINNT/client_creds/afskfw.c index bedb85ff32..32dabdd1f3 100644 --- a/src/WINNT/client_creds/afskfw.c +++ b/src/WINNT/client_creds/afskfw.c @@ -3354,7 +3354,7 @@ ObtainTokensFromUserIfNeeded(HWND hWnd) code = pkrb5_c_random_make_octets(ctx, &pwdata); if (code) { int i; - for ( i=0 ; iSetState (STEP_MOUNT); } diff --git a/src/WINNT/client_creds/creds.cpp b/src/WINNT/client_creds/creds.cpp index ac8a218da2..930418c79f 100644 --- a/src/WINNT/client_creds/creds.cpp +++ b/src/WINNT/client_creds/creds.cpp @@ -370,7 +370,7 @@ int DestroyCurrentCredentials (LPCTSTR pszCell) } -int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword) +int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword, BOOL Silent) { int rc = KTC_NOCM; char *Result = NULL; @@ -398,7 +398,7 @@ int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword) rc = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION, szNameA, "", szCellA, szPasswordA, 0, &Expiration, 0, &Result); } - if (rc != 0) + if (!Silent && rc != 0) { int idsTitle = (g.fIsWinNT) ? IDS_ERROR_TITLE : IDS_ERROR_TITLE_95; int idsDesc = (g.fIsWinNT) ? IDS_ERROR_OBTAIN : IDS_ERROR_OBTAIN_95; diff --git a/src/WINNT/client_creds/creds.h b/src/WINNT/client_creds/creds.h index ab87b647a6..f1ea6aeb35 100644 --- a/src/WINNT/client_creds/creds.h +++ b/src/WINNT/client_creds/creds.h @@ -27,7 +27,7 @@ int GetCurrentCredentials (void); int DestroyCurrentCredentials (LPCTSTR pszCell); -int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword); +int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword, BOOL Silent); int GetDefaultCell (LPTSTR pszCell); diff --git a/src/WINNT/client_creds/credstab.cpp b/src/WINNT/client_creds/credstab.cpp index bbcb8a63e9..f6bfc444c0 100644 --- a/src/WINNT/client_creds/credstab.cpp +++ b/src/WINNT/client_creds/credstab.cpp @@ -357,7 +357,7 @@ BOOL NewCreds_OnOK (HWND hDlg) GetDlgItemText (hDlg, IDC_NEWCREDS_PASSWORD, szPassword, cchRESOURCE); int rc; - if ((rc = ObtainNewCredentials (szCell, szUser, szPassword)) != 0) + if ((rc = ObtainNewCredentials (szCell, szUser, szPassword, FALSE)) != 0) { EnableWindow (GetDlgItem (hDlg, IDOK), TRUE); EnableWindow (GetDlgItem (hDlg, IDCANCEL), TRUE);