From 674afe86c0ffbc808803127564a744ee59311737 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 15 Jul 2004 06:20:33 +0000 Subject: [PATCH] afslogon-20040714 Add a Winlogon Event Notification handler to afslogon.dll to process Logoff events. Upon Logoff call ktc_ForgetAllTokens() on behalf of the logged off user. Fix a filename wildcard matching error introduced a few versions back. --- src/WINNT/afsd/afslogon.c | 15 +++++++++++++++ src/WINNT/afsd/afslogon.def | 2 ++ src/WINNT/afsd/smb3.c | 20 +++++++++++++++----- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/WINNT/afsd/afslogon.c b/src/WINNT/afsd/afslogon.c index 1d24875bd..2916b4364 100644 --- a/src/WINNT/afsd/afslogon.c +++ b/src/WINNT/afsd/afslogon.c @@ -583,3 +583,18 @@ DWORD APIENTRY NPPasswordChangeNotify( return 0; } +#include + +VOID AFS_Logoff_Event( + PWLX_NOTIFICATION_INFO pInfo ) +{ + DWORD code; + if (code = ktc_ForgetAllTokens()) + DebugEvent("AFS AfsLogon - AFS_Logoff_Event - ForgetAllTokens failed [%lX]",code); + else + DebugEvent0("AFS AfsLogon - AFS_Logoff_Event - ForgetAllTokens succeeded"); +} + + + + diff --git a/src/WINNT/afsd/afslogon.def b/src/WINNT/afsd/afslogon.def index a1000c401..2c9c30402 100644 --- a/src/WINNT/afsd/afslogon.def +++ b/src/WINNT/afsd/afslogon.def @@ -8,4 +8,6 @@ EXPORTS NPGetCaps NPLogonNotify NPPasswordChangeNotify + AFS_Logoff_Event + diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index c2f8451ed..8c60896cc 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -2447,6 +2447,10 @@ VOID initUpperCaseTable(VOID) mapCaseTable[i] = toupper(i); // make '"' match '.' mapCaseTable[(int)'"'] = toupper('.'); + // make '<' match '*' + mapCaseTable[(int)'<'] = toupper('*'); + // make '>' match '?' + mapCaseTable[(int)'>'] = toupper('?'); } // Compare 'pattern' (containing metacharacters '*' and '?') with the file @@ -2465,15 +2469,19 @@ BOOL szWildCardMatchFileName(PSZ pattern, PSZ name) { while (*name) { switch (*pattern) { case '?': + case '>': if (*(++pattern) != '<' || *(++pattern) != '*') { - if (*name == '.') return FALSE; + if (*name == '.') + return FALSE; ++name; break; } /* endif */ case '<': case '*': - while ((*pattern == '<') || (*pattern == '*') || (*pattern == '?')) ++pattern; - if (!*pattern) return TRUE; + while ((*pattern == '<') || (*pattern == '*') || (*pattern == '?') || (*pattern == '>')) + ++pattern; + if (!*pattern) + return TRUE; for (p = pename; p >= name; --p) { if ((mapCaseTable[*p] == mapCaseTable[*pattern]) && szWildCardMatchFileName(pattern + 1, p + 1)) @@ -2481,11 +2489,13 @@ BOOL szWildCardMatchFileName(PSZ pattern, PSZ name) { } /* endfor */ return FALSE; default: - if (mapCaseTable[*name] != mapCaseTable[*pattern]) return FALSE; + if (mapCaseTable[*name] != mapCaseTable[*pattern]) + return FALSE; ++pattern, ++name; break; } /* endswitch */ - } /* endwhile */ return !*pattern; + } /* endwhile */ + return !*pattern; } /* do a case-folding search of the star name mask with the name in namep. -- 2.39.5