]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: limit number of retries due to kdc repeat error
authorDerrick Brashear <shadow@your-file-system.com>
Wed, 19 Dec 2012 15:59:24 +0000 (10:59 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 21 Dec 2012 17:56:17 +0000 (09:56 -0800)
don't retry forever. does not apply to master due to difference
in sdk for kerberos

Reviewed-on: http://gerrit.openafs.org/8792
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 8c1288ed64714a3e136a644eac1e64466d5dfdbc)

Change-Id: I67e20e302d09ebecec8e7856cafe7133333b89f4
Reviewed-on: http://gerrit.openafs.org/8798
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/WINNT/afsd/afskfw.c
src/WINNT/aklog/aklog.c

index 7ce4516b0d2d17218fda95d6043939a8667eeed9..edd81aab1f8b5d89305b0035c13e328837b4b626 100644 (file)
@@ -2060,7 +2060,7 @@ KFW_kinit( krb5_context alt_ctx,
     krb5_creds                 my_creds;
     krb5_get_init_creds_opt     options;
     krb5_address **             addrs = NULL;
-    int                         i = 0, addr_count = 0;
+    int                         i = 0, addr_count = 0, passes = 0;
 
     if (!pkrb5_init_context)
         return KRB5_CONFIG_CANTOPEN;
@@ -2182,7 +2182,7 @@ KFW_kinit( krb5_context alt_ctx,
                                               &options);
         if (code == KRB5KRB_AP_ERR_REPEAT)
             Sleep(1000);
-    } while(code == KRB5KRB_AP_ERR_REPEAT);
+    } while(code == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
 
     if (code)
        goto cleanup;
@@ -2882,6 +2882,7 @@ KFW_AFS_klog(
     krb5_principal client_principal = NULL;
     krb5_data * k5data = NULL;
     unsigned int i, retry = 0;
+    int passes = 0;
 
     CurrentState = 0;
     memset(HostName, '\0', sizeof(HostName));
@@ -3040,12 +3041,12 @@ KFW_AFS_klog(
             pkrb5_free_unparsed_name(ctx,cname);
             pkrb5_free_unparsed_name(ctx,sname);
         }
-
+       passes = 0;
         do {
             code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
             if (code == KRB5KRB_AP_ERR_REPEAT)
                 Sleep(1000);
-        } while(code == KRB5KRB_AP_ERR_REPEAT);
+        } while(code == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
 
         if (code == 0) {
             /* The client's realm is a local realm for the cell.
@@ -3089,11 +3090,12 @@ KFW_AFS_klog(
                     }
 
                     if (!code) {
+                       passes = 0;
                         do {
                             code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
                             if (code == KRB5KRB_AP_ERR_REPEAT)
                                 Sleep(1000);
-                        } while(code == KRB5KRB_AP_ERR_REPEAT);
+                        } while(code == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
                     }
 
                     if (code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
@@ -3124,11 +3126,12 @@ KFW_AFS_klog(
                         }
 
                         if (!code) {
+                           passes = 0;
                             do {
                                 code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
                                 if (code == KRB5KRB_AP_ERR_REPEAT)
                                     Sleep(1000);
-                            } while(code == KRB5KRB_AP_ERR_REPEAT);
+                            } while(code == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
                         }
                     }
                 }
@@ -3161,11 +3164,12 @@ KFW_AFS_klog(
                     }
 
                     if (!code) {
+                       passes = 0;
                         do {
                             code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
                             if (code == KRB5KRB_AP_ERR_REPEAT)
                                 Sleep(1000);
-                        } while(code == KRB5KRB_AP_ERR_REPEAT);
+                        } while(code == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
                     }
 
                     if (!code && !strlen(realm_of_cell))
@@ -3203,11 +3207,12 @@ KFW_AFS_klog(
                     }
 
                     if (!code) {
+                       passes = 0;
                         do {
                             code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
                             if (code == KRB5KRB_AP_ERR_REPEAT)
                                 Sleep(1000);
-                        } while(code == KRB5KRB_AP_ERR_REPEAT);
+                        } while(code == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
                     }
 
                     if (!code && !strlen(realm_of_cell))
@@ -3242,11 +3247,12 @@ KFW_AFS_klog(
                     }
 
                     if (!code) {
+                       passes = 0;
                         do {
                             code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
                             if (code == KRB5KRB_AP_ERR_REPEAT)
                                 Sleep(1000);
-                        } while(code == KRB5KRB_AP_ERR_REPEAT);
+                        } while(code == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
                     }
 
                     if (!code && !strlen(realm_of_cell))
index f1a50311f38ebb8610ed3c9f9d16aa6dbf7bf08a..2229364763d138a7a5042e39f00ea1c71dbe1955 100644 (file)
@@ -482,6 +482,7 @@ static int get_v5cred(krb5_context context,
     krb5_creds increds;
     krb5_error_code r;
     static krb5_principal client_principal = 0;
+    int passes = 0;
 
     if (client_principal) {
         krb5_free_principal(context, client_principal);
@@ -518,7 +519,7 @@ static int get_v5cred(krb5_context context,
         r = krb5_get_credentials(context, 0, _krb425_ccache, &increds, creds);
         if (r == KRB5KRB_AP_ERR_REPEAT)
             Sleep(1000);
-    } while(r == KRB5KRB_AP_ERR_REPEAT);
+    } while(r == KRB5KRB_AP_ERR_REPEAT && passes++ < 2);
 
     if (r) {
         return((int)r);