windows-nim-afs-linked-cells-20081107
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 7 Nov 2008 16:35:20 +0000 (16:35 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 7 Nov 2008 16:35:20 +0000 (16:35 +0000)
LICENSE MIT

add linked cell support to the NIM afs provider.

src/WINNT/netidmgr_plugin/afsfuncs.c
src/WINNT/netidmgr_plugin/afsfuncs.h
src/WINNT/netidmgr_plugin/afsnewcreds.c

index c0b856c..a4e7137 100644 (file)
@@ -728,7 +728,8 @@ afs_klog(khm_handle identity,
          char *realm,
          int LifeTime,
          afs_tk_method method,
-         time_t * tok_expiration) {
+         time_t * tok_expiration,
+         char *linkedCell) {
 
     long       rc;
     CREDENTIALS        creds;
@@ -785,6 +786,10 @@ afs_klog(khm_handle identity,
         return(rc);
     }
 
+    if (linkedCell && ak_cellconfig.linkedCell)
+        StringCbCopyA(linkedCell, MAXCELLCHARS, 
+                      ak_cellconfig.linkedCell);
+
     StringCbCopyA(realm_of_cell, sizeof(realm_of_cell), 
                   afs_realm_of_cell(&ak_cellconfig, FALSE));
 
index be55608..f7ba42e 100644 (file)
@@ -50,8 +50,8 @@ afs_klog(khm_handle identity,
          char *realm,
          int LifeTime,
          afs_tk_method method,
-         time_t * tok_expiration /* OUT: expiration time of new
-                                    token */
+         time_t * tok_expiration,/* OUT: expiration time of new token */
+         char *linkedCell        /* OUT: name of linkedCell (if any) */
          );
 
 int
index c1f4131..16c03ee 100644 (file)
@@ -2655,6 +2655,7 @@ afs_msg_newcred(khm_int32 msg_subtype,
                 int code;
                 char cell[MAXCELLCHARS];
                 char realm[MAXCELLCHARS];
+                char linkedCell[MAXCELLCHARS]="";
                 khm_handle ctoken;
                 FILETIME ft_old;
                 FILETIME ft_new;
@@ -2662,6 +2663,7 @@ afs_msg_newcred(khm_int32 msg_subtype,
                 khm_size cb;
                 khm_int32 method = AFS_TOKEN_AUTO;
                 khm_handle csp_cell = NULL;
+                BOOL bgetLinked = 0;
 
                 if (l->rows[i].flags &
                     (DLGROW_FLAG_DONE | DLGROW_FLAG_DELETED))
@@ -2709,16 +2711,20 @@ afs_msg_newcred(khm_int32 msg_subtype,
                     method = l->rows[i].method;
                 }
 
+              getLinked:
                 _report_cs3(KHERR_INFO,
                             L"Getting tokens for cell %1!S! with realm %2!S! using method %3!d!",
-                            _cstr(cell),
+                            _cstr(bgetLinked ? linkedCell: cell),
                             _cstr(realm),
                             _int32(method));
                 _resolve();
 
                 /* make the call */
-                code = afs_klog(ident, "", cell, realm, 0, 
-                                method, &new_exp);
+                code = afs_klog(ident, "", 
+                                bgetLinked ? linkedCell : cell, 
+                                realm, 0,
+                                method, &new_exp, 
+                                bgetLinked ? NULL :linkedCell);
 
                 _report_cs1(KHERR_INFO,
                             L"klog returns code %1!d!",
@@ -2769,6 +2775,11 @@ afs_msg_newcred(khm_int32 msg_subtype,
                             ident_renew_triggered = TRUE;
                         }
                     }
+
+                    if ( !bgetLinked && linkedCell[0] ) {
+                        bgetLinked = TRUE;
+                        goto getLinked;
+                    }
                 }
             }