Index: openafs/src/WINNT/afsapplib/checklist.cpp diff -c openafs/src/WINNT/afsapplib/checklist.cpp:1.3.4.1 openafs/src/WINNT/afsapplib/checklist.cpp:1.3.4.2 *** openafs/src/WINNT/afsapplib/checklist.cpp:1.3.4.1 Sun Jun 25 13:54:47 2006 --- openafs/src/WINNT/afsapplib/checklist.cpp Tue Dec 12 15:40:52 2006 *************** *** 134,141 **** wc.hbrBackground = CreateSolidBrush (GetSysColor (COLOR_BTNFACE)); wc.lpszClassName = WC_CHECKLIST; ! if (RegisterClass (&wc)) ! fRegistered = TRUE; } return fRegistered; --- 134,144 ---- wc.hbrBackground = CreateSolidBrush (GetSysColor (COLOR_BTNFACE)); wc.lpszClassName = WC_CHECKLIST; ! if (RegisterClass (&wc)) { ! fRegistered = TRUE; ! } else { ! OutputDebugString("CheckList class registration failed\n"); ! } } return fRegistered; Index: openafs/src/WINNT/afsapplib/checklist.h diff -c openafs/src/WINNT/afsapplib/checklist.h:1.2 openafs/src/WINNT/afsapplib/checklist.h:1.2.32.1 *** openafs/src/WINNT/afsapplib/checklist.h:1.2 Sat Nov 4 05:01:21 2000 --- openafs/src/WINNT/afsapplib/checklist.h Tue Dec 12 15:40:52 2006 *************** *** 31,37 **** EXPORTED BOOL RegisterCheckListClass (void); ! #define WC_CHECKLIST TEXT("CheckList") #define LB_GETCHECK (WM_USER+300) // int iItem=wp --- 31,37 ---- EXPORTED BOOL RegisterCheckListClass (void); ! #define WC_CHECKLIST TEXT("OpenAFS_CheckList") #define LB_GETCHECK (WM_USER+300) // int iItem=wp Index: openafs/src/WINNT/afsapplib/fastlist.h diff -c openafs/src/WINNT/afsapplib/fastlist.h:1.2 openafs/src/WINNT/afsapplib/fastlist.h:1.2.32.1 *** openafs/src/WINNT/afsapplib/fastlist.h:1.2 Sat Nov 4 05:01:23 2000 --- openafs/src/WINNT/afsapplib/fastlist.h Tue Dec 12 15:40:52 2006 *************** *** 26,32 **** #define THIS_HINST (HINSTANCE)GetModuleHandle(NULL) #endif ! #define WC_FASTLIST TEXT("FastList") #define FLM_FIRST 0x1400 --- 26,32 ---- #define THIS_HINST (HINSTANCE)GetModuleHandle(NULL) #endif ! #define WC_FASTLIST TEXT("OpenAFS_FastList") #define FLM_FIRST 0x1400 Index: openafs/src/WINNT/afsd/afsd_service.c diff -c openafs/src/WINNT/afsd/afsd_service.c:1.52.4.8 openafs/src/WINNT/afsd/afsd_service.c:1.52.4.9 *** openafs/src/WINNT/afsd/afsd_service.c:1.52.4.8 Tue Nov 28 04:17:14 2006 --- openafs/src/WINNT/afsd/afsd_service.c Mon Dec 11 23:01:26 2006 *************** *** 40,46 **** HANDLE WaitToTerminate; ! int GlobalStatus; #ifdef JUMP unsigned int MainThreadId; --- 40,46 ---- HANDLE WaitToTerminate; ! static int GlobalStatus; #ifdef JUMP unsigned int MainThreadId; *************** *** 50,56 **** extern int traceOnPanic; extern HANDLE afsi_file; ! int powerEventsRegistered = 0; /* * Notifier function for use by osi_panic --- 50,57 ---- extern int traceOnPanic; extern HANDLE afsi_file; ! static int powerEventsRegistered = 0; ! extern int powerStateSuspended = 0; /* * Notifier function for use by osi_panic *************** *** 325,336 **** --- 326,339 ---- /* allow remaining case PBT_WhatEver */ case PBT_APMSUSPEND: afsi_log("SERVICE_CONTROL_APMSUSPEND"); + powerStateSuspended = 1; if (osVersion.dwMajorVersion >= 6) smb_StopListeners(); dwRet = NO_ERROR; break; case PBT_APMSTANDBY: afsi_log("SERVICE_CONTROL_APMSTANDBY"); + powerStateSuspended = 1; if (osVersion.dwMajorVersion >= 6) smb_StopListeners(); dwRet = NO_ERROR; *************** *** 342,356 **** dwRet = NO_ERROR; break; case PBT_APMRESUMESUSPEND: afsi_log("SERVICE_CONTROL_APMRESUMESUSPEND"); - if (osVersion.dwMajorVersion >= 6) - smb_RestartListeners(); dwRet = NO_ERROR; break; ! case PBT_APMRESUMESTANDBY: afsi_log("SERVICE_CONTROL_APMRESUMESTANDBY"); - if (osVersion.dwMajorVersion >= 6) - smb_RestartListeners(); dwRet = NO_ERROR; break; case PBT_APMBATTERYLOW: --- 345,357 ---- dwRet = NO_ERROR; break; case PBT_APMRESUMESUSPEND: + /* User logged in after suspend */ afsi_log("SERVICE_CONTROL_APMRESUMESUSPEND"); dwRet = NO_ERROR; break; ! case PBT_APMRESUMESTANDBY: ! /* User logged in after standby */ afsi_log("SERVICE_CONTROL_APMRESUMESTANDBY"); dwRet = NO_ERROR; break; case PBT_APMBATTERYLOW: *************** *** 369,376 **** #endif dwRet = NO_ERROR; break; ! case PBT_APMRESUMEAUTOMATIC: afsi_log("SERVICE_CONTROL_APMRESUMEAUTOMATIC"); if (osVersion.dwMajorVersion >= 6) smb_RestartListeners(); dwRet = NO_ERROR; --- 370,379 ---- #endif dwRet = NO_ERROR; break; ! case PBT_APMRESUMEAUTOMATIC: ! /* This is the message delivered once all devices are up */ afsi_log("SERVICE_CONTROL_APMRESUMEAUTOMATIC"); + powerStateSuspended = 0; if (osVersion.dwMajorVersion >= 6) smb_RestartListeners(); dwRet = NO_ERROR; Index: openafs/src/WINNT/afsd/afslogon.c diff -c openafs/src/WINNT/afsd/afslogon.c:1.45.2.5 openafs/src/WINNT/afsd/afslogon.c:1.45.2.7 *** openafs/src/WINNT/afsd/afslogon.c:1.45.2.5 Tue Nov 28 04:01:14 2006 --- openafs/src/WINNT/afsd/afslogon.c Tue Dec 19 12:56:30 2006 *************** *** 74,92 **** BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved) { hDLL = dll; switch (reason) { case DLL_PROCESS_ATTACH: ! /* Initialization Mutex */ ! if (!bInit) { hInitMutex = CreateMutex(NULL, FALSE, NULL); ! } break; case DLL_PROCESS_DETACH: ! /* do nothing on unload because we might ! * be reloaded. ! */ CloseHandle(hInitMutex); hInitMutex = NULL; bInit = FALSE; --- 74,93 ---- BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved) { + WSADATA wsaData; hDLL = dll; + switch (reason) { case DLL_PROCESS_ATTACH: ! /* Initialization Mutex */ ! if (!hInitMutex) hInitMutex = CreateMutex(NULL, FALSE, NULL); ! ! WSAStartup( MAKEWORD(2,2), &wsaData ); break; case DLL_PROCESS_DETACH: ! WSACleanup(); CloseHandle(hInitMutex); hInitMutex = NULL; bInit = FALSE; Index: openafs/src/WINNT/afsd/cm_buf.c diff -c openafs/src/WINNT/afsd/cm_buf.c:1.31.2.10 openafs/src/WINNT/afsd/cm_buf.c:1.31.2.11 *** openafs/src/WINNT/afsd/cm_buf.c:1.31.2.10 Wed Nov 29 01:23:44 2006 --- openafs/src/WINNT/afsd/cm_buf.c Tue Dec 12 12:04:41 2006 *************** *** 908,913 **** --- 908,914 ---- return 0; } /* for all buffers in lru queue */ lock_ReleaseWrite(&buf_globalLock); + Sleep(100); /* give some time for a buffer to be freed */ } /* while loop over everything */ /* not reached */ } /* the proc */ Index: openafs/src/WINNT/afsd/cm_callback.c diff -c openafs/src/WINNT/afsd/cm_callback.c:1.41.4.9 openafs/src/WINNT/afsd/cm_callback.c:1.41.4.10 *** openafs/src/WINNT/afsd/cm_callback.c:1.41.4.9 Thu Oct 5 16:30:38 2006 --- openafs/src/WINNT/afsd/cm_callback.c Mon Dec 11 23:01:26 2006 *************** *** 149,155 **** dscp->flags & CM_SCACHEFLAG_ANYWATCH ) smb_NotifyChange( 0, FILE_NOTIFY_GENERIC_FILE_FILTER, ! dscp, NULL, NULL, TRUE); #else if (dscp) dc_break_callback(FID_HASH_FN(&dscp->fid)); --- 149,155 ---- dscp->flags & CM_SCACHEFLAG_ANYWATCH ) smb_NotifyChange( 0, FILE_NOTIFY_GENERIC_FILE_FILTER, ! dscp, NULL, NULL, TRUE); #else if (dscp) dc_break_callback(FID_HASH_FN(&dscp->fid)); Index: openafs/src/WINNT/afsd/cm_conn.c diff -c openafs/src/WINNT/afsd/cm_conn.c:1.49.2.9 openafs/src/WINNT/afsd/cm_conn.c:1.49.2.10 *** openafs/src/WINNT/afsd/cm_conn.c:1.49.2.9 Tue Nov 28 04:08:04 2006 --- openafs/src/WINNT/afsd/cm_conn.c Sun Dec 17 16:07:22 2006 *************** *** 24,30 **** osi_rwlock_t cm_connLock; ! long RDRtimeout = CM_CONN_DEFAULTRDRTIMEOUT; unsigned short ConnDeadtimeout = CM_CONN_CONNDEADTIME; unsigned short HardDeadtimeout = CM_CONN_HARDDEADTIME; --- 24,30 ---- osi_rwlock_t cm_connLock; ! DWORD RDRtimeout = CM_CONN_DEFAULTRDRTIMEOUT; unsigned short ConnDeadtimeout = CM_CONN_CONNDEADTIME; unsigned short HardDeadtimeout = CM_CONN_HARDDEADTIME; *************** *** 88,94 **** RegCloseKey(parmKey); } ! afsi_log("lanmanworkstation : SessTimeout %d", RDRtimeout); if (ConnDeadtimeout == 0) ConnDeadtimeout = (unsigned short) (RDRtimeout / 2); afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout); --- 88,94 ---- RegCloseKey(parmKey); } ! afsi_log("lanmanworkstation : SessTimeout %u", RDRtimeout); if (ConnDeadtimeout == 0) ConnDeadtimeout = (unsigned short) (RDRtimeout / 2); afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout); Index: openafs/src/WINNT/afsd/cm_conn.h diff -c openafs/src/WINNT/afsd/cm_conn.h:1.13.4.4 openafs/src/WINNT/afsd/cm_conn.h:1.13.4.5 *** openafs/src/WINNT/afsd/cm_conn.h:1.13.4.4 Sat Oct 21 16:47:48 2006 --- openafs/src/WINNT/afsd/cm_conn.h Sun Dec 17 16:07:22 2006 *************** *** 16,22 **** extern unsigned short ConnDeadtimeout; extern unsigned short HardDeadtimeout; ! extern long RDRtimeout; typedef struct cm_conn { struct cm_conn *nextp; /* locked by cm_connLock */ --- 16,22 ---- extern unsigned short ConnDeadtimeout; extern unsigned short HardDeadtimeout; ! extern DWORD RDRtimeout; typedef struct cm_conn { struct cm_conn *nextp; /* locked by cm_connLock */ Index: openafs/src/WINNT/afsd/cm_daemon.c diff -c openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.7 openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.8 *** openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.7 Fri Oct 6 12:32:43 2006 --- openafs/src/WINNT/afsd/cm_daemon.c Mon Dec 11 23:01:26 2006 *************** *** 296,301 **** --- 296,306 ---- lastTokenCacheCheck = now - cm_daemonTokenCheckInterval/2 + (rand() % cm_daemonTokenCheckInterval); while (daemon_ShutdownFlag == 0) { + /* check to see if the listener threads halted due to network + * disconnect or other issues. If so, attempt to restart them. + */ + smb_RestartListeners(); + if (configureFirewall) { /* Open Microsoft Firewall to allow in port 7001 */ switch (icf_CheckAndAddAFSPorts(AFS_PORTSET_CLIENT)) { Index: openafs/src/WINNT/afsd/cm_vnodeops.c diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.17 openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.19 *** openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.17 Mon Oct 16 20:32:57 2006 --- openafs/src/WINNT/afsd/cm_vnodeops.c Sun Dec 17 16:07:23 2006 *************** *** 179,189 **** }; int cm_8Dot3MapSize = sizeof(cm_8Dot3Mapping); ! void cm_Gen8Dot3Name(cm_dirEntry_t *dep, char *shortName, char **shortNameEndp) { char number[12]; int i, nsize = 0; ! int vnode = ntohl(dep->fid.vnode); char *lastDot; int validExtension = 0; char tc, *temp, *name; --- 179,190 ---- }; int cm_8Dot3MapSize = sizeof(cm_8Dot3Mapping); ! void cm_Gen8Dot3NameInt(const char * longname, cm_dirFid_t * pfid, ! char *shortName, char **shortNameEndp) { char number[12]; int i, nsize = 0; ! int vnode = ntohl(pfid->vnode); char *lastDot; int validExtension = 0; char tc, *temp, *name; *************** *** 199,205 **** * Look for valid extension. There has to be a dot, and * at least one of the characters following has to be legal. */ ! lastDot = strrchr(dep->name, '.'); if (lastDot) { temp = lastDot; temp++; while (tc = *temp++) --- 200,206 ---- * Look for valid extension. There has to be a dot, and * at least one of the characters following has to be legal. */ ! lastDot = strrchr(longname, '.'); if (lastDot) { temp = lastDot; temp++; while (tc = *temp++) *************** *** 210,217 **** } /* Copy name characters */ ! name = dep->name; ! for (i = 0, name = dep->name; i < (7 - nsize) && name != lastDot; ) { tc = *name++; --- 211,217 ---- } /* Copy name characters */ ! for (i = 0, name = longname; i < (7 - nsize) && name != lastDot; ) { tc = *name++; *************** *** 332,342 **** /* return success if we can open this file in this mode */ long cm_CheckNTOpen(cm_scache_t *scp, unsigned int desiredAccess, ! unsigned int createDisp, cm_user_t *userp, cm_req_t *reqp) { long rights; long code; /* Always allow delete; the RPC will tell us if it's OK */ if (desiredAccess == DELETE) return 0; --- 332,346 ---- /* return success if we can open this file in this mode */ long cm_CheckNTOpen(cm_scache_t *scp, unsigned int desiredAccess, ! unsigned int createDisp, cm_user_t *userp, cm_req_t *reqp, ! cm_lock_data_t **ldpp) { long rights; long code; + osi_assert(ldpp != NULL); + *ldpp = NULL; + /* Always allow delete; the RPC will tell us if it's OK */ if (desiredAccess == DELETE) return 0; *************** *** 391,397 **** code = cm_Lock(scp, sLockType, LOffset, LLength, key, 0, userp, reqp, NULL); if (code == 0) { ! cm_Unlock(scp, sLockType, LOffset, LLength, key, userp, reqp); } else { /* In this case, we allow the file open to go through even though we can't enforce mandatory locking on the --- 395,412 ---- code = cm_Lock(scp, sLockType, LOffset, LLength, key, 0, userp, reqp, NULL); if (code == 0) { ! (*ldpp) = (cm_lock_data_t *)malloc(sizeof(cm_lock_data_t)); ! if (!*ldpp) { ! code = ENOMEM; ! goto _done; ! } ! ! (*ldpp)->key = key; ! (*ldpp)->sLockType = sLockType; ! (*ldpp)->LOffset.HighPart = LOffset.HighPart; ! (*ldpp)->LOffset.LowPart = LOffset.LowPart; ! (*ldpp)->LLength.HighPart = LLength.HighPart; ! (*ldpp)->LLength.LowPart = LLength.LowPart; } else { /* In this case, we allow the file open to go through even though we can't enforce mandatory locking on the *************** *** 425,430 **** --- 440,458 ---- return code; } + extern long cm_CheckNTOpenDone(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp, + cm_lock_data_t ** ldpp) + { + if (*ldpp) { + lock_ObtainMutex(&scp->mx); + cm_Unlock(scp, (*ldpp)->sLockType, (*ldpp)->LOffset, (*ldpp)->LLength, + (*ldpp)->key, userp, reqp); + lock_ReleaseMutex(&scp->mx); + free(*ldpp); + *ldpp = NULL; + } + return 0; + } /* * When CAP_NT_SMBS has been negotiated, deletion (of files or directories) is * done in three steps: Index: openafs/src/WINNT/afsd/cm_vnodeops.h diff -c openafs/src/WINNT/afsd/cm_vnodeops.h:1.14.4.2 openafs/src/WINNT/afsd/cm_vnodeops.h:1.14.4.4 *** openafs/src/WINNT/afsd/cm_vnodeops.h:1.14.4.2 Mon Oct 16 20:32:57 2006 --- openafs/src/WINNT/afsd/cm_vnodeops.h Sun Dec 17 16:07:23 2006 *************** *** 62,67 **** --- 62,73 ---- extern void cm_Gen8Dot3Name(struct cm_dirEntry *dep, char *shortName, char **shortNameEndp); + #define cm_Gen8Dot3Name(dep,shortName,shortNameEndp) \ + cm_Gen8Dot3NameInt((dep)->name, &(dep)->fid, shortName, shortNameEndp) + + extern void cm_Gen8Dot3NameInt(const char * longname, cm_dirFid_t * pfid, + char *shortName, char **shortNameEndp); + extern long cm_ReadMountPoint(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp); *************** *** 149,156 **** #define AFS_ACCESS_WRITE ((FILE_GENERIC_WRITE & ~(READ_CONTROL | SYNCHRONIZE)) \ & ~FILE_WRITE_ATTRIBUTES) extern long cm_CheckNTOpen(cm_scache_t *scp, unsigned int desiredAccess, ! unsigned int createDisp, cm_user_t *userp, cm_req_t *reqp); extern long cm_CheckNTDelete(cm_scache_t *dscp, cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp); --- 155,171 ---- #define AFS_ACCESS_WRITE ((FILE_GENERIC_WRITE & ~(READ_CONTROL | SYNCHRONIZE)) \ & ~FILE_WRITE_ATTRIBUTES) + typedef struct cm_lock_data { + cm_key_t key; + unsigned int sLockType; + LARGE_INTEGER LOffset, LLength; + } cm_lock_data_t; + extern long cm_CheckNTOpen(cm_scache_t *scp, unsigned int desiredAccess, ! unsigned int createDisp, cm_user_t *userp, cm_req_t *reqp, cm_lock_data_t ** ldpp); ! ! extern long cm_CheckNTOpenDone(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp, ! cm_lock_data_t ** ldpp); extern long cm_CheckNTDelete(cm_scache_t *dscp, cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp); Index: openafs/src/WINNT/afsd/dosdefs95.h diff -c openafs/src/WINNT/afsd/dosdefs95.h:1.1 openafs/src/WINNT/afsd/dosdefs95.h:1.1.30.1 *** openafs/src/WINNT/afsd/dosdefs95.h:1.1 Mon Apr 30 02:48:07 2001 --- openafs/src/WINNT/afsd/dosdefs95.h Mon Dec 11 23:01:26 2006 *************** *** 35,42 **** #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 ! #define FILE_NOTIFY_CHANGE_CREATION 0x00000040 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 #define ULONG unsigned long #define USHORT unsigned short --- 35,46 ---- #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 ! #define FILE_NOTIFY_CHANGE_CREATION 0x00000040 ! #define FILE_NOTIFY_CHANGE_EA 0x00000080 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 + #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 + #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 + #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 #define ULONG unsigned long #define USHORT unsigned short Index: openafs/src/WINNT/afsd/rawops.c diff -c openafs/src/WINNT/afsd/rawops.c:1.2.4.1 openafs/src/WINNT/afsd/rawops.c:1.2.4.2 *** openafs/src/WINNT/afsd/rawops.c:1.2.4.1 Mon Oct 2 23:23:21 2006 --- openafs/src/WINNT/afsd/rawops.c Mon Dec 11 23:01:26 2006 *************** *** 359,373 **** buf_Release(bufferp); } - #if 0 - if (code == 0 /* && filter != 0 && (fidp->flags & SMB_FID_NTOPEN) - && (fidp->NTopen_dscp->flags & CM_SCACHEFLAG_ANYWATCH)*/) { - smb_NotifyChange(FILE_ACTION_MODIFIED, filter, - fidp->NTopen_dscp, fidp->NTopen_pathp, - NULL, TRUE); - } - #endif - if (code == 0 && doWriteBack) { lock_ObtainMutex(&scp->mx); cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE); --- 359,364 ---- Index: openafs/src/WINNT/afsd/smb.c diff -c openafs/src/WINNT/afsd/smb.c:1.118.2.26 openafs/src/WINNT/afsd/smb.c:1.118.2.28 *** openafs/src/WINNT/afsd/smb.c:1.118.2.26 Tue Nov 28 04:17:14 2006 --- openafs/src/WINNT/afsd/smb.c Sun Dec 17 16:07:24 2006 *************** *** 37,43 **** static char *illegalChars = "\\/:*?\"<>|"; static int smbShutdownFlag = 0; ! static int smb_ListenerState = SMB_LISTENER_STOPPED; int smb_LogoffTokenTransfer; time_t smb_LogoffTransferTimeout; --- 37,43 ---- static char *illegalChars = "\\/:*?\"<>|"; static int smbShutdownFlag = 0; ! static int smb_ListenerState = SMB_LISTENER_UNINITIALIZED; int smb_LogoffTokenTransfer; time_t smb_LogoffTransferTimeout; *************** *** 52,57 **** --- 52,58 ---- extern void afsi_log(char *pattern, ...); extern HANDLE afsi_file; + extern int powerStateSuspended; osi_hyper_t hzero = {0, 0}; osi_hyper_t hones = {0xFFFFFFFF, -1}; *************** *** 174,180 **** /* forward decl */ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, NCB *ncbp, raw_write_cont_t *rwcp); ! void smb_NetbiosInit(); #ifdef DJGPP #ifndef AFS_WIN95_ENV DWORD smb_ServerExceptionFilter(void); --- 175,181 ---- /* forward decl */ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, NCB *ncbp, raw_write_cont_t *rwcp); ! int smb_NetbiosInit(void); #ifdef DJGPP #ifndef AFS_WIN95_ENV DWORD smb_ServerExceptionFilter(void); *************** *** 2005,2010 **** --- 2006,2013 ---- { lock_ObtainWrite(&smb_globalLock); lock_ObtainMutex(&dsp->mx); + osi_Log3(afsd_logp,"smb_DeleteDirSearch cookie %d dsp 0x%p scp 0x%p", + dsp->cookie, dsp, dsp->scp); dsp->flags |= SMB_DIRSEARCH_DELETE; if (dsp->scp != NULL) { lock_ObtainMutex(&dsp->scp->mx); *************** *** 2033,2039 **** lock_ReleaseMutex(&dsp->mx); lock_FinalizeMutex(&dsp->mx); scp = dsp->scp; ! osi_Log2(afsd_logp,"smb_ReleaseDirSearch dsp 0x%p scp 0x%p", dsp, scp); free(dsp); } else { lock_ReleaseMutex(&dsp->mx); --- 2036,2043 ---- lock_ReleaseMutex(&dsp->mx); lock_FinalizeMutex(&dsp->mx); scp = dsp->scp; ! osi_Log3(afsd_logp,"smb_ReleaseDirSearch cookie %d dsp 0x%p scp 0x%p", ! dsp->cookie, dsp, scp); free(dsp); } else { lock_ReleaseMutex(&dsp->mx); *************** *** 2121,2126 **** --- 2125,2132 ---- counter = 0; /* what's the biggest ID allowed in this version of the protocol */ + /* TODO: do we really want a non v3 dir search request to wrap + smb_dirSearchCounter? */ maxAllowed = isV3 ? 65535 : 255; if (smb_dirSearchCounter > maxAllowed) smb_dirSearchCounter = 1; *************** *** 2164,2170 **** osi_QAdd((osi_queue_t **) &smb_firstDirSearchp, &dsp->q); if (!smb_lastDirSearchp) smb_lastDirSearchp = (smb_dirSearch_t *) &dsp->q; ! break; } lock_ReleaseWrite(&smb_globalLock); return dsp; --- 2170,2179 ---- osi_QAdd((osi_queue_t **) &smb_firstDirSearchp, &dsp->q); if (!smb_lastDirSearchp) smb_lastDirSearchp = (smb_dirSearch_t *) &dsp->q; ! ! osi_Log2(afsd_logp,"smb_NewDirSearch cookie %d dsp 0x%p", ! dsp->cookie, dsp); ! break; } lock_ReleaseWrite(&smb_globalLock); return dsp; *************** *** 2358,2364 **** } /* return the parm'th parameter in the smbp packet */ ! unsigned int smb_GetSMBParm(smb_packet_t *smbp, int parm) { int parmCount; unsigned char *parmDatap; --- 2367,2373 ---- } /* return the parm'th parameter in the smbp packet */ ! unsigned short smb_GetSMBParm(smb_packet_t *smbp, int parm) { int parmCount; unsigned char *parmDatap; *************** *** 2384,2389 **** --- 2393,2422 ---- } /* return the parm'th parameter in the smbp packet */ + unsigned char smb_GetSMBParmByte(smb_packet_t *smbp, int parm) + { + int parmCount; + unsigned char *parmDatap; + + parmCount = *smbp->wctp; + + if (parm >= parmCount) { + char s[100]; + + sprintf(s, "Bad SMB param %d out of %d, ncb len %d", + parm, parmCount, smbp->ncb_length); + osi_Log3(smb_logp,"Bad SMB param %d out of %d, ncb len %d", + parm, parmCount, smbp->ncb_length); + LogEvent(EVENTLOG_ERROR_TYPE, MSG_BAD_SMB_PARAM, + __FILE__, __LINE__, parm, parmCount, smbp->ncb_length); + osi_panic(s, __FILE__, __LINE__); + } + parmDatap = smbp->wctp + (2*parm) + 1; + + return parmDatap[0]; + } + + /* return the parm'th parameter in the smbp packet */ unsigned int smb_GetSMBParmLong(smb_packet_t *smbp, int parm) { int parmCount; *************** *** 8280,8285 **** --- 8313,8320 ---- code = Netbios(ncbp, dos_ncb); #endif if (code == NRC_BRIDGE) { + int lanaRemaining = 0; + if (smb_ListenerState == SMB_LISTENER_STOPPED || smbShutdownFlag == 1) { #ifndef DJGPP ExitThread(1); *************** *** 8294,8306 **** for (i = 0; i < lana_list.length; i++) { if (lana_list.lana[i] == ncbp->ncb_lana_num) { lana_list.lana[i] = 255; - break; } } return; ! } else if (code != 0) ! { #ifndef DJGPP char tbuffer[256]; #endif --- 8329,8349 ---- for (i = 0; i < lana_list.length; i++) { if (lana_list.lana[i] == ncbp->ncb_lana_num) { + smb_StopListener(ncbp, lana_list.lana[i]); lana_list.lana[i] = 255; } + if (lana_list.lana[i] != 255) + lanaRemaining++; + } + + if (lanaRemaining == 0) { + smb_ListenerState = SMB_LISTENER_STOPPED; + smb_LANadapter = -1; + lana_list.length = 0; } + FreeNCB(ncbp); return; ! } else if (code != 0) { #ifndef DJGPP char tbuffer[256]; #endif *************** *** 8535,8541 **** } /* initialize Netbios */ ! void smb_NetbiosInit() { NCB *ncbp; #ifdef DJGPP --- 8578,8584 ---- } /* initialize Netbios */ ! int smb_NetbiosInit(void) { NCB *ncbp; #ifdef DJGPP *************** *** 8677,8683 **** else { afsi_log("Netbios NCBADDNAME lana %d error code %d", lana, code); lana_list.lana[l] = 255; /* invalid lana */ - osi_panic(s, __FILE__, __LINE__); } } if (code == 0) { --- 8720,8725 ---- *************** *** 8690,8700 **** osi_assert(lana_list.length >= 0); if (!lana_found) { ! osi_panic("No valid LANA numbers found!", __FILE__, __LINE__); } /* we're done with the NCB now */ FreeNCB(ncbp); } void smb_StartListeners() --- 8732,8747 ---- osi_assert(lana_list.length >= 0); if (!lana_found) { ! afsi_log("No valid LANA numbers found!"); ! lana_list.length = 0; ! smb_LANadapter = -1; ! smb_ListenerState = SMB_LISTENER_STOPPED; } /* we're done with the NCB now */ FreeNCB(ncbp); + + return (lana_list.length > 0 ? 1 : 0); } void smb_StartListeners() *************** *** 8720,8739 **** void smb_RestartListeners() { ! if (smb_ListenerState == SMB_LISTENER_STARTED) ! return; ! smb_NetbiosInit(); ! smb_StartListeners(); } ! void smb_StopListeners() { NCB *ncbp; ! #ifdef DJGPP ! dos_ptr dos_ncb; ! #endif /* DJGPP */ ! int lana, code, l; if (smb_ListenerState == SMB_LISTENER_STOPPED) return; --- 8767,8810 ---- void smb_RestartListeners() { ! if (!powerStateSuspended && smb_ListenerState == SMB_LISTENER_STOPPED) { ! if (smb_NetbiosInit()) ! smb_StartListeners(); ! } ! } ! void smb_StopListener(NCB *ncbp, int lana) ! { ! long code; ! ! memset(ncbp, 0, sizeof(*ncbp)); ! ncbp->ncb_command = NCBDELNAME; ! ncbp->ncb_lana_num = lana; ! memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ); ! code = Netbios(ncbp); ! ! afsi_log("Netbios NCBDELNAME lana=%d code=%d retcode=%d complete=%d", ! lana, code, ncbp->ncb_retcode, ncbp->ncb_cmd_cplt); ! ! /* and then reset the LANA; this will cause the listener threads to exit */ ! ncbp->ncb_command = NCBRESET; ! ncbp->ncb_callname[0] = 100; ! ncbp->ncb_callname[2] = 100; ! ncbp->ncb_lana_num = lana; ! code = Netbios(ncbp); ! if (code == 0) ! code = ncbp->ncb_retcode; ! if (code != 0) { ! afsi_log("Netbios NCBRESET lana %d error code %d", lana, code); ! } else { ! afsi_log("Netbios NCBRESET lana %d succeeded", lana); ! } } ! void smb_StopListeners(void) { NCB *ncbp; ! int lana, l; if (smb_ListenerState == SMB_LISTENER_STOPPED) return; *************** *** 8746,8783 **** for (l = 0; l < lana_list.length; l++) { lana = lana_list.lana[l]; ! memset(ncbp, 0, sizeof(*ncbp)); ! ncbp->ncb_command = NCBDELNAME; ! ncbp->ncb_lana_num = lana; ! memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ); ! #ifndef DJGPP ! code = Netbios(ncbp); ! #else /* DJGPP */ ! code = Netbios(ncbp, dos_ncb); ! #endif /* !DJGPP */ ! ! afsi_log("Netbios NCBDELNAME lana=%d code=%d retcode=%d complete=%d", ! lana, code, ncbp->ncb_retcode, ncbp->ncb_cmd_cplt); ! /* and then reset the LANA; this will cause the listener threads to exit */ ! ncbp->ncb_command = NCBRESET; ! ncbp->ncb_callname[0] = 100; ! ncbp->ncb_callname[2] = 100; ! ncbp->ncb_lana_num = lana_list.lana[l]; ! code = Netbios(ncbp); ! if (code == 0) ! code = ncbp->ncb_retcode; ! if (code != 0) { ! afsi_log("Netbios NCBRESET lana %d error code %d", lana_list.lana[l], code); ! } else { ! afsi_log("Netbios NCBRESET lana %d succeeded", lana_list.lana[l]); ! } ! ! /* mark the adapter invalid */ ! lana_list.lana[l] = 255; /* invalid lana */ } lana_list.length = 0; FreeNCB(ncbp); Sleep(1000); /* give the listener threads a chance to exit */ } --- 8817,8833 ---- for (l = 0; l < lana_list.length; l++) { lana = lana_list.lana[l]; ! if (lana != 255) { ! smb_StopListener(ncbp, lana); ! /* mark the adapter invalid */ ! lana_list.lana[l] = 255; /* invalid lana */ ! } } + /* force a re-evaluation of the network adapters */ lana_list.length = 0; + smb_LANadapter = -1; FreeNCB(ncbp); Sleep(1000); /* give the listener threads a chance to exit */ } Index: openafs/src/WINNT/afsd/smb.h diff -c openafs/src/WINNT/afsd/smb.h:1.41.2.10 openafs/src/WINNT/afsd/smb.h:1.41.2.11 *** openafs/src/WINNT/afsd/smb.h:1.41.2.10 Tue Nov 28 04:17:14 2006 --- openafs/src/WINNT/afsd/smb.h Mon Dec 11 23:01:26 2006 *************** *** 609,615 **** extern void smb_SetSMBDataLength(smb_packet_t *smbp, unsigned int dsize); ! extern unsigned int smb_GetSMBParm(smb_packet_t *smbp, int parm); extern unsigned int smb_GetSMBParmLong(smb_packet_t *smbp, int parm); --- 609,617 ---- extern void smb_SetSMBDataLength(smb_packet_t *smbp, unsigned int dsize); ! extern unsigned short smb_GetSMBParm(smb_packet_t *smbp, int parm); ! ! extern unsigned char smb_GetSMBParmByte(smb_packet_t *smbp, int parm); extern unsigned int smb_GetSMBParmLong(smb_packet_t *smbp, int parm); *************** *** 748,754 **** --- 750,758 ---- extern void smb_ResetServerPriority(void); extern void smb_RestartListeners(void); extern void smb_StopListeners(void); + extern void smb_StopListener(NCB *ncbp, int lana); + #define SMB_LISTENER_UNINITIALIZED -1 #define SMB_LISTENER_STOPPED 0 #define SMB_LISTENER_STARTED 1 Index: openafs/src/WINNT/afsd/smb3.c diff -c openafs/src/WINNT/afsd/smb3.c:1.95.2.23 openafs/src/WINNT/afsd/smb3.c:1.95.2.26 *** openafs/src/WINNT/afsd/smb3.c:1.95.2.23 Sun Oct 22 08:25:39 2006 --- openafs/src/WINNT/afsd/smb3.c Tue Dec 26 15:18:30 2006 *************** *** 1502,1507 **** --- 1502,1508 ---- char * cstrp; char thisShare[256]; int i,j; + DWORD dw; int nonrootShares; smb_rap_share_list_t rootShares; cm_req_t req; *************** *** 1590,1598 **** } if (hkSubmount) { ! for (i=0; i < nRegShares && cshare < nSharesRet; i++) { len = sizeof(thisShare); ! rv = RegEnumValue(hkSubmount, i, thisShare, &len, NULL, NULL, NULL, NULL); if (rv == ERROR_SUCCESS && strlen(thisShare) && (!allSubmount || stricmp(thisShare,"all"))) { strncpy(shares[cshare].shi1_netname, thisShare, sizeof(shares->shi1_netname)-1); shares[cshare].shi1_netname[sizeof(shares->shi1_netname)-1] = 0; /* unfortunate truncation */ --- 1591,1599 ---- } if (hkSubmount) { ! for (dw=0; dw < nRegShares && cshare < nSharesRet; dw++) { len = sizeof(thisShare); ! rv = RegEnumValue(hkSubmount, dw, thisShare, &len, NULL, NULL, NULL, NULL); if (rv == ERROR_SUCCESS && strlen(thisShare) && (!allSubmount || stricmp(thisShare,"all"))) { strncpy(shares[cshare].shi1_netname, thisShare, sizeof(shares->shi1_netname)-1); shares[cshare].shi1_netname[sizeof(shares->shi1_netname)-1] = 0; /* unfortunate truncation */ *************** *** 2426,2443 **** return 0; } - long smb_ReceiveTran2FindFirst(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *outp) - { - osi_Log0(smb_logp,"ReceiveTran2FindFirst - NOT_SUPPORTED"); - return CM_ERROR_BADOP; - } - - long smb_ReceiveTran2FindNext(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *outp) - { - osi_Log0(smb_logp,"ReceiveTran2FindNext - NOT_SUPPORTED"); - return CM_ERROR_BADOP; - } - long smb_ReceiveTran2QFSInfoFid(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) { unsigned short fid; --- 2427,2432 ---- *************** *** 4140,4145 **** --- 4129,4551 ---- } #endif /* USE_OLD_MATCHING */ + /* smb_ReceiveTran2SearchDir implements both + * Tran2_Find_First and Tran2_Find_Next + */ + #define TRAN2_FIND_FLAG_CLOSE_SEARCH 0x01 + #define TRAN2_FIND_FLAG_CLOSE_SEARCH_IF_END 0x02 + #define TRAN2_FIND_FLAG_RETURN_RESUME_KEYS 0x04 + #define TRAN2_FIND_FLAG_CONTINUE_SEARCH 0x08 + #define TRAN2_FIND_FLAG_BACKUP_INTENT 0x10 + + /* this is an optimized handler for T2SearchDir that handles the case + where there are no wildcards in the search path. I.e. an + application is using FindFirst(Ex) to get information about a + single file or directory. It will attempt to do a single lookup. + If that fails, then smb_ReceiveTran2SearchDir() will fall back to + the usual mechanism. + + This function will return either CM_ERROR_NOSUCHFILE or SUCCESS. + */ + long smb_T2SearchDirSingle(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *opx) + { + int attribute; + long nextCookie; + long code = 0, code2 = 0; + char *pathp; + int maxCount; + smb_dirListPatch_t *dirListPatchesp; + smb_dirListPatch_t *curPatchp; + long orbytes; /* # of bytes in this output record */ + long ohbytes; /* # of bytes, except file name */ + long onbytes; /* # of bytes in name, incl. term. null */ + cm_scache_t *scp = NULL; + cm_scache_t *targetscp = NULL; + cm_user_t *userp = NULL; + char *op; /* output data ptr */ + char *origOp; /* original value of op */ + cm_space_t *spacep; /* for pathname buffer */ + long maxReturnData; /* max # of return data */ + long maxReturnParms; /* max # of return parms */ + long bytesInBuffer; /* # data bytes in the output buffer */ + char *maskp; /* mask part of path */ + int infoLevel; + int searchFlags; + int eos; + smb_tran2Packet_t *outp; /* response packet */ + char *tidPathp; + int align; + char shortName[13]; /* 8.3 name if needed */ + int NeedShortName; + char *shortNameEnd; + cm_req_t req; + char * s; + + cm_InitReq(&req); + + eos = 0; + osi_assert(p->opcode == 1); + + /* find first; obtain basic parameters from request */ + + /* note that since we are going to failover to regular + * processing at smb_ReceiveTran2SearchDir(), we shouldn't + * modify any of the input parameters here. */ + attribute = p->parmsp[0]; + maxCount = p->parmsp[1]; + infoLevel = p->parmsp[3]; + searchFlags = p->parmsp[2]; + pathp = ((char *) p->parmsp) + 12; /* points to path */ + nextCookie = 0; + maskp = strrchr(pathp, '\\'); + if (maskp == NULL) + maskp = pathp; + else + maskp++; /* skip over backslash */ + /* track if this is likely to match a lot of entries */ + + osi_Log2(smb_logp, "smb_T2SearchDirSingle : path[%s], mask[%s]", + osi_LogSaveString(smb_logp, pathp), + osi_LogSaveString(smb_logp, maskp)); + + switch ( infoLevel ) { + case SMB_INFO_STANDARD: + s = "InfoStandard"; + break; + case SMB_INFO_QUERY_EA_SIZE: + s = "InfoQueryEaSize"; + break; + case SMB_INFO_QUERY_EAS_FROM_LIST: + s = "InfoQueryEasFromList"; + break; + case SMB_FIND_FILE_DIRECTORY_INFO: + s = "FindFileDirectoryInfo"; + break; + case SMB_FIND_FILE_FULL_DIRECTORY_INFO: + s = "FindFileFullDirectoryInfo"; + break; + case SMB_FIND_FILE_NAMES_INFO: + s = "FindFileNamesInfo"; + break; + case SMB_FIND_FILE_BOTH_DIRECTORY_INFO: + s = "FindFileBothDirectoryInfo"; + break; + default: + s = "unknownInfoLevel"; + } + + osi_Log1(smb_logp, "smb_T2SearchDirSingle info level: %s", s); + + osi_Log4(smb_logp, + "smb_T2SearchDirSingle attr 0x%x, info level 0x%x, max count %d, flags 0x%x", + attribute, infoLevel, maxCount, searchFlags); + + if (infoLevel > SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { + osi_Log1(smb_logp, "Unsupported InfoLevel 0x%x", infoLevel); + return CM_ERROR_INVAL; + } + + if (infoLevel >= SMB_FIND_FILE_DIRECTORY_INFO) + searchFlags &= ~TRAN2_FIND_FLAG_RETURN_RESUME_KEYS; /* no resume keys */ + + dirListPatchesp = NULL; + + maxReturnData = p->maxReturnData; + maxReturnParms = 10; /* return params for findfirst, which + is the only one we handle.*/ + + #ifndef CM_CONFIG_MULTITRAN2RESPONSES + if (maxReturnData > 6000) + maxReturnData = 6000; + #endif /* CM_CONFIG_MULTITRAN2RESPONSES */ + + outp = smb_GetTran2ResponsePacket(vcp, p, opx, maxReturnParms, + maxReturnData); + + osi_Log2(smb_logp, "T2SDSingle search dir count %d [%s]", + maxCount, osi_LogSaveString(smb_logp, pathp)); + + /* bail out if request looks bad */ + if (!pathp) { + smb_FreeTran2Packet(outp); + return CM_ERROR_BADSMB; + } + + userp = smb_GetTran2User(vcp, p); + if (!userp) { + osi_Log1(smb_logp, "T2 search dir unable to resolve user [%d]", p->uid); + smb_FreeTran2Packet(outp); + return CM_ERROR_BADSMB; + } + + /* try to get the vnode for the path name next */ + spacep = cm_GetSpace(); + smb_StripLastComponent(spacep->data, NULL, pathp); + code = smb_LookupTIDPath(vcp, p->tid, &tidPathp); + if (code) { + cm_ReleaseUser(userp); + smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOFILES); + smb_FreeTran2Packet(outp); + return 0; + } + + code = cm_NameI(cm_data.rootSCachep, spacep->data, + CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, + userp, tidPathp, &req, &scp); + cm_FreeSpace(spacep); + + if (code) { + cm_ReleaseUser(userp); + smb_SendTran2Error(vcp, p, opx, code); + smb_FreeTran2Packet(outp); + return 0; + } + + #ifdef DFS_SUPPORT_BUT_NOT_FIND_FIRST + if (scp->fileType == CM_SCACHETYPE_DFSLINK) { + cm_ReleaseSCache(scp); + cm_ReleaseUser(userp); + if ( WANTS_DFS_PATHNAMES(p) ) + code = CM_ERROR_PATH_NOT_COVERED; + else + code = CM_ERROR_BADSHARENAME; + smb_SendTran2Error(vcp, p, opx, code); + smb_FreeTran2Packet(outp); + return 0; + } + #endif /* DFS_SUPPORT */ + osi_Log1(afsd_logp,"smb_ReceiveTran2SearchDir scp 0x%p", scp); + lock_ObtainMutex(&scp->mx); + if ((scp->flags & CM_SCACHEFLAG_BULKSTATTING) == 0 && + LargeIntegerGreaterOrEqualToZero(scp->bulkStatProgress)) { + scp->flags |= CM_SCACHEFLAG_BULKSTATTING; + } + lock_ReleaseMutex(&scp->mx); + + /* now do a single case sensitive lookup for the file in question */ + code = cm_Lookup(scp, maskp, 0, userp, &req, &targetscp); + + /* if a case sensitive match failed, we try a case insensitive one + next. */ + if (code == CM_ERROR_NOSUCHFILE) { + code = cm_Lookup(scp, maskp, CM_FLAG_CASEFOLD, userp, &req, &targetscp); + } + + if (code == 0 && targetscp->fid.vnode == 0) { + cm_ReleaseSCache(targetscp); + code = CM_ERROR_NOSUCHFILE; + } + + if (code) { + /* if we can't find the directory entry, this block will + return CM_ERROR_NOSUCHFILE, which we will pass on to + smb_ReceiveTran2SearchDir(). */ + cm_ReleaseSCache(scp); + cm_ReleaseUser(userp); + if (code != CM_ERROR_NOSUCHFILE) { + smb_SendTran2Error(vcp, p, opx, code); + code = 0; + } + smb_FreeTran2Packet(outp); + return code; + } + + /* now that we have the target in sight, we proceed with filling + up the return data. */ + + op = origOp = outp->datap; + bytesInBuffer = 0; + + if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) { + /* skip over resume key */ + op += 4; + } + + if (infoLevel == SMB_FIND_FILE_BOTH_DIRECTORY_INFO + && targetscp->fid.vnode != 0 + && !cm_Is8Dot3(maskp)) { + + cm_dirFid_t dfid; + dfid.vnode = htonl(targetscp->fid.vnode); + dfid.unique = htonl(targetscp->fid.unique); + + cm_Gen8Dot3NameInt(maskp, &dfid, shortName, &shortNameEnd); + NeedShortName = 1; + } else { + NeedShortName = 0; + } + + /* Eliminate entries that don't match requested attributes */ + if (smb_hideDotFiles && !(attribute & SMB_ATTR_HIDDEN) && + smb_IsDotFile(maskp)) { + + code = CM_ERROR_NOSUCHFILE; + osi_Log0(smb_logp, "T2SDSingle skipping hidden file"); + goto skip_file; + + } + + if (!(attribute & SMB_ATTR_DIRECTORY) && + (targetscp->fileType == CM_SCACHETYPE_DIRECTORY || + targetscp->fileType == CM_SCACHETYPE_DFSLINK || + targetscp->fileType == CM_SCACHETYPE_INVALID)) { + + code = CM_ERROR_NOSUCHFILE; + osi_Log0(smb_logp, "T2SDSingle skipping directory or bad link"); + goto skip_file; + + } + + /* Check if the name will fit */ + if (infoLevel < 0x101) + ohbytes = 23; /* pre-NT */ + else if (infoLevel == SMB_FIND_FILE_NAMES_INFO) + ohbytes = 12; /* NT names only */ + else + ohbytes = 64; /* NT */ + + if (infoLevel == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) + ohbytes += 26; /* Short name & length */ + + if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) { + ohbytes += 4; /* if resume key required */ + } + + if (infoLevel != SMB_INFO_STANDARD + && infoLevel != SMB_FIND_FILE_DIRECTORY_INFO + && infoLevel != SMB_FIND_FILE_NAMES_INFO) + ohbytes += 4; /* EASIZE */ + + /* add header to name & term. null */ + onbytes = strlen(maskp); + orbytes = ohbytes + onbytes + 1; + + /* now, we round up the record to a 4 byte alignment, and we make + * sure that we have enough room here for even the aligned version + * (so we don't have to worry about an * overflow when we pad + * things out below). That's the reason for the alignment + * arithmetic below. + */ + if (infoLevel >= SMB_FIND_FILE_DIRECTORY_INFO) + align = (4 - (orbytes & 3)) & 3; + else + align = 0; + + if (orbytes + align > maxReturnData) { + + /* even though this request is unlikely to succeed with a + failover, we do it anyway. */ + code = CM_ERROR_NOSUCHFILE; + osi_Log1(smb_logp, "T2 dir search exceed max return data %d", + maxReturnData); + goto skip_file; + } + + /* this is one of the entries to use: it is not deleted and it + * matches the star pattern we're looking for. Put out the name, + * preceded by its length. + */ + /* First zero everything else */ + memset(origOp, 0, ohbytes); + + if (infoLevel <= SMB_FIND_FILE_DIRECTORY_INFO) + *(origOp + ohbytes - 1) = (unsigned char) onbytes; + else if (infoLevel == SMB_FIND_FILE_NAMES_INFO) + *((u_long *)(op + 8)) = onbytes; + else + *((u_long *)(op + 60)) = onbytes; + strcpy(origOp+ohbytes, maskp); + if (smb_StoreAnsiFilenames) + CharToOem(origOp+ohbytes, origOp+ohbytes); + + /* Short name if requested and needed */ + if (infoLevel == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { + if (NeedShortName) { + strcpy(op + 70, shortName); + if (smb_StoreAnsiFilenames) + CharToOem(op + 70, op + 70); + *(op + 68) = (char)(shortNameEnd - shortName); + } + } + + /* NextEntryOffset and FileIndex */ + if (infoLevel >= SMB_FIND_FILE_DIRECTORY_INFO) { + int entryOffset = orbytes + align; + *((u_long *)op) = 0; + *((u_long *)(op+4)) = 0; + } + + if (infoLevel != SMB_FIND_FILE_NAMES_INFO) { + curPatchp = malloc(sizeof(*curPatchp)); + osi_QAdd((osi_queue_t **) &dirListPatchesp, + &curPatchp->q); + curPatchp->dptr = op; + if (infoLevel >= SMB_FIND_FILE_DIRECTORY_INFO) + curPatchp->dptr += 8; + + if (smb_hideDotFiles && smb_IsDotFile(maskp)) { + curPatchp->flags = SMB_DIRLISTPATCH_DOTFILE; + } else { + curPatchp->flags = 0; + } + + curPatchp->fid.cell = targetscp->fid.cell; + curPatchp->fid.volume = targetscp->fid.volume; + curPatchp->fid.vnode = targetscp->fid.vnode; + curPatchp->fid.unique = targetscp->fid.unique; + + /* temp */ + curPatchp->dep = NULL; + } + + if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) { + /* put out resume key */ + *((u_long *)origOp) = 0; + } + + /* Adjust byte ptr and count */ + origOp += orbytes; /* skip entire record */ + bytesInBuffer += orbytes; + + /* and pad the record out */ + while (--align >= 0) { + *origOp++ = 0; + bytesInBuffer++; + } + + /* apply the patches */ + code2 = smb_ApplyV3DirListPatches(scp, &dirListPatchesp, infoLevel, userp, &req); + + outp->parmsp[0] = 0; + outp->parmsp[1] = 1; /* number of names returned */ + outp->parmsp[2] = 1; /* end of search */ + outp->parmsp[3] = 0; /* nothing wrong with EAS */ + outp->parmsp[4] = 0; + + outp->totalParms = 10; /* in bytes */ + + outp->totalData = bytesInBuffer; + + osi_Log0(smb_logp, "T2SDSingle done."); + + if (code != CM_ERROR_NOSUCHFILE) { + if (code) + smb_SendTran2Error(vcp, p, opx, code); + else + smb_SendTran2Packet(vcp, outp, opx); + code = 0; + } + + skip_file: + smb_FreeTran2Packet(outp); + cm_ReleaseSCache(scp); + cm_ReleaseSCache(targetscp); + cm_ReleaseUser(userp); + + return code; + } + + long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *opx) { int attribute; *************** *** 4202,4209 **** maxCount = p->parmsp[1]; infoLevel = p->parmsp[3]; searchFlags = p->parmsp[2]; - dsp = smb_NewDirSearch(1); - dsp->attribute = attribute; pathp = ((char *) p->parmsp) + 12; /* points to path */ if (smb_StoreAnsiFilenames) OemToChar(pathp,pathp); --- 4608,4613 ---- *************** *** 4213,4221 **** maskp = pathp; else maskp++; /* skip over backslash */ ! strcpy(dsp->mask, maskp); /* and save mask */ /* track if this is likely to match a lot of entries */ starPattern = smb_V3IsStarMask(maskp); } else { osi_assert(p->opcode == 2); --- 4617,4643 ---- maskp = pathp; else maskp++; /* skip over backslash */ ! /* track if this is likely to match a lot of entries */ starPattern = smb_V3IsStarMask(maskp); + + #ifndef NOFINDFIRSTOPTIMIZE + if (!starPattern) { + /* if this is for a single directory or file, we let the + optimized routine handle it. The only error it + returns is CM_ERROR_NOSUCHFILE. The */ + code = smb_T2SearchDirSingle(vcp, p, opx); + + /* we only failover if we see a CM_ERROR_NOSUCHFILE */ + if (code != CM_ERROR_NOSUCHFILE) { + return code; + } + } + #endif + + dsp = smb_NewDirSearch(1); + dsp->attribute = attribute; + strcpy(dsp->mask, maskp); /* and save mask */ } else { osi_assert(p->opcode == 2); *************** *** 4278,4284 **** } if (infoLevel >= SMB_FIND_FILE_DIRECTORY_INFO) ! searchFlags &= ~4; /* no resume keys */ dirListPatchesp = NULL; --- 4700,4706 ---- } if (infoLevel >= SMB_FIND_FILE_DIRECTORY_INFO) ! searchFlags &= ~TRAN2_FIND_FLAG_RETURN_RESUME_KEYS; /* no resume keys */ dirListPatchesp = NULL; *************** *** 4416,4422 **** bytesInBuffer = 0; while (1) { op = origOp; ! if (searchFlags & 4) /* skip over resume key */ op += 4; --- 4838,4844 ---- bytesInBuffer = 0; while (1) { op = origOp; ! if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) /* skip over resume key */ op += 4; *************** *** 4490,4496 **** if ((dsp->flags & SMB_DIRSEARCH_BULKST) && LargeIntegerGreaterThanOrEqualTo(thyper, scp->bulkStatProgress)) { /* Don't bulk stat if risking timeout */ ! int now = GetTickCount(); if (now - req.startTime > RDRtimeout) { scp->bulkStatProgress = thyper; scp->flags &= ~CM_SCACHEFLAG_BULKSTATTING; --- 4912,4918 ---- if ((dsp->flags & SMB_DIRSEARCH_BULKST) && LargeIntegerGreaterThanOrEqualTo(thyper, scp->bulkStatProgress)) { /* Don't bulk stat if risking timeout */ ! DWORD now = GetTickCount(); if (now - req.startTime > RDRtimeout) { scp->bulkStatProgress = thyper; scp->flags &= ~CM_SCACHEFLAG_BULKSTATTING; *************** *** 4644,4650 **** if (infoLevel == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) ohbytes += 26; /* Short name & length */ ! if (searchFlags & 4) { ohbytes += 4; /* if resume key required */ } --- 5066,5072 ---- if (infoLevel == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) ohbytes += 26; /* Short name & length */ ! if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) { ohbytes += 4; /* if resume key required */ } *************** *** 4745,4751 **** curPatchp->dep = dep; } ! if (searchFlags & 4) /* put out resume key */ *((u_long *)origOp) = nextEntryCookie; --- 5167,5173 ---- curPatchp->dep = dep; } ! if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) /* put out resume key */ *((u_long *)origOp) = nextEntryCookie; *************** *** 4838,4847 **** * we're supposed to close the search if we're done, and we're done, * or if something went wrong, close the search. */ ! /* ((searchFlags & 1) || ((searchFlags & 2) && eos) */ ! if ((searchFlags & 1) || (returnedNames == 0) || ! ((searchFlags & 2) && eos) || code != 0) smb_DeleteDirSearch(dsp); if (code) smb_SendTran2Error(vcp, p, opx, code); else --- 5260,5271 ---- * we're supposed to close the search if we're done, and we're done, * or if something went wrong, close the search. */ ! if ((searchFlags & TRAN2_FIND_FLAG_CLOSE_SEARCH) || ! (returnedNames == 0) || ! ((searchFlags & TRAN2_FIND_FLAG_CLOSE_SEARCH_IF_END) && eos) || ! code != 0) smb_DeleteDirSearch(dsp); + if (code) smb_SendTran2Error(vcp, p, opx, code); else *************** *** 5934,5939 **** --- 6358,6364 ---- BOOL foundscp; cm_req_t req; int created = 0; + cm_lock_data_t *ldp = NULL; cm_InitReq(&req); *************** *** 6303,6309 **** * scp is NULL. */ if (code == 0 && !treeCreate) { ! code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, &req); if (code) { if (dscp) cm_ReleaseSCache(dscp); --- 6728,6734 ---- * scp is NULL. */ if (code == 0 && !treeCreate) { ! code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, &req, &ldp); if (code) { if (dscp) cm_ReleaseSCache(dscp); *************** *** 6316,6321 **** --- 6741,6747 ---- if (createDisp == FILE_CREATE) { /* oops, file shouldn't be there */ + cm_CheckNTOpenDone(scp, userp, &req, &ldp); if (dscp) cm_ReleaseSCache(dscp); if (scp) *************** *** 6344,6352 **** */ osi_Log2(smb_logp, "symlink vp %x to vp %x", scp, targetScp); cm_ReleaseSCache(scp); scp = targetScp; ! } } code = cm_SetAttr(scp, &setAttr, userp, &req); openAction = 3; /* truncated existing file */ --- 6770,6789 ---- */ osi_Log2(smb_logp, "symlink vp %x to vp %x", scp, targetScp); + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); scp = targetScp; ! code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, &req, &ldp); ! if (code) { ! if (dscp) ! cm_ReleaseSCache(dscp); ! if (scp) ! cm_ReleaseSCache(scp); ! cm_ReleaseUser(userp); ! free(realPathp); ! return code; ! } ! } } code = cm_SetAttr(scp, &setAttr, userp, &req); openAction = 3; /* truncated existing file */ *************** *** 6501,6506 **** --- 6938,6945 ---- if (code) { /* something went wrong creating or truncating the file */ + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); if (scp) cm_ReleaseSCache(scp); if (dscp) *************** *** 6523,6534 **** --- 6962,6977 ---- * we'll just use the symlink anyway. */ osi_Log2(smb_logp, "symlink vp %x to vp %x", scp, targetScp); + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); scp = targetScp; } } if (scp->fileType != CM_SCACHETYPE_FILE) { + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); if (dscp) cm_ReleaseSCache(dscp); cm_ReleaseSCache(scp); *************** *** 6540,6545 **** --- 6983,6990 ---- /* (only applies to single component case) */ if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) { + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); if (dscp) cm_ReleaseSCache(dscp); *************** *** 6582,6599 **** lock_ReleaseMutex(&scp->mx); if (code) { cm_ReleaseSCache(scp); if (dscp) cm_ReleaseSCache(dscp); ! cm_ReleaseUser(userp); ! /* shouldn't this be smb_CloseFID() fidp->flags = SMB_FID_DELETE; */ smb_CloseFID(vcp, fidp, NULL, 0); ! smb_ReleaseFID(fidp); free(realPathp); return code; } } lock_ObtainMutex(&fidp->mx); /* save a pointer to the vnode */ fidp->scp = scp; /* Hold transfered to fidp->scp and no longer needed */ --- 7027,7050 ---- lock_ReleaseMutex(&scp->mx); if (code) { + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); if (dscp) cm_ReleaseSCache(dscp); ! cm_ReleaseUser(userp); ! /* Shouldn't this be smb_CloseFID()? fidp->flags = SMB_FID_DELETE; */ smb_CloseFID(vcp, fidp, NULL, 0); ! smb_ReleaseFID(fidp); free(realPathp); return code; } } + /* Now its safe to release the file server lock obtained by cm_CheckNTOpen() */ + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); + lock_ObtainMutex(&fidp->mx); /* save a pointer to the vnode */ fidp->scp = scp; /* Hold transfered to fidp->scp and no longer needed */ *************** *** 6717,6722 **** --- 7168,7174 ---- char *outData; cm_req_t req; int created = 0; + cm_lock_data_t *ldp = NULL; cm_InitReq(&req); *************** *** 6989,6996 **** * scp is NULL. */ if (code == 0) { ! code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, ! &req); if (code) { if (dscp) cm_ReleaseSCache(dscp); --- 7441,7447 ---- * scp is NULL. */ if (code == 0) { ! code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, &req, &ldp); if (code) { if (dscp) cm_ReleaseSCache(dscp); *************** *** 7002,7007 **** --- 7453,7459 ---- if (createDisp == FILE_CREATE) { /* oops, file shouldn't be there */ + cm_CheckNTOpenDone(scp, userp, &req, &ldp); if (dscp) cm_ReleaseSCache(dscp); cm_ReleaseSCache(scp); *************** *** 7028,7035 **** --- 7480,7498 ---- */ osi_Log2(smb_logp, "symlink vp %x to vp %x", scp, targetScp); + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); scp = targetScp; + code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, &req, &ldp); + if (code) { + if (dscp) + cm_ReleaseSCache(dscp); + if (scp) + cm_ReleaseSCache(scp); + cm_ReleaseUser(userp); + free(realPathp); + return code; + } } } code = cm_SetAttr(scp, &setAttr, userp, &req); *************** *** 7124,7130 **** if (code) { /* something went wrong creating or truncating the file */ ! if (scp) cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); --- 7587,7595 ---- if (code) { /* something went wrong creating or truncating the file */ ! if (ldp) ! cm_CheckNTOpenDone(scp, userp, &req, &ldp); ! if (scp) cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); *************** *** 7145,7156 **** --- 7610,7625 ---- */ osi_Log2(smb_logp, "symlink vp %x to vp %x", scp, targetScp); + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); scp = targetScp; } } if (scp->fileType != CM_SCACHETYPE_FILE) { + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); *************** *** 7159,7164 **** --- 7628,7635 ---- } if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) { + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); *************** *** 7199,7214 **** lock_ReleaseMutex(&scp->mx); if (code) { cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! /* Shouldn't this be smb_CloseFID()? fidp->flags = SMB_FID_DELETE; */ smb_CloseFID(vcp, fidp, NULL, 0); ! smb_ReleaseFID(fidp); ! free(realPathp); return CM_ERROR_SHARING_VIOLATION; } } lock_ObtainMutex(&fidp->mx); /* save a pointer to the vnode */ fidp->scp = scp; --- 7670,7691 ---- lock_ReleaseMutex(&scp->mx); if (code) { + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! /* Shouldn't this be smb_CloseFID()? fidp->flags = SMB_FID_DELETE; */ smb_CloseFID(vcp, fidp, NULL, 0); ! smb_ReleaseFID(fidp); ! free(realPathp); return CM_ERROR_SHARING_VIOLATION; } } + /* Now its safe to drop the file server lock obtained by cm_CheckNTOpen() */ + if (ldp) + cm_CheckNTOpenDone(scp, userp, &req, &ldp); + lock_ObtainMutex(&fidp->mx); /* save a pointer to the vnode */ fidp->scp = scp; *************** *** 7363,7376 **** smb_packet_t *outp) { smb_packet_t *savedPacketp; ! ULONG filter; USHORT fid, watchtree; smb_fid_t *fidp; cm_scache_t *scp; filter = smb_GetSMBParm(inp, 19) | (smb_GetSMBParm(inp, 20) << 16); fid = smb_GetSMBParm(inp, 21); ! watchtree = smb_GetSMBParm(inp, 22) && 0xffff; /* TODO: should this be 0xff ? */ fidp = smb_FindFID(vcp, fid, 0); if (!fidp) { --- 7840,7854 ---- smb_packet_t *outp) { smb_packet_t *savedPacketp; ! ULONG filter; ! USHORT fid, watchtree; smb_fid_t *fidp; cm_scache_t *scp; filter = smb_GetSMBParm(inp, 19) | (smb_GetSMBParm(inp, 20) << 16); fid = smb_GetSMBParm(inp, 21); ! watchtree = (smb_GetSMBParm(inp, 22) & 0xff) ? 1 : 0; fidp = smb_FindFID(vcp, fid, 0); if (!fidp) { *************** *** 7378,7398 **** return CM_ERROR_BADFD; } savedPacketp = smb_CopyPacket(inp); smb_HoldVC(vcp); if (savedPacketp->vcp) smb_ReleaseVC(savedPacketp->vcp); savedPacketp->vcp = vcp; lock_ObtainMutex(&smb_Dir_Watch_Lock); savedPacketp->nextp = smb_Directory_Watches; smb_Directory_Watches = savedPacketp; lock_ReleaseMutex(&smb_Dir_Watch_Lock); - osi_Log4(smb_logp, "Request for NotifyChange filter 0x%x fid %d wtree %d file %s", - filter, fid, watchtree, osi_LogSaveString(smb_logp, fidp->NTopen_wholepathp)); - scp = fidp->scp; ! osi_Log2(afsd_logp,"smb_ReceiveNTTranNotifyChange fidp 0x%p scp 0x%p", fidp, scp); lock_ObtainMutex(&scp->mx); if (watchtree) scp->flags |= CM_SCACHEFLAG_WATCHEDSUBTREE; --- 7856,7906 ---- return CM_ERROR_BADFD; } + /* Create a copy of the Directory Watch Packet to use when sending the + * notification if in the future a matching change is detected. + */ savedPacketp = smb_CopyPacket(inp); smb_HoldVC(vcp); if (savedPacketp->vcp) smb_ReleaseVC(savedPacketp->vcp); savedPacketp->vcp = vcp; + + /* Add the watch to the list of events to send notifications for */ lock_ObtainMutex(&smb_Dir_Watch_Lock); savedPacketp->nextp = smb_Directory_Watches; smb_Directory_Watches = savedPacketp; lock_ReleaseMutex(&smb_Dir_Watch_Lock); scp = fidp->scp; ! osi_Log3(afsd_logp,"smb_ReceiveNTTranNotifyChange fidp 0x%p scp 0x%p file \"%s\"", ! fidp, scp, osi_LogSaveString(smb_logp, fidp->NTopen_wholepathp)); ! osi_Log3(smb_logp, "Request for NotifyChange filter 0x%x fid %d wtree %d", ! filter, fid, watchtree); ! if (filter & FILE_NOTIFY_CHANGE_FILE_NAME) ! osi_Log0(smb_logp, " Notify Change File Name"); ! if (filter & FILE_NOTIFY_CHANGE_DIR_NAME) ! osi_Log0(smb_logp, " Notify Change Directory Name"); ! if (filter & FILE_NOTIFY_CHANGE_ATTRIBUTES) ! osi_Log0(smb_logp, " Notify Change Attributes"); ! if (filter & FILE_NOTIFY_CHANGE_SIZE) ! osi_Log0(smb_logp, " Notify Change Size"); ! if (filter & FILE_NOTIFY_CHANGE_LAST_WRITE) ! osi_Log0(smb_logp, " Notify Change Last Write"); ! if (filter & FILE_NOTIFY_CHANGE_LAST_ACCESS) ! osi_Log0(smb_logp, " Notify Change Last Access"); ! if (filter & FILE_NOTIFY_CHANGE_CREATION) ! osi_Log0(smb_logp, " Notify Change Creation"); ! if (filter & FILE_NOTIFY_CHANGE_EA) ! osi_Log0(smb_logp, " Notify Change Extended Attributes"); ! if (filter & FILE_NOTIFY_CHANGE_SECURITY) ! osi_Log0(smb_logp, " Notify Change Security"); ! if (filter & FILE_NOTIFY_CHANGE_STREAM_NAME) ! osi_Log0(smb_logp, " Notify Change Stream Name"); ! if (filter & FILE_NOTIFY_CHANGE_STREAM_SIZE) ! osi_Log0(smb_logp, " Notify Change Stream Size"); ! if (filter & FILE_NOTIFY_CHANGE_STREAM_WRITE) ! osi_Log0(smb_logp, " Notify Change Stream Write"); ! lock_ObtainMutex(&scp->mx); if (watchtree) scp->flags |= CM_SCACHEFLAG_WATCHEDSUBTREE; *************** *** 7526,7531 **** --- 8034,8042 ---- * * If we don't know the file name (i.e. a callback break), filename is * NULL, and we return a zero-length list. + * + * At present there is not a single call to smb_NotifyChange that + * has the isDirectParent parameter set to FALSE. */ void smb_NotifyChange(DWORD action, DWORD notifyFilter, cm_scache_t *dscp, char *filename, char *otherFilename, *************** *** 7548,7555 **** otherAction = FILE_ACTION_RENAMED_NEW_NAME; } ! osi_Log2(smb_logp,"in smb_NotifyChange for file [%s] dscp [%x]", ! osi_LogSaveString(smb_logp,filename),dscp); lock_ObtainMutex(&smb_Dir_Watch_Lock); watch = smb_Directory_Watches; --- 8059,8078 ---- otherAction = FILE_ACTION_RENAMED_NEW_NAME; } ! osi_Log4(smb_logp,"in smb_NotifyChange for file [%s] dscp [%p] notification 0x%x parent %d", ! osi_LogSaveString(smb_logp,filename),dscp, notifyFilter, isDirectParent); ! if (action == 0) ! osi_Log0(smb_logp," FILE_ACTION_NONE"); ! if (action == FILE_ACTION_ADDED) ! osi_Log0(smb_logp," FILE_ACTION_ADDED"); ! if (action == FILE_ACTION_REMOVED) ! osi_Log0(smb_logp," FILE_ACTION_REMOVED"); ! if (action == FILE_ACTION_MODIFIED) ! osi_Log0(smb_logp," FILE_ACTION_MODIFIED"); ! if (action == FILE_ACTION_RENAMED_OLD_NAME) ! osi_Log0(smb_logp," FILE_ACTION_RENAMED_OLD_NAME"); ! if (action == FILE_ACTION_RENAMED_NEW_NAME) ! osi_Log0(smb_logp," FILE_ACTION_RENAMED_NEW_NAME"); lock_ObtainMutex(&smb_Dir_Watch_Lock); watch = smb_Directory_Watches; *************** *** 7557,7576 **** filter = smb_GetSMBParm(watch, 19) | (smb_GetSMBParm(watch, 20) << 16); fid = smb_GetSMBParm(watch, 21); ! wtree = smb_GetSMBParm(watch, 22) & 0xffff; /* TODO: should this be 0xff ? */ maxLen = smb_GetSMBOffsetParm(watch, 5, 1) | (smb_GetSMBOffsetParm(watch, 6, 1) << 16); /* ! * Strange hack - bug in NT Client and NT Server that we ! * must emulate? */ ! if (filter == 3 && wtree) ! filter = 0x17; fidp = smb_FindFID(watch->vcp, fid, 0); if (!fidp) { ! osi_Log1(smb_logp," no fidp for fid[%d]",fid); lastWatch = watch; watch = watch->nextp; continue; --- 8080,8099 ---- filter = smb_GetSMBParm(watch, 19) | (smb_GetSMBParm(watch, 20) << 16); fid = smb_GetSMBParm(watch, 21); ! wtree = (smb_GetSMBParm(watch, 22) & 0xff) ? 1 : 0; ! maxLen = smb_GetSMBOffsetParm(watch, 5, 1) | (smb_GetSMBOffsetParm(watch, 6, 1) << 16); /* ! * Strange hack - bug in NT Client and NT Server that we must emulate? */ ! if ((filter == (FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME)) && wtree) ! filter |= FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_ATTRIBUTES; fidp = smb_FindFID(watch->vcp, fid, 0); if (!fidp) { ! osi_Log2(smb_logp," no fidp for fid[%d] in vcp 0x%p",fid, watch->vcp); lastWatch = watch; watch = watch->nextp; continue; *************** *** 7578,7584 **** if (fidp->scp != dscp || (filter & notifyFilter) == 0 || (!isDirectParent && !wtree)) { ! osi_Log1(smb_logp," passing fidp->scp[%x]", fidp->scp); smb_ReleaseFID(fidp); lastWatch = watch; watch = watch->nextp; --- 8101,8107 ---- if (fidp->scp != dscp || (filter & notifyFilter) == 0 || (!isDirectParent && !wtree)) { ! osi_Log1(smb_logp," skipping fidp->scp[%x]", fidp->scp); smb_ReleaseFID(fidp); lastWatch = watch; watch = watch->nextp; *************** *** 7589,7595 **** osi_Log4(smb_logp, "Sending Change Notification for fid %d filter 0x%x wtree %d file %s", fid, filter, wtree, osi_LogSaveString(smb_logp, filename)); ! nextWatch = watch->nextp; if (watch == smb_Directory_Watches) smb_Directory_Watches = nextWatch; --- 8112,8143 ---- osi_Log4(smb_logp, "Sending Change Notification for fid %d filter 0x%x wtree %d file %s", fid, filter, wtree, osi_LogSaveString(smb_logp, filename)); ! if (filter & FILE_NOTIFY_CHANGE_FILE_NAME) ! osi_Log0(smb_logp, " Notify Change File Name"); ! if (filter & FILE_NOTIFY_CHANGE_DIR_NAME) ! osi_Log0(smb_logp, " Notify Change Directory Name"); ! if (filter & FILE_NOTIFY_CHANGE_ATTRIBUTES) ! osi_Log0(smb_logp, " Notify Change Attributes"); ! if (filter & FILE_NOTIFY_CHANGE_SIZE) ! osi_Log0(smb_logp, " Notify Change Size"); ! if (filter & FILE_NOTIFY_CHANGE_LAST_WRITE) ! osi_Log0(smb_logp, " Notify Change Last Write"); ! if (filter & FILE_NOTIFY_CHANGE_LAST_ACCESS) ! osi_Log0(smb_logp, " Notify Change Last Access"); ! if (filter & FILE_NOTIFY_CHANGE_CREATION) ! osi_Log0(smb_logp, " Notify Change Creation"); ! if (filter & FILE_NOTIFY_CHANGE_EA) ! osi_Log0(smb_logp, " Notify Change Extended Attributes"); ! if (filter & FILE_NOTIFY_CHANGE_SECURITY) ! osi_Log0(smb_logp, " Notify Change Security"); ! if (filter & FILE_NOTIFY_CHANGE_STREAM_NAME) ! osi_Log0(smb_logp, " Notify Change Stream Name"); ! if (filter & FILE_NOTIFY_CHANGE_STREAM_SIZE) ! osi_Log0(smb_logp, " Notify Change Stream Size"); ! if (filter & FILE_NOTIFY_CHANGE_STREAM_WRITE) ! osi_Log0(smb_logp, " Notify Change Stream Write"); ! ! /* A watch can only be notified once. Remove it from the list */ nextWatch = watch->nextp; if (watch == smb_Directory_Watches) smb_Directory_Watches = nextWatch; Index: openafs/src/WINNT/afsd/smb3.h diff -c openafs/src/WINNT/afsd/smb3.h:1.12.2.4 openafs/src/WINNT/afsd/smb3.h:1.12.2.5 *** openafs/src/WINNT/afsd/smb3.h:1.12.2.4 Fri Aug 25 13:08:23 2006 --- openafs/src/WINNT/afsd/smb3.h Mon Dec 11 23:01:26 2006 *************** *** 339,342 **** --- 339,347 ---- #define FILE_GENERIC_EXECUTE (0x001200a0) #endif /* DJGPP */ + /* Some of the FILE_NOTIFY_CHANGE values are undefined in winnt.h */ + #define FILE_NOTIFY_CHANGE_EA 0x00000080 + #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 + #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 + #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 #endif /* __SMB3_H_ENV__ */ Index: openafs/src/WINNT/afsd/smb_ioctl.h diff -c openafs/src/WINNT/afsd/smb_ioctl.h:1.4.14.1 openafs/src/WINNT/afsd/smb_ioctl.h:1.4.14.2 *** openafs/src/WINNT/afsd/smb_ioctl.h:1.4.14.1 Sat Jun 24 16:41:55 2006 --- openafs/src/WINNT/afsd/smb_ioctl.h Mon Dec 11 23:01:26 2006 *************** *** 15,21 **** #define SMB_IOCTL_FILENAME_NOSLASH "_._AFS_IOCTL_._" /* max parms for ioctl, in either direction */ ! #define SMB_IOCTL_MAXDATA 8192 #define SMB_IOCTL_MAXPROCS 64 /* max # of calls */ --- 15,21 ---- #define SMB_IOCTL_FILENAME_NOSLASH "_._AFS_IOCTL_._" /* max parms for ioctl, in either direction */ ! #define SMB_IOCTL_MAXDATA 8192*2 #define SMB_IOCTL_MAXPROCS 64 /* max # of calls */ Index: openafs/src/WINNT/afssvrcfg/admin_info_dlg.cpp diff -c openafs/src/WINNT/afssvrcfg/admin_info_dlg.cpp:1.2 openafs/src/WINNT/afssvrcfg/admin_info_dlg.cpp:1.2.32.1 *** openafs/src/WINNT/afssvrcfg/admin_info_dlg.cpp:1.2 Sat Nov 4 05:01:49 2000 --- openafs/src/WINNT/afssvrcfg/admin_info_dlg.cpp Tue Dec 26 15:22:28 2006 *************** *** 48,58 **** */ BOOL GetAdminInfo(HWND hParent, GET_ADMIN_INFO_OPTIONS options) { ! eOptions = options; ! int nResult = ModalDialog(IDD_ADMIN_INFO, hParent, (DLGPROC)AdminInfoDlgProc); ! return (nResult == IDOK); } --- 48,58 ---- */ BOOL GetAdminInfo(HWND hParent, GET_ADMIN_INFO_OPTIONS options) { ! eOptions = options; ! int nResult = ModalDialog(IDD_ADMIN_INFO, hParent, (DLGPROC)AdminInfoDlgProc); ! return (nResult == IDOK); } *************** *** 61,96 **** * */ BOOL CALLBACK AdminInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp) ! { ! if (AfsAppLib_HandleHelp(IDD_ADMIN_INFO, hwndDlg, msg, wp, lp)) ! return TRUE; ! ! switch (msg) { ! case WM_INITDIALOG: ! OnInitDialog(hwndDlg); ! break; ! ! case WM_COMMAND: ! switch (LOWORD(wp)) { ! case IDC_ADMIN_NAME: ! case IDC_ADMIN_PW: ! case IDC_HOSTNAME: ! case IDC_SCS: ! if (HIWORD(wp) == EN_CHANGE) ! CheckEnableButtons(); ! break; ! ! case IDCANCEL: ! EndDialog(hDlg, IDCANCEL); ! break; ! ! ! case IDOK: ! SaveDlgInfo(); ! EndDialog(hDlg, IDOK); ! break; ! } ! break; } return FALSE; --- 61,95 ---- * */ BOOL CALLBACK AdminInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp) ! { ! if (AfsAppLib_HandleHelp(IDD_ADMIN_INFO, hwndDlg, msg, wp, lp)) ! return TRUE; ! ! switch (msg) { ! case WM_INITDIALOG: ! OnInitDialog(hwndDlg); ! break; ! ! case WM_COMMAND: ! switch (LOWORD(wp)) { ! case IDC_ADMIN_NAME: ! case IDC_ADMIN_PW: ! case IDC_HOSTNAME: ! case IDC_SCS: ! if (HIWORD(wp) == EN_CHANGE) ! CheckEnableButtons(); ! break; ! ! case IDCANCEL: ! EndDialog(hDlg, IDCANCEL); ! break; ! ! case IDOK: ! SaveDlgInfo(); ! EndDialog(hDlg, IDOK); ! break; ! } ! break; } return FALSE; *************** *** 110,123 **** { static int nOffset = 0; ! hDlg = hwndDlg; ! // Hide the additional server stuff if we don't need it ! if (eOptions == GAIO_LOGIN_ONLY) { ! HideAndDisable(hDlg, IDC_HOSTNAME_FRAME); ! HideAndDisable(hDlg, IDC_HOSTNAME_PROMPT); ! HideAndDisable(hDlg, IDC_HOSTNAME_LABEL); ! HideAndDisable(hDlg, IDC_HOSTNAME); if (nOffset == 0) { // Get dimensions of the frame containing the things we will hide or show --- 109,122 ---- { static int nOffset = 0; ! hDlg = hwndDlg; ! // Hide the additional server stuff if we don't need it ! if (eOptions == GAIO_LOGIN_ONLY) { ! HideAndDisable(hDlg, IDC_HOSTNAME_FRAME); ! HideAndDisable(hDlg, IDC_HOSTNAME_PROMPT); ! HideAndDisable(hDlg, IDC_HOSTNAME_LABEL); ! HideAndDisable(hDlg, IDC_HOSTNAME); if (nOffset == 0) { // Get dimensions of the frame containing the things we will hide or show *************** *** 134,151 **** } // Move the buttons ! MoveWnd(hDlg, IDOK, 0, -nOffset); ! MoveWnd(hDlg, IDCANCEL, 0, -nOffset); ! MoveWnd(hDlg, IDHELP, 0, -nOffset); // Resize the dialog RECT rectDlg; GetWindowRect(hDlg, &rectDlg); ! MoveWindow(hDlg, rectDlg.left, rectDlg.top, rectDlg.right - rectDlg.left + 1, rectDlg.bottom - rectDlg.top - nOffset, TRUE); ! ! } ! ShowPageInfo(); } /* --- 133,149 ---- } // Move the buttons ! MoveWnd(hDlg, IDOK, 0, -nOffset); ! MoveWnd(hDlg, IDCANCEL, 0, -nOffset); ! MoveWnd(hDlg, IDHELP, 0, -nOffset); // Resize the dialog RECT rectDlg; GetWindowRect(hDlg, &rectDlg); ! MoveWindow(hDlg, rectDlg.left, rectDlg.top, rectDlg.right - rectDlg.left + 1, rectDlg.bottom - rectDlg.top - nOffset, TRUE); ! } ! ShowPageInfo(); } /* *************** *** 154,186 **** */ static void CheckEnableButtons() { ! BOOL bDisable = FALSE; ! TCHAR szDummy[cchRESOURCE]; ! bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_NAME, szDummy)) == 0; ! bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_PW, szDummy)) == 0; ! SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable); } static void SaveDlgInfo() { ! TCHAR szText[cchRESOURCE]; ! lstrncpy(g_CfgData.szAdminName, GetWndText(hDlg, IDC_ADMIN_NAME, szText), MAX_ADMIN_NAME_LEN); ! lstrncpy(g_CfgData.szAdminPW, GetWndText(hDlg, IDC_ADMIN_PW, szText), MAX_ADMIN_PW_LEN); ! if (eOptions == GAIO_GET_SCS) ! lstrncpy(g_CfgData.szSysControlMachine, GetWndText(hDlg, IDC_HOSTNAME, szText), MAX_MACHINE_NAME_LEN); } static void ShowPageInfo() { ! SetWndText(hDlg, IDC_ADMIN_NAME, g_CfgData.szAdminName); ! SetWndText(hDlg, IDC_ADMIN_PW, g_CfgData.szAdminPW); ! if (eOptions == GAIO_GET_SCS) ! SetWndText(hDlg, IDC_HOSTNAME, g_CfgData.szSysControlMachine); } --- 152,184 ---- */ static void CheckEnableButtons() { ! BOOL bDisable = FALSE; ! TCHAR szDummy[cchRESOURCE]; ! bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_NAME, szDummy)) == 0; ! bDisable |= lstrlen(GetWndText(hDlg, IDC_ADMIN_PW, szDummy)) == 0; ! SetEnable(hDlg, IDOK, (ENABLE_STATE)!bDisable); } static void SaveDlgInfo() { ! TCHAR szText[cchRESOURCE]; ! lstrncpy(g_CfgData.szAdminName, GetWndText(hDlg, IDC_ADMIN_NAME, szText), MAX_ADMIN_NAME_LEN); ! lstrncpy(g_CfgData.szAdminPW, GetWndText(hDlg, IDC_ADMIN_PW, szText), MAX_ADMIN_PW_LEN); ! if (eOptions == GAIO_GET_SCS) ! lstrncpy(g_CfgData.szSysControlMachine, GetWndText(hDlg, IDC_HOSTNAME, szText), MAX_MACHINE_NAME_LEN); } static void ShowPageInfo() { ! SetWndText(hDlg, IDC_ADMIN_NAME, g_CfgData.szAdminName); ! SetWndText(hDlg, IDC_ADMIN_PW, g_CfgData.szAdminPW); ! if (eOptions == GAIO_GET_SCS) ! SetWndText(hDlg, IDC_HOSTNAME, g_CfgData.szSysControlMachine); } Index: openafs/src/WINNT/afssvrcfg/afscfg.cpp diff -c openafs/src/WINNT/afssvrcfg/afscfg.cpp:1.5 openafs/src/WINNT/afssvrcfg/afscfg.cpp:1.5.14.1 *** openafs/src/WINNT/afssvrcfg/afscfg.cpp:1.5 Fri Apr 2 01:56:24 2004 --- openafs/src/WINNT/afssvrcfg/afscfg.cpp Tue Dec 26 15:22:28 2006 *************** *** 63,80 **** static WIZARD_STATE g_aStates[] = { ! { sidSTEP_ONE, IDD_INTRO_PAGE, (DLGPROC)IntroPageDlgProc, 0 }, ! { sidSTEP_TWO, IDD_INFO_PAGE, (DLGPROC)InfoPageDlgProc, 0 }, { sidSTEP_THREE, IDD_INFO_PAGE2_FIRST_SERVER, (DLGPROC)InfoPage2DlgProc, 0 }, ! { sidSTEP_FOUR, IDD_INFO_PAGE2_NOT_FIRST_SERVER,(DLGPROC)InfoPage2DlgProc, 0 }, ! { sidSTEP_FIVE, IDD_FILE_SERVER_PAGE, (DLGPROC)FileServerPageDlgProc, 0 }, ! { sidSTEP_SIX, IDD_DB_SERVER_PAGE, (DLGPROC)DBServerPageDlgProc, 0 }, ! { sidSTEP_SEVEN, IDD_BACKUP_SERVER_PAGE, (DLGPROC)BackupPageDlgProc, 0 }, ! { sidSTEP_EIGHT, IDD_PARTITION_PAGE, (DLGPROC)PartitionPageDlgProc, 0 }, ! { sidSTEP_NINE, IDD_ROOT_VOLUMES_PAGE, (DLGPROC)RootAfsPageDlgProc, 0 }, ! { sidSTEP_TEN, IDD_REPLICATION_PAGE, (DLGPROC)ReplicationPageDlgProc, 0 }, ! { sidSTEP_ELEVEN, IDD_SYS_CONTROL_PAGE, (DLGPROC)SysControlPageDlgProc, 0 }, ! { sidSTEP_TWELVE, IDD_CONFIG_SERVER_PAGE, (DLGPROC)ConfigServerPageDlgProc, 0 } }; size_t g_nNumStates = sizeof(g_aStates) / sizeof(g_aStates[0]); --- 63,80 ---- static WIZARD_STATE g_aStates[] = { ! { sidSTEP_ONE, IDD_INTRO_PAGE, (DLGPROC)IntroPageDlgProc, 0 }, ! { sidSTEP_TWO, IDD_INFO_PAGE, (DLGPROC)InfoPageDlgProc, 0 }, { sidSTEP_THREE, IDD_INFO_PAGE2_FIRST_SERVER, (DLGPROC)InfoPage2DlgProc, 0 }, ! { sidSTEP_FOUR, IDD_INFO_PAGE2_NOT_FIRST_SERVER,(DLGPROC)InfoPage2DlgProc, 0 }, ! { sidSTEP_FIVE, IDD_FILE_SERVER_PAGE, (DLGPROC)FileServerPageDlgProc, 0 }, ! { sidSTEP_SIX, IDD_DB_SERVER_PAGE, (DLGPROC)DBServerPageDlgProc, 0 }, ! { sidSTEP_SEVEN, IDD_BACKUP_SERVER_PAGE, (DLGPROC)BackupPageDlgProc, 0 }, ! { sidSTEP_EIGHT, IDD_PARTITION_PAGE, (DLGPROC)PartitionPageDlgProc, 0 }, ! { sidSTEP_NINE, IDD_ROOT_VOLUMES_PAGE, (DLGPROC)RootAfsPageDlgProc, 0 }, ! { sidSTEP_TEN, IDD_REPLICATION_PAGE, (DLGPROC)ReplicationPageDlgProc, 0 }, ! { sidSTEP_ELEVEN, IDD_SYS_CONTROL_PAGE, (DLGPROC)SysControlPageDlgProc, 0 }, ! { sidSTEP_TWELVE, IDD_CONFIG_SERVER_PAGE, (DLGPROC)ConfigServerPageDlgProc, 0 } }; size_t g_nNumStates = sizeof(g_aStates) / sizeof(g_aStates[0]); *************** *** 124,198 **** */ extern "C" int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR pszCmdLineA, int nCmdShow) { ! afs_status_t nStatus; ! ! TaLocale_LoadCorrespondingModule (hInst); ! // Tell the applib our application's name ! TCHAR szAppName[cchRESOURCE]; ! AfsAppLib_SetAppName(GetResString(GetAppTitleID(), szAppName)); ! // Open the admin libraries ! int nResult = afsclient_Init(&nStatus); ! if (!nResult) { ! ShowError(0, nStatus, IDS_CANT_INIT_ADMIN_LIBS); ! return 0; ! } ! // Open the log file ! char szLogPath[MAX_PATH]; ! sprintf(szLogPath, "%s\\%s", AFSDIR_SERVER_LOGS_DIRPATH, LOG_FILE_NAME); ! if (!g_LogFile.Open(szLogPath)) ! ShowError(0, 0, IDS_CANT_OPEN_LOG_FILE); ! // Register the help file with the applib's help system ! AfsAppLib_RegisterHelpFile(TEXT("TaAfsCfg.hlp")); /* Start up sockets */ WSADATA WSAjunk; WSAStartup(0x0101, &WSAjunk); ! memset(&g_CfgData, 0, sizeof(CFG_DATA)); ! // Get this machine's local name ! char szLocalName[sizeof(g_CfgData.szLocalName) / sizeof(TCHAR)]; if (gethostname(szLocalName, sizeof(szLocalName)) != 0) { ! ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_LOCAL_HOST_NAME); ! return 0; ! } CopyAnsiToString(g_CfgData.szLocalName, szLocalName); ! // Turn the local name into a host name struct hostent *pHostEnt = gethostbyname(szLocalName); if (!pHostEnt) { ! ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_HOST_NAME); ! return 0; ! } CopyAnsiToString(g_CfgData.szHostname, pHostEnt->h_name, sizeof(g_CfgData.szHostname)); ! RegisterFastListClass(); ! // Get current config status ! BOOL bCanceled = FALSE; ! DWORD dwStatus = GetCurrentConfig(NULL, bCanceled); ! if (dwStatus || bCanceled) { ! if (!bCanceled) ! ShowError(GetFocus(), dwStatus, IDS_CONFIG_CHECK_FAILED); ! return 0; ! } ! // Run the appropriate interface ! if ((strstr(_strlwr(pszCmdLineA), "wizard") != 0)) ! RunWizard(); ! else ! RunCfgTool(); ! FreePartitionTable(); ! // Disconnect from the config and admin libraries ! CloseLibHandles(TRUE); ! return 0; } /* --- 124,198 ---- */ extern "C" int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR pszCmdLineA, int nCmdShow) { ! afs_status_t nStatus; ! TaLocale_LoadCorrespondingModule (hInst); ! // Tell the applib our application's name ! TCHAR szAppName[cchRESOURCE]; ! AfsAppLib_SetAppName(GetResString(GetAppTitleID(), szAppName)); ! ! // Open the admin libraries ! int nResult = afsclient_Init(&nStatus); ! if (!nResult) { ! ShowError(0, nStatus, IDS_CANT_INIT_ADMIN_LIBS); ! return 0; ! } ! // Open the log file ! char szLogPath[MAX_PATH]; ! sprintf(szLogPath, "%s\\%s", AFSDIR_SERVER_LOGS_DIRPATH, LOG_FILE_NAME); ! if (!g_LogFile.Open(szLogPath)) ! ShowError(0, 0, IDS_CANT_OPEN_LOG_FILE); ! // Register the help file with the applib's help system ! AfsAppLib_RegisterHelpFile(TEXT("TaAfsCfg.hlp")); /* Start up sockets */ WSADATA WSAjunk; WSAStartup(0x0101, &WSAjunk); ! memset(&g_CfgData, 0, sizeof(CFG_DATA)); ! // Get this machine's local name ! char szLocalName[sizeof(g_CfgData.szLocalName) / sizeof(TCHAR)]; if (gethostname(szLocalName, sizeof(szLocalName)) != 0) { ! ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_LOCAL_HOST_NAME); ! return 0; ! } CopyAnsiToString(g_CfgData.szLocalName, szLocalName); ! // Turn the local name into a host name struct hostent *pHostEnt = gethostbyname(szLocalName); if (!pHostEnt) { ! ShowError(GetFocus(), WSAGetLastError(), IDS_ERROR_HOST_NAME); ! return 0; ! } CopyAnsiToString(g_CfgData.szHostname, pHostEnt->h_name, sizeof(g_CfgData.szHostname)); ! RegisterFastListClass(); ! // Get current config status ! BOOL bCanceled = FALSE; ! DWORD dwStatus = GetCurrentConfig(NULL, bCanceled); ! if (dwStatus || bCanceled) { ! if (!bCanceled) ! ShowError(GetFocus(), dwStatus, IDS_CONFIG_CHECK_FAILED); ! return 0; ! } ! // Run the appropriate interface ! if ((strstr(_strlwr(pszCmdLineA), "wizard") != 0)) ! RunWizard(); ! else ! RunCfgTool(); ! FreePartitionTable(); ! // Disconnect from the config and admin libraries ! CloseLibHandles(TRUE); ! return 0; } /* *************** *** 202,241 **** */ BOOL CALLBACK WizStep_Common_DlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp) { ! // Get the dialog's resource ID ! int nIDD = GetWindowLong(hRHS, GWL_ID); ! if (AfsAppLib_HandleHelp(nIDD, hRHS, msg, wp, lp)) ! return TRUE; ! switch (msg) { ! case WM_INITDIALOG: MakeBold(hRHS, IDC_TITLE); ! RedrawGraphic(); ! break; ! ! case WM_COMMAND: ! switch (LOWORD(wp)) { ! case IDCANCEL: ! QueryCancelWiz(); ! return TRUE; ! } ! break; } ! return FALSE; } BOOL QueryCancelWiz() { ! int nChoice = Message(MB_YESNO, IDS_WIZARD_APP_TITLE, IDS_CANCEL_DESC); ! if (nChoice == IDYES) { ! g_LogFile.Write("User has chosen to cancel the program.\r\n"); ! if (g_pWiz) ! g_pWiz->Show(FALSE); ! return TRUE; ! } ! return FALSE; } --- 202,241 ---- */ BOOL CALLBACK WizStep_Common_DlgProc(HWND hRHS, UINT msg, WPARAM wp, LPARAM lp) { ! // Get the dialog's resource ID ! int nIDD = GetWindowLong(hRHS, GWL_ID); ! if (AfsAppLib_HandleHelp(nIDD, hRHS, msg, wp, lp)) ! return TRUE; ! switch (msg) { ! case WM_INITDIALOG: MakeBold(hRHS, IDC_TITLE); ! RedrawGraphic(); ! break; ! ! case WM_COMMAND: ! switch (LOWORD(wp)) { ! case IDCANCEL: ! QueryCancelWiz(); ! return TRUE; } + break; + } ! return FALSE; } BOOL QueryCancelWiz() { ! int nChoice = Message(MB_YESNO, IDS_WIZARD_APP_TITLE, IDS_CANCEL_DESC); ! if (nChoice == IDYES) { ! g_LogFile.Write("User has chosen to cancel the program.\r\n"); ! if (g_pWiz) ! g_pWiz->Show(FALSE); ! return TRUE; ! } ! return FALSE; } *************** *** 262,269 **** { static TCHAR szValue[MAX_MACHINE_NAME_LEN + 1] = ""; ! if ( szValue[0] == 0 ) ! CopyAnsiToString(GetClientNetbiosNameA(), szValue); return szValue; } --- 262,269 ---- { static TCHAR szValue[MAX_MACHINE_NAME_LEN + 1] = ""; ! if ( szValue[0] == 0 ) ! CopyAnsiToString(GetClientNetbiosNameA(), szValue); return szValue; } *************** *** 383,392 **** { static char szValueA[MAX_MACHINE_NAME_LEN + 1]=""; ! if ( szValueA[0] == 0 ) lana_GetNetbiosName(szValueA, LANA_NETBIOS_NAME_FULL); ! return szValueA; } char *GetSalvageLogFileNameA() --- 383,392 ---- { static char szValueA[MAX_MACHINE_NAME_LEN + 1]=""; ! if ( szValueA[0] == 0 ) lana_GetNetbiosName(szValueA, LANA_NETBIOS_NAME_FULL); ! return szValueA; } char *GetSalvageLogFileNameA() *************** *** 401,433 **** BOOL GetLibHandles(afs_status_t *pStatus) { ! ASSERT(g_CfgData.szHostname[0]); ! int nResult; ! // ************************* NOTE ******************************** ! // * You MUST have already determined whether or not the host ! // * and client config info is valid before calling this function. ! // *************************************************************** ! ! // This function can be called at any time to get handles to the cell and ! // the config library. It will try to get the most powerful handle to the ! // cell that it can, and then use that to open the config library. If the ! // libraries are already open, it will close them first. Two handles to ! // the config library will be opened, one to the server to be configured, ! // and one to the client machine we are configuring from. ! ! // There are two types of cell handles, NULL and Standard. A null handle ! // can make calls to any server except DB servers. We need this primarily ! // to talk to the bos server to determine the machine's current configuration, ! // and to configure the client information if it is not already. A standard ! // handle can talk to any server. Standard handles can be either authenticated ! // or unauthenticated. ! // Close all current handles ! CloseLibHandles(); ! g_LogFile.Write("Getting handles to the cell and the config library.\r\n"); if (!hClientCell) { // Start by getting a null cell handle and using it to open the client --- 401,433 ---- BOOL GetLibHandles(afs_status_t *pStatus) { ! ASSERT(g_CfgData.szHostname[0]); ! int nResult; ! // ************************* NOTE ******************************** ! // * You MUST have already determined whether or not the host ! // * and client config info is valid before calling this function. ! // *************************************************************** ! ! // This function can be called at any time to get handles to the cell and ! // the config library. It will try to get the most powerful handle to the ! // cell that it can, and then use that to open the config library. If the ! // libraries are already open, it will close them first. Two handles to ! // the config library will be opened, one to the server to be configured, ! // and one to the client machine we are configuring from. ! ! // There are two types of cell handles, NULL and Standard. A null handle ! // can make calls to any server except DB servers. We need this primarily ! // to talk to the bos server to determine the machine's current configuration, ! // and to configure the client information if it is not already. A standard ! // handle can talk to any server. Standard handles can be either authenticated ! // or unauthenticated. ! // Close all current handles ! CloseLibHandles(); ! g_LogFile.Write("Getting handles to the cell and the config library.\r\n"); if (!hClientCell) { // Start by getting a null cell handle and using it to open the client *************** *** 448,510 **** } } ! // Now we need to get the most powerful cell handle that we can and use it ! // to open the config library for the server. ! // If the client info is valid and we know what cell the server should be in, ! // and the client has that cell in its CellServDB, then we can get a Standard cell ! // handle. However there is an exception: if this is the first server in the ! // cell then there may not yet be an authentication server to talk to. In that ! // case we use a null cell handle. if (g_CfgData.bValidClientInfo && // Client config is valid g_CfgData.szCellName[0] && // We have a cell name (!g_CfgData.bFirstServer || g_CfgData.bAuthServerRunning)) // Auth server is running { ! g_LogFile.Write("Opening a non-NULL cell handle to use with the server config library handle.\r\n"); // Do we have the user info necessary to authenticate? BOOL bHaveUserInfo = g_CfgData.szAdminName[0] && g_CfgData.szAdminPW[0]; ! // Open a standard cell handle. szAdminName and szAdminPW will either be NULL, or ! // if they have been entered by the user, will be the admin name and password strings. ! if ((!g_CfgData.bFirstServer || g_CfgData.bAdminPrincipalCreated) && bHaveUserInfo) { ! g_LogFile.Write("Getting tokens in cell %s for user '%s'.\r\n", GetCellNameA(), GetAdminNameA()); ! nResult = afsclient_TokenGetNew(GetCellNameA(), GetAdminNameA(), GetAdminPWA(), &g_hToken, pStatus); ! } else { ! g_LogFile.Write("Getting unauthenticated tokens for cell '%s'.\r\n", GetCellNameA()); ! nResult = afsclient_TokenGetNew(GetCellNameA(), "", "", &g_hToken, pStatus); ! } ! ! if (!nResult) { ! g_LogFile.Write("Failed to get tokens for the specified cell: %lx.\r\n", (unsigned long)*pStatus); ! return FALSE; ! } ! ! // If the admin name and password are NULL, then this will be an unauthenticated ! // connection to the cell. ! g_LogFile.Write("Getting cell handle for cell %s.\r\n", GetCellNameA()); ! nResult = afsclient_CellOpen(GetCellNameA(), g_hToken, &g_hCell, pStatus); ! if (!nResult) { ! g_LogFile.Write("Failed to open the cell: %lx.\r\n", (unsigned long)*pStatus); ! return FALSE; ! } } else { g_LogFile.Write("Opening a NULL cell handle to use with the server config library handle.\r\n"); nResult = afsclient_NullCellOpen(&g_hCell, pStatus); if (!nResult) { g_LogFile.Write("Failed to open a NULL cell handle: %lx.\r\n", (unsigned long)*pStatus); ! return FALSE; ! } ! } ! ! // Get the server handle ! g_LogFile.Write("Getting config library handle for the server.\r\n"); ! if (!cfg_HostOpen(g_hCell, GetHostnameA(), &g_hServer, pStatus)) { g_LogFile.Write("Failed to get config library handle for the server: %lx.\r\n", (unsigned long)*pStatus); ! return FALSE; ! } ! return TRUE; } BOOL GetHandles(HWND hParentDlg) --- 448,510 ---- } } ! // Now we need to get the most powerful cell handle that we can and use it ! // to open the config library for the server. ! // If the client info is valid and we know what cell the server should be in, ! // and the client has that cell in its CellServDB, then we can get a Standard cell ! // handle. However there is an exception: if this is the first server in the ! // cell then there may not yet be an authentication server to talk to. In that ! // case we use a null cell handle. if (g_CfgData.bValidClientInfo && // Client config is valid g_CfgData.szCellName[0] && // We have a cell name (!g_CfgData.bFirstServer || g_CfgData.bAuthServerRunning)) // Auth server is running { ! g_LogFile.Write("Opening a non-NULL cell handle to use with the server config library handle.\r\n"); // Do we have the user info necessary to authenticate? BOOL bHaveUserInfo = g_CfgData.szAdminName[0] && g_CfgData.szAdminPW[0]; ! // Open a standard cell handle. szAdminName and szAdminPW will either be NULL, or ! // if they have been entered by the user, will be the admin name and password strings. ! if ((!g_CfgData.bFirstServer || g_CfgData.bAdminPrincipalCreated) && bHaveUserInfo) { ! g_LogFile.Write("Getting tokens in cell %s for user '%s'.\r\n", GetCellNameA(), GetAdminNameA()); ! nResult = afsclient_TokenGetNew(GetCellNameA(), GetAdminNameA(), GetAdminPWA(), &g_hToken, pStatus); } else { + g_LogFile.Write("Getting unauthenticated tokens for cell '%s'.\r\n", GetCellNameA()); + nResult = afsclient_TokenGetNew(GetCellNameA(), "", "", &g_hToken, pStatus); + } + + if (!nResult) { + g_LogFile.Write("Failed to get tokens for the specified cell: %lx.\r\n", (unsigned long)*pStatus); + return FALSE; + } + + // If the admin name and password are NULL, then this will be an unauthenticated + // connection to the cell. + g_LogFile.Write("Getting cell handle for cell %s.\r\n", GetCellNameA()); + nResult = afsclient_CellOpen(GetCellNameA(), g_hToken, &g_hCell, pStatus); + if (!nResult) { + g_LogFile.Write("Failed to open the cell: %lx.\r\n", (unsigned long)*pStatus); + return FALSE; + } + } else { g_LogFile.Write("Opening a NULL cell handle to use with the server config library handle.\r\n"); nResult = afsclient_NullCellOpen(&g_hCell, pStatus); if (!nResult) { g_LogFile.Write("Failed to open a NULL cell handle: %lx.\r\n", (unsigned long)*pStatus); ! return FALSE; ! } ! } ! ! // Get the server handle ! g_LogFile.Write("Getting config library handle for the server.\r\n"); ! if (!cfg_HostOpen(g_hCell, GetHostnameA(), &g_hServer, pStatus)) { g_LogFile.Write("Failed to get config library handle for the server: %lx.\r\n", (unsigned long)*pStatus); ! return FALSE; ! } ! return TRUE; } BOOL GetHandles(HWND hParentDlg) *************** *** 527,598 **** */ static void CloseLibHandles(BOOL bExiting) { ! afs_status_t nStatus; ! ! // We will close them in the reverse order of their creation. ! if (g_hServer) { ! cfg_HostClose(g_hServer, &nStatus); ! g_hServer = 0; ! } ! if (g_hCell) { ! afsclient_CellClose(g_hCell, &nStatus); ! g_hCell = 0; ! } ! if (g_hToken) { ! afsclient_TokenClose(g_hToken, &nStatus); ! g_hToken = 0; ! } // Only close the client cfg and cell handles if we are exiting. ! if (bExiting) { if (g_hClient) { ! cfg_HostClose(g_hClient, &nStatus); ! g_hClient = 0; ! } if (hClientCell) { ! afsclient_CellClose(hClientCell, &nStatus); ! hClientCell = 0; } } } static void SetConfigDefaults() { ! if (g_CfgData.bWizard) { ! if (g_CfgData.configFS == CS_NULL) ! g_CfgData.configFS = CS_CONFIGURE; ! ! if (g_CfgData.configDB == CS_NULL) ! g_CfgData.configDB = CS_CONFIGURE; ! ! if (g_CfgData.configBak == CS_NULL) ! g_CfgData.configBak = CS_CONFIGURE; ! ! if (g_CfgData.configPartition == CS_NULL) ! g_CfgData.configPartition = CS_CONFIGURE; ! ! if (g_CfgData.configRootVolumes == CS_NULL) ! g_CfgData.configRootVolumes = CS_CONFIGURE; ! if (g_CfgData.configRep == CS_NULL) ! g_CfgData.configRep = CS_CONFIGURE; ! if (g_CfgData.configSCS == CS_NULL) ! g_CfgData.configSCS = CS_DONT_CONFIGURE; ! if (g_CfgData.configSCC == CS_NULL) ! g_CfgData.configSCC = CS_DONT_CONFIGURE; ! } ! lstrcpy(g_CfgData.szAdminName, TEXT("admin")); ! lstrcpy(g_CfgData.szAdminUID, TEXT("0")); ! g_CfgData.bUseNextUid = TRUE; ! } // Prototypes for each property page's dialog proc --- 527,597 ---- */ static void CloseLibHandles(BOOL bExiting) { ! afs_status_t nStatus; ! // We will close them in the reverse order of their creation. ! if (g_hServer) { ! cfg_HostClose(g_hServer, &nStatus); ! g_hServer = 0; ! } ! if (g_hCell) { ! afsclient_CellClose(g_hCell, &nStatus); ! g_hCell = 0; ! } ! if (g_hToken) { ! afsclient_TokenClose(g_hToken, &nStatus); ! g_hToken = 0; ! } // Only close the client cfg and cell handles if we are exiting. ! if (bExiting) { if (g_hClient) { ! cfg_HostClose(g_hClient, &nStatus); ! g_hClient = 0; ! } if (hClientCell) { ! afsclient_CellClose(hClientCell, &nStatus); ! hClientCell = 0; } } } static void SetConfigDefaults() { ! if (g_CfgData.bWizard) { ! if (g_CfgData.configFS == CS_NULL) ! g_CfgData.configFS = CS_CONFIGURE; ! if (g_CfgData.configDB == CS_NULL) ! g_CfgData.configDB = CS_CONFIGURE; ! if (g_CfgData.configBak == CS_NULL) ! g_CfgData.configBak = CS_CONFIGURE; ! if (g_CfgData.configPartition == CS_NULL) ! g_CfgData.configPartition = CS_CONFIGURE; ! if (g_CfgData.configRootVolumes == CS_NULL) ! g_CfgData.configRootVolumes = CS_CONFIGURE; ! if (g_CfgData.configRep == CS_NULL) ! g_CfgData.configRep = CS_CONFIGURE; ! ! if (g_CfgData.configSCS == CS_NULL) ! g_CfgData.configSCS = CS_DONT_CONFIGURE; ! ! if (g_CfgData.configSCC == CS_NULL) ! g_CfgData.configSCC = CS_DONT_CONFIGURE; ! } ! ! lstrcpy(g_CfgData.szAdminName, TEXT("admin")); ! lstrcpy(g_CfgData.szAdminUID, TEXT("0")); ! ! g_CfgData.bUseNextUid = TRUE; ! } // Prototypes for each property page's dialog proc *************** *** 601,660 **** static void RunCfgTool() { ! // If the client info is invalid, then the config tool cannot run. Inform the user and ! // ask if they want to run the wizard instead. ! if (!g_CfgData.bValidClientInfo) { ! int nChoice = MsgBox(0, IDS_NEED_CLIENT_INFO, GetAppTitleID(), MB_YESNO | MB_ICONSTOP); ! if (nChoice == IDYES) ! RunWizard(); ! return; ! } ! ! // If the server info is invalid, then the config tool cannot run. The Wizard must be run ! // to initially configure the server. Inform the user and ask if they want to run the wizard instead. ! if (!g_CfgData.bValidServerInfo) { ! int nChoice = MsgBox(0, IDS_NEED_SERVER_INFO, GetAppTitleID(), MB_OKCANCEL | MB_ICONEXCLAMATION); ! if (nChoice == IDOK) ! RunWizard(); ! return; ! } ! g_CfgData.bWizard = FALSE; ! SetConfigDefaults(); ! RegisterConfigToolHelp(); ! // Create the prop sheet ! g_pSheet = PropSheet_Create(IDS_CFG_TOOL_APP_TITLE, TRUE); ! ! // Add the pages ! PropSheet_AddTab(g_pSheet, IDS_PARTITIONS_PAGE_TITLE, IDD_PARTITIONS_PAGE, (DLGPROC)PartitionsPageDlgProc, 0, TRUE, TRUE); ! PropSheet_AddTab(g_pSheet, IDS_SERVICES_PAGE_TITLE, IDD_SERVICES_PAGE, (DLGPROC)ServicesPageDlgProc, 0, TRUE); ! // Let the user see it ! PropSheet_ShowModal(g_pSheet); ! } static void RunWizard() { ! g_CfgData.bWizard = TRUE; SetConfigDefaults(); ! RegisterWizardHelp(); ! ! g_pWiz = new WIZARD; ! g_pWiz->SetDialogTemplate(IDD_WIZARD, IDC_WIZARD_LEFTPANE, IDC_WIZARD_RIGHTPANE, IDBACK, IDNEXT); ! g_pWiz->SetGraphic(IDB_GRAPHIC_16, IDB_GRAPHIC_256); ! g_pWiz->SetStates(g_aStates, g_nNumStates); ! g_pWiz->SetGraphicCallback(PaintPageGraphic); ! g_pWiz->SetState(sidSTEP_ONE); ! g_pWiz->Show(); ! delete g_pWiz; ! g_pWiz = 0; ! } --- 600,659 ---- static void RunCfgTool() { ! // If the client info is invalid, then the config tool cannot run. Inform the user and ! // ask if they want to run the wizard instead. ! if (!g_CfgData.bValidClientInfo) { ! int nChoice = MsgBox(0, IDS_NEED_CLIENT_INFO, GetAppTitleID(), MB_YESNO | MB_ICONSTOP); ! if (nChoice == IDYES) ! RunWizard(); ! return; ! } ! ! // If the server info is invalid, then the config tool cannot run. The Wizard must be run ! // to initially configure the server. Inform the user and ask if they want to run the wizard instead. ! if (!g_CfgData.bValidServerInfo) { ! int nChoice = MsgBox(0, IDS_NEED_SERVER_INFO, GetAppTitleID(), MB_OKCANCEL | MB_ICONEXCLAMATION); ! if (nChoice == IDOK) ! RunWizard(); ! return; ! } ! g_CfgData.bWizard = FALSE; ! SetConfigDefaults(); ! RegisterConfigToolHelp(); ! // Create the prop sheet ! g_pSheet = PropSheet_Create(IDS_CFG_TOOL_APP_TITLE, TRUE); ! // Add the pages ! PropSheet_AddTab(g_pSheet, IDS_PARTITIONS_PAGE_TITLE, IDD_PARTITIONS_PAGE, (DLGPROC)PartitionsPageDlgProc, 0, TRUE, TRUE); ! PropSheet_AddTab(g_pSheet, IDS_SERVICES_PAGE_TITLE, IDD_SERVICES_PAGE, (DLGPROC)ServicesPageDlgProc, 0, TRUE); ! ! // Let the user see it ! PropSheet_ShowModal(g_pSheet); ! } static void RunWizard() { ! g_CfgData.bWizard = TRUE; SetConfigDefaults(); ! RegisterWizardHelp(); ! g_pWiz = new WIZARD; ! g_pWiz->SetDialogTemplate(IDD_WIZARD, IDC_WIZARD_LEFTPANE, IDC_WIZARD_RIGHTPANE, IDBACK, IDNEXT); ! g_pWiz->SetGraphic(IDB_GRAPHIC_16, IDB_GRAPHIC_256); ! g_pWiz->SetStates(g_aStates, g_nNumStates); ! g_pWiz->SetGraphicCallback(PaintPageGraphic); ! g_pWiz->SetState(sidSTEP_ONE); ! g_pWiz->Show(); ! delete g_pWiz; ! ! g_pWiz = 0; ! } Index: openafs/src/WINNT/afssvrcfg/backup_server_page.cpp diff -c openafs/src/WINNT/afssvrcfg/backup_server_page.cpp:1.2 openafs/src/WINNT/afssvrcfg/backup_server_page.cpp:1.2.32.1 *** openafs/src/WINNT/afssvrcfg/backup_server_page.cpp:1.2 Sat Nov 4 05:01:50 2000 --- openafs/src/WINNT/afssvrcfg/backup_server_page.cpp Tue Dec 26 15:22:28 2006 *************** *** 48,85 **** */ BOOL CALLBACK BackupPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp) { ! if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp)) ! return FALSE; ! ! switch (msg) { ! case WM_INITDIALOG: ! OnInitDialog(hwndDlg); ! break; ! ! case WM_COMMAND: ! switch (LOWORD(wp)) { ! case IDNEXT: ! g_pWiz->SetState(sidSTEP_EIGHT); ! break; ! ! case IDBACK: ! g_pWiz->SetState(sidSTEP_SIX); ! break; ! ! case IDC_DONT_CONFIG_BACKUP_SERVER: ! g_CfgData.configBak = CS_DONT_CONFIGURE; ! break; ! ! case IDC_CONFIG_BACKUP_SERVER: ! g_CfgData.configBak = CS_CONFIGURE; ! break; ! } ! break; } ! return FALSE; ! } /* --- 48,85 ---- */ BOOL CALLBACK BackupPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp) { ! if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp)) ! return FALSE; + switch (msg) { + case WM_INITDIALOG: + OnInitDialog(hwndDlg); + break; + + case WM_COMMAND: + switch (LOWORD(wp)) { + case IDNEXT: + g_pWiz->SetState(sidSTEP_EIGHT); + break; + + case IDBACK: + g_pWiz->SetState(sidSTEP_SIX); + break; + + case IDC_DONT_CONFIG_BACKUP_SERVER: + g_CfgData.configBak = CS_DONT_CONFIGURE; + break; + + case IDC_CONFIG_BACKUP_SERVER: + g_CfgData.configBak = CS_CONFIGURE; + break; } + break; ! } ! ! return FALSE; ! } /* *************** *** 93,127 **** */ static void OnInitDialog(HWND hwndDlg) { ! hDlg = hwndDlg; CalcOptionButtonSeparationHeight(); ! g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON); ! g_pWiz->SetButtonText(IDNEXT, IDS_NEXT); ! g_pWiz->SetDefaultControl(IDNEXT); ! ! if (g_CfgData.configBak == CS_ALREADY_CONFIGURED) { ! CantBackup(IDS_ALREADY_A_BACKUP_SERVER); ! return; ! } ! ! // Should this step be disabled? Yes, if this machine ! // is not configured as a database server. ! if (!ConfiguredOrConfiguring(g_CfgData.configDB)) { ! CantBackup(IDS_NOT_A_DB_SERVER); ! EnableStep(g_CfgData.configBak, FALSE); ! return; ! } ! ! // Enable this in case it was disabled the last time ! EnableStep(g_CfgData.configBak); ! ! if (g_CfgData.configBak == CS_DONT_CONFIGURE) ! SetCheck(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER); ! else if (g_CfgData.configBak == CS_CONFIGURE) ! SetCheck(hDlg, IDC_CONFIG_BACKUP_SERVER); ! } /* --- 93,127 ---- */ static void OnInitDialog(HWND hwndDlg) { ! hDlg = hwndDlg; CalcOptionButtonSeparationHeight(); ! g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON); ! g_pWiz->SetButtonText(IDNEXT, IDS_NEXT); ! g_pWiz->SetDefaultControl(IDNEXT); ! ! if (g_CfgData.configBak == CS_ALREADY_CONFIGURED) { ! CantBackup(IDS_ALREADY_A_BACKUP_SERVER); ! return; ! } ! ! // Should this step be disabled? Yes, if this machine ! // is not configured as a database server. ! if (!ConfiguredOrConfiguring(g_CfgData.configDB)) { ! CantBackup(IDS_NOT_A_DB_SERVER); ! EnableStep(g_CfgData.configBak, FALSE); ! return; ! } ! ! // Enable this in case it was disabled the last time ! EnableStep(g_CfgData.configBak); ! ! if (g_CfgData.configBak == CS_DONT_CONFIGURE) ! SetCheck(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER); ! else if (g_CfgData.configBak == CS_CONFIGURE) ! SetCheck(hDlg, IDC_CONFIG_BACKUP_SERVER); ! } /* *************** *** 130,145 **** */ static void CantBackup(UINT nMsgID) { ! TCHAR szMsg[cchRESOURCE]; ! GetString(szMsg, nMsgID); ! ShowWnd(hDlg, IDC_BACKUP_SERVER_QUESTION, FALSE); ! ShowWnd(hDlg, IDC_CONFIG_BACKUP_SERVER, FALSE); ! ShowWnd(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER, FALSE); ! ShowWnd(hDlg, IDC_CANT_BACKUP_MSG); ! SetWndText(hDlg, IDC_CANT_BACKUP_MSG, szMsg); } static void CalcOptionButtonSeparationHeight() --- 130,145 ---- */ static void CantBackup(UINT nMsgID) { ! TCHAR szMsg[cchRESOURCE]; ! GetString(szMsg, nMsgID); ! ShowWnd(hDlg, IDC_BACKUP_SERVER_QUESTION, FALSE); ! ShowWnd(hDlg, IDC_CONFIG_BACKUP_SERVER, FALSE); ! ShowWnd(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER, FALSE); ! ShowWnd(hDlg, IDC_CANT_BACKUP_MSG); ! SetWndText(hDlg, IDC_CANT_BACKUP_MSG, szMsg); } static void CalcOptionButtonSeparationHeight() Index: openafs/src/WINNT/afssvrcfg/cfg_utils.cpp diff -c openafs/src/WINNT/afssvrcfg/cfg_utils.cpp:1.3 openafs/src/WINNT/afssvrcfg/cfg_utils.cpp:1.3.14.1 *** openafs/src/WINNT/afssvrcfg/cfg_utils.cpp:1.3 Sat Dec 6 22:39:50 2003 --- openafs/src/WINNT/afssvrcfg/cfg_utils.cpp Tue Dec 26 15:22:28 2006 *************** *** 27,95 **** */ BOOL IsStepEnabled(const CONFIG_STATE& step) { ! return ((step & CS_DISABLED) == 0); } void EnableStep(CONFIG_STATE& step, BOOL bEnable) ! { ! if (bEnable) ! step &= ~CS_DISABLED; ! else ! step |= CS_DISABLED; ! } BOOL ShouldConfig(const CONFIG_STATE& state) { ! return (state == CS_CONFIGURE); } BOOL DontConfig(const CONFIG_STATE& state) { ! return (state == CS_DONT_CONFIGURE); } BOOL ShouldUnconfig(const CONFIG_STATE& state) { ! return (state == CS_UNCONFIGURE); } BOOL ConfiguredOrConfiguring(const CONFIG_STATE& step) { ! return (step == CS_CONFIGURE) || (step == CS_ALREADY_CONFIGURED); } BOOL Configured(const CONFIG_STATE& step) { ! return (step == CS_ALREADY_CONFIGURED); } void ToggleConfig(CONFIG_STATE& state) { ! if (ShouldConfig(state)) ! state = CS_DONT_CONFIGURE; ! else if (DontConfig(state)) ! state = CS_CONFIGURE; ! } void RedrawGraphic() { ! HWND hWiz = g_pWiz->GetWindow(); ! HWND hBg = GetDlgItem(hWiz, IDC_WIZARD_LEFTPANE); ! RECT rect; ! GetClientRect(hBg, &rect); ! InvalidateRect(hBg, &rect, FALSE); ! UpdateWindow(hBg); ! } UINT GetAppTitleID() { ! if (g_CfgData.bWizard) ! return IDS_WIZARD_APP_TITLE; ! return IDS_CFG_TOOL_APP_TITLE; } const char *GetAdminLibErrorCodeMessage(afs_status_t nErrorCode) --- 27,95 ---- */ BOOL IsStepEnabled(const CONFIG_STATE& step) { ! return ((step & CS_DISABLED) == 0); } void EnableStep(CONFIG_STATE& step, BOOL bEnable) ! { ! if (bEnable) ! step &= ~CS_DISABLED; ! else ! step |= CS_DISABLED; ! } BOOL ShouldConfig(const CONFIG_STATE& state) { ! return (state == CS_CONFIGURE); } BOOL DontConfig(const CONFIG_STATE& state) { ! return (state == CS_DONT_CONFIGURE); } BOOL ShouldUnconfig(const CONFIG_STATE& state) { ! return (state == CS_UNCONFIGURE); } BOOL ConfiguredOrConfiguring(const CONFIG_STATE& step) { ! return (step == CS_CONFIGURE) || (step == CS_ALREADY_CONFIGURED); } BOOL Configured(const CONFIG_STATE& step) { ! return (step == CS_ALREADY_CONFIGURED); } void ToggleConfig(CONFIG_STATE& state) { ! if (ShouldConfig(state)) ! state = CS_DONT_CONFIGURE; ! else if (DontConfig(state)) ! state = CS_CONFIGURE; ! } void RedrawGraphic() { ! HWND hWiz = g_pWiz->GetWindow(); ! HWND hBg = GetDlgItem(hWiz, IDC_WIZARD_LEFTPANE); ! RECT rect; ! GetClientRect(hBg, &rect); ! InvalidateRect(hBg, &rect, FALSE); ! UpdateWindow(hBg); ! } UINT GetAppTitleID() { ! if (g_CfgData.bWizard) ! return IDS_WIZARD_APP_TITLE; ! return IDS_CFG_TOOL_APP_TITLE; } const char *GetAdminLibErrorCodeMessage(afs_status_t nErrorCode) *************** *** 116,140 **** void ShowError(HWND hDlg, afs_status_t nErrorCode, UINT uiErrorMsgID) { ! TCHAR szMsg[cchRESOURCE]; LogError(nErrorCode); ! GetString(szMsg, uiErrorMsgID); ! ! ErrorDialog(nErrorCode, szMsg); SetWndText(hDlg, IDC_STATUS_MSG, IDS_CONFIG_FAILED); } int ShowWarning(HWND hDlg, UINT uiMsgID) { ! TCHAR szMsg[cchRESOURCE]; ! TCHAR szTitle[cchRESOURCE]; ! GetString(szTitle, GetAppTitleID()); ! GetString(szMsg, uiMsgID); ! return MessageBox(hDlg, szMsg, szTitle, MB_OKCANCEL | MB_ICONWARNING); } --- 116,140 ---- void ShowError(HWND hDlg, afs_status_t nErrorCode, UINT uiErrorMsgID) { ! TCHAR szMsg[cchRESOURCE]; LogError(nErrorCode); ! GetString(szMsg, uiErrorMsgID); ! ! ErrorDialog(nErrorCode, szMsg); SetWndText(hDlg, IDC_STATUS_MSG, IDS_CONFIG_FAILED); } int ShowWarning(HWND hDlg, UINT uiMsgID) { ! TCHAR szMsg[cchRESOURCE]; ! TCHAR szTitle[cchRESOURCE]; ! GetString(szTitle, GetAppTitleID()); ! GetString(szMsg, uiMsgID); ! return MessageBox(hDlg, szMsg, szTitle, MB_OKCANCEL | MB_ICONWARNING); } Index: openafs/src/WINNT/afssvrcfg/config_server_page.cpp diff -c openafs/src/WINNT/afssvrcfg/config_server_page.cpp:1.6 openafs/src/WINNT/afssvrcfg/config_server_page.cpp:1.6.4.1 *** openafs/src/WINNT/afssvrcfg/config_server_page.cpp:1.6 Wed Jul 6 20:23:24 2005 --- openafs/src/WINNT/afssvrcfg/config_server_page.cpp Tue Dec 26 15:22:28 2006 *************** *** 25,30 **** --- 25,33 ---- #include #include #include + #include + #include + #include } #include "config.h" #include "graphics.h" *************** *** 102,112 **** * DEFINITIONS _________________________________________________________________ * */ ! #define QUORUM_WAIT_TIMEOUT 3 * 60 // 3 minutes in seconds ! #define ROOT_VOLUMES_QUOTA 5000 // k bytes ! #define RX_TIMEOUT 15 * 1000 // 15 seconds in milleseconds ! #define CELLSERVDB_UPDATE_TIMEOUT RX_TIMEOUT * 2 ! #define INVALID_PARTITION_ID (UINT)VOLMAXPARTS + 1 #define CLIENT_START_TIMEOUT 2 * 60 // 2 minutes in seconds #define CLIENT_STOP_TIMEOUT 3 * 60 // 2 minutes in seconds --- 105,115 ---- * DEFINITIONS _________________________________________________________________ * */ ! #define QUORUM_WAIT_TIMEOUT 3 * 60 // 3 minutes in seconds ! #define ROOT_VOLUMES_QUOTA 5000 // k bytes ! #define RX_TIMEOUT 15 * 1000 // 15 seconds in milleseconds ! #define CELLSERVDB_UPDATE_TIMEOUT RX_TIMEOUT * 2 ! #define INVALID_PARTITION_ID (UINT)VOLMAXPARTS + 1 #define CLIENT_START_TIMEOUT 2 * 60 // 2 minutes in seconds #define CLIENT_STOP_TIMEOUT 3 * 60 // 2 minutes in seconds *************** *** 160,171 **** * Structure that is used to form an array of all possible configuration steps. */ struct CONFIG_STEP { ! STEP_STATE eState; // Where we are at in performing this step ! STEP_FUNC pFunc; // Function used to perform this step ! UINT nDescCtrlID; // Control ID of the static used to hold the steps description ! UINT nGraphicCtrlID; // Control ID of the static that will display the graphic ! UINT nMsgID; // Message to show when performing this step ! UINT nDescID; // Step description to show }; --- 163,174 ---- * Structure that is used to form an array of all possible configuration steps. */ struct CONFIG_STEP { ! STEP_STATE eState; // Where we are at in performing this step ! STEP_FUNC pFunc; // Function used to perform this step ! UINT nDescCtrlID; // Control ID of the static used to hold the steps description ! UINT nGraphicCtrlID; // Control ID of the static that will display the graphic ! UINT nMsgID; // Message to show when performing this step ! UINT nDescID; // Step description to show }; *************** *** 178,196 **** * to just reproduce the two fields for ease of use. */ struct STEP_GUI_INFO { ! UINT nDescCtrlID; // Control ID of the static used to hold the steps description ! UINT nGraphicCtrlID; // Control ID of the static that will display the graphic }; static STEP_GUI_INFO StepGuiCtrlIDs[] = { ! { IDC_STEP1, IDC_STEP1_GRAPHIC }, ! { IDC_STEP2, IDC_STEP2_GRAPHIC }, ! { IDC_STEP3, IDC_STEP3_GRAPHIC }, ! { IDC_STEP4, IDC_STEP4_GRAPHIC }, ! { IDC_STEP5, IDC_STEP5_GRAPHIC }, ! { IDC_STEP6, IDC_STEP6_GRAPHIC }, ! { IDC_STEP7, IDC_STEP7_GRAPHIC }, ! { IDC_STEP8, IDC_STEP8_GRAPHIC } }; --- 181,199 ---- * to just reproduce the two fields for ease of use. */ struct STEP_GUI_INFO { ! UINT nDescCtrlID; // Control ID of the static used to hold the steps description ! UINT nGraphicCtrlID; // Control ID of the static that will display the graphic }; static STEP_GUI_INFO StepGuiCtrlIDs[] = { ! { IDC_STEP1, IDC_STEP1_GRAPHIC }, ! { IDC_STEP2, IDC_STEP2_GRAPHIC }, ! { IDC_STEP3, IDC_STEP3_GRAPHIC }, ! { IDC_STEP4, IDC_STEP4_GRAPHIC }, ! { IDC_STEP5, IDC_STEP5_GRAPHIC }, ! { IDC_STEP6, IDC_STEP6_GRAPHIC }, ! { IDC_STEP7, IDC_STEP7_GRAPHIC }, ! { IDC_STEP8, IDC_STEP8_GRAPHIC } }; *************** *** 200,238 **** * enum MUST match the order of the steps in the STEPS arrray below. */ enum STEP_ID { ! SID_CONFIG_PARTITION, ! SID_DEFINE_CELL_FOR_SERVER, ! SID_DEFINE_CELL_FOR_CLIENT, ! SID_START_BOS, ! SID_START_AUTH, ! SID_CREATE_PRINCIPAL_AND_KEY, ! SID_START_DB, ! SID_START_DB_AND_BAK, ! SID_START_BAK, ! SID_CREATE_ADMIN_PRINCIPAL, ! SID_START_FS_VL_AND_SALVAGER, ! SID_CONFIG_SCC, ! SID_CONFIG_SCS, ! SID_CREATE_ROOT_AFS, ! SID_START_CLIENT, ! SID_SET_ROOT_ACL, ! SID_CREATE_ROOT_CELL, ! SID_MOUNT_ROOT_CELL_STANDARD, ! SID_SET_ROOT_CELL_ACL, ! SID_MOUNT_ROOT_CELL_RW, ! SID_REPLICATE, ! SID_ENABLE_AUTH_CHECKING, ! SID_RESTART_SERVERS, ! SID_ADD_TO_CELLSERVDB, ! SID_RESTART_ALL_DB_SERVERS, ! SID_VOS_OPEN_SERVER, ! SID_UNCONFIG_DB, ! SID_UNCONFIG_BAK, ! SID_UNCONFIG_FS, ! SID_UNCONFIG_SCS, ! SID_UNCONFIG_SCC, ! SID_POST_CONFIG, ! SID_GET_CREDENTIALS, SID_GET_ROOT_VOLUME_INFO }; --- 203,241 ---- * enum MUST match the order of the steps in the STEPS arrray below. */ enum STEP_ID { ! SID_CONFIG_PARTITION, ! SID_DEFINE_CELL_FOR_SERVER, ! SID_DEFINE_CELL_FOR_CLIENT, ! SID_START_BOS, ! SID_START_AUTH, ! SID_CREATE_PRINCIPAL_AND_KEY, ! SID_START_DB, ! SID_START_DB_AND_BAK, ! SID_START_BAK, ! SID_CREATE_ADMIN_PRINCIPAL, ! SID_START_FS_VL_AND_SALVAGER, ! SID_CONFIG_SCC, ! SID_CONFIG_SCS, ! SID_CREATE_ROOT_AFS, ! SID_START_CLIENT, ! SID_SET_ROOT_ACL, ! SID_CREATE_ROOT_CELL, ! SID_MOUNT_ROOT_CELL_STANDARD, ! SID_SET_ROOT_CELL_ACL, ! SID_MOUNT_ROOT_CELL_RW, ! SID_REPLICATE, ! SID_ENABLE_AUTH_CHECKING, ! SID_RESTART_SERVERS, ! SID_ADD_TO_CELLSERVDB, ! SID_RESTART_ALL_DB_SERVERS, ! SID_VOS_OPEN_SERVER, ! SID_UNCONFIG_DB, ! SID_UNCONFIG_BAK, ! SID_UNCONFIG_FS, ! SID_UNCONFIG_SCS, ! SID_UNCONFIG_SCC, ! SID_POST_CONFIG, ! SID_GET_CREDENTIALS, SID_GET_ROOT_VOLUME_INFO }; *************** *** 251,290 **** * depends on exactly how the server is being configured. */ static CONFIG_STEP STEPS[MAX_STEPS] = { ! { SS_STEP_TO_BE_DONE, ConfigPartition, 0, 0, IDS_PARTITION_STEP, IDS_PARTITION_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, DefineCellForServer, 0, 0, IDS_DEFINE_CELL_NAME_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, DefineCellForClient, 0, 0, IDS_DEFINE_CELL_MEMBERSHIP_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, StartBosServer, 0, 0, IDS_START_BOS_SERVER_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, StartAuthServer, 0, 0, IDS_START_AUTH_SERVER_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, CreatePrincipalAndKey,0, 0, IDS_CREATE_PRINCIPAL_AND_KEY_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_STEP, IDS_DB_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_AND_BK_STEP, IDS_DB_AND_BK_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_BK_STEP, IDS_BK_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, CreateAdminPrincipal, 0, 0, IDS_CREATE_ADMIN_PRINCIPAL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, StartFsVlAndSalvager, 0, 0, IDS_START_FS_STEP, IDS_FS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, ConfigSCC, 0, 0, IDS_START_SCC_STEP, IDS_SCC_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, ConfigSCS, 0, 0, IDS_START_SCS_STEP, IDS_SCS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, CreateRootAfs, 0, 0, IDS_CREATE_ROOT_AFS_STEP, IDS_ROOT_AFS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, StartClient, 0, 0, IDS_START_CLIENT_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, SetRootAcl, 0, 0, IDS_SET_ROOT_ACL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, CreateRootCell, 0, 0, IDS_CREATE_ROOT_CELL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, MountRootCellStandard,0, 0, IDS_MOUNT_ROOT_CELL_STANDARD_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, SetRootCellAcl, 0, 0, IDS_SET_ROOT_CELL_ACL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, MountRootCellRW, 0, 0, IDS_MOUNT_ROOT_CELL_RW_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, Replicate, 0, 0, IDS_REP_STEP, IDS_REP_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, EnableAuthChecking, 0, 0, IDS_ENABLE_AUTH_CHECKING_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, RestartServers, 0, 0, IDS_RESTART_SERVERS_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, AddToCellServDB, 0, 0, IDS_ADD_TO_CELLSERVDB_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, RestartAllDbServers, 0, 0, IDS_RESTART_ALL_DB_SERVERS_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, VosOpenServer, 0, 0, IDS_NO_MSG_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, UnconfigDB, 0, 0, IDS_UNCONFIG_DB_STEP, IDS_UNCONFIG_DB_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigBak, 0, 0, IDS_UNCONFIG_BK_STEP, IDS_UNCONFIG_BK_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigFS, 0, 0, IDS_UNCONFIG_FS_STEP, IDS_UNCONFIG_FS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigSCS, 0, 0, IDS_UNCONFIG_SCS_STEP, IDS_UNCONFIG_SCS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigSCC, 0, 0, IDS_UNCONFIG_SCC_STEP, IDS_UNCONFIG_SCC_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, PostConfig, 0, 0, IDS_NO_MSG_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, UpgradeLibHandles, 0, 0, IDS_GET_CREDENTIALS_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, GetRootVolumeInfo, 0, 0, IDS_NO_MSG_STEP, 0 }, }; --- 254,293 ---- * depends on exactly how the server is being configured. */ static CONFIG_STEP STEPS[MAX_STEPS] = { ! { SS_STEP_TO_BE_DONE, ConfigPartition, 0, 0, IDS_PARTITION_STEP, IDS_PARTITION_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, DefineCellForServer, 0, 0, IDS_DEFINE_CELL_NAME_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, DefineCellForClient, 0, 0, IDS_DEFINE_CELL_MEMBERSHIP_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, StartBosServer, 0, 0, IDS_START_BOS_SERVER_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, StartAuthServer, 0, 0, IDS_START_AUTH_SERVER_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, CreatePrincipalAndKey,0, 0, IDS_CREATE_PRINCIPAL_AND_KEY_STEP,0 }, ! { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_STEP, IDS_DB_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_DB_AND_BK_STEP, IDS_DB_AND_BK_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, StartDbServers, 0, 0, IDS_START_BK_STEP, IDS_BK_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, CreateAdminPrincipal, 0, 0, IDS_CREATE_ADMIN_PRINCIPAL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, StartFsVlAndSalvager, 0, 0, IDS_START_FS_STEP, IDS_FS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, ConfigSCC, 0, 0, IDS_START_SCC_STEP, IDS_SCC_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, ConfigSCS, 0, 0, IDS_START_SCS_STEP, IDS_SCS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, CreateRootAfs, 0, 0, IDS_CREATE_ROOT_AFS_STEP, IDS_ROOT_AFS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, StartClient, 0, 0, IDS_START_CLIENT_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, SetRootAcl, 0, 0, IDS_SET_ROOT_ACL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, CreateRootCell, 0, 0, IDS_CREATE_ROOT_CELL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, MountRootCellStandard,0, 0, IDS_MOUNT_ROOT_CELL_STANDARD_STEP,0 }, ! { SS_STEP_TO_BE_DONE, SetRootCellAcl, 0, 0, IDS_SET_ROOT_CELL_ACL_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, MountRootCellRW, 0, 0, IDS_MOUNT_ROOT_CELL_RW_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, Replicate, 0, 0, IDS_REP_STEP, IDS_REP_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, EnableAuthChecking, 0, 0, IDS_ENABLE_AUTH_CHECKING_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, RestartServers, 0, 0, IDS_RESTART_SERVERS_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, AddToCellServDB, 0, 0, IDS_ADD_TO_CELLSERVDB_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, RestartAllDbServers, 0, 0, IDS_RESTART_ALL_DB_SERVERS_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, VosOpenServer, 0, 0, IDS_NO_MSG_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, UnconfigDB, 0, 0, IDS_UNCONFIG_DB_STEP, IDS_UNCONFIG_DB_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigBak, 0, 0, IDS_UNCONFIG_BK_STEP, IDS_UNCONFIG_BK_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigFS, 0, 0, IDS_UNCONFIG_FS_STEP, IDS_UNCONFIG_FS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigSCS, 0, 0, IDS_UNCONFIG_SCS_STEP, IDS_UNCONFIG_SCS_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, UnconfigSCC, 0, 0, IDS_UNCONFIG_SCC_STEP, IDS_UNCONFIG_SCC_STEP_DESC }, ! { SS_STEP_TO_BE_DONE, PostConfig, 0, 0, IDS_NO_MSG_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, UpgradeLibHandles, 0, 0, IDS_GET_CREDENTIALS_STEP, 0 }, ! { SS_STEP_TO_BE_DONE, GetRootVolumeInfo, 0, 0, IDS_NO_MSG_STEP, 0 }, }; *************** *** 292,381 **** * These are the steps to perform when configuring the very first server. */ static STEP_ID FirstServerSteps[] = { ! SID_CONFIG_PARTITION, ! SID_DEFINE_CELL_FOR_SERVER, ! SID_DEFINE_CELL_FOR_CLIENT, ! SID_START_BOS, ! SID_START_AUTH, ! SID_CREATE_PRINCIPAL_AND_KEY, ! SID_START_DB, ! SID_CREATE_ADMIN_PRINCIPAL, ! SID_START_FS_VL_AND_SALVAGER, ! SID_CONFIG_SCS, ! SID_VOS_OPEN_SERVER, ! SID_CREATE_ROOT_AFS, ! SID_START_CLIENT, ! SID_SET_ROOT_ACL, ! SID_CREATE_ROOT_CELL, ! SID_MOUNT_ROOT_CELL_STANDARD, ! SID_SET_ROOT_CELL_ACL, ! SID_MOUNT_ROOT_CELL_RW, ! SID_REPLICATE, ! SID_ENABLE_AUTH_CHECKING ! }; static STEP_ID InvalidServerInfoSteps[] = { ! SID_DEFINE_CELL_FOR_SERVER, ! SID_START_BOS, ! SID_CREATE_PRINCIPAL_AND_KEY, ! SID_CREATE_ADMIN_PRINCIPAL, ! SID_ENABLE_AUTH_CHECKING }; static STEP_ID InvalidClientInfoSteps[] = { ! SID_DEFINE_CELL_FOR_CLIENT, ! SID_START_CLIENT }; static STEP_ID PreconfigSteps[] = { ! SID_GET_CREDENTIALS, // Always do this so we will always have credentials - need this for the config manager. SID_VOS_OPEN_SERVER // We'll always do this step so we know we can make vos calls }; static STEP_ID UnconfigDbSteps[] = { ! SID_UNCONFIG_DB, ! SID_RESTART_ALL_DB_SERVERS }; static STEP_ID UnconfigBakSteps[] = { ! SID_UNCONFIG_BAK, ! SID_GET_CREDENTIALS ! }; static STEP_ID UnconfigFsSteps[] = { ! SID_UNCONFIG_FS }; static STEP_ID UnconfigScsSteps[] = { ! SID_UNCONFIG_SCS }; static STEP_ID UnconfigSccSteps[] = { ! SID_UNCONFIG_SCC }; static STEP_ID FsSteps[] = { ! SID_START_FS_VL_AND_SALVAGER }; static STEP_ID DbSteps[] = { ! SID_ADD_TO_CELLSERVDB, ! SID_START_DB, ! SID_RESTART_ALL_DB_SERVERS ! };