diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index 4230200a57..9d036dc10e 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -1238,6 +1238,13 @@ int afsd_InitCM(char **reasonP) return 0; } +int afsd_ShutdownCM(void) +{ + cm_ReleaseSCache(&cm_data.rootSCachep); + + return 0; +} + int afsd_InitDaemons(char **reasonP) { long code; diff --git a/src/WINNT/afsd/afsd_init.h b/src/WINNT/afsd/afsd_init.h index 6465341a51..67c5646f60 100644 --- a/src/WINNT/afsd/afsd_init.h +++ b/src/WINNT/afsd/afsd_init.h @@ -19,6 +19,7 @@ int afsd_InitCM(char **reasonP, struct cmd_syndesc *as, char *arock); int afsd_InitSMB(char **reasonP); #endif /* !DJGPP */ int afsd_InitDaemons(char **reasonP); +int afsd_ShutdownCM(void); void afsd_ForceTrace(BOOL flush); void afsd_SetUnhandledExceptionFilter(); diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index 7b444d919d..ac9826f763 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -1401,7 +1401,9 @@ afsd_Main(DWORD argc, LPTSTR *argv) cm_DaemonShutdown(); afsi_log("Daemon shutdown complete"); - + + afsd_ShutdownCM(); + buf_Shutdown(); afsi_log("Buffer shutdown complete"); @@ -1409,7 +1411,7 @@ afsd_Main(DWORD argc, LPTSTR *argv) afsi_log("rx finalization complete"); #ifndef AFSIFS - smb_Shutdown(); + smb_Shutdown(); afsi_log("smb shutdown complete"); #endif diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 362fa8765b..ea48cee17f 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -217,7 +217,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, { long code; #ifndef AFSIFS - cm_scache_t *substRootp; + cm_scache_t *substRootp = NULL; #endif char * relativePath = ioctlp->inDatap; @@ -241,8 +241,10 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, "", reqp, scpp); - if (code) - return code; + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath code 0x%x", code); + return code; + } #else /* AFSIFS */ if (relativePath[0] == relativePath[1] && relativePath[1] == '\\' && @@ -275,13 +277,17 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, sharePath, reqp, &substRootp); free(sharePath); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [1] code 0x%x", code); return code; + } code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, NULL, reqp, scpp); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [2] code 0x%x", code); return code; + } } else { /* otherwise, treat the name as a cellname mounted off the afs root. * This requires that we reconstruct the shareName string with @@ -303,25 +309,35 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, code = cm_NameI(cm_data.rootSCachep, ioctlp->prefix->data, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, shareName, reqp, &substRootp); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [3] code 0x%x", code); return code; + } code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, NULL, reqp, scpp); - if (code) + if (code) { + cm_ReleaseSCache(substRootp); + osi_Log1(afsd_logp,"cm_ParseIoctlPath code [4] 0x%x", code); return code; + } } } else { code = cm_NameI(cm_data.rootSCachep, ioctlp->prefix->data, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, ioctlp->tidPathp, reqp, &substRootp); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [6] code 0x%x", code); return code; + } code = cm_NameI(substRootp, relativePath, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, NULL, reqp, scpp); - if (code) + if (code) { + cm_ReleaseSCache(substRootp); + osi_Log1(afsd_logp,"cm_ParseIoctlPath [7] code 0x%x", code); return code; + } } #endif /* AFSIFS */ @@ -332,7 +348,11 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, /* This is usually nothing, but for StatMountPoint it is the file name. */ TranslateExtendedChars(ioctlp->inDatap); + if (substRootp) + cm_ReleaseSCache(substRootp); + /* and return success */ + osi_Log1(afsd_logp,"cm_ParseIoctlPath [8] code 0x%x", code); return 0; }