From fffc8d7016b3f659d111276a1657dad8acc8cf50 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 7 Nov 2008 16:35:20 +0000 Subject: [PATCH] windows-nim-afs-linked-cells-20081107 LICENSE MIT add linked cell support to the NIM afs provider. --- src/WINNT/netidmgr_plugin/afsfuncs.c | 7 ++++++- src/WINNT/netidmgr_plugin/afsfuncs.h | 4 ++-- src/WINNT/netidmgr_plugin/afsnewcreds.c | 17 ++++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/WINNT/netidmgr_plugin/afsfuncs.c b/src/WINNT/netidmgr_plugin/afsfuncs.c index c0b856c95..a4e7137fd 100644 --- a/src/WINNT/netidmgr_plugin/afsfuncs.c +++ b/src/WINNT/netidmgr_plugin/afsfuncs.c @@ -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)); diff --git a/src/WINNT/netidmgr_plugin/afsfuncs.h b/src/WINNT/netidmgr_plugin/afsfuncs.h index be55608e4..f7ba42e8c 100644 --- a/src/WINNT/netidmgr_plugin/afsfuncs.h +++ b/src/WINNT/netidmgr_plugin/afsfuncs.h @@ -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 diff --git a/src/WINNT/netidmgr_plugin/afsnewcreds.c b/src/WINNT/netidmgr_plugin/afsnewcreds.c index c1f413160..16c03ee41 100644 --- a/src/WINNT/netidmgr_plugin/afsnewcreds.c +++ b/src/WINNT/netidmgr_plugin/afsnewcreds.c @@ -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; + } } } -- 2.39.5