]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
non-kfw-probe-fix-20040319
authorJeffrey Altman <jaltman@mit.edu>
Sat, 20 Mar 2004 01:01:07 +0000 (01:01 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 20 Mar 2004 01:01:07 +0000 (01:01 +0000)
Fix the non-KFW case of the KDC Probe.  Prevent infinite loop.

src/WINNT/client_creds/afskfw-int.h
src/WINNT/client_creds/afskfw.c
src/WINNT/client_creds/afswiz.cpp
src/WINNT/client_creds/creds.cpp
src/WINNT/client_creds/creds.h
src/WINNT/client_creds/credstab.cpp

index 828724d43e04b793fa7b6f6c96848e5224ba6ecc..139bceb93b9d522041e1699e0a8742052076cf4c 100644 (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 */
index bedb85ff321169f57dbe6b39c24c154c040bd3a2..32dabdd1f32a46c8292f6dc629b0a6fc920a74c7 100644 (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 ) {
index 65b942c0c4ab27b23e5a9f079de56c43214ee8c5..43390d591b2844fefdd432641ce3b54654dfaa37 100644 (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);
                         }
index ac8a218da288b377bb04f8cafa39b7a138a353f1..930418c79f0be59ef190678a37e593e30071ae71 100644 (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;
index ab87b647a6cacead6185c59d9a884c21bd6a9dea..f1ea6aeb353e8389cdc35c21299a1d66f9c50404 100644 (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);
 
index bbcb8a63e94af152d2d794a98af3664176481e3b..f6bfc444c02f2e4cbe4940fa81eb8ec7405d478b 100644 (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);