Index: openafs/src/JAVA/classes/org/openafs/jafs/Token.java diff -c openafs/src/JAVA/classes/org/openafs/jafs/Token.java:1.3 openafs/src/JAVA/classes/org/openafs/jafs/Token.java:1.3.4.1 *** openafs/src/JAVA/classes/org/openafs/jafs/Token.java:1.3 Fri Oct 14 22:12:23 2005 --- openafs/src/JAVA/classes/org/openafs/jafs/Token.java Fri Dec 14 16:35:55 2007 *************** *** 144,149 **** --- 144,163 ---- } /** + * Constructs a new Token object instance given the + * name of the AFS cell it represents; the token for administrative + * access will be extracted from the kernel cache manager if possible. + * + * @param cellName the name of the cell to Token into + * @exception AFSException If an error occurs in the native code + */ + public Token(String cellName) + throws AFSException + { + this(null, null, cellName); + } + + /** * Constructs a new Token object instance given * the name of the AFS cell it represents and the username and password * of the user to be Tokend for Index: openafs/src/JAVA/libjafs/AdminToken.c diff -c openafs/src/JAVA/libjafs/AdminToken.c:1.4 openafs/src/JAVA/libjafs/AdminToken.c:1.4.4.1 *** openafs/src/JAVA/libjafs/AdminToken.c:1.4 Fri Oct 14 22:12:24 2005 --- openafs/src/JAVA/libjafs/AdminToken.c Fri Dec 14 16:35:56 2007 *************** *** 30,35 **** --- 30,36 ---- #include #include #include + #include /** * Static function used to initialize the client library and the *************** *** 71,76 **** --- 72,78 ---- const char *password; void *tokenHandle; int rc; + int err; // convert java strings if( jcellName != NULL ) { *************** *** 101,108 **** password = NULL; } ! if ( !(afsclient_TokenGetNew( cellName, userName, password, &tokenHandle, ! &ast) ) ) { // release converted strings if( cellName != NULL ) { (*env)->ReleaseStringUTFChars(env, jcellName, cellName); --- 103,113 ---- password = NULL; } ! err = (password==NULL || userName==NULL) ! ? afsclient_TokenGetExisting( cellName, &tokenHandle, &ast) ! : afsclient_TokenGetNew( cellName, userName, password, &tokenHandle, &ast); ! ! if ( !err ) { // release converted strings if( cellName != NULL ) { (*env)->ReleaseStringUTFChars(env, jcellName, cellName); Index: openafs/src/JAVA/libjafs/Makefile.in diff -c openafs/src/JAVA/libjafs/Makefile.in:1.4 openafs/src/JAVA/libjafs/Makefile.in:1.4.4.1 *** openafs/src/JAVA/libjafs/Makefile.in:1.4 Fri Oct 14 22:12:25 2005 --- openafs/src/JAVA/libjafs/Makefile.in Fri Dec 14 16:35:56 2007 *************** *** 13,19 **** TOP_INCDIR=@TOP_INCDIR@ TOP_LIBDIR=@TOP_LIBDIR@ TOP_JLIBDIR=@TOP_SRCDIR@/JAVA/libjafs ! JNI_INC=${JAVA_HOME}/include prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ --- 13,19 ---- TOP_INCDIR=@TOP_INCDIR@ TOP_LIBDIR=@TOP_LIBDIR@ TOP_JLIBDIR=@TOP_SRCDIR@/JAVA/libjafs ! JNI_INC=-I ${JAVA_HOME}/include -I `dirname ${JAVA_HOME}/include/*/jni_md.h` prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ *************** *** 35,44 **** OBJECT_FLAGS = -fPIC -c ifeq "$(BUILD_TYPE)" "admin" ! INC := -I${TOP_INCDIR} -I${TOP_INCDIR}/afs/ -I${JAVA_HOME}/include -I ${JNI_INC} CFLAGS := ${INC} ${DBG} ${OPTMZ} -I${TOP_SRCDIR}/config ${MT_CFLAGS} else ! INC := -I${TOP_SRCDIR}/libuafs -I${TOP_INCDIR} -I${JAVA_HOME}/include -I ${JNI_INC} CFLAGS := ${INC} ${DBG} ${OPTMZ} ${FSINCLUDES} -D_REENTRANT -DLIBJUAFS ${MT_CFLAGS} endif --- 35,44 ---- OBJECT_FLAGS = -fPIC -c ifeq "$(BUILD_TYPE)" "admin" ! INC := -I${TOP_INCDIR} -I${TOP_INCDIR}/afs/ ${JNI_INC} CFLAGS := ${INC} ${DBG} ${OPTMZ} -I${TOP_SRCDIR}/config ${MT_CFLAGS} else ! INC := -I${TOP_SRCDIR}/libuafs -I${TOP_INCDIR} ${JNI_INC} CFLAGS := ${INC} ${DBG} ${OPTMZ} ${FSINCLUDES} -D_REENTRANT -DLIBJUAFS ${MT_CFLAGS} endif *************** *** 50,56 **** JAVADOCSDIR = javadocs/ JAVAH = ${JAVA_HOME}/bin/javah -classpath ${ROOTPACKAGEDIR} -jni -d ${LIBJAFSADMDIR} ! JAVAC = ${JAVA_HOME}/bin/javac -classpath ${ROOTPACKAGEDIR} J_NATIVE_PREFIX = org.openafs.jafs. C_NATIVE_PREFIX = org_openafs_jafs_ --- 50,56 ---- JAVADOCSDIR = javadocs/ JAVAH = ${JAVA_HOME}/bin/javah -classpath ${ROOTPACKAGEDIR} -jni -d ${LIBJAFSADMDIR} ! JAVAC = ${JAVA_HOME}/bin/javac -source 1.4 -classpath ${ROOTPACKAGEDIR} J_NATIVE_PREFIX = org.openafs.jafs. C_NATIVE_PREFIX = org_openafs_jafs_ *************** *** 153,158 **** --- 153,159 ---- LIBJAFS_LIBS =\ ${TOP_LIBDIR}/libjuafs.a \ + ${TOP_LIBDIR}/libafsutil.a \ ${TOP_LIBDIR}/libdes.a \ -lresolv \ -lpthread Index: openafs/src/WINNT/afsd/afsd.h diff -c openafs/src/WINNT/afsd/afsd.h:1.18.2.5 openafs/src/WINNT/afsd/afsd.h:1.18.2.6 *** openafs/src/WINNT/afsd/afsd.h:1.18.2.5 Thu Nov 29 11:11:43 2007 --- openafs/src/WINNT/afsd/afsd.h Sat Dec 22 23:52:58 2007 *************** *** 127,133 **** extern HANDLE WaitToTerminate; ! #undef DFS_SUPPORT #define LOG_PACKET 1 #undef NOTSERVICE #define LOCK_TESTING 1 --- 127,133 ---- extern HANDLE WaitToTerminate; ! #define DFS_SUPPORT 1 #define LOG_PACKET 1 #undef NOTSERVICE #define LOCK_TESTING 1 Index: openafs/src/WINNT/afsd/afsd_init.c diff -c openafs/src/WINNT/afsd/afsd_init.c:1.79.2.22 openafs/src/WINNT/afsd/afsd_init.c:1.79.2.23 *** openafs/src/WINNT/afsd/afsd_init.c:1.79.2.22 Fri Dec 7 11:05:22 2007 --- openafs/src/WINNT/afsd/afsd_init.c Mon Dec 24 00:24:14 2007 *************** *** 752,760 **** dummyLen = sizeof(numBkgD); code = RegQueryValueEx(parmKey, "Daemons", NULL, NULL, (BYTE *) &numBkgD, &dummyLen); ! if (code == ERROR_SUCCESS) afsi_log("%d background daemons", numBkgD); ! else { numBkgD = CM_CONFIGDEFAULT_DAEMONS; afsi_log("Defaulting to %d background daemons", numBkgD); } --- 752,762 ---- dummyLen = sizeof(numBkgD); code = RegQueryValueEx(parmKey, "Daemons", NULL, NULL, (BYTE *) &numBkgD, &dummyLen); ! if (code == ERROR_SUCCESS) { ! if (numBkgD > CM_MAX_DAEMONS) ! numBkgD = CM_MAX_DAEMONS; afsi_log("%d background daemons", numBkgD); ! } else { numBkgD = CM_CONFIGDEFAULT_DAEMONS; afsi_log("Defaulting to %d background daemons", numBkgD); } Index: openafs/src/WINNT/afsd/afsd_service.c diff -c openafs/src/WINNT/afsd/afsd_service.c:1.52.4.18 openafs/src/WINNT/afsd/afsd_service.c:1.52.4.19 *** openafs/src/WINNT/afsd/afsd_service.c:1.52.4.18 Sun Nov 4 19:24:45 2007 --- openafs/src/WINNT/afsd/afsd_service.c Sat Dec 22 23:52:58 2007 *************** *** 1305,1310 **** --- 1305,1313 ---- SetServiceStatus(StatusHandle, &ServiceStatus); #endif + /* Notify any volume status handlers that the cache manager has started */ + cm_VolStatus_Service_Started(); + /* the following ifdef chooses the mode of operation for the service. to enable * a runtime flag (instead of compile-time), pioctl() would need to dynamically * determine the mode, in order to use the correct ioctl special-file path. */ *************** *** 1367,1375 **** LogEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVICE_RUNNING); } - /* Notify any volume status handlers that we have started */ - cm_VolStatus_Service_Started(); - /* allow an exit to be called when started */ hHookDll = LoadLibrary(AFSD_HOOK_DLL); if (hHookDll) --- 1370,1375 ---- Index: openafs/src/WINNT/afsd/afslogon.c diff -c openafs/src/WINNT/afsd/afslogon.c:1.45.2.11 openafs/src/WINNT/afsd/afslogon.c:1.45.2.12 *** openafs/src/WINNT/afsd/afslogon.c:1.45.2.11 Tue Apr 17 00:04:36 2007 --- openafs/src/WINNT/afsd/afslogon.c Tue Dec 11 23:25:38 2007 *************** *** 1230,1236 **** /* We can't use pInfo->Domain for the domain since in the cross realm case * this is source domain and not the destination domain. */ ! if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, pInfo->Domain)) { WCHAR Domain[64]=L""; GetLocalShortDomain(Domain, sizeof(Domain)); if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, Domain)) { --- 1230,1236 ---- /* We can't use pInfo->Domain for the domain since in the cross realm case * this is source domain and not the destination domain. */ ! if (tokenUser && QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, pInfo->Domain)) { WCHAR Domain[64]=L""; GetLocalShortDomain(Domain, sizeof(Domain)); if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, Domain)) { *************** *** 1342,1348 **** /* We can't use pInfo->Domain for the domain since in the cross realm case * this is source domain and not the destination domain. */ ! if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, pInfo->Domain)) { WCHAR Domain[64]=L""; GetLocalShortDomain(Domain, sizeof(Domain)); if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, Domain)) { --- 1342,1348 ---- /* We can't use pInfo->Domain for the domain since in the cross realm case * this is source domain and not the destination domain. */ ! if (tokenUser && QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, pInfo->Domain)) { WCHAR Domain[64]=L""; GetLocalShortDomain(Domain, sizeof(Domain)); if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, Domain)) { Index: openafs/src/WINNT/afsd/cm.h diff -c openafs/src/WINNT/afsd/cm.h:1.17.2.6 openafs/src/WINNT/afsd/cm.h:1.17.2.7 *** openafs/src/WINNT/afsd/cm.h:1.17.2.6 Thu Aug 30 22:56:59 2007 --- openafs/src/WINNT/afsd/cm.h Sat Dec 22 23:52:58 2007 *************** *** 303,308 **** --- 303,309 ---- #define CM_ERROR_NOT_A_DFSLINK (CM_ERROR_BASE+53) #define CM_ERROR_INEXACT_MATCH (CM_ERROR_BASE+54) #define CM_ERROR_BPLUS_NOMATCH (CM_ERROR_BASE+55) + #define CM_ERROR_EAS_NOT_SUPPORTED (CM_ERROR_BASE+56) /* Used by cm_FollowMountPoint and cm_GetVolumeByName */ #define RWVOL 0 Index: openafs/src/WINNT/afsd/cm_buf.c diff -c openafs/src/WINNT/afsd/cm_buf.c:1.31.2.24 openafs/src/WINNT/afsd/cm_buf.c:1.31.2.25 *** openafs/src/WINNT/afsd/cm_buf.c:1.31.2.24 Wed Nov 14 12:19:41 2007 --- openafs/src/WINNT/afsd/cm_buf.c Mon Dec 10 15:35:06 2007 *************** *** 700,718 **** i = BUF_HASH(&bp->fid, &bp->offset); lbpp = &(cm_data.buf_scacheHashTablepp[i]); for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = *lbpp) { ! if (tbp == bp) break; } /* we better find it */ osi_assertx(tbp != NULL, "buf_Recycle: hash table screwup"); *lbpp = bp->hashp; /* hash out */ /* Remove from file hash */ i = BUF_FILEHASH(&bp->fid); prevBp = bp->fileHashBackp; nextBp = bp->fileHashp; if (prevBp) prevBp->fileHashp = nextBp; else --- 700,722 ---- i = BUF_HASH(&bp->fid, &bp->offset); lbpp = &(cm_data.buf_scacheHashTablepp[i]); for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = *lbpp) { ! if (tbp == bp) ! break; } /* we better find it */ osi_assertx(tbp != NULL, "buf_Recycle: hash table screwup"); *lbpp = bp->hashp; /* hash out */ + bp->hashp = NULL; /* Remove from file hash */ i = BUF_FILEHASH(&bp->fid); prevBp = bp->fileHashBackp; + bp->fileHashBackp = NULL; nextBp = bp->fileHashp; + bp->fileHashp = NULL; if (prevBp) prevBp->fileHashp = nextBp; else *************** *** 1560,1566 **** i = BUF_FILEHASH(&scp->fid); ! lock_ObtainWrite(&buf_globalLock); for (bp = cm_data.buf_fileHashTablepp[i]; bp; bp = bp->fileHashp) { if (cm_FidCmp(&bp->fid, &scp->fid) == 0) { --- 1564,1570 ---- i = BUF_FILEHASH(&scp->fid); ! lock_ObtainRead(&buf_globalLock); for (bp = cm_data.buf_fileHashTablepp[i]; bp; bp = bp->fileHashp) { if (cm_FidCmp(&bp->fid, &scp->fid) == 0) { *************** *** 1570,1576 **** } } } ! lock_ReleaseWrite(&buf_globalLock); if (found) return 0; --- 1574,1580 ---- } } } ! lock_ReleaseRead(&buf_globalLock); if (found) return 0; Index: openafs/src/WINNT/afsd/cm_callback.c diff -c openafs/src/WINNT/afsd/cm_callback.c:1.41.4.24 openafs/src/WINNT/afsd/cm_callback.c:1.41.4.28 *** openafs/src/WINNT/afsd/cm_callback.c:1.41.4.24 Tue Dec 4 10:48:48 2007 --- openafs/src/WINNT/afsd/cm_callback.c Wed Dec 26 11:22:19 2007 *************** *** 359,365 **** unsigned long host = 0; unsigned short port = 0; cm_server_t *tsp = NULL; ! cm_cell_t * cellp = NULL; MUTEX_ENTER(&callp->lock); --- 359,365 ---- unsigned long host = 0; unsigned short port = 0; cm_server_t *tsp = NULL; ! cm_cell_t* cellp = NULL; MUTEX_ENTER(&callp->lock); *************** *** 370,380 **** tsp = cm_FindServerByIP(host, CM_SERVER_FILE); if (tsp) cellp = tsp->cellp; } - osi_Log2(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d", - ntohl(host), - ntohs(port)); for (i=0; i < (long) fidsArrayp->AFSCBFids_len; i++) { tfidp = &fidsArrayp->AFSCBFids_val[i]; --- 370,389 ---- tsp = cm_FindServerByIP(host, CM_SERVER_FILE); if (tsp) cellp = tsp->cellp; + + if (cellp) + osi_Log2(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d", + ntohl(host), + ntohs(port)); + else + osi_Log3(afsd_logp, "SRXAFSCB_CallBack from host 0x%x port %d for cell %s", + ntohl(host), + ntohs(port), + cellp->name /* does not need to be saved, doesn't change */); + } else { + osi_Log0(afsd_logp, "SRXAFSCB_CallBack from unknown host"); } for (i=0; i < (long) fidsArrayp->AFSCBFids_len; i++) { tfidp = &fidsArrayp->AFSCBFids_val[i]; *************** *** 1842,1848 **** osi_Log0(afsd_logp, "CheckCBExpiration"); ! now = osi_Time(); lock_ObtainWrite(&cm_scacheLock); for (i=0; inextp) { --- 1851,1857 ---- osi_Log0(afsd_logp, "CheckCBExpiration"); ! now = time(NULL); lock_ObtainWrite(&cm_scacheLock); for (i=0; inextp) { *************** *** 1905,1912 **** tsp->downTime = osi_Time(); } cm_ForceNewConnections(tsp); - lock_ReleaseMutex(&tsp->mx); - /* Now update the volume status */ for (tsrvp = tsp->vols; tsrvp; tsrvp = tsrvp->nextp) { for (i=0; imx); } } } Index: openafs/src/WINNT/afsd/cm_cell.c diff -c openafs/src/WINNT/afsd/cm_cell.c:1.23.2.7 openafs/src/WINNT/afsd/cm_cell.c:1.23.2.9 *** openafs/src/WINNT/afsd/cm_cell.c:1.23.2.7 Wed Oct 10 11:22:14 2007 --- openafs/src/WINNT/afsd/cm_cell.c Fri Dec 28 02:13:15 2007 *************** *** 26,34 **** osi_rwlock_t cm_cellLock; /* function called as callback proc from cm_SearchCellFile. Return 0 to ! * continue processing. */ ! long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep) { cm_server_t *tsp; cm_serverRef_t *tsrp; --- 26,36 ---- osi_rwlock_t cm_cellLock; /* function called as callback proc from cm_SearchCellFile. Return 0 to ! * continue processing. ! * ! * At the present time the return value is ignored by the caller. */ ! long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *hostnamep) { cm_server_t *tsp; cm_serverRef_t *tsrp; *************** *** 41,46 **** --- 43,54 ---- { if ( !tsp->cellp ) tsp->cellp = cellp; + else if (tsp->cellp != cellp) { + osi_Log3(afsd_logp, "found a vlserver %s associated with two cells named %s and %s", + osi_LogSaveString(afsd_logp,hostnamep), + osi_LogSaveString(afsd_logp,tsp->cellp->name), + osi_LogSaveString(afsd_logp,cellp->name)); + } } else tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp); *************** *** 52,57 **** --- 60,66 ---- lock_ObtainWrite(&cm_serverLock); tsrp->refCount--; lock_ReleaseWrite(&cm_serverLock); + return 0; } *************** *** 139,146 **** strcpy(fullname, cp->name); break; } ! } ! lock_ReleaseRead(&cm_cellLock); if (cp) { cm_UpdateCell(cp); --- 148,165 ---- strcpy(fullname, cp->name); break; } ! } ! ! if (!cp) { ! for (cp = cm_data.allCellsp; cp; cp=cp->allNextp) { ! if (strnicmp(namep, cp->name, strlen(namep)) == 0) { ! strcpy(fullname, cp->name); ! break; ! } ! } ! } ! ! lock_ReleaseRead(&cm_cellLock); if (cp) { cm_UpdateCell(cp); *************** *** 161,166 **** --- 180,195 ---- if (cp) goto done; + for (cp = cm_data.allCellsp; cp; cp=cp->allNextp) { + if (strnicmp(namep, cp->name, strlen(namep)) == 0) { + strcpy(fullname, cp->name); + break; + } + } + + if (cp) + goto done; + if ( cm_data.currentCells >= cm_data.maxCells ) osi_panic("Exceeded Max Cells", __FILE__, __LINE__); Index: openafs/src/WINNT/afsd/cm_config.h diff -c openafs/src/WINNT/afsd/cm_config.h:1.8.6.1 openafs/src/WINNT/afsd/cm_config.h:1.8.6.3 *** openafs/src/WINNT/afsd/cm_config.h:1.8.6.1 Thu Aug 9 01:33:56 2007 --- openafs/src/WINNT/afsd/cm_config.h Fri Dec 28 02:09:11 2007 *************** *** 13,20 **** #define CM_CONFIGDEFAULT_CACHESIZE 98304 #define CM_CONFIGDEFAULT_BLOCKSIZE 4096 #define CM_CONFIGDEFAULT_STATS 10000 ! #define CM_CONFIGDEFAULT_CHUNKSIZE 20 ! #define CM_CONFIGDEFAULT_DAEMONS 2 #define CM_CONFIGDEFAULT_SVTHREADS 25 #define CM_CONFIGDEFAULT_TRACEBUFSIZE 5000 --- 13,20 ---- #define CM_CONFIGDEFAULT_CACHESIZE 98304 #define CM_CONFIGDEFAULT_BLOCKSIZE 4096 #define CM_CONFIGDEFAULT_STATS 10000 ! #define CM_CONFIGDEFAULT_CHUNKSIZE 18 /* 256KB */ ! #define CM_CONFIGDEFAULT_DAEMONS 1 #define CM_CONFIGDEFAULT_SVTHREADS 25 #define CM_CONFIGDEFAULT_TRACEBUFSIZE 5000 Index: openafs/src/WINNT/afsd/cm_conn.h diff -c openafs/src/WINNT/afsd/cm_conn.h:1.13.4.8 openafs/src/WINNT/afsd/cm_conn.h:1.13.4.9 *** openafs/src/WINNT/afsd/cm_conn.h:1.13.4.8 Sun Jun 10 13:00:07 2007 --- openafs/src/WINNT/afsd/cm_conn.h Sat Dec 22 23:52:58 2007 *************** *** 32,44 **** #define CM_CONN_FLAG_FORCE_NEW 1 ! /* structure used for tracking RPC progress */ typedef struct cm_req { DWORD startTime; /* Quit before RDR times us out */ int rpcError; /* RPC error code */ int volumeError; /* volume error code */ int accessError; /* access error code */ int flags; } cm_req_t; /* flags in cm_req structure */ --- 32,50 ---- #define CM_CONN_FLAG_FORCE_NEW 1 ! /* ! * structure used for tracking RPC progress ! * and for passing path info from the smb layer ! * to the cache manager functions. ! */ typedef struct cm_req { DWORD startTime; /* Quit before RDR times us out */ int rpcError; /* RPC error code */ int volumeError; /* volume error code */ int accessError; /* access error code */ int flags; + char * tidPathp; + char * relPathp; } cm_req_t; /* flags in cm_req structure */ Index: openafs/src/WINNT/afsd/cm_daemon.c diff -c openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.20 openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.21 *** openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.20 Thu Nov 29 11:02:14 2007 --- openafs/src/WINNT/afsd/cm_daemon.c Mon Dec 24 00:24:14 2007 *************** *** 49,81 **** cm_bkgRequest_t *cm_bkgListEndp; /* last elt in the list of requests */ static int daemon_ShutdownFlag = 0; #ifndef DJGPP void cm_IpAddrDaemon(long parm) { extern void smb_CheckVCs(void); rx_StartClientThread(); while (daemon_ShutdownFlag == 0) { ! DWORD Result = NotifyAddrChange(NULL,NULL); ! if (Result == NO_ERROR && daemon_ShutdownFlag == 0) { Sleep(2500); ! osi_Log0(afsd_logp, "cm_IpAddrDaemon CheckDownServers"); ! cm_CheckServers(CM_FLAG_CHECKVLDBSERVERS | CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL); ! cm_ForceNewConnectionsAllServers(); ! cm_CheckServers(CM_FLAG_CHECKFILESERVERS | CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL); ! smb_CheckVCs(); ! cm_VolStatus_Network_Addr_Change(); } } } #endif ! void cm_BkgDaemon(long parm) { cm_bkgRequest_t *rp; afs_int32 code; rx_StartClientThread(); --- 49,108 ---- cm_bkgRequest_t *cm_bkgListEndp; /* last elt in the list of requests */ static int daemon_ShutdownFlag = 0; + static int cm_nDaemons = 0; + + static EVENT_HANDLE cm_Daemon_ShutdownEvent = NULL; + static EVENT_HANDLE cm_IPAddrDaemon_ShutdownEvent = NULL; + static EVENT_HANDLE cm_BkgDaemon_ShutdownEvent[CM_MAX_DAEMONS] = + {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; #ifndef DJGPP void cm_IpAddrDaemon(long parm) { extern void smb_CheckVCs(void); + char * name = "cm_IPAddrDaemon_ShutdownEvent"; + + cm_IPAddrDaemon_ShutdownEvent = thrd_CreateEvent(NULL, FALSE, FALSE, name); + if ( GetLastError() == ERROR_ALREADY_EXISTS ) + afsi_log("Event Object Already Exists: %s", name); rx_StartClientThread(); while (daemon_ShutdownFlag == 0) { ! DWORD Result; ! ! thrd_SetEvent(cm_IPAddrDaemon_ShutdownEvent); ! Result = NotifyAddrChange(NULL,NULL); ! if (Result == NO_ERROR && daemon_ShutdownFlag == 0) { ! thrd_ResetEvent(cm_IPAddrDaemon_ShutdownEvent); Sleep(2500); ! if (daemon_ShutdownFlag == 0) { ! osi_Log0(afsd_logp, "cm_IpAddrDaemon CheckDownServers"); ! cm_CheckServers(CM_FLAG_CHECKVLDBSERVERS | CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL); ! cm_ForceNewConnectionsAllServers(); ! cm_CheckServers(CM_FLAG_CHECKFILESERVERS | CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL); ! smb_CheckVCs(); ! cm_VolStatus_Network_Addr_Change(); ! } } } + + thrd_SetEvent(cm_IPAddrDaemon_ShutdownEvent); } #endif ! void cm_BkgDaemon(void * parm) { cm_bkgRequest_t *rp; afs_int32 code; + char name[32] = ""; + long daemonID = (long)parm; + + snprintf(name, sizeof(name), "cm_BkgDaemon_ShutdownEvent%d", daemonID); + + cm_BkgDaemon_ShutdownEvent[daemonID] = thrd_CreateEvent(NULL, FALSE, FALSE, name); + if ( GetLastError() == ERROR_ALREADY_EXISTS ) + afsi_log("Event Object Already Exists: %s", name); rx_StartClientThread(); *************** *** 144,149 **** --- 171,179 ---- } } lock_ReleaseWrite(&cm_daemonLock); + + thrd_SetEvent(cm_BkgDaemon_ShutdownEvent[daemonID]); + } void cm_QueueBKGRequest(cm_scache_t *scp, cm_bkgProc_t *procp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4, *************** *** 322,329 **** --- 352,364 ---- unsigned long code; struct hostent *thp; HMODULE hHookDll; + char * name = "cm_Daemon_ShutdownEvent"; int configureFirewall = IsWindowsFirewallPresent(); + cm_Daemon_ShutdownEvent = thrd_CreateEvent(NULL, FALSE, FALSE, name); + if ( GetLastError() == ERROR_ALREADY_EXISTS ) + afsi_log("Event Object Already Exists: %s", name); + if (!configureFirewall) { afsi_log("No Windows Firewall detected"); } *************** *** 368,374 **** smb_RestartListeners(); if (daemon_ShutdownFlag == 1) ! return; if (configureFirewall) { /* Open Microsoft Firewall to allow in port 7001 */ --- 403,409 ---- smb_RestartListeners(); if (daemon_ShutdownFlag == 1) ! break; if (configureFirewall) { /* Open Microsoft Firewall to allow in port 7001 */ *************** *** 401,407 **** osi_Log0(afsd_logp, "cm_Daemon CheckDownServers"); cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 436,442 ---- osi_Log0(afsd_logp, "cm_Daemon CheckDownServers"); cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 412,418 **** osi_Log0(afsd_logp, "cm_Daemon CheckUpServers"); cm_CheckServers(CM_FLAG_CHECKUPSERVERS, NULL); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 447,453 ---- osi_Log0(afsd_logp, "cm_Daemon CheckUpServers"); cm_CheckServers(CM_FLAG_CHECKUPSERVERS, NULL); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 421,427 **** lastVolCheck = now; cm_RefreshVolumes(); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 456,462 ---- lastVolCheck = now; cm_RefreshVolumes(); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 431,437 **** lastVolCBRenewalCheck = now; cm_VolumeRenewROCallbacks(); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 466,472 ---- lastVolCBRenewalCheck = now; cm_VolumeRenewROCallbacks(); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 440,446 **** lastVolCheck = now; cm_CheckOfflineVolumes(); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 475,481 ---- lastVolCheck = now; cm_CheckOfflineVolumes(); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 449,455 **** lastCBExpirationCheck = now; cm_CheckCBExpiration(); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 484,490 ---- lastCBExpirationCheck = now; cm_CheckCBExpiration(); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 458,464 **** lastLockCheck = now; cm_CheckLocks(); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 493,499 ---- lastLockCheck = now; cm_CheckLocks(); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 467,473 **** lastTokenCacheCheck = now; cm_CheckTokenCache(now); if (daemon_ShutdownFlag == 1) ! return; now = osi_Time(); } --- 502,508 ---- lastTokenCacheCheck = now; cm_CheckTokenCache(now); if (daemon_ShutdownFlag == 1) ! break; now = osi_Time(); } *************** *** 490,504 **** } } ! if (daemon_ShutdownFlag == 1) ! return; thrd_Sleep(30 * 1000); /* sleep 30 seconds */ } } void cm_DaemonShutdown(void) { daemon_ShutdownFlag = 1; } void cm_InitDaemon(int nDaemons) --- 525,557 ---- } } ! if (daemon_ShutdownFlag == 1) { ! break; ! } thrd_Sleep(30 * 1000); /* sleep 30 seconds */ } + thrd_SetEvent(cm_Daemon_ShutdownEvent); } void cm_DaemonShutdown(void) { + int i; + DWORD code; + daemon_ShutdownFlag = 1; + osi_Wakeup((LONG_PTR) &cm_bkgListp); + + /* wait for shutdown */ + if (cm_Daemon_ShutdownEvent) + code = thrd_WaitForSingleObject_Event(cm_Daemon_ShutdownEvent, INFINITE); + + for ( i=0; i CM_MAX_DAEMONS) ? CM_MAX_DAEMONS : nDaemons; ! if (osi_Once(&once)) { lock_InitializeRWLock(&cm_daemonLock, "cm_daemonLock"); osi_EndOnce(&once); *************** *** 526,534 **** osi_assertx(phandle != NULL, "cm_Daemon thread creation failure"); thrd_CloseHandle(phandle); ! for(i=0; i < nDaemons; i++) { phandle = thrd_Create((SecurityAttrib) 0, 0, ! (ThreadFunc) cm_BkgDaemon, 0, 0, &pid, "cm_BkgDaemon"); osi_assertx(phandle != NULL, "cm_BkgDaemon thread creation failure"); thrd_CloseHandle(phandle); --- 581,589 ---- osi_assertx(phandle != NULL, "cm_Daemon thread creation failure"); thrd_CloseHandle(phandle); ! for(i=0; i < cm_nDaemons; i++) { phandle = thrd_Create((SecurityAttrib) 0, 0, ! (ThreadFunc) cm_BkgDaemon, (LPVOID)i, 0, &pid, "cm_BkgDaemon"); osi_assertx(phandle != NULL, "cm_BkgDaemon thread creation failure"); thrd_CloseHandle(phandle); Index: openafs/src/WINNT/afsd/cm_daemon.h diff -c openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.2 openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.3 *** openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.2 Sat Feb 3 21:46:25 2007 --- openafs/src/WINNT/afsd/cm_daemon.h Mon Dec 24 00:24:14 2007 *************** *** 41,44 **** --- 41,46 ---- extern void cm_QueueBKGRequest(cm_scache_t *scp, cm_bkgProc_t *procp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4, cm_user_t *userp); + #define CM_MAX_DAEMONS 8 + #endif /* __CM_DAEMON_H_ENV_ */ Index: openafs/src/WINNT/afsd/cm_dcache.c diff -c openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.22 openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.23 *** openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.22 Wed Nov 14 12:19:41 2007 --- openafs/src/WINNT/afsd/cm_dcache.c Fri Dec 28 02:26:00 2007 *************** *** 696,702 **** lock_ReleaseMutex(&scp->mx); mxheld = 0; } ! code = buf_Get(scp, &base, &bp); if (!mxheld) { lock_ObtainMutex(&scp->mx); mxheld = 1; --- 696,702 ---- lock_ReleaseMutex(&scp->mx); mxheld = 0; } ! code = buf_Get(scp, &offset, &bp); if (!mxheld) { lock_ObtainMutex(&scp->mx); mxheld = 1; *************** *** 1356,1361 **** --- 1356,1366 ---- osi_Log1(afsd_logp,"GetBuffer returns cm_data.rootSCachep=%x",cm_data.rootSCachep); #endif + if (cm_HaveCallback(scp) && bufp->dataVersion == scp->dataVersion) { + /* We already have this buffer don't do extra work */ + return 0; + } + cm_AFSFidFromFid(&tfid, &scp->fid); code = cm_SetupFetchBIOD(scp, &bufp->offset, &biod, userp, reqp); Index: openafs/src/WINNT/afsd/cm_freelance.h diff -c openafs/src/WINNT/afsd/cm_freelance.h:1.12 openafs/src/WINNT/afsd/cm_freelance.h:1.12.6.1 *** openafs/src/WINNT/afsd/cm_freelance.h:1.12 Fri Mar 11 00:33:22 2005 --- openafs/src/WINNT/afsd/cm_freelance.h Sat Dec 22 22:39:59 2007 *************** *** 6,12 **** char* namep; char* mountPointStringp; unsigned int fileType; - struct cm_localMountPoint* next; } cm_localMountPoint_t; extern int cm_getNoLocalMountPoints(); --- 6,11 ---- Index: openafs/src/WINNT/afsd/cm_ioctl.c diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.27 openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.28 *** openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.27 Sun Nov 4 19:24:46 2007 --- openafs/src/WINNT/afsd/cm_ioctl.c Sat Dec 22 22:44:58 2007 *************** *** 1922,1934 **** scp->fileType == CM_SCACHETYPE_DFSLINK || code == CM_ERROR_NOSUCHPATH && scp->fileType == CM_SCACHETYPE_INVALID) { cp = ioctlp->outDatap; ! StringCbCopyA(cp, SMB_IOCTL_MAXDATA - (cp - ioctlp->outAllocp), spacep->data); cp += strlen(cp) + 1; ioctlp->outDatap = cp; - cm_FreeSpace(spacep); - if (newRootScp != NULL) - cm_ReleaseSCache(newRootScp); code = 0; } --- 1922,1932 ---- scp->fileType == CM_SCACHETYPE_DFSLINK || code == CM_ERROR_NOSUCHPATH && scp->fileType == CM_SCACHETYPE_INVALID) { + cp = ioctlp->outDatap; ! StringCbCopyA(cp, SMB_IOCTL_MAXDATA - (cp - ioctlp->outAllocp), scp->mountPointStringp); cp += strlen(cp) + 1; ioctlp->outDatap = cp; code = 0; } Index: openafs/src/WINNT/afsd/cm_scache.c diff -c openafs/src/WINNT/afsd/cm_scache.c:1.35.2.50 openafs/src/WINNT/afsd/cm_scache.c:1.35.2.54 *** openafs/src/WINNT/afsd/cm_scache.c:1.35.2.50 Wed Nov 14 12:19:41 2007 --- openafs/src/WINNT/afsd/cm_scache.c Fri Dec 28 10:47:43 2007 *************** *** 494,500 **** * without network, the stat cache item will still be * considered valid. */ ! now = osi_Time(); lock_ObtainWrite(&cm_scacheLock); for ( scp = cm_data.allSCachesp; scp; scp = scp->allNextp ) { --- 494,500 ---- * without network, the stat cache item will still be * considered valid. */ ! now = time(NULL); lock_ObtainWrite(&cm_scacheLock); for ( scp = cm_data.allSCachesp; scp; scp = scp->allNextp ) { *************** *** 640,646 **** long code; cm_volume_t *volp = NULL; cm_cell_t *cellp; - char* mp = NULL; int special; // yj: boolean variable to test if file is on root.afs int isRoot; extern cm_fid_t cm_rootFid; --- 640,645 ---- *************** *** 697,710 **** } if (cm_freelanceEnabled && special) { osi_Log0(afsd_logp,"cm_GetSCache Freelance and special"); ! if (fidp->vnode > 1 && fidp->vnode <= cm_noLocalMountPoints + 2) { ! lock_ObtainMutex(&cm_Freelance_Lock); ! mp =(cm_localMountPoints+fidp->vnode-2)->mountPointStringp; ! lock_ReleaseMutex(&cm_Freelance_Lock); } else { ! mp = ""; } scp = cm_GetNewSCache(); if (scp == NULL) { osi_Log0(afsd_logp,"cm_GetSCache unable to obtain *new* scache entry"); --- 696,719 ---- } if (cm_freelanceEnabled && special) { + char mp[MOUNTPOINTLEN] = ""; + afs_uint32 fileType; + osi_Log0(afsd_logp,"cm_GetSCache Freelance and special"); ! lock_ObtainMutex(&cm_Freelance_Lock); ! if (fidp->vnode >= 2 && fidp->vnode - 2 < cm_noLocalMountPoints) { ! strncpy(mp,(cm_localMountPoints+fidp->vnode-2)->mountPointStringp, MOUNTPOINTLEN); ! mp[MOUNTPOINTLEN-1] = '\0'; ! if ( !strnicmp(mp, "msdfs:", strlen("msdfs:")) ) ! fileType = CM_SCACHETYPE_DFSLINK; ! else ! fileType = (cm_localMountPoints+fidp->vnode-2)->fileType; } else { ! fileType = CM_SCACHETYPE_INVALID; ! } + lock_ReleaseMutex(&cm_Freelance_Lock); + scp = cm_GetNewSCache(); if (scp == NULL) { osi_Log0(afsd_logp,"cm_GetSCache unable to obtain *new* scache entry"); *************** *** 735,752 **** scp->flags |= CM_SCACHEFLAG_INHASH; scp->refCount = 1; osi_Log1(afsd_logp,"cm_GetSCache (freelance) sets refCount to 1 scp 0x%x", scp); ! if (fidp->vnode > 1 && fidp->vnode <= cm_noLocalMountPoints + 2) ! scp->fileType = (cm_localMountPoints+fidp->vnode-2)->fileType; ! else ! scp->fileType = CM_SCACHETYPE_INVALID; ! ! lock_ObtainMutex(&cm_Freelance_Lock); scp->length.LowPart = (DWORD)strlen(mp)+4; scp->length.HighPart = 0; strncpy(scp->mountPointStringp,mp,MOUNTPOINTLEN); - scp->mountPointStringp[MOUNTPOINTLEN-1] = '\0'; - lock_ReleaseMutex(&cm_Freelance_Lock); - scp->owner=0x0; scp->unixModeBits=0777; scp->clientModTime=FakeFreelanceModTime; --- 744,753 ---- scp->flags |= CM_SCACHEFLAG_INHASH; scp->refCount = 1; osi_Log1(afsd_logp,"cm_GetSCache (freelance) sets refCount to 1 scp 0x%x", scp); ! scp->fileType = fileType; scp->length.LowPart = (DWORD)strlen(mp)+4; scp->length.HighPart = 0; strncpy(scp->mountPointStringp,mp,MOUNTPOINTLEN); scp->owner=0x0; scp->unixModeBits=0777; scp->clientModTime=FakeFreelanceModTime; *************** *** 1277,1298 **** scp->waitCount = scp->waitRequests = 1; } - if (bufLocked) - lock_ReleaseMutex(&bufp->mx); - cm_SyncOpAddToWaitQueue(scp, flags, bufp); wakeupCycle = 0; do { ! if (wakeupCycle++ != 0) ! lock_ObtainMutex(&scp->mx); osi_SleepM((LONG_PTR) &scp->flags, &scp->mx); } while (!cm_SyncOpCheckContinue(scp, flags, bufp)); smb_UpdateServerPriority(); - if (bufLocked) - lock_ObtainMutex(&bufp->mx); - lock_ObtainMutex(&scp->mx); scp->waitCount--; osi_Log3(afsd_logp, "CM SyncOp woke! scp 0x%p; still waiting %d threads of %d requests", scp, scp->waitCount, scp->waitRequests); --- 1278,1296 ---- scp->waitCount = scp->waitRequests = 1; } cm_SyncOpAddToWaitQueue(scp, flags, bufp); wakeupCycle = 0; do { ! if (bufLocked) ! lock_ReleaseMutex(&bufp->mx); osi_SleepM((LONG_PTR) &scp->flags, &scp->mx); + if (bufLocked) + lock_ObtainMutex(&bufp->mx); + lock_ObtainMutex(&scp->mx); } while (!cm_SyncOpCheckContinue(scp, flags, bufp)); smb_UpdateServerPriority(); scp->waitCount--; osi_Log3(afsd_logp, "CM SyncOp woke! scp 0x%p; still waiting %d threads of %d requests", scp, scp->waitCount, scp->waitRequests); *************** *** 1504,1510 **** statusp->Group = 0; statusp->SyncCounter = 0; statusp->dataVersionHigh = (afs_uint32)(cm_data.fakeDirVersion >> 32); ! statusp->errorCode = 0; } #endif /* AFS_FREELANCE_CLIENT */ --- 1502,1510 ---- statusp->Group = 0; statusp->SyncCounter = 0; statusp->dataVersionHigh = (afs_uint32)(cm_data.fakeDirVersion >> 32); ! statusp->errorCode = 0; ! ! buf_ForceDataVersion(scp, scp->dataVersion, cm_data.fakeDirVersion); } #endif /* AFS_FREELANCE_CLIENT */ *************** *** 1637,1651 **** } if ((flags & CM_MERGEFLAG_STOREDATA) && dataVersion - scp->dataVersion == 1) { ! cm_buf_t *bp; ! ! for (bp = cm_data.buf_fileHashTablepp[BUF_FILEHASH(&scp->fid)]; bp; bp=bp->fileHashp) { ! if (cm_FidCmp(&scp->fid, &bp->fid) == 0 && ! bp->dataVersion == scp->dataVersion) ! bp->dataVersion = dataVersion; } } scp->dataVersion = dataVersion; } --- 1637,1690 ---- } if ((flags & CM_MERGEFLAG_STOREDATA) && dataVersion - scp->dataVersion == 1) { ! buf_ForceDataVersion(scp, scp->dataVersion, dataVersion); ! } else if (scp->dataVersion != 0 && ! (!(flags & CM_MERGEFLAG_DIROP) && dataVersion != scp->dataVersion || ! (flags & CM_MERGEFLAG_DIROP) && dataVersion - scp->dataVersion > 1)) { ! /* ! * We now know that all of the data buffers that we have associated ! * with this scp are invalid. Subsequent operations will go faster ! * if the buffers are removed from the hash tables. ! * ! * We do not remove directory buffers if the dataVersion delta is 1 because ! * those version numbers will be updated as part of the directory operation. ! */ ! int i, j; ! cm_buf_t **lbpp; ! cm_buf_t *tbp; ! cm_buf_t *bp, *prevBp, *nextBp; ! ! lock_ObtainWrite(&buf_globalLock); ! i = BUF_FILEHASH(&scp->fid); ! for (bp = cm_data.buf_fileHashTablepp[i]; bp; bp=nextBp) { ! nextBp = bp->fileHashp; ! ! if (cm_FidCmp(&scp->fid, &bp->fid) == 0) { ! prevBp = bp->fileHashBackp; ! bp->fileHashBackp = bp->fileHashp = NULL; ! if (prevBp) ! prevBp->fileHashp = nextBp; ! else ! cm_data.buf_fileHashTablepp[i] = nextBp; ! if (nextBp) ! nextBp->fileHashBackp = prevBp; ! ! j = BUF_HASH(&bp->fid, &bp->offset); ! lbpp = &(cm_data.buf_scacheHashTablepp[j]); ! for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = *lbpp) { ! if (tbp == bp) ! break; ! } ! ! *lbpp = bp->hashp; /* hash out */ ! bp->hashp = NULL; ! ! bp->flags &= ~CM_BUF_INHASH; ! } } + lock_ReleaseWrite(&buf_globalLock); } scp->dataVersion = dataVersion; } *************** *** 1671,1676 **** --- 1710,1718 ---- cm_dnlcPurgevp(scp); cm_FreeAllACLEnts(scp); + if (scp->fileType == CM_SCACHETYPE_DFSLINK) + cm_VolStatus_Invalidate_DFS_Mapping(scp); + /* Force mount points and symlinks to be re-evaluated */ scp->mountPointStringp[0] = '\0'; } Index: openafs/src/WINNT/afsd/cm_scache.h diff -c openafs/src/WINNT/afsd/cm_scache.h:1.21.2.17 openafs/src/WINNT/afsd/cm_scache.h:1.21.2.19 *** openafs/src/WINNT/afsd/cm_scache.h:1.21.2.17 Wed Nov 14 01:23:33 2007 --- openafs/src/WINNT/afsd/cm_scache.h Fri Dec 28 10:47:43 2007 *************** *** 307,312 **** --- 307,313 ---- * in old info. */ #define CM_MERGEFLAG_STOREDATA 2 /* Merge due to storedata op */ + #define CM_MERGEFLAG_DIROP 4 /* Merge due to directory op */ /* hash define. Must not include the cell, since the callback revocation code * doesn't necessarily know the cell in the case of a multihomed server *************** *** 318,335 **** (fidp)->unique)) \ % cm_data.scacheHashTableSize) typedef struct cm_scache_waiter { osi_queue_t q; afs_int32 threadId; cm_scache_t *scp; afs_int32 flags; ! void *bufp; } cm_scache_waiter_t; - #include "cm_conn.h" - #include "cm_buf.h" - extern void cm_InitSCache(int, long); #ifdef DEBUG_REFCOUNT --- 319,336 ---- (fidp)->unique)) \ % cm_data.scacheHashTableSize) + #include "cm_conn.h" + #include "cm_buf.h" + typedef struct cm_scache_waiter { osi_queue_t q; afs_int32 threadId; cm_scache_t *scp; afs_int32 flags; ! cm_buf_t *bufp; } cm_scache_waiter_t; extern void cm_InitSCache(int, long); #ifdef DEBUG_REFCOUNT Index: openafs/src/WINNT/afsd/cm_server.c diff -c openafs/src/WINNT/afsd/cm_server.c:1.25.2.14 openafs/src/WINNT/afsd/cm_server.c:1.25.2.16 *** openafs/src/WINNT/afsd/cm_server.c:1.25.2.14 Sun Nov 4 19:24:46 2007 --- openafs/src/WINNT/afsd/cm_server.c Mon Dec 24 00:30:37 2007 *************** *** 35,47 **** { cm_server_t *tsp; ! lock_ObtainRead(&cm_serverLock); for (tsp = cm_allServersp; tsp; tsp = tsp->allNextp) { cm_GetServerNoLock(tsp); cm_ForceNewConnections(tsp); cm_PutServerNoLock(tsp); } ! lock_ReleaseRead(&cm_serverLock); } void --- 35,47 ---- { cm_server_t *tsp; ! lock_ObtainWrite(&cm_serverLock); for (tsp = cm_allServersp; tsp; tsp = tsp->allNextp) { cm_GetServerNoLock(tsp); cm_ForceNewConnections(tsp); cm_PutServerNoLock(tsp); } ! lock_ReleaseWrite(&cm_serverLock); } void *************** *** 133,139 **** cm_volume_t * volp; int i; - lock_ReleaseMutex(&tsp->mx); for (tsrvp = tsp->vols; tsrvp; tsrvp = tsrvp->nextp) { for (i=0; iids[i] != 0) { --- 133,138 ---- *************** *** 148,154 **** } } } - lock_ObtainMutex(&tsp->mx); } } else { /* mark server as down */ --- 147,152 ---- *************** *** 170,176 **** cm_volume_t * volp; int i; - lock_ReleaseMutex(&tsp->mx); for (tsrvp = tsp->vols; tsrvp; tsrvp = tsrvp->nextp) { for (i=0; iids[i] != 0) { --- 168,173 ---- *************** *** 185,191 **** } } } - lock_ObtainMutex(&tsp->mx); } } --- 182,187 ---- Index: openafs/src/WINNT/afsd/cm_vnodeops.c diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.47 openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.49 *** openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.47 Fri Dec 7 11:05:23 2007 --- openafs/src/WINNT/afsd/cm_vnodeops.c Sat Dec 22 23:52:58 2007 *************** *** 476,482 **** long code; osi_hyper_t thyper; cm_buf_t *bufferp; ! cm_dirEntry_t *dep; unsigned short *hashTable; unsigned int i, idx; int BeyondPage = 0, HaveDot = 0, HaveDotDot = 0; --- 476,482 ---- long code; osi_hyper_t thyper; cm_buf_t *bufferp; ! cm_dirEntry_t *dep = 0; unsigned short *hashTable; unsigned int i, idx; int BeyondPage = 0, HaveDot = 0, HaveDotDot = 0; *************** *** 575,581 **** { char *tp; long code; ! cm_dirEntry_t *dep; cm_buf_t *bufferp; long temp; osi_hyper_t dirLength; --- 575,581 ---- { char *tp; long code; ! cm_dirEntry_t *dep = 0; cm_buf_t *bufferp; long temp; osi_hyper_t dirLength; *************** *** 1646,1652 **** cm_dnlcRemove(dscp, namep); cm_SyncOpDone(dscp, NULL, sflags); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &newDirStatus, &volSync, userp, 0); } else if (code == CM_ERROR_NOSUCHFILE) { /* windows would not have allowed the request to delete the file * if it did not believe the file existed. therefore, we must --- 1646,1652 ---- cm_dnlcRemove(dscp, namep); cm_SyncOpDone(dscp, NULL, sflags); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &newDirStatus, &volSync, userp, CM_MERGEFLAG_DIROP); } else if (code == CM_ERROR_NOSUCHFILE) { /* windows would not have allowed the request to delete the file * if it did not believe the file existed. therefore, we must *************** *** 1719,1724 **** --- 1719,1727 ---- if (!linkScp->mountPointStringp[0]) { strncpy(linkScp->mountPointStringp, bufp->datap, temp); linkScp->mountPointStringp[temp] = 0; /* null terminate */ + + if ( !strnicmp(linkScp->mountPointStringp, "msdfs:", strlen("msdfs:")) ) + linkScp->fileType = CM_SCACHETYPE_DFSLINK; } buf_Release(bufp); } /* don't have sym link contents cached */ *************** *** 1741,1749 **** char *linkp; cm_space_t *tsp; lock_ObtainMutex(&linkScp->mx); code = cm_HandleLink(linkScp, userp, reqp); ! if (code) goto done; /* if we may overflow the buffer, bail out; buffer is signficantly --- 1744,1755 ---- char *linkp; cm_space_t *tsp; + *newRootScpp = NULL; + *newSpaceBufferp = NULL; + lock_ObtainMutex(&linkScp->mx); code = cm_HandleLink(linkScp, userp, reqp); ! if (code) goto done; /* if we may overflow the buffer, bail out; buffer is signficantly *************** *** 1780,1792 **** } else { linkScp->fileType = CM_SCACHETYPE_DFSLINK; strcpy(tsp->data, linkp); - *newRootScpp = NULL; code = CM_ERROR_PATH_NOT_COVERED; } ! } else if ( !strnicmp(linkp, "msdfs:", (len = (long)strlen("msdfs:"))) ) { linkScp->fileType = CM_SCACHETYPE_DFSLINK; strcpy(tsp->data, linkp); - *newRootScpp = NULL; code = CM_ERROR_PATH_NOT_COVERED; } else if (*linkp == '\\' || *linkp == '/') { #if 0 --- 1786,1797 ---- } else { linkScp->fileType = CM_SCACHETYPE_DFSLINK; strcpy(tsp->data, linkp); code = CM_ERROR_PATH_NOT_COVERED; } ! } else if ( linkScp->fileType == CM_SCACHETYPE_DFSLINK || ! !strnicmp(linkp, "msdfs:", (len = (long)strlen("msdfs:"))) ) { linkScp->fileType = CM_SCACHETYPE_DFSLINK; strcpy(tsp->data, linkp); code = CM_ERROR_PATH_NOT_COVERED; } else if (*linkp == '\\' || *linkp == '/') { #if 0 *************** *** 1802,1820 **** */ linkScp->fileType = CM_SCACHETYPE_INVALID; strcpy(tsp->data, linkp); - *newRootScpp = NULL; code = CM_ERROR_NOSUCHPATH; #endif } else { /* a relative link */ strcpy(tsp->data, linkp); - *newRootScpp = NULL; } if (pathSuffixp[0] != 0) { /* if suffix string is non-null */ strcat(tsp->data, "\\"); strcat(tsp->data, pathSuffixp); } ! *newSpaceBufferp = tsp; done: lock_ReleaseMutex(&linkScp->mx); --- 1807,1830 ---- */ linkScp->fileType = CM_SCACHETYPE_INVALID; strcpy(tsp->data, linkp); code = CM_ERROR_NOSUCHPATH; #endif } else { /* a relative link */ strcpy(tsp->data, linkp); } if (pathSuffixp[0] != 0) { /* if suffix string is non-null */ strcat(tsp->data, "\\"); strcat(tsp->data, pathSuffixp); } ! if (code == 0) ! *newSpaceBufferp = tsp; ! else { ! cm_FreeSpace(tsp); ! ! if (code == CM_ERROR_PATH_NOT_COVERED && reqp->tidPathp && reqp->relPathp) ! cm_VolStatus_Notify_DFS_Mapping(linkScp, reqp->tidPathp, reqp->relPathp); ! } done: lock_ReleaseMutex(&linkScp->mx); *************** *** 2716,2722 **** lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0); } lock_ReleaseMutex(&dscp->mx); --- 2726,2732 ---- lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, CM_MERGEFLAG_DIROP); } lock_ReleaseMutex(&dscp->mx); *************** *** 2866,2872 **** lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0); } lock_ReleaseMutex(&dscp->mx); --- 2876,2882 ---- lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, CM_MERGEFLAG_DIROP); } lock_ReleaseMutex(&dscp->mx); *************** *** 2976,2982 **** lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0); } lock_ReleaseMutex(&dscp->mx); --- 2986,2992 ---- lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, CM_MERGEFLAG_DIROP); } lock_ReleaseMutex(&dscp->mx); *************** *** 3058,3064 **** lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0); } lock_ReleaseMutex(&dscp->mx); --- 3068,3074 ---- lock_ObtainMutex(&dscp->mx); cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, CM_MERGEFLAG_DIROP); } lock_ReleaseMutex(&dscp->mx); *************** *** 3162,3168 **** cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { cm_dnlcRemove(dscp, namep); ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0); } lock_ReleaseMutex(&dscp->mx); --- 3172,3178 ---- cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) { cm_dnlcRemove(dscp, namep); ! cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, CM_MERGEFLAG_DIROP); } lock_ReleaseMutex(&dscp->mx); *************** *** 3357,3363 **** if (code == 0) cm_MergeStatus(NULL, oldDscp, &updatedOldDirStatus, &volSync, ! userp, 0); lock_ReleaseMutex(&oldDscp->mx); if (code == 0) { --- 3367,3373 ---- if (code == 0) cm_MergeStatus(NULL, oldDscp, &updatedOldDirStatus, &volSync, ! userp, CM_MERGEFLAG_DIROP); lock_ReleaseMutex(&oldDscp->mx); if (code == 0) { *************** *** 3400,3406 **** cm_SyncOpDone(newDscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) cm_MergeStatus(NULL, newDscp, &updatedNewDirStatus, &volSync, ! userp, 0); lock_ReleaseMutex(&newDscp->mx); if (code == 0) { --- 3410,3416 ---- cm_SyncOpDone(newDscp, NULL, CM_SCACHESYNC_STOREDATA); if (code == 0) cm_MergeStatus(NULL, newDscp, &updatedNewDirStatus, &volSync, ! userp, CM_MERGEFLAG_DIROP); lock_ReleaseMutex(&newDscp->mx); if (code == 0) { Index: openafs/src/WINNT/afsd/cm_vnodeops.h diff -c openafs/src/WINNT/afsd/cm_vnodeops.h:1.14.4.6 openafs/src/WINNT/afsd/cm_vnodeops.h:1.14.4.7 *** openafs/src/WINNT/afsd/cm_vnodeops.h:1.14.4.6 Fri Dec 7 11:05:24 2007 --- openafs/src/WINNT/afsd/cm_vnodeops.h Sat Dec 22 23:52:58 2007 *************** *** 189,194 **** --- 189,198 ---- extern long cm_EvaluateSymLink(cm_scache_t *dscp, cm_scache_t *linkScp, cm_scache_t **outScpp, cm_user_t *userp, cm_req_t *reqp); + extern long cm_FollowMountPoint(cm_scache_t *scp, cm_scache_t *dscp, cm_user_t *userp, + cm_req_t *reqp, cm_scache_t **outScpp); + + extern long cm_Lock(cm_scache_t *scp, unsigned char sLockType, LARGE_INTEGER LOffset, LARGE_INTEGER LLength, cm_key_t key, int allowWait, cm_user_t *userp, cm_req_t *reqp, Index: openafs/src/WINNT/afsd/cm_volstat.c diff -c openafs/src/WINNT/afsd/cm_volstat.c:1.1.2.3 openafs/src/WINNT/afsd/cm_volstat.c:1.1.2.4 *** openafs/src/WINNT/afsd/cm_volstat.c:1.1.2.3 Thu Nov 29 11:11:44 2007 --- openafs/src/WINNT/afsd/cm_volstat.c Sat Dec 22 23:52:58 2007 *************** *** 46,51 **** --- 46,59 ---- dll_VolStatus_Funcs_t dll_funcs; cm_VolStatus_Funcs_t cm_funcs; + static char volstat_NetbiosName[64] = ""; + + afs_uint32 + cm_VolStatus_Active(void) + { + return (hVolStatus != NULL); + } + /* This function is used to load any Volume Status Handlers * and their associated function pointers. */ *************** *** 64,69 **** --- 72,83 ---- dummyLen = sizeof(wd); code = RegQueryValueEx(parmKey, "VolStatusHandler", NULL, NULL, (BYTE *) &wd, &dummyLen); + + if (code == 0) { + dummyLen = sizeof(volstat_NetbiosName); + code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL, + (BYTE *)volstat_NetbiosName, &dummyLen); + } RegCloseKey (parmKey); } *************** *** 76,81 **** --- 90,96 ---- cm_funcs.cm_VolStatus_Path_To_ID = cm_VolStatus_Path_To_ID; cm_funcs.cm_VolStatus_Path_To_DFSlink = cm_VolStatus_Path_To_DFSlink; + dll_funcs.version = DLL_VOLSTATUS_FUNCS_VERSION; code = dll_VolStatus_Initialization(&dll_funcs, &cm_funcs); } *************** *** 87,92 **** --- 102,109 ---- } } + osi_Log1(afsd_logp,"cm_VolStatus_Initialization 0x%x", code); + return code; } *************** *** 96,101 **** --- 113,120 ---- long cm_VolStatus_Finalize(void) { + osi_Log1(afsd_logp,"cm_VolStatus_Finalize handle 0x%x", hVolStatus); + if (hVolStatus == NULL) return 0; *************** *** 113,118 **** --- 132,139 ---- { long code = 0; + osi_Log1(afsd_logp,"cm_VolStatus_Service_Started handle 0x%x", hVolStatus); + if (hVolStatus == NULL) return 0; *************** *** 131,136 **** --- 152,159 ---- { long code = 0; + osi_Log1(afsd_logp,"cm_VolStatus_Service_Stopped handle 0x%x", hVolStatus); + if (hVolStatus == NULL) return 0; *************** *** 225,246 **** } long __fastcall ! cm_VolStatus_Path_To_ID(const char * share, const char * path, afs_uint32 * cellID, afs_uint32 * volID) { ! afs_uint32 code; cm_req_t req; cm_scache_t *scp; if (cellID == NULL || volID == NULL) return CM_ERROR_INVAL; ! cm_InitReq(&req); ! code = cm_NameI(cm_data.rootSCachep, (char *)path, CM_FLAG_FOLLOW, cm_rootUserp, (char *)share, &req, &scp); if (code) ! return code; lock_ObtainMutex(&scp->mx); code = cm_SyncOp(scp, NULL,cm_rootUserp, &req, 0, --- 248,315 ---- } + + long + cm_VolStatus_Notify_DFS_Mapping(cm_scache_t *scp, char *tidPathp, char *pathp) + { + long code = 0; + char src[1024], *p; + size_t len; + + if (hVolStatus == NULL || dll_funcs.version < 2) + return 0; + + snprintf(src,sizeof(src), "\\\\%s%s", volstat_NetbiosName, tidPathp); + len = strlen(src); + if ((src[len-1] == '\\' || src[len-1] == '/') && + (pathp[0] == '\\' || pathp[0] == '/')) + strncat(src, &pathp[1], sizeof(src)); + else + strncat(src, pathp, sizeof(src)); + + for ( p=src; *p; p++ ) { + if (*p == '/') + *p = '\\'; + } + + code = dll_funcs.dll_VolStatus_Notify_DFS_Mapping(scp->fid.cell, scp->fid.volume, scp->fid.vnode, scp->fid.unique, + src, scp->mountPointStringp); + + return code; + } + + long + cm_VolStatus_Invalidate_DFS_Mapping(cm_scache_t *scp) + { + long code = 0; + + if (hVolStatus == NULL || dll_funcs.version < 2) + return 0; + + code = dll_funcs.dll_VolStatus_Invalidate_DFS_Mapping(scp->fid.cell, scp->fid.volume, scp->fid.vnode, scp->fid.unique); + + return code; + } + + long __fastcall ! cm_VolStatus_Path_To_ID(const char * share, const char * path, afs_uint32 * cellID, afs_uint32 * volID, enum volstatus *pstatus) { ! afs_uint32 code = 0; cm_req_t req; cm_scache_t *scp; if (cellID == NULL || volID == NULL) return CM_ERROR_INVAL; ! osi_Log2(afsd_logp,"cm_VolStatus_Path_To_ID share %s path %s", ! osi_LogSaveString(afsd_logp, (char *)share), osi_LogSaveString(afsd_logp, (char *)path)); + cm_InitReq(&req); ! code = cm_NameI(cm_data.rootSCachep, (char *)path, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, cm_rootUserp, (char *)share, &req, &scp); if (code) ! goto done; lock_ObtainMutex(&scp->mx); code = cm_SyncOp(scp, NULL,cm_rootUserp, &req, 0, *************** *** 248,271 **** if (code) { lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! return code; } cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); *cellID = scp->fid.cell; *volID = scp->fid.volume; lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! return 0; } long __fastcall cm_VolStatus_Path_To_DFSlink(const char * share, const char * path, afs_uint32 *pBufSize, char *pBuffer) { ! afs_uint32 code; cm_req_t req; cm_scache_t *scp; size_t len; --- 317,343 ---- if (code) { lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! goto done; } cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); *cellID = scp->fid.cell; *volID = scp->fid.volume; + *pstatus = cm_GetVolumeStatus(scp->volp, scp->fid.volume); lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! done: ! osi_Log1(afsd_logp,"cm_VolStatus_Path_To_ID code 0x%x",code); ! return code; } long __fastcall cm_VolStatus_Path_To_DFSlink(const char * share, const char * path, afs_uint32 *pBufSize, char *pBuffer) { ! afs_uint32 code = 0; cm_req_t req; cm_scache_t *scp; size_t len; *************** *** 273,283 **** if (pBufSize == NULL || (pBuffer == NULL && *pBufSize != 0)) return CM_ERROR_INVAL; cm_InitReq(&req); ! code = cm_NameI(cm_data.rootSCachep, (char *)path, CM_FLAG_FOLLOW, cm_rootUserp, (char *)share, &req, &scp); if (code) ! return code; lock_ObtainMutex(&scp->mx); code = cm_SyncOp(scp, NULL, cm_rootUserp, &req, 0, --- 345,359 ---- if (pBufSize == NULL || (pBuffer == NULL && *pBufSize != 0)) return CM_ERROR_INVAL; + osi_Log2(afsd_logp,"cm_VolStatus_Path_To_DFSlink share %s path %s", + osi_LogSaveString(afsd_logp, (char *)share), osi_LogSaveString(afsd_logp, (char *)path)); + cm_InitReq(&req); ! code = cm_NameI(cm_data.rootSCachep, (char *)path, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, ! cm_rootUserp, (char *)share, &req, &scp); if (code) ! goto done; lock_ObtainMutex(&scp->mx); code = cm_SyncOp(scp, NULL, cm_rootUserp, &req, 0, *************** *** 285,297 **** if (code) { lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! return code; } cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); ! if (scp->fileType != CM_SCACHETYPE_DFSLINK) ! return CM_ERROR_NOT_A_DFSLINK; len = strlen(scp->mountPointStringp) + 1; if (pBuffer == NULL) --- 361,375 ---- if (code) { lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! goto done; } cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); ! if (scp->fileType != CM_SCACHETYPE_DFSLINK) { ! code = CM_ERROR_NOT_A_DFSLINK; ! goto done; ! } len = strlen(scp->mountPointStringp) + 1; if (pBuffer == NULL) *************** *** 299,309 **** else if (*pBufSize >= len) { strcpy(pBuffer, scp->mountPointStringp); *pBufSize = len; ! } else code = CM_ERROR_TOOBIG; lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! return 0; } --- 377,391 ---- else if (*pBufSize >= len) { strcpy(pBuffer, scp->mountPointStringp); *pBufSize = len; ! } else { code = CM_ERROR_TOOBIG; + goto done; + } lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); ! done: ! osi_Log1(afsd_logp,"cm_VolStatus_Path_To_DFSlink code 0x%x",code); ! return code; } Index: openafs/src/WINNT/afsd/cm_volstat.h diff -c openafs/src/WINNT/afsd/cm_volstat.h:1.1.2.4 openafs/src/WINNT/afsd/cm_volstat.h:1.1.2.5 *** openafs/src/WINNT/afsd/cm_volstat.h:1.1.2.4 Thu Nov 29 11:11:44 2007 --- openafs/src/WINNT/afsd/cm_volstat.h Sat Dec 22 23:52:58 2007 *************** *** 55,79 **** extern long cm_VolStatus_Change_Notification(afs_uint32 cellID, afs_uint32 volID, enum volstatus status); ! extern long __fastcall cm_VolStatus_Path_To_ID(const char * share, const char * path, afs_uint32 * cellID, afs_uint32 * volID); extern long __fastcall cm_VolStatus_Path_To_DFSlink(const char * share, const char * path, afs_uint32 *pBufSize, char *pBuffer); ! #define DLL_VOLSTATUS_FUNCS_VERSION 1 typedef struct dll_VolStatus_Funcs { afs_uint32 version; long (__fastcall * dll_VolStatus_Service_Started)(void); long (__fastcall * dll_VolStatus_Service_Stopped)(void); long (__fastcall * dll_VolStatus_Network_Started)(const char *netbios32, const char *netbios64); long (__fastcall * dll_VolStatus_Network_Stopped)(const char *netbios32, const char *netbios64); long (__fastcall * dll_VolStatus_Network_Addr_Change)(void); long (__fastcall * dll_VolStatus_Change_Notification)(afs_uint32 cellID, afs_uint32 volID, enum volstatus status); } dll_VolStatus_Funcs_t; #define CM_VOLSTATUS_FUNCS_VERSION 1 typedef struct cm_VolStatus_Funcs { afs_uint32 version; ! long (__fastcall * cm_VolStatus_Path_To_ID)(const char * share, const char * path, afs_uint32 * cellID, afs_uint32 * volID); long (__fastcall * cm_VolStatus_Path_To_DFSlink)(const char * share, const char * path, afs_uint32 *pBufSize, char *pBuffer); } cm_VolStatus_Funcs_t; --- 55,90 ---- extern long cm_VolStatus_Change_Notification(afs_uint32 cellID, afs_uint32 volID, enum volstatus status); ! extern long __fastcall cm_VolStatus_Path_To_ID(const char * share, const char * path, afs_uint32 * cellID, afs_uint32 * volID, enum volstatus *pstatus); extern long __fastcall cm_VolStatus_Path_To_DFSlink(const char * share, const char * path, afs_uint32 *pBufSize, char *pBuffer); ! extern long cm_VolStatus_Notify_DFS_Mapping(cm_scache_t *scp, char *tidPathp, char *pathp); ! ! extern long cm_VolStatus_Invalidate_DFS_Mapping(cm_scache_t *scp); ! ! #define DLL_VOLSTATUS_FUNCS_VERSION 2 typedef struct dll_VolStatus_Funcs { afs_uint32 version; + /* version 1 */ long (__fastcall * dll_VolStatus_Service_Started)(void); long (__fastcall * dll_VolStatus_Service_Stopped)(void); long (__fastcall * dll_VolStatus_Network_Started)(const char *netbios32, const char *netbios64); long (__fastcall * dll_VolStatus_Network_Stopped)(const char *netbios32, const char *netbios64); long (__fastcall * dll_VolStatus_Network_Addr_Change)(void); long (__fastcall * dll_VolStatus_Change_Notification)(afs_uint32 cellID, afs_uint32 volID, enum volstatus status); + /* version 2 */ + long (__fastcall * dll_VolStatus_Notify_DFS_Mapping)(afs_uint32 cellID, afs_uint32 volID, + afs_uint32 vnodeID, afs_uint32 uniqID, + char *src, char *target); + long (__fastcall * dll_VolStatus_Invalidate_DFS_Mapping)(afs_uint32 cellID, afs_uint32 volID, + afs_uint32 vnodeID, afs_uint32 uniqID); } dll_VolStatus_Funcs_t; #define CM_VOLSTATUS_FUNCS_VERSION 1 typedef struct cm_VolStatus_Funcs { afs_uint32 version; ! long (__fastcall * cm_VolStatus_Path_To_ID)(const char * share, const char * path, afs_uint32 * cellID, afs_uint32 * volID, enum volstatus *pstatus); long (__fastcall * cm_VolStatus_Path_To_DFSlink)(const char * share, const char * path, afs_uint32 *pBufSize, char *pBuffer); } cm_VolStatus_Funcs_t; Index: openafs/src/WINNT/afsd/cm_volume.c diff -c openafs/src/WINNT/afsd/cm_volume.c:1.14.4.21 openafs/src/WINNT/afsd/cm_volume.c:1.14.4.22 *** openafs/src/WINNT/afsd/cm_volume.c:1.14.4.21 Sun Nov 11 22:25:55 2007 --- openafs/src/WINNT/afsd/cm_volume.c Mon Dec 24 00:19:09 2007 *************** *** 1119,1142 **** lock_ReleaseWrite(&cm_volumeLock); } ! void ! cm_UpdateVolumeStatus(cm_volume_t *volp, afs_uint32 volID) { - struct cm_vol_state * statep = NULL; enum volstatus newStatus; cm_serverRef_t *tsrp; cm_server_t *tsp; int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1; ! if (volp->rw.ID == volID) { ! statep = &volp->rw; ! } else if (volp->ro.ID == volID) { ! statep = &volp->ro; ! } else if (volp->bk.ID == volID) { ! statep = &volp->bk; ! } ! ! if (!statep) { #ifdef DEBUG DebugBreak(); #endif --- 1119,1134 ---- lock_ReleaseWrite(&cm_volumeLock); } ! ! static void ! cm_UpdateVolumeStatusInt(cm_volume_t *volp, struct cm_vol_state *statep) { enum volstatus newStatus; cm_serverRef_t *tsrp; cm_server_t *tsp; int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1; ! if (!volp || !statep) { #ifdef DEBUG DebugBreak(); #endif *************** *** 1173,1185 **** else newStatus = vl_online; - if (statep->ID && statep->state != newStatus) cm_VolumeStatusNotification(volp, statep->ID, statep->state, newStatus); statep->state = newStatus; } /* ** Finds all volumes that reside on this server and reorders their ** RO list according to the changed rank of server. --- 1165,1203 ---- else newStatus = vl_online; if (statep->ID && statep->state != newStatus) cm_VolumeStatusNotification(volp, statep->ID, statep->state, newStatus); statep->state = newStatus; } + void + cm_UpdateVolumeStatus(cm_volume_t *volp, afs_uint32 volID) + { + + if (volp->rw.ID == volID) { + cm_UpdateVolumeStatusInt(volp, &volp->rw); + } else if (volp->ro.ID == volID) { + cm_UpdateVolumeStatusInt(volp, &volp->ro); + } else if (volp->bk.ID == volID) { + cm_UpdateVolumeStatusInt(volp, &volp->bk); + } else { + /* + * If we are called with volID == 0 then something has gone wrong. + * Most likely a race occurred in the server volume list maintenance. + * Since we don't know which volume's status should be updated, + * just update all of them that are known to exist. Better to be + * correct than fast. + */ + if (volp->rw.ID != 0) + cm_UpdateVolumeStatusInt(volp, &volp->rw); + if (volp->ro.ID != 0) + cm_UpdateVolumeStatusInt(volp, &volp->ro); + if (volp->bk.ID != 0) + cm_UpdateVolumeStatusInt(volp, &volp->bk); + } + } + /* ** Finds all volumes that reside on this server and reorders their ** RO list according to the changed rank of server. Index: openafs/src/WINNT/afsd/smb.c diff -c openafs/src/WINNT/afsd/smb.c:1.118.2.47 openafs/src/WINNT/afsd/smb.c:1.118.2.48 *** openafs/src/WINNT/afsd/smb.c:1.118.2.47 Thu Nov 29 11:08:57 2007 --- openafs/src/WINNT/afsd/smb.c Sat Dec 22 23:52:58 2007 *************** *** 2876,2898 **** else if (code == CM_ERROR_PATH_NOT_COVERED) { NTStatus = 0xC0000257L; /* Path Not Covered */ } - #ifdef COMMENT else if (code == CM_ERROR_ALLBUSY) { ! NTStatus = 0xC00000BFL; /* Network Busy */ } else if (code == CM_ERROR_ALLOFFLINE || code == CM_ERROR_ALLDOWN) { - NTStatus = 0xC0000350L; /* Remote Host Down */ - } - #else - /* we do not want to be telling the SMB/CIFS client that - * the AFS Client Service is busy or down. - */ - else if (code == CM_ERROR_ALLBUSY || - code == CM_ERROR_ALLOFFLINE || - code == CM_ERROR_ALLDOWN) { NTStatus = 0xC00000BEL; /* Bad Network Path */ ! } ! #endif else if (code == RXKADUNKNOWNKEY) { NTStatus = 0xC0000322L; /* Bad Kerberos key */ } --- 2876,2887 ---- else if (code == CM_ERROR_PATH_NOT_COVERED) { NTStatus = 0xC0000257L; /* Path Not Covered */ } else if (code == CM_ERROR_ALLBUSY) { ! NTStatus = 0xC000022DL; /* Retry */ } else if (code == CM_ERROR_ALLOFFLINE || code == CM_ERROR_ALLDOWN) { NTStatus = 0xC00000BEL; /* Bad Network Path */ ! } else if (code == RXKADUNKNOWNKEY) { NTStatus = 0xC0000322L; /* Bad Kerberos key */ } *************** *** 3891,3913 **** /* mask starts out all blanks */ memset(maskp, ' ', 11); /* find last backslash, or use whole thing if there is none */ tp = strrchr(pathp, '\\'); ! if (!tp) tp = pathp; ! else tp++; /* skip slash */ up = maskp; /* names starting with a dot are illegal */ ! if (*tp == '.') valid8Dot3 = 0; for(i=0;; i++) { tc = *tp++; ! if (tc == 0) return valid8Dot3; ! if (tc == '.' || tc == '"') break; ! if (i < 8) *up++ = tc; ! else valid8Dot3 = 0; } /* if we get here, tp point after the dot */ --- 3880,3910 ---- /* mask starts out all blanks */ memset(maskp, ' ', 11); + maskp[11] = '\0'; /* find last backslash, or use whole thing if there is none */ tp = strrchr(pathp, '\\'); ! if (!tp) ! tp = pathp; ! else ! tp++; /* skip slash */ up = maskp; /* names starting with a dot are illegal */ ! if (*tp == '.') ! valid8Dot3 = 0; for(i=0;; i++) { tc = *tp++; ! if (tc == 0) ! return valid8Dot3; ! if (tc == '.' || tc == '"') ! break; ! if (i < 8) ! *up++ = tc; ! else ! valid8Dot3 = 0; } /* if we get here, tp point after the dot */ *************** *** 3986,3992 **** { unsigned char *pathp; unsigned char *tp; ! unsigned char mask[11]; unsigned char *statBlockp; unsigned char initStatBlock[21]; int statLen; --- 3983,3989 ---- { unsigned char *pathp; unsigned char *tp; ! unsigned char mask[12]; unsigned char *statBlockp; unsigned char initStatBlock[21]; int statLen; *************** *** 4052,4059 **** return 0; } ! long smb_ApplyDirListPatches(smb_dirListPatch_t **dirPatchespp, ! cm_user_t *userp, cm_req_t *reqp) { long code = 0; cm_scache_t *scp; --- 4049,4058 ---- return 0; } ! static long ! smb_ApplyDirListPatches(smb_dirListPatch_t **dirPatchespp, ! char * tidPathp, char * relPathp, ! cm_user_t *userp, cm_req_t *reqp) { long code = 0; cm_scache_t *scp; *************** *** 4063,4075 **** --- 4062,4081 ---- char attr; smb_dirListPatch_t *patchp; smb_dirListPatch_t *npatchp; + char path[AFSPATHMAX]; for (patchp = *dirPatchespp; patchp; patchp = (smb_dirListPatch_t *) osi_QNext(&patchp->q)) { dptr = patchp->dptr; + snprintf(path, AFSPATHMAX, "%s\\%s", relPathp ? relPathp : "", patchp->dep->name); + reqp->relPathp = path; + reqp->tidPathp = tidPathp; + code = cm_GetSCache(&patchp->fid, &scp, userp, reqp); + reqp->relPathp = reqp->tidPathp = NULL; + if (code) { if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) *dptr++ = SMB_ATTR_HIDDEN; *************** *** 4133,4139 **** char *tp; long code = 0; char *pathp; ! cm_dirEntry_t *dep; int maxCount; smb_dirListPatch_t *dirListPatchesp; smb_dirListPatch_t *curPatchp; --- 4139,4145 ---- char *tp; long code = 0; char *pathp; ! cm_dirEntry_t *dep = 0; int maxCount; smb_dirListPatch_t *dirListPatchesp; smb_dirListPatch_t *curPatchp; *************** *** 4156,4162 **** char shortName[13]; char *actualName; char *shortNameEnd; ! char mask[11]; int returnedNames; long nextEntryCookie; int numDirChunks; /* # of 32 byte dir chunks in this entry */ --- 4162,4168 ---- char shortName[13]; char *actualName; char *shortNameEnd; ! char mask[12]; int returnedNames; long nextEntryCookie; int numDirChunks; /* # of 32 byte dir chunks in this entry */ *************** *** 4167,4173 **** int starPattern; int rootPath = 0; int caseFold; ! char *tidPathp; cm_req_t req; cm_fid_t fid; int fileType; --- 4173,4179 ---- int starPattern; int rootPath = 0; int caseFold; ! char *tidPathp = 0; cm_req_t req; cm_fid_t fid; int fileType; *************** *** 4218,4224 **** dsp = smb_NewDirSearch(0); dsp->attribute = attribute; smb_Get8Dot3MaskFromPath(mask, pathp); ! memcpy(dsp->mask, mask, 11); /* track if this is likely to match a lot of entries */ if (smb_IsStarMask(mask)) --- 4224,4230 ---- dsp = smb_NewDirSearch(0); dsp->attribute = attribute; smb_Get8Dot3MaskFromPath(mask, pathp); ! memcpy(dsp->mask, mask, 12); /* track if this is likely to match a lot of entries */ if (smb_IsStarMask(mask)) *************** *** 4244,4250 **** */ memcpy(&clientCookie, &inCookiep[17], 4); ! memcpy(mask, dsp->mask, 11); /* assume we're doing a star match if it has continued for more * than one call. --- 4250,4256 ---- */ memcpy(&clientCookie, &inCookiep[17], 4); ! memcpy(mask, dsp->mask, 12); /* assume we're doing a star match if it has continued for more * than one call. *************** *** 4275,4291 **** smb_ReleaseDirSearch(dsp); return CM_ERROR_NOFILES; } code = cm_NameI(cm_data.rootSCachep, spacep->data, caseFold | CM_FLAG_FOLLOW, userp, tidPathp, &req, &scp); if (code == 0) { #ifdef DFS_SUPPORT if (scp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(scp); lock_ReleaseMutex(&dsp->mx); cm_ReleaseUser(userp); smb_DeleteDirSearch(dsp); smb_ReleaseDirSearch(dsp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 4281,4301 ---- smb_ReleaseDirSearch(dsp); return CM_ERROR_NOFILES; } + strcpy(dsp->tidPath, tidPathp ? tidPathp : "/"); + strcpy(dsp->relPath, spacep->data); + code = cm_NameI(cm_data.rootSCachep, spacep->data, caseFold | CM_FLAG_FOLLOW, userp, tidPathp, &req, &scp); if (code == 0) { #ifdef DFS_SUPPORT if (scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, spacep->data); cm_ReleaseSCache(scp); lock_ReleaseMutex(&dsp->mx); cm_ReleaseUser(userp); smb_DeleteDirSearch(dsp); smb_ReleaseDirSearch(dsp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 4409,4415 **** * the status info for files in the dir. */ if (starPattern) { ! smb_ApplyDirListPatches(&dirListPatchesp, userp, &req); lock_ObtainMutex(&scp->mx); if ((dsp->flags & SMB_DIRSEARCH_BULKST) && LargeIntegerGreaterThanOrEqualTo(thyper, --- 4419,4425 ---- * the status info for files in the dir. */ if (starPattern) { ! smb_ApplyDirListPatches(&dirListPatchesp, dsp->tidPath, dsp->relPath, userp, &req); lock_ObtainMutex(&scp->mx); if ((dsp->flags & SMB_DIRSEARCH_BULKST) && LargeIntegerGreaterThanOrEqualTo(thyper, *************** *** 4632,4638 **** /* apply and free last set of patches; if not doing a star match, this * will be empty, but better safe (and freeing everything) than sorry. */ ! smb_ApplyDirListPatches(&dirListPatchesp, userp, &req); /* special return code for unsuccessful search */ if (code == 0 && dataLength < 21 && returnedNames == 0) --- 4642,4648 ---- /* apply and free last set of patches; if not doing a star match, this * will be empty, but better safe (and freeing everything) than sorry. */ ! smb_ApplyDirListPatches(&dirListPatchesp, dsp->tidPath, dsp->relPath, userp, &req); /* special return code for unsuccessful search */ if (code == 0 && dataLength < 21 && returnedNames == 0) *************** *** 4719,4727 **** #ifdef DFS_SUPPORT if (newScp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(newScp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 4729,4738 ---- #ifdef DFS_SUPPORT if (newScp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(newScp, tidPathp, pathp); cm_ReleaseSCache(newScp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 4806,4814 **** #ifdef DFS_SUPPORT if (newScp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(newScp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 4817,4826 ---- #ifdef DFS_SUPPORT if (newScp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(newScp, tidPathp, pathp); cm_ReleaseSCache(newScp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 4940,4946 **** if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 4952,4959 ---- if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { ! int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 4974,4982 **** #ifdef DFS_SUPPORT if (newScp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(newScp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 4987,4996 ---- #ifdef DFS_SUPPORT if (newScp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(newScp, tidPathp, pathp); cm_ReleaseSCache(newScp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5129,5137 **** #ifdef DFS_SUPPORT if (scp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5143,5152 ---- #ifdef DFS_SUPPORT if (scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, pathp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5243,5253 **** cm_DirEntryListAdd(dep->name, &rockp->matches); ! rockp->any = 1; ! /* If we made a case sensitive exact match, we might as well quit now. */ ! if (!(rockp->flags & SMB_MASKFLAG_CASEFOLD) && !strcmp(matchName, rockp->maskp)) ! code = CM_ERROR_STOPNOW; else code = 0; } --- 5258,5268 ---- cm_DirEntryListAdd(dep->name, &rockp->matches); ! rockp->any = 1; ! /* If we made a case sensitive exact match, we might as well quit now. */ ! if (!(rockp->flags & SMB_MASKFLAG_CASEFOLD) && !strcmp(matchName, rockp->maskp)) ! code = CM_ERROR_STOPNOW; else code = 0; } *************** *** 5305,5313 **** #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5320,5329 ---- #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp,spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5466,5474 **** #ifdef DFS_SUPPORT if (oldDscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(oldDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5482,5491 ---- #ifdef DFS_SUPPORT if (oldDscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(oldDscp, tidPathp, spacep->data); cm_ReleaseSCache(oldDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5487,5496 **** #ifdef DFS_SUPPORT if (newDscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(oldDscp); cm_ReleaseSCache(newDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5504,5514 ---- #ifdef DFS_SUPPORT if (newDscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(newDscp, tidPathp, spacep->data); cm_ReleaseSCache(oldDscp); cm_ReleaseSCache(newDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5666,5674 **** #ifdef DFS_SUPPORT if (oldDscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(oldDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5684,5693 ---- #ifdef DFS_SUPPORT if (oldDscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(oldDscp, tidPathp, spacep->data); cm_ReleaseSCache(oldDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5686,5695 **** #ifdef DFS_SUPPORT if (newDscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(newDscp); cm_ReleaseSCache(oldDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5705,5715 ---- #ifdef DFS_SUPPORT if (newDscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(newDscp, tidPathp, spacep->data); cm_ReleaseSCache(newDscp); cm_ReleaseSCache(oldDscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5891,5899 **** #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5911,5920 ---- #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 7281,7289 **** #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 7302,7311 ---- #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 7405,7413 **** #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 7427,7436 ---- #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; Index: openafs/src/WINNT/afsd/smb.h diff -c openafs/src/WINNT/afsd/smb.h:1.41.2.18 openafs/src/WINNT/afsd/smb.h:1.41.2.19 *** openafs/src/WINNT/afsd/smb.h:1.41.2.18 Mon Sep 10 15:08:17 2007 --- openafs/src/WINNT/afsd/smb.h Sat Dec 22 23:52:58 2007 *************** *** 460,465 **** --- 460,467 ---- * locked by smb_globalLock */ unsigned short attribute; /* search attribute * (used for extended protocol) */ + char tidPath[256]; /* tid path */ + char relPath[1024]; /* relative path */ char mask[256]; /* search mask for V3 */ } smb_dirSearch_t; Index: openafs/src/WINNT/afsd/smb3.c diff -c openafs/src/WINNT/afsd/smb3.c:1.95.2.48 openafs/src/WINNT/afsd/smb3.c:1.95.2.49 *** openafs/src/WINNT/afsd/smb3.c:1.95.2.48 Sun Nov 4 19:24:46 2007 --- openafs/src/WINNT/afsd/smb3.c Sat Dec 22 23:52:58 2007 *************** *** 1070,1079 **** if (vcp->flags & SMB_VCFLAG_USENT) { int policy = smb_FindShareCSCPolicy(shareName); smb_SetSMBParm(outp, 2, SMB_SUPPORT_SEARCH_BITS | ! #ifdef DFS_SUPPORT ! SMB_SHARE_IS_IN_DFS | ! #endif (policy << 2)); } } else { --- 1070,1090 ---- if (vcp->flags & SMB_VCFLAG_USENT) { int policy = smb_FindShareCSCPolicy(shareName); + HKEY parmKey; + DWORD code; + DWORD dwAdvertiseDFS = 0, dwSize = sizeof(DWORD); + + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, + 0, KEY_QUERY_VALUE, &parmKey); + if (code == ERROR_SUCCESS) { + code = RegQueryValueEx(parmKey, "AdvertiseDFS", NULL, NULL, + (BYTE *)&dwAdvertiseDFS, &dwSize); + if (code != ERROR_SUCCESS) + dwAdvertiseDFS = 0; + RegCloseKey (parmKey); + } smb_SetSMBParm(outp, 2, SMB_SUPPORT_SEARCH_BITS | ! (dwAdvertiseDFS ? SMB_SHARE_IS_IN_DFS : 0) | (policy << 2)); } } else { *************** *** 2222,2231 **** #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); smb_FreeTran2Packet(outp); ! if ( WANTS_DFS_PATHNAMES(p) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 2233,2243 ---- #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); smb_FreeTran2Packet(outp); ! if ( WANTS_DFS_PATHNAMES(p) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 2251,2260 **** } else { #ifdef DFS_SUPPORT if (scp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(scp); cm_ReleaseUser(userp); smb_FreeTran2Packet(outp); ! if ( WANTS_DFS_PATHNAMES(p) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 2263,2273 ---- } else { #ifdef DFS_SUPPORT if (scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, lastNamep); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); smb_FreeTran2Packet(outp); ! if ( WANTS_DFS_PATHNAMES(p) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 2627,2632 **** --- 2640,2646 ---- if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); + DebugBreak(); return CM_ERROR_PATH_NOT_COVERED; } #endif /* DFS_SUPPORT */ *************** *** 2770,2776 **** if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { ! if ( WANTS_DFS_PATHNAMES(p) ) code = CM_ERROR_PATH_NOT_COVERED; else code = CM_ERROR_BADSHARENAME; --- 2784,2791 ---- if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { ! int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); ! if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else code = CM_ERROR_BADSHARENAME; *************** *** 2816,2824 **** #ifdef DFS_SUPPORT 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; --- 2831,2840 ---- #ifdef DFS_SUPPORT if (scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, pathp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else code = CM_ERROR_BADSHARENAME; *************** *** 2982,2988 **** infoLevel != SMB_INFO_QUERY_ALL_EAS) { osi_Log2(smb_logp, "Bad Tran2 op 0x%x infolevel 0x%x", p->opcode, infoLevel); ! smb_SendTran2Error(vcp, p, opx, CM_ERROR_BAD_LEVEL); return 0; } --- 2998,3005 ---- infoLevel != SMB_INFO_QUERY_ALL_EAS) { osi_Log2(smb_logp, "Bad Tran2 op 0x%x infolevel 0x%x", p->opcode, infoLevel); ! smb_SendTran2Error(vcp, p, opx, ! infoLevel == SMB_INFO_QUERY_ALL_EAS ? CM_ERROR_EAS_NOT_SUPPORTED : CM_ERROR_BAD_LEVEL); return 0; } *************** *** 3040,3046 **** if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { ! if ( WANTS_DFS_PATHNAMES(p) ) code = CM_ERROR_PATH_NOT_COVERED; else code = CM_ERROR_BADSHARENAME; --- 3057,3064 ---- if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { ! int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); ! if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else code = CM_ERROR_BADSHARENAME; *************** *** 3162,3168 **** } else if (infoLevel == SMB_INFO_QUERY_ALL_EAS) { /* we don't support EAs */ ! code = CM_ERROR_INVAL; } done: --- 3180,3186 ---- } else if (infoLevel == SMB_INFO_QUERY_ALL_EAS) { /* we don't support EAs */ ! code = CM_ERROR_EAS_NOT_SUPPORTED; } done: *************** *** 3575,3585 **** long code = 0; int maxReferralLevel = 0; char requestFileName[1024] = ""; smb_tran2Packet_t *outp = 0; cm_user_t *userp = 0; cm_req_t req; CPINFO CodePageInfo; ! int i, nbnLen, reqLen; int idx; cm_InitReq(&req); --- 3593,3606 ---- long code = 0; int maxReferralLevel = 0; char requestFileName[1024] = ""; + char referralPath[1024] = ""; smb_tran2Packet_t *outp = 0; cm_user_t *userp = 0; + cm_scache_t *scp = 0; + cm_scache_t *dscp = 0; cm_req_t req; CPINFO CodePageInfo; ! int i, nbnLen, reqLen, refLen; int idx; cm_InitReq(&req); *************** *** 3596,3652 **** nbnLen = strlen(cm_NetbiosName); reqLen = strlen(requestFileName); ! if (reqLen == nbnLen + 5 && ! requestFileName[0] == '\\' && !_strnicmp(cm_NetbiosName,&requestFileName[1],nbnLen) && ! requestFileName[nbnLen+1] == '\\' && ! (!_strnicmp("all",&requestFileName[nbnLen+2],3) || ! !_strnicmp("*.",&requestFileName[nbnLen+2],2))) { ! USHORT * sp; ! struct smb_v2_referral * v2ref; ! outp = smb_GetTran2ResponsePacket(vcp, p, op, 0, 2 * (reqLen + 8)); ! ! sp = (USHORT *)outp->datap; ! idx = 0; ! sp[idx++] = reqLen; /* path consumed */ ! sp[idx++] = 1; /* number of referrals */ ! sp[idx++] = 0x03; /* flags */ #ifdef DFS_VERSION_1 ! sp[idx++] = 1; /* Version Number */ ! sp[idx++] = reqLen + 4; /* Referral Size */ ! sp[idx++] = 1; /* Type = SMB Server */ ! sp[idx++] = 0; /* Do not strip path consumed */ ! for ( i=0;i<=reqLen; i++ ) ! sp[i+idx] = requestFileName[i]; #else /* DFS_VERSION_2 */ ! sp[idx++] = 2; /* Version Number */ ! sp[idx++] = sizeof(struct smb_v2_referral); /* Referral Size */ ! idx += (sizeof(struct smb_v2_referral) / 2); ! v2ref = (struct smb_v2_referral *) &sp[5]; ! v2ref->ServerType = 1; /* SMB Server */ ! v2ref->ReferralFlags = 0x03; ! v2ref->Proximity = 0; /* closest */ ! v2ref->TimeToLive = 3600; /* seconds */ ! v2ref->DfsPathOffset = idx * 2; ! v2ref->DfsAlternativePathOffset = idx * 2; ! v2ref->NetworkAddressOffset = 0; ! for ( i=0;i<=reqLen; i++ ) ! sp[i+idx] = requestFileName[i]; #endif } else { - userp = smb_GetTran2User(vcp, p); - if (!userp) { - osi_Log1(smb_logp,"ReceiveTran2GetDfsReferral unable to resolve user [%d]", p->uid); - code = CM_ERROR_BADSMB; - goto done; - } - - /* not done yet */ code = CM_ERROR_NOSUCHPATH; } ! done: if (userp) cm_ReleaseUser(userp); if (code == 0) --- 3617,3768 ---- nbnLen = strlen(cm_NetbiosName); reqLen = strlen(requestFileName); ! if (reqLen > nbnLen + 2 && requestFileName[0] == '\\' && !_strnicmp(cm_NetbiosName,&requestFileName[1],nbnLen) && ! requestFileName[nbnLen+1] == '\\') { ! int found = 0; ! ! if (!_strnicmp("all",&requestFileName[nbnLen+2],3) || ! !_strnicmp("*.",&requestFileName[nbnLen+2],2)) ! { ! found = 1; ! strcpy(referralPath, requestFileName); ! refLen = reqLen; ! } else { ! userp = smb_GetTran2User(vcp, p); ! if (!userp) { ! osi_Log1(smb_logp,"ReceiveTran2GetDfsReferral unable to resolve user [%d]", p->uid); ! code = CM_ERROR_BADSMB; ! goto done; ! } ! ! /* ! * We have a requested path. Check to see if it is something ! * we know about. ! */ ! code = cm_NameI(cm_data.rootSCachep, &requestFileName[nbnLen+2], ! CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, ! userp, NULL, &req, &scp); ! if (code == 0) { ! /* Yes it is. */ ! found = 1; ! strcpy(referralPath, requestFileName); ! refLen = reqLen; ! } else if (code == CM_ERROR_PATH_NOT_COVERED ) { ! char temp[1024]; ! char pathName[1024]; ! char *lastComponent; ! /* ! * we have a msdfs link somewhere in the path ! * we should figure out where in the path the link is. ! * and return it. ! */ ! osi_Log1(smb_logp,"ReceiveTran2GetDfsReferral PATH_NOT_COVERED [%s]", requestFileName); ! ! strcpy(temp, &requestFileName[nbnLen+2]); ! ! do { ! if (dscp) { ! cm_ReleaseSCache(dscp); ! dscp = 0; ! } ! if (scp) { ! cm_ReleaseSCache(scp); ! scp = 0; ! } ! smb_StripLastComponent(pathName, &lastComponent, temp); ! ! code = cm_NameI(cm_data.rootSCachep, pathName, ! CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, ! userp, NULL, &req, &dscp); ! if (code == 0) { ! code = cm_NameI(dscp, ++lastComponent, ! CM_FLAG_CASEFOLD, ! userp, NULL, &req, &scp); ! if (code == 0 && scp->fileType == CM_SCACHETYPE_DFSLINK) ! break; ! } ! } while (code == CM_ERROR_PATH_NOT_COVERED); ! ! /* scp should now be the DfsLink we are looking for */ ! if (scp) { ! /* figure out how much of the input path was used */ ! reqLen = nbnLen+2 + strlen(pathName) + 1 + strlen(lastComponent); ! ! strcpy(referralPath, &scp->mountPointStringp[strlen("msdfs:")]); ! refLen = strlen(referralPath); ! found = 1; ! } ! } else { ! char shareName[MAX_PATH + 1]; ! char *p, *q; ! /* we may have a sharename that is a volume reference */ ! ! for (p = &requestFileName[nbnLen+2], q = shareName; *p && *p != '\\'; p++, q++) ! { ! *q = *p; ! } ! *q = '\0'; ! ! if (smb_FindShare(vcp, vcp->usersp, shareName, &p)) { ! code = cm_NameI(cm_data.rootSCachep, "", ! CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, ! userp, p, &req, &scp); ! free(p); ! ! if (code == 0) { ! found = 1; ! strcpy(referralPath, requestFileName); ! refLen = reqLen; ! } ! } ! } ! } ! ! if (found) ! { ! USHORT * sp; ! struct smb_v2_referral * v2ref; ! outp = smb_GetTran2ResponsePacket(vcp, p, op, 0, 2 * (refLen + 8)); ! ! sp = (USHORT *)outp->datap; ! idx = 0; ! sp[idx++] = reqLen; /* path consumed */ ! sp[idx++] = 1; /* number of referrals */ ! sp[idx++] = 0x03; /* flags */ #ifdef DFS_VERSION_1 ! sp[idx++] = 1; /* Version Number */ ! sp[idx++] = refLen + 4; /* Referral Size */ ! sp[idx++] = 1; /* Type = SMB Server */ ! sp[idx++] = 0; /* Do not strip path consumed */ ! for ( i=0;i<=refLen; i++ ) ! sp[i+idx] = referralPath[i]; #else /* DFS_VERSION_2 */ ! sp[idx++] = 2; /* Version Number */ ! sp[idx++] = sizeof(struct smb_v2_referral); /* Referral Size */ ! idx += (sizeof(struct smb_v2_referral) / 2); ! v2ref = (struct smb_v2_referral *) &sp[5]; ! v2ref->ServerType = 1; /* SMB Server */ ! v2ref->ReferralFlags = 0x03; ! v2ref->Proximity = 0; /* closest */ ! v2ref->TimeToLive = 3600; /* seconds */ ! v2ref->DfsPathOffset = idx * 2; ! v2ref->DfsAlternativePathOffset = idx * 2; ! v2ref->NetworkAddressOffset = 0; ! for ( i=0;i<=refLen; i++ ) ! sp[i+idx] = referralPath[i]; #endif + } } else { code = CM_ERROR_NOSUCHPATH; } ! done: + if (dscp) + cm_ReleaseSCache(dscp); + if (scp) + cm_ReleaseSCache(scp); if (userp) cm_ReleaseUser(userp); if (code == 0) *************** *** 3679,3688 **** return CM_ERROR_BADOP; } ! long ! smb_ApplyV3DirListPatches(cm_scache_t *dscp, ! smb_dirListPatch_t **dirPatchespp, int infoLevel, cm_user_t *userp, ! cm_req_t *reqp) { long code = 0; cm_scache_t *scp; --- 3795,3805 ---- return CM_ERROR_BADOP; } ! static long ! smb_ApplyV3DirListPatches(cm_scache_t *dscp,smb_dirListPatch_t **dirPatchespp, ! char * tidPathp, char * relPathp, ! int infoLevel, cm_user_t *userp, ! cm_req_t *reqp) { long code = 0; cm_scache_t *scp; *************** *** 3697,3702 **** --- 3814,3820 ---- smb_dirListPatch_t *npatchp; afs_uint32 rights; afs_int32 mustFake = 0; + char path[AFSPATHMAX]; code = cm_FindACLCache(dscp, userp, &rights); if (code == 0 && !(rights & PRSFS_READ)) *************** *** 3716,3722 **** --- 3834,3845 ---- for(patchp = *dirPatchespp; patchp; patchp = (smb_dirListPatch_t *) osi_QNext(&patchp->q)) { + snprintf(path, AFSPATHMAX, "%s\\%s", relPathp ? relPathp : "", patchp->dep->name); + reqp->relPathp = path; + reqp->tidPathp = tidPathp; + code = cm_GetSCache(&patchp->fid, &scp, userp, reqp); + reqp->relPathp = reqp->tidPathp = NULL; if (code) continue; *************** *** 3840,3846 **** --- 3963,3973 ---- code = 0; while (code == 0 && scp->fileType == CM_SCACHETYPE_SYMLINK) { lock_ReleaseMutex(&scp->mx); + snprintf(path, AFSPATHMAX, "%s\\%s", relPathp ? relPathp : "", patchp->dep->name); + reqp->relPathp = path; + reqp->tidPathp = tidPathp; code = cm_EvaluateSymLink(dscp, scp, &targetScp, userp, reqp); + reqp->relPathp = reqp->tidPathp = NULL; if (code == 0) { /* we have a more accurate file to use (the * target of the symbolic link). Otherwise, *************** *** 3884,3890 **** /* Copy attributes */ lattr = smb_ExtAttributes(scp); ! if (code == CM_ERROR_NOSUCHPATH && scp->fileType == CM_SCACHETYPE_SYMLINK) { if (lattr == SMB_ATTR_NORMAL) lattr = SMB_ATTR_DIRECTORY; else --- 4011,4018 ---- /* Copy attributes */ lattr = smb_ExtAttributes(scp); ! if (code == CM_ERROR_NOSUCHPATH && scp->fileType == CM_SCACHETYPE_SYMLINK || ! code == CM_ERROR_PATH_NOT_COVERED && scp->fileType == CM_SCACHETYPE_DFSLINK) { if (lattr == SMB_ATTR_NORMAL) lattr = SMB_ATTR_DIRECTORY; else *************** *** 4117,4123 **** int attribute; long nextCookie; long code = 0, code2 = 0; ! char *pathp; int maxCount; smb_dirListPatch_t *dirListPatchesp; smb_dirListPatch_t *curPatchp; --- 4245,4251 ---- int attribute; long nextCookie; long code = 0, code2 = 0; ! char *pathp = 0; int maxCount; smb_dirListPatch_t *dirListPatchesp; smb_dirListPatch_t *curPatchp; *************** *** 4138,4148 **** 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; --- 4266,4277 ---- int searchFlags; int eos; smb_tran2Packet_t *outp; /* response packet */ ! char *tidPathp = 0; int align; char shortName[13]; /* 8.3 name if needed */ int NeedShortName; char *shortNameEnd; + cm_dirEntry_t * dep = NULL; cm_req_t req; char * s; *************** *** 4268,4276 **** #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; --- 4397,4406 ---- #ifdef DFS_SUPPORT_BUT_NOT_FIND_FIRST if (scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, spacep->data); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else code = CM_ERROR_BADSHARENAME; *************** *** 4461,4467 **** curPatchp->fid.unique = targetscp->fid.unique; /* temp */ ! curPatchp->dep = NULL; } if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) { --- 4591,4601 ---- curPatchp->fid.unique = targetscp->fid.unique; /* temp */ ! dep = (cm_dirEntry_t *)malloc(sizeof(cm_dirEntry_t)+strlen(maskp)); ! strcpy(dep->name, maskp); ! dep->fid.vnode = targetscp->fid.vnode; ! dep->fid.unique = targetscp->fid.unique; ! curPatchp->dep = dep; } if (searchFlags & TRAN2_FIND_FLAG_RETURN_RESUME_KEYS) { *************** *** 4480,4486 **** } /* apply the patches */ ! code2 = smb_ApplyV3DirListPatches(scp, &dirListPatchesp, infoLevel, userp, &req); outp->parmsp[0] = 0; outp->parmsp[1] = 1; /* number of names returned */ --- 4614,4620 ---- } /* apply the patches */ ! code2 = smb_ApplyV3DirListPatches(scp, &dirListPatchesp, tidPathp, spacep->data, infoLevel, userp, &req); outp->parmsp[0] = 0; outp->parmsp[1] = 1; /* number of names returned */ *************** *** 4504,4509 **** --- 4638,4645 ---- skip_file: smb_FreeTran2Packet(outp); + if (dep) + free(dep); cm_ReleaseSCache(scp); cm_ReleaseSCache(targetscp); cm_ReleaseUser(userp); *************** *** 4519,4528 **** char *tp; long code = 0, code2 = 0; char *pathp; ! cm_dirEntry_t *dep; int maxCount; ! smb_dirListPatch_t *dirListPatchesp; ! smb_dirListPatch_t *curPatchp; cm_buf_t *bufferp; long temp; long orbytes; /* # of bytes in this output record */ --- 4655,4664 ---- char *tp; long code = 0, code2 = 0; char *pathp; ! cm_dirEntry_t *dep = 0; int maxCount; ! smb_dirListPatch_t *dirListPatchesp = 0; ! smb_dirListPatch_t *curPatchp = 0; cm_buf_t *bufferp; long temp; long orbytes; /* # of bytes in this output record */ *************** *** 4731,4736 **** --- 4867,4876 ---- smb_ReleaseDirSearch(dsp); return 0; } + + strcpy(dsp->tidPath, tidPathp ? tidPathp : "/"); + strcpy(dsp->relPath, spacep->data); + code = cm_NameI(cm_data.rootSCachep, spacep->data, CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, userp, tidPathp, &req, &scp); *************** *** 4739,4747 **** if (code == 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; --- 4879,4888 ---- if (code == 0) { #ifdef DFS_SUPPORT_BUT_NOT_FIND_FIRST if (scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, spacep->data); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(p) || pnc ) code = CM_ERROR_PATH_NOT_COVERED; else code = CM_ERROR_BADSHARENAME; *************** *** 4877,4885 **** * of all of the status info for files in the dir. */ if (starPattern) { ! smb_ApplyV3DirListPatches(scp, &dirListPatchesp, ! infoLevel, userp, ! &req); lock_ObtainMutex(&scp->mx); if ((dsp->flags & SMB_DIRSEARCH_BULKST) && LargeIntegerGreaterThanOrEqualTo(thyper, scp->bulkStatProgress)) { --- 5018,5025 ---- * of all of the status info for files in the dir. */ if (starPattern) { ! code2 = smb_ApplyV3DirListPatches(scp, &dirListPatchesp, dsp->tidPath, dsp->relPath, infoLevel, userp, &req); ! lock_ObtainMutex(&scp->mx); if ((dsp->flags & SMB_DIRSEARCH_BULKST) && LargeIntegerGreaterThanOrEqualTo(thyper, scp->bulkStatProgress)) { *************** *** 5189,5196 **** /* apply and free last set of patches; if not doing a star match, this * will be empty, but better safe (and freeing everything) than sorry. */ ! code2 = smb_ApplyV3DirListPatches(scp, &dirListPatchesp, infoLevel, userp, &req); ! /* now put out the final parameters */ if (returnedNames == 0) eos = 1; --- 5329,5337 ---- /* apply and free last set of patches; if not doing a star match, this * will be empty, but better safe (and freeing everything) than sorry. */ ! code2 = smb_ApplyV3DirListPatches(scp, &dirListPatchesp, dsp->tidPath, ! dsp->relPath, infoLevel, userp, &req); ! /* now put out the final parameters */ if (returnedNames == 0) eos = 1; *************** *** 5393,5401 **** #ifdef DFS_SUPPORT if (code == 0 && scp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5534,5543 ---- #ifdef DFS_SUPPORT if (code == 0 && scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, pathp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 5413,5421 **** #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 5555,5564 ---- #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 6579,6590 **** if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 6722,6734 ---- if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 6612,6623 **** userp, tidPathp, &req, &scp); #ifdef DFS_SUPPORT if (code == 0 && scp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 6756,6768 ---- userp, tidPathp, &req, &scp); #ifdef DFS_SUPPORT if (code == 0 && scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, realPathp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 6648,6653 **** --- 6793,6799 ---- #ifdef DFS_SUPPORT if (code == 0 && dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); if (scp) cm_ReleaseSCache(scp); cm_ReleaseSCache(dscp); *************** *** 6655,6661 **** free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 6801,6807 ---- free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 7378,7389 **** if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 7524,7536 ---- if (code == 0) { #ifdef DFS_SUPPORT if (dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 7411,7422 **** userp, tidPathp, &req, &scp); #ifdef DFS_SUPPORT if (code == 0 && scp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 7558,7570 ---- userp, tidPathp, &req, &scp); #ifdef DFS_SUPPORT if (code == 0 && scp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(scp, tidPathp, realPathp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; *************** *** 7435,7446 **** userp, tidPathp, &req, &dscp); #ifdef DFS_SUPPORT if (code == 0 && dscp->fileType == CM_SCACHETYPE_DFSLINK) { cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; --- 7583,7595 ---- userp, tidPathp, &req, &dscp); #ifdef DFS_SUPPORT if (code == 0 && dscp->fileType == CM_SCACHETYPE_DFSLINK) { + int pnc = cm_VolStatus_Notify_DFS_Mapping(dscp, tidPathp, spacep->data); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); if (baseFidp) smb_ReleaseFID(baseFidp); ! if ( WANTS_DFS_PATHNAMES(inp) || pnc ) return CM_ERROR_PATH_NOT_COVERED; else return CM_ERROR_BADSHARENAME; Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.23 openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.24 *** openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.23 Tue Dec 4 14:54:24 2007 --- openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm Fri Dec 28 14:47:11 2007 *************** *** 57,63 ****

OpenAFS for Windows

!

Version 1.5.28

 

--- 57,63 ----

OpenAFS for Windows

!

Version 1.5.29

 

*************** *** 80,86 **** ·         OpenAFS for Windows 1.5.28 Release Notes

--- 80,86 ---- ·         OpenAFS for Windows 1.5.29 Release Notes

Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.23 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.2