non-kfw-probe-fix-20040319

Fix the non-KFW case of the KDC Probe.  Prevent infinite loop.
This commit is contained in:
Jeffrey Altman 2004-03-20 01:01:07 +00:00 committed by Jeffrey Altman
parent 24cee2b758
commit 1612508689
6 changed files with 33 additions and 9 deletions

View File

@ -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 */

View File

@ -3354,7 +3354,7 @@ ObtainTokensFromUserIfNeeded(HWND hWnd)
code = pkrb5_c_random_make_octets(ctx, &pwdata);
if (code) {
int i;
for ( i=0 ; i<PROBE_PASSWORD_LEN ; i )
for ( i=0 ; i<PROBE_PASSWORD_LEN ; i++ )
password[i] = 'x';
}
password[PROBE_PASSWORD_LEN] = '\0';
@ -3382,11 +3382,21 @@ ObtainTokensFromUserIfNeeded(HWND hWnd)
}
} else {
int i;
for ( i=0 ; i<PROBE_PASSWORD_LEN ; i )
for ( i=0 ; i<PROBE_PASSWORD_LEN ; i++ )
password[i] = 'x';
code = ObtainNewCredentials(rootcell, PROBE_USERNAME, password);
serverReachable = 1;
code = ObtainNewCredentials(rootcell, PROBE_USERNAME, password, TRUE);
switch ( code ) {
case INTK_BADPW:
case KERB_ERR_PRINCIPAL_UNKNOWN:
case KERB_ERR_SERVICE_EXP:
case RD_AP_TIME:
serverReachable = TRUE;
break;
default:
serverReachable = FALSE;
}
}
#endif
if ( !serverReachable ) {

View File

@ -313,7 +313,7 @@ BOOL CALLBACK WizCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
WizCreds_OnEnable (hDlg, FALSE);
if (ObtainNewCredentials (szCell, szUser, szPassword) == 0)
if (ObtainNewCredentials (szCell, szUser, szPassword, FALSE) == 0)
{
g.pWizard->SetState (STEP_MOUNT);
}

View File

@ -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;

View File

@ -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);

View File

@ -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);