Index: openafs/src/WINNT/afsd/afsd_init.c diff -c openafs/src/WINNT/afsd/afsd_init.c:1.40.2.24 openafs/src/WINNT/afsd/afsd_init.c:1.40.2.24.2.1 *** openafs/src/WINNT/afsd/afsd_init.c:1.40.2.24 Sun Oct 2 02:08:55 2005 --- openafs/src/WINNT/afsd/afsd_init.c Mon Oct 17 15:35:44 2005 *************** *** 32,38 **** #include "cm_rpc.h" #include "lanahelper.h" #include - #include "afsicf.h" #include "cm_memmap.h" extern int RXAFSCB_ExecuteRequest(struct rx_call *z_call); --- 32,37 ---- *************** *** 1065,1084 **** cm_initParams.setTime = 0; cm_initParams.memCache = 1; - /* Set RX parameters before initializing RX */ - if ( rx_nojumbo ) { - rx_SetNoJumbo(); - afsi_log("rx_SetNoJumbo successful"); - } - - if ( rx_mtu != -1 ) { - rx_SetMaxMTU(rx_mtu); - afsi_log("rx_SetMaxMTU %d successful", rx_mtu); - } - - /* Open Microsoft Firewall to allow in port 7001 */ - icf_CheckAndAddAFSPorts(AFS_PORTSET_CLIENT); - /* Ensure the AFS Netbios Name is registered to allow loopback access */ configureBackConnectionHostNames(); --- 1064,1069 ---- *************** *** 1110,1115 **** --- 1095,1111 ---- #endif #endif + /* Set RX parameters before initializing RX */ + if ( rx_nojumbo ) { + rx_SetNoJumbo(); + afsi_log("rx_SetNoJumbo successful"); + } + + if ( rx_mtu != -1 ) { + rx_SetMaxMTU(rx_mtu); + afsi_log("rx_SetMaxMTU %d successful", rx_mtu); + } + /* initialize RX, and tell it to listen to port 7001, which is used for * callback RPC messages. */ Index: openafs/src/WINNT/afsd/afsicf.cpp diff -c openafs/src/WINNT/afsd/afsicf.cpp:1.1.2.1 openafs/src/WINNT/afsd/afsicf.cpp:1.1.2.1.4.1 *** openafs/src/WINNT/afsd/afsicf.cpp:1.1.2.1 Tue Dec 7 00:53:57 2004 --- openafs/src/WINNT/afsd/afsicf.cpp Mon Oct 17 15:35:45 2005 *************** *** 30,79 **** #include #include "afsicf.h" - //#define TESTMAIN - #ifdef TESTMAIN #include #pragma comment(lib,"ole32.lib") #pragma comment(lib,"oleaut32.lib") ! #define DEBUGOUT(x) printf x #else ! #define DEBUGOUT(x) #endif /* an IPv4, enabled port with global scope */ struct global_afs_port_type { LPWSTR name; ! LONG port; ! NET_FW_IP_PROTOCOL protocol; }; typedef struct global_afs_port_type global_afs_port_t; global_afs_port_t afs_clientPorts[] = { ! { L"AFS CacheManager Callback (UDP)", 7001, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS CacheManager Callback (TCP)", 7001, NET_FW_IP_PROTOCOL_TCP } }; global_afs_port_t afs_serverPorts[] = { ! { L"AFS File Server (UDP)", 7000, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS File Server (TCP)", 7000, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS User & Group Database (UDP)", 7002, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS User & Group Database (TCP)", 7002, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS Volume Location Database (UDP)", 7003, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS Volume Location Database (TCP)", 7003, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS/Kerberos Authentication (UDP)", 7004, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS/Kerberos Authentication (TCP)", 7004, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS Volume Mangement (UDP)", 7005, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS Volume Mangement (TCP)", 7005, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS Error Interpretation (UDP)", 7006, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS Error Interpretation (TCP)", 7006, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS Basic Overseer (UDP)", 7007, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS Basic Overseer (TCP)", 7007, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS Server-to-server Updater (UDP)", 7008, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS Server-to-server Updater (TCP)", 7008, NET_FW_IP_PROTOCOL_TCP }, ! { L"AFS Remote Cache Manager (UDP)", 7009, NET_FW_IP_PROTOCOL_UDP }, ! { L"AFS Remote Cache Manager (TCP)", 7009, NET_FW_IP_PROTOCOL_TCP } }; HRESULT icf_OpenFirewallProfile(INetFwProfile ** fwProfile) { --- 30,99 ---- #include #include "afsicf.h" #ifdef TESTMAIN #include #pragma comment(lib,"ole32.lib") #pragma comment(lib,"oleaut32.lib") ! #define DEBUGOUT(x) printf(x) ! #define DEBUGOUTW(x) wprintf(x) #else ! #define DEBUGOUT(x) OutputDebugString(x) ! #define DEBUGOUTW(x) OutputDebugStringW(x) #endif /* an IPv4, enabled port with global scope */ struct global_afs_port_type { LPWSTR name; ! LONG port; ! NET_FW_IP_PROTOCOL protocol; }; typedef struct global_afs_port_type global_afs_port_t; global_afs_port_t afs_clientPorts[] = { ! { L"AFS CacheManager Callback (UDP)", 7001, NET_FW_IP_PROTOCOL_UDP } ! #ifdef AFS_TCP ! , { L"AFS CacheManager Callback (TCP)", 7001, NET_FW_IP_PROTOCOL_TCP } ! #endif }; global_afs_port_t afs_serverPorts[] = { ! { L"AFS File Server (UDP)", 7000, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS File Server (TCP)", 7000, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS User & Group Database (UDP)", 7002, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS User & Group Database (TCP)", 7002, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS Volume Location Database (UDP)", 7003, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS Volume Location Database (TCP)", 7003, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS/Kerberos Authentication (UDP)", 7004, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS/Kerberos Authentication (TCP)", 7004, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS Volume Mangement (UDP)", 7005, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS Volume Mangement (TCP)", 7005, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS Error Interpretation (UDP)", 7006, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS Error Interpretation (TCP)", 7006, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS Basic Overseer (UDP)", 7007, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS Basic Overseer (TCP)", 7007, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS Server-to-server Updater (UDP)", 7008, NET_FW_IP_PROTOCOL_UDP }, ! #ifdef AFS_TCP ! { L"AFS Server-to-server Updater (TCP)", 7008, NET_FW_IP_PROTOCOL_TCP }, ! #endif ! { L"AFS Remote Cache Manager (UDP)", 7009, NET_FW_IP_PROTOCOL_UDP } ! #ifdef AFS_TCP ! , { L"AFS Remote Cache Manager (TCP)", 7009, NET_FW_IP_PROTOCOL_TCP } ! #endif }; HRESULT icf_OpenFirewallProfile(INetFwProfile ** fwProfile) { *************** *** 93,99 **** ); if (FAILED(hr)) { ! DEBUGOUT(("Can't create fwMgr\n")); goto error; } --- 113,119 ---- ); if (FAILED(hr)) { ! DEBUGOUT(("Can't create fwMgr\n")); goto error; } *************** *** 101,107 **** hr = fwMgr->get_LocalPolicy(&fwPolicy); if (FAILED(hr)) { ! DEBUGOUT(("Cant get local policy\n")); goto error; } --- 121,127 ---- hr = fwMgr->get_LocalPolicy(&fwPolicy); if (FAILED(hr)) { ! DEBUGOUT(("Cant get local policy\n")); goto error; } *************** *** 109,119 **** hr = fwPolicy->get_CurrentProfile(fwProfile); if (FAILED(hr)) { ! DEBUGOUT(("Can't get current profile\n")); goto error; } ! error: // Release the local firewall policy. if (fwPolicy != NULL) --- 129,139 ---- hr = fwPolicy->get_CurrentProfile(fwProfile); if (FAILED(hr)) { ! DEBUGOUT(("Can't get current profile\n")); goto error; } ! error: // Release the local firewall policy. if (fwPolicy != NULL) *************** *** 131,327 **** } HRESULT icf_CheckAndAddPorts(INetFwProfile * fwProfile, global_afs_port_t * ports, int nPorts) { ! INetFwOpenPorts * fwPorts = NULL; ! INetFwOpenPort * fwPort = NULL; ! HRESULT hr; ! HRESULT rhr = S_OK; /* return value */ ! int i = 0; ! ! hr = fwProfile->get_GloballyOpenPorts(&fwPorts); ! if (FAILED(hr)) { ! // Abort! ! DEBUGOUT(("Can't get globallyOpenPorts\n")); ! rhr = hr; ! goto cleanup; ! } ! // go through the supplied ports ! for (i=0; iItem(ports[i].port, ports[i].protocol, &fwPort); ! if (SUCCEEDED(hr)) { ! DEBUGOUT(("Found port for %S\n",ports[i].name)); hr = fwPort->get_Enabled(&vbEnabled); ! if (SUCCEEDED(hr)) { ! if ( vbEnabled == VARIANT_FALSE ) { ! hr = fwPort->put_Enabled(VARIANT_TRUE); ! if (FAILED(hr)) { ! // failed. Mark as failure. Don't try to create the port either. ! rhr = hr; ! } ! } // else we are fine ! } else { // Something is wrong with the port. ! // We try to create a new one thus overriding this faulty one. ! bCreate = TRUE; ! } ! fwPort->Release(); ! fwPort = NULL; ! } else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) { ! DEBUGOUT(("Port not found for %S\n", ports[i].name)); ! bCreate = TRUE; ! } ! if (bCreate) { ! DEBUGOUT(("Trying to create port %S\n",ports[i].name)); ! hr = CoCreateInstance( ! __uuidof(NetFwOpenPort), ! NULL, ! CLSCTX_INPROC_SERVER, ! __uuidof(INetFwOpenPort), ! reinterpret_cast ! (static_cast(&fwPort)) ! ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't create port\n")); rhr = hr; ! } else { ! DEBUGOUT(("Created port\n")); ! hr = fwPort->put_IpVersion( NET_FW_IP_VERSION_ANY ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set IpVersion\n")); ! rhr = hr; ! goto abandon_port; ! } ! ! hr = fwPort->put_Port( ports[i].port ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Port\n")); ! rhr = hr; ! goto abandon_port; ! } ! ! hr = fwPort->put_Protocol( ports[i].protocol ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Protocol\n")); ! rhr = hr; ! goto abandon_port; ! } ! ! hr = fwPort->put_Scope( NET_FW_SCOPE_ALL ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Scope\n")); ! rhr = hr; ! goto abandon_port; ! } ! ! bstName = SysAllocString( ports[i].name ); ! ! if (SysStringLen(bstName) == 0) { ! rhr = E_OUTOFMEMORY; ! } else { ! hr = fwPort->put_Name( bstName ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Name\n")); ! rhr = hr; ! SysFreeString( bstName ); ! goto abandon_port; ! } ! } ! ! SysFreeString( bstName ); ! ! hr = fwPorts->Add( fwPort ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't add port\n")); ! rhr = hr; ! } else ! DEBUGOUT(("Added port\n")); ! ! abandon_port: ! fwPort->Release(); ! } } - } // loop through ports ! fwPorts->Release(); ! cleanup: ! if (fwPorts != NULL) ! fwPorts->Release(); ! return rhr; ! } long icf_CheckAndAddAFSPorts(int portset) { ! HRESULT hr; ! BOOL coInitialized = FALSE; ! INetFwProfile * fwProfile = NULL; ! global_afs_port_t * ports; ! int nports; ! long code = 0; ! ! if (portset == AFS_PORTSET_CLIENT) { ! ports = afs_clientPorts; ! nports = sizeof(afs_clientPorts) / sizeof(*afs_clientPorts); ! } else if (portset == AFS_PORTSET_SERVER) { ! ports = afs_serverPorts; ! nports = sizeof(afs_serverPorts) / sizeof(*afs_serverPorts); ! } else ! return 1; /* Invalid port set */ ! ! hr = CoInitializeEx( ! NULL, ! COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE ! ); ! if (SUCCEEDED(hr) || RPC_E_CHANGED_MODE == hr) { coInitialized = TRUE; } ! // not necessarily catastrophic if the call failed. We'll try to ! // continue as if it succeeded. hr = icf_OpenFirewallProfile(&fwProfile); ! if (FAILED(hr)) { ! // Ok. That didn't work. This could be because the machine we ! // are running on doesn't have Windows Firewall. We'll return ! // a failure to the caller, which shouldn't be taken to mean ! // it's catastrophic. ! DEBUGOUT(("Can't open Firewall profile\n")); ! code = 1; ! goto cleanup; ! } ! // Now that we have a firewall profile, we can start checking ! // and adding the ports that we want. ! hr = icf_CheckAndAddPorts(fwProfile, ports, nports); ! if (FAILED(hr)) ! code = 1; ! ! cleanup: ! if (coInitialized) { ! CoUninitialize(); ! } ! return code; } #ifdef TESTMAIN int main(int argc, char **argv) { ! printf("Starting...\n"); if (icf_CheckAndAddAFSPorts(AFS_PORTSET_CLIENT)) ! printf("Failed\n"); ! else ! printf("Succeeded\n"); ! printf("Done\n"); ! return 0; ! } #endif \ No newline at end of file --- 151,345 ---- } HRESULT icf_CheckAndAddPorts(INetFwProfile * fwProfile, global_afs_port_t * ports, int nPorts) { ! INetFwOpenPorts * fwPorts = NULL; ! INetFwOpenPort * fwPort = NULL; ! HRESULT hr; ! HRESULT rhr = S_OK; /* return value */ ! int i = 0; ! ! hr = fwProfile->get_GloballyOpenPorts(&fwPorts); ! if (FAILED(hr)) { ! // Abort! ! DEBUGOUT(("Can't get globallyOpenPorts\n")); ! rhr = hr; ! goto cleanup; ! } ! // go through the supplied ports ! for (i=0; iItem(ports[i].port, ports[i].protocol, &fwPort); ! if (SUCCEEDED(hr)) { ! DEBUGOUTW((L"Found port for %S\n",ports[i].name)); hr = fwPort->get_Enabled(&vbEnabled); ! if (SUCCEEDED(hr)) { ! if ( vbEnabled == VARIANT_FALSE ) { ! hr = fwPort->put_Enabled(VARIANT_TRUE); ! if (FAILED(hr)) { ! // failed. Mark as failure. Don't try to create the port either. ! rhr = hr; ! } ! } // else we are fine ! } else { // Something is wrong with the port. ! // We try to create a new one thus overriding this faulty one. ! bCreate = TRUE; ! } ! fwPort->Release(); ! fwPort = NULL; ! } else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) { ! DEBUGOUTW((L"Port not found for %S\n", ports[i].name)); ! bCreate = TRUE; ! } ! if (bCreate) { ! DEBUGOUTW((L"Trying to create port %S\n",ports[i].name)); ! hr = CoCreateInstance( __uuidof(NetFwOpenPort), ! NULL, ! CLSCTX_INPROC_SERVER, ! __uuidof(INetFwOpenPort), ! reinterpret_cast ! (static_cast(&fwPort)) ! ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't create port\n")); rhr = hr; ! } else { ! DEBUGOUT(("Created port\n")); ! hr = fwPort->put_IpVersion( NET_FW_IP_VERSION_ANY ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set IpVersion\n")); ! rhr = hr; ! goto abandon_port; } ! hr = fwPort->put_Port( ports[i].port ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Port\n")); ! rhr = hr; ! goto abandon_port; ! } ! hr = fwPort->put_Protocol( ports[i].protocol ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Protocol\n")); ! rhr = hr; ! goto abandon_port; ! } ! hr = fwPort->put_Scope( NET_FW_SCOPE_ALL ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Scope\n")); ! rhr = hr; ! goto abandon_port; ! } ! bstName = SysAllocString( ports[i].name ); ! ! if (SysStringLen(bstName) == 0) { ! rhr = E_OUTOFMEMORY; ! } else { ! hr = fwPort->put_Name( bstName ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't set Name\n")); ! rhr = hr; ! SysFreeString( bstName ); ! goto abandon_port; ! } ! } ! ! SysFreeString( bstName ); ! ! hr = fwPorts->Add( fwPort ); ! if (FAILED(hr)) { ! DEBUGOUT(("Can't add port\n")); ! rhr = hr; ! } else ! DEBUGOUT(("Added port\n")); ! ! abandon_port: ! fwPort->Release(); ! } ! } ! } // loop through ports ! ! fwPorts->Release(); ! ! cleanup: ! ! if (fwPorts != NULL) ! fwPorts->Release(); ! ! return rhr; ! } long icf_CheckAndAddAFSPorts(int portset) { ! HRESULT hr; ! BOOL coInitialized = FALSE; ! INetFwProfile * fwProfile = NULL; ! global_afs_port_t * ports; ! int nports; ! long code = 0; ! ! if (portset == AFS_PORTSET_CLIENT) { ! ports = afs_clientPorts; ! nports = sizeof(afs_clientPorts) / sizeof(*afs_clientPorts); ! } else if (portset == AFS_PORTSET_SERVER) { ! ports = afs_serverPorts; ! nports = sizeof(afs_serverPorts) / sizeof(*afs_serverPorts); ! } else ! return 1; /* Invalid port set */ ! ! hr = CoInitializeEx( NULL, ! COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE ! ); ! if (SUCCEEDED(hr) || RPC_E_CHANGED_MODE == hr) { coInitialized = TRUE; } ! // not necessarily catastrophic if the call failed. We'll try to ! // continue as if it succeeded. hr = icf_OpenFirewallProfile(&fwProfile); ! if (FAILED(hr)) { ! // Ok. That didn't work. This could be because the machine we ! // are running on doesn't have Windows Firewall. We'll return ! // a failure to the caller, which shouldn't be taken to mean ! // it's catastrophic. ! DEBUGOUT(("Can't open Firewall profile\n")); ! code = 2; ! goto cleanup; ! } ! // Now that we have a firewall profile, we can start checking ! // and adding the ports that we want. ! hr = icf_CheckAndAddPorts(fwProfile, ports, nports); ! if (FAILED(hr)) ! code = 3; ! ! cleanup: ! if (coInitialized) { ! CoUninitialize(); ! } ! return code; } #ifdef TESTMAIN int main(int argc, char **argv) { ! printf("Starting...\n"); if (icf_CheckAndAddAFSPorts(AFS_PORTSET_CLIENT)) ! printf("Failed\n"); ! else ! printf("Succeeded\n"); ! printf("Done\n"); ! return 0; ! } #endif \ No newline at end of file Index: openafs/src/WINNT/afsd/cm_daemon.c diff -c openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.5 openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.5.4.3 *** openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.5 Tue Apr 19 17:07:14 2005 --- openafs/src/WINNT/afsd/cm_daemon.c Tue Oct 18 16:55:29 2005 *************** *** 13,18 **** --- 13,19 ---- #ifndef DJGPP #include #include + #include #else #include #endif /* !DJGPP */ *************** *** 24,29 **** --- 25,31 ---- #include #include "afsd.h" + #include "afsicf.h" long cm_daemonCheckInterval = 30; long cm_daemonTokenCheckInterval = 180; *************** *** 39,44 **** --- 41,62 ---- static int daemon_ShutdownFlag = 0; + #ifndef DJGPP + void cm_IpAddrDaemon(long parm) + { + rx_StartClientThread(); + + while (daemon_ShutdownFlag == 0) { + DWORD Result = NotifyAddrChange(NULL,NULL); + if (Result == NO_ERROR && daemon_ShutdownFlag == 0) { + osi_Log0(afsd_logp, "cm_IpAddrDaemon CheckDownServers"); + Sleep(2500); + cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); + } + } + } + #endif + void cm_BkgDaemon(long parm) { cm_bkgRequest_t *rp; *************** *** 99,104 **** --- 117,173 ---- osi_Wakeup((long) &cm_bkgListp); } + static int + IsWindowsFirewallPresent(void) + { + SC_HANDLE scm; + SC_HANDLE svc; + BOOLEAN flag; + BOOLEAN result = FALSE; + LPQUERY_SERVICE_CONFIG pConfig = NULL; + DWORD BufSize; + LONG status; + + /* Open services manager */ + scm = OpenSCManager(NULL, NULL, GENERIC_READ); + if (!scm) return FALSE; + + /* Open Windows Firewall service */ + svc = OpenService(scm, "SharedAccess", SERVICE_QUERY_CONFIG); + if (!svc) + goto close_scm; + + /* Query Windows Firewall service config, first just to get buffer size */ + /* Expected to fail, so don't test return value */ + (void) QueryServiceConfig(svc, NULL, 0, &BufSize); + status = GetLastError(); + if (status != ERROR_INSUFFICIENT_BUFFER) + goto close_svc; + + /* Allocate buffer */ + pConfig = (LPQUERY_SERVICE_CONFIG)GlobalAlloc(GMEM_FIXED,BufSize); + if (!pConfig) + goto close_svc; + + /* Query Windows Firewall service config, this time for real */ + flag = QueryServiceConfig(svc, pConfig, BufSize, &BufSize); + if (!flag) + goto free_pConfig; + + /* Is it autostart? */ + if (pConfig->dwStartType < SERVICE_DEMAND_START) + result = TRUE; + + free_pConfig: + GlobalFree(pConfig); + close_svc: + CloseServiceHandle(svc); + close_scm: + CloseServiceHandle(scm); + + return result; + } + /* periodic check daemon */ void cm_Daemon(long parm) { *************** *** 113,118 **** --- 182,188 ---- unsigned long code; struct hostent *thp; HMODULE hHookDll; + int configureFirewall = IsWindowsFirewallPresent(); /* ping all file servers, up or down, with unauthenticated connection, * to find out whether we have all our callbacks from the server still. *************** *** 142,184 **** lastTokenCacheCheck = now - cm_daemonTokenCheckInterval/2 + (rand() % cm_daemonTokenCheckInterval); while (daemon_ShutdownFlag == 0) { ! thrd_Sleep(30 * 1000); /* sleep 30 seconds */ if (daemon_ShutdownFlag == 1) return; /* find out what time it is */ now = osi_Time(); /* check down servers */ if (now > lastDownServerCheck + cm_daemonCheckInterval) { lastDownServerCheck = now; cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); } /* check up servers */ if (now > lastUpServerCheck + 3600) { lastUpServerCheck = now; cm_CheckServers(CM_FLAG_CHECKUPSERVERS, NULL); } if (now > lastVolCheck + 3600) { lastVolCheck = now; cm_CheckVolumes(); } if (now > lastCBExpirationCheck + 60) { lastCBExpirationCheck = now; cm_CheckCBExpiration(); } if (now > lastLockCheck + 60) { lastLockCheck = now; cm_CheckLocks(); } if (now > lastTokenCacheCheck + cm_daemonTokenCheckInterval) { lastTokenCacheCheck = now; cm_CheckTokenCache(now); } /* allow an exit to be called prior to stopping the service */ --- 212,283 ---- lastTokenCacheCheck = now - cm_daemonTokenCheckInterval/2 + (rand() % cm_daemonTokenCheckInterval); while (daemon_ShutdownFlag == 0) { ! thrd_Sleep(30 * 1000); /* sleep 30 seconds */ if (daemon_ShutdownFlag == 1) return; + if (configureFirewall) { + /* Open Microsoft Firewall to allow in port 7001 */ + switch (icf_CheckAndAddAFSPorts(AFS_PORTSET_CLIENT)) { + case 0: + afsi_log("Windows Firewall Configuration succeeded"); + configureFirewall = 0; + break; + case 1: + afsi_log("Invalid Windows Firewall Port Set"); + break; + case 2: + afsi_log("Unable to open Windows Firewall Profile"); + break; + case 3: + afsi_log("Unable to create/modify Windows Firewall Port entries"); + break; + default: + afsi_log("Unknown Windows Firewall Configuration error"); + } + } + /* find out what time it is */ now = osi_Time(); /* check down servers */ if (now > lastDownServerCheck + cm_daemonCheckInterval) { lastDownServerCheck = now; + osi_Log0(afsd_logp, "cm_Daemon CheckDownServers"); cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); + now = osi_Time(); } /* check up servers */ if (now > lastUpServerCheck + 3600) { lastUpServerCheck = now; + osi_Log0(afsd_logp, "cm_Daemon CheckUpServers"); cm_CheckServers(CM_FLAG_CHECKUPSERVERS, NULL); + now = osi_Time(); } if (now > lastVolCheck + 3600) { lastVolCheck = now; cm_CheckVolumes(); + now = osi_Time(); } if (now > lastCBExpirationCheck + 60) { lastCBExpirationCheck = now; cm_CheckCBExpiration(); + now = osi_Time(); } if (now > lastLockCheck + 60) { lastLockCheck = now; cm_CheckLocks(); + now = osi_Time(); } if (now > lastTokenCacheCheck + cm_daemonTokenCheckInterval) { lastTokenCacheCheck = now; cm_CheckTokenCache(now); + now = osi_Time(); } /* allow an exit to be called prior to stopping the service */ *************** *** 217,230 **** if (osi_Once(&once)) { lock_InitializeRWLock(&cm_daemonLock, "cm_daemonLock"); osi_EndOnce(&once); ! /* creating pinging daemon */ phandle = thrd_Create((SecurityAttrib) 0, 0, (ThreadFunc) cm_Daemon, 0, 0, &pid, "cm_Daemon"); osi_assert(phandle != NULL); - thrd_CloseHandle(phandle); ! for(i=0; i < nDaemons; i++) { phandle = thrd_Create((SecurityAttrib) 0, 0, (ThreadFunc) cm_BkgDaemon, 0, 0, &pid, "cm_BkgDaemon"); --- 316,337 ---- if (osi_Once(&once)) { lock_InitializeRWLock(&cm_daemonLock, "cm_daemonLock"); osi_EndOnce(&once); ! ! #ifndef DJGPP ! /* creating IP Address Change monitor daemon */ ! phandle = thrd_Create((SecurityAttrib) 0, 0, ! (ThreadFunc) cm_IpAddrDaemon, 0, 0, &pid, "cm_IpAddrDaemon"); ! osi_assert(phandle != NULL); ! thrd_CloseHandle(phandle); ! #endif /* DJGPP */ ! /* creating pinging daemon */ phandle = thrd_Create((SecurityAttrib) 0, 0, (ThreadFunc) cm_Daemon, 0, 0, &pid, "cm_Daemon"); osi_assert(phandle != NULL); thrd_CloseHandle(phandle); ! ! for(i=0; i < nDaemons; i++) { phandle = thrd_Create((SecurityAttrib) 0, 0, (ThreadFunc) cm_BkgDaemon, 0, 0, &pid, "cm_BkgDaemon"); Index: openafs/src/WINNT/afsd/largeintdotnet.c diff -c openafs/src/WINNT/afsd/largeintdotnet.c:1.1 openafs/src/WINNT/afsd/largeintdotnet.c:1.1.12.1 *** openafs/src/WINNT/afsd/largeintdotnet.c:1.1 Wed May 28 14:34:38 2003 --- openafs/src/WINNT/afsd/largeintdotnet.c Wed Oct 19 16:13:21 2005 *************** *** 20,90 **** #if (_MSC_VER >= 1300) LARGE_INTEGER LargeIntegerAdd(LARGE_INTEGER a, LARGE_INTEGER b) { ! LARGE_INTEGER result; ! int carry; ! result.LowPart=a.LowPart+b.LowPart; ! carry=(result.LowPart < b.LowPart) ? 1 : 0; ! result.HighPart=a.HighPart+b.HighPart+ carry; ! return result; } LARGE_INTEGER LargeIntegerSubtract(LARGE_INTEGER a, LARGE_INTEGER b) { ! LARGE_INTEGER result; ! int borrow; ! result.LowPart=a.LowPart-b.LowPart; ! borrow=(result.LowPart > a.LowPart) ? 1 : 0; ! result.HighPart=a.HighPart-b.HighPart- borrow; ! return result; } LARGE_INTEGER ExtendedLargeIntegerDivide(LARGE_INTEGER a, unsigned long b, unsigned long *remainder) { ! LARGE_INTEGER result; ! ULONGLONG a1,q1,r1; result.HighPart=0; result.LowPart=0; if (b == 0) { return result; } if (b == 1) { *remainder = 0; return a; } ! a1=(a.HighPart << 32) | a.LowPart; ! q1=a1/b; ! r1=a1-(q1*b); ! if (r1 > ULONG_MAX) /*XXX */; ! result.HighPart=q1 >> 32; ! result.LowPart=q1 & 0xffffffff; ! *remainder=r1 & 0xffffffff; ! return result; } LARGE_INTEGER LargeIntegerDivide(LARGE_INTEGER a, LARGE_INTEGER b, LARGE_INTEGER *remainder) { ! LARGE_INTEGER result; ! ULONGLONG a1,b1,q1,r1; result.HighPart=0; result.LowPart=0; if (b.HighPart == 0 && b.LowPart == 0) { return result; } if (b.HighPart == 0 && b.LowPart == 1) { ! remainder->HighPart = 0; ! remainder->LowPart = 0; ! return a; ! } ! a1=(a.HighPart << 32) | a.LowPart; ! b1=(b.HighPart << 32) | a.LowPart; ! q1=a1/b1; ! r1=a1-(q1*b1); ! result.HighPart=q1 >> 32; ! result.LowPart=q1 & 0xffffffff; ! remainder->HighPart=r1 >> 32; ! remainder->LowPart=r1 & 0xffffffff; ! return result; ! } LARGE_INTEGER ConvertLongToLargeInteger(unsigned long a) { ! LARGE_INTEGER result; ! result.HighPart=0; ! result.LowPart=a; ! return result; ! } ! #endif --- 20,96 ---- #if (_MSC_VER >= 1300) LARGE_INTEGER LargeIntegerAdd(LARGE_INTEGER a, LARGE_INTEGER b) { ! LARGE_INTEGER result; ! int carry; ! result.LowPart=a.LowPart+b.LowPart; ! carry=(result.LowPart < b.LowPart) ? 1 : 0; ! result.HighPart=a.HighPart+b.HighPart+ carry; ! return result; } LARGE_INTEGER LargeIntegerSubtract(LARGE_INTEGER a, LARGE_INTEGER b) { ! LARGE_INTEGER result; ! int borrow; ! result.LowPart=a.LowPart-b.LowPart; ! borrow=(result.LowPart > a.LowPart) ? 1 : 0; ! result.HighPart=a.HighPart-b.HighPart- borrow; ! return result; } LARGE_INTEGER ExtendedLargeIntegerDivide(LARGE_INTEGER a, unsigned long b, unsigned long *remainder) { ! LARGE_INTEGER result; ! ULONGLONG a1,q1,r1; result.HighPart=0; result.LowPart=0; if (b == 0) { return result; } if (b == 1) { *remainder = 0; return a; } ! a1=a.HighPart; ! a1<<=32; ! a1 |= a.LowPart; ! q1=a1/b; ! r1=a1-(q1*b); ! if (r1 > ULONG_MAX) /*XXX */; ! result.HighPart=(LONG)(q1 >> 32); ! result.LowPart=(DWORD)(q1 & 0xffffffff); ! *remainder=(unsigned long)(r1 & 0xffffffff); ! return result; } LARGE_INTEGER LargeIntegerDivide(LARGE_INTEGER a, LARGE_INTEGER b, LARGE_INTEGER *remainder) { ! LARGE_INTEGER result; ! ULONGLONG a1,b1,q1,r1; result.HighPart=0; result.LowPart=0; if (b.HighPart == 0 && b.LowPart == 0) { return result; } if (b.HighPart == 0 && b.LowPart == 1) { ! remainder->HighPart = 0; ! remainder->LowPart = 0; ! return a; ! } ! a1=a.HighPart; ! a1<<=32; ! a1|=a.LowPart; ! b1=b.HighPart; ! b1<<=32; ! b1|=b.LowPart; ! q1=a1/b1; ! r1=a1-(q1*b1); ! result.HighPart=(LONG)(q1 >> 32); ! result.LowPart=(DWORD)(q1 & 0xffffffff); ! remainder->HighPart=(LONG)(r1 >> 32); ! remainder->LowPart=(DWORD)(r1 & 0xffffffff); ! return result; ! } LARGE_INTEGER ConvertLongToLargeInteger(unsigned long a) { ! LARGE_INTEGER result; ! result.HighPart=0; ! result.LowPart=a; ! return result; ! } ! #endif Index: openafs/src/WINNT/afsd/smb.c diff -c openafs/src/WINNT/afsd/smb.c:1.55.2.27 openafs/src/WINNT/afsd/smb.c:1.55.2.27.2.2 *** openafs/src/WINNT/afsd/smb.c:1.55.2.27 Mon Aug 15 13:29:54 2005 --- openafs/src/WINNT/afsd/smb.c Wed Oct 19 03:00:23 2005 *************** *** 2439,2445 **** else if (code == CM_ERROR_ALLBUSY) { NTStatus = 0xC00000BFL; /* Network Busy */ } ! else if (code == CM_ERROR_ALLOFFLINE) { NTStatus = 0xC0000350L; /* Remote Host Down */ } #else --- 2439,2445 ---- 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 *************** *** 2447,2457 **** * the AFS Client Service is busy or down. */ else if (code == CM_ERROR_ALLBUSY || ! code == CM_ERROR_ALLOFFLINE) { NTStatus = 0xC00000BEL; /* Bad Network Path */ } #endif ! else { NTStatus = 0xC0982001L; /* SMB non-specific error */ } --- 2447,2460 ---- * 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 */ ! } else { NTStatus = 0xC0982001L; /* SMB non-specific error */ } Index: openafs/src/config/NTMakefile.amd64_w2k diff -c openafs/src/config/NTMakefile.amd64_w2k:1.1.2.20.2.3 openafs/src/config/NTMakefile.amd64_w2k:1.1.2.20.2.4 *** openafs/src/config/NTMakefile.amd64_w2k:1.1.2.20.2.3 Fri Oct 14 23:15:50 2005 --- openafs/src/config/NTMakefile.amd64_w2k Wed Oct 19 16:15:22 2005 *************** *** 80,86 **** #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MAJOR=1 AFSPRODUCT_VER_MINOR=4 ! AFSPRODUCT_VER_PATCH=0007 AFSPRODUCT_VER_BUILD=0 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH) --- 80,86 ---- #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MAJOR=1 AFSPRODUCT_VER_MINOR=4 ! AFSPRODUCT_VER_PATCH=0008 AFSPRODUCT_VER_BUILD=0 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH) Index: openafs/src/config/NTMakefile.i386_nt40 diff -c openafs/src/config/NTMakefile.i386_nt40:1.46.2.35.2.3 openafs/src/config/NTMakefile.i386_nt40:1.46.2.35.2.4 *** openafs/src/config/NTMakefile.i386_nt40:1.46.2.35.2.3 Fri Oct 14 23:15:50 2005 --- openafs/src/config/NTMakefile.i386_nt40 Wed Oct 19 16:15:22 2005 *************** *** 80,86 **** #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MAJOR=1 AFSPRODUCT_VER_MINOR=4 ! AFSPRODUCT_VER_PATCH=0007 AFSPRODUCT_VER_BUILD=0 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH) --- 80,86 ---- #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MAJOR=1 AFSPRODUCT_VER_MINOR=4 ! AFSPRODUCT_VER_PATCH=0008 AFSPRODUCT_VER_BUILD=0 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH) Index: openafs/src/config/NTMakefile.i386_w2k diff -c openafs/src/config/NTMakefile.i386_w2k:1.1.2.21.2.3 openafs/src/config/NTMakefile.i386_w2k:1.1.2.21.2.4 *** openafs/src/config/NTMakefile.i386_w2k:1.1.2.21.2.3 Fri Oct 14 23:15:50 2005 --- openafs/src/config/NTMakefile.i386_w2k Wed Oct 19 16:15:22 2005 *************** *** 79,85 **** #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MINOR=4 ! AFSPRODUCT_VER_PATCH=0007 AFSPRODUCT_VER_BUILD=0 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH) --- 79,85 ---- #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MINOR=4 ! AFSPRODUCT_VER_PATCH=0008 AFSPRODUCT_VER_BUILD=0 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH) Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in diff -c openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.7 openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.7.2.1 *** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.7 Fri Aug 19 11:52:55 2005 --- openafs/src/libafs/afs.ppc_darwin_70.plist.in Thu Oct 20 17:13:05 2005 *************** *** 15,25 **** CFBundlePackageType KEXT CFBundleShortVersionString ! 1.3.99 CFBundleSignature ???? CFBundleVersion ! 1.3.99 OSBundleLibraries com.apple.kernel.bsd --- 15,25 ---- CFBundlePackageType KEXT CFBundleShortVersionString ! 1.4.0 CFBundleSignature ???? CFBundleVersion ! 1.4.0 OSBundleLibraries com.apple.kernel.bsd Index: openafs/src/libafs/afs.ppc_darwin_80.plist.in diff -c openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.1.2.1 openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.1.2.1.4.1 *** openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.1.2.1 Tue Apr 19 12:03:07 2005 --- openafs/src/libafs/afs.ppc_darwin_80.plist.in Thu Oct 20 17:13:05 2005 *************** *** 15,25 **** CFBundlePackageType KEXT CFBundleShortVersionString ! 1.3.82 CFBundleSignature ???? CFBundleVersion ! 1.3.82 OSBundleLibraries com.apple.kernel.bsd --- 15,25 ---- CFBundlePackageType KEXT CFBundleShortVersionString ! 1.4.0 CFBundleSignature ???? CFBundleVersion ! 1.4.0 OSBundleLibraries com.apple.kernel.bsd Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.15 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.15.2.1 *** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.15 Fri Aug 19 11:52:56 2005 --- openafs/src/packaging/MacOS/OpenAFS.Info.plist Thu Oct 20 17:13:09 2005 *************** *** 3,19 **** CFBundleGetInfoString ! OpenAFS 1.3.99 CFBundleIdentifier org.openafs.OpenAFS.pkg CFBundleName OpenAFS CFBundleShortVersionString ! 1.3.99 IFMajorVersion 1 IFMinorVersion ! 3 IFPkgFlagAllowBackRev IFPkgFlagAuthorizationAction --- 3,19 ---- CFBundleGetInfoString ! OpenAFS 1.4.0 CFBundleIdentifier org.openafs.OpenAFS.pkg CFBundleName OpenAFS CFBundleShortVersionString ! 1.4.0 IFMajorVersion 1 IFMinorVersion ! 4 IFPkgFlagAllowBackRev IFPkgFlagAuthorizationAction Index: openafs/src/packaging/MacOS/OpenAFS.info diff -c openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.20.2.2 openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.20.2.3 *** openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.20.2.2 Sun Oct 16 21:55:43 2005 --- openafs/src/packaging/MacOS/OpenAFS.info Thu Oct 20 17:13:09 2005 *************** *** 1,5 **** Title OpenAFS ! Version 1.4.0-rc8 Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information. DefaultLocation / Diskname (null) --- 1,5 ---- Title OpenAFS ! Version 1.4.0 Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information. DefaultLocation / Diskname (null) Index: openafs/src/vol/partition.c diff -c openafs/src/vol/partition.c:1.30.2.1 openafs/src/vol/partition.c:1.30.2.1.4.1 *** openafs/src/vol/partition.c:1.30.2.1 Wed Aug 25 03:14:19 2004 --- openafs/src/vol/partition.c Mon Oct 17 16:48:29 2005 *************** *** 21,27 **** #include RCSID ! ("$Header: /cvs/openafs/src/vol/partition.c,v 1.30.2.1 2004/08/25 07:14:19 shadow Exp $"); #include #ifdef AFS_NT40_ENV --- 21,27 ---- #include RCSID ! ("$Header: /cvs/openafs/src/vol/partition.c,v 1.30.2.1.4.1 2005/10/17 20:48:29 shadow Exp $"); #include #ifdef AFS_NT40_ENV *************** *** 346,358 **** Log("This program is compiled without AFS_NAMEI_ENV, but partition %s seems to contain volumes which use the namei-interface; aborting\n", part); return -1; } - #endif /* AFS_NAMEI_ENV */ - #endif #ifdef AFS_SGI_XFS_IOPS_ENV if (VerifyXFSInodeSize(part, status.st_fstype) < 0) return -1; #endif #if defined(AFS_DUX40_ENV) && !defined(AFS_NAMEI_ENV) if (status.st_ino != ROOTINO) { --- 346,358 ---- Log("This program is compiled without AFS_NAMEI_ENV, but partition %s seems to contain volumes which use the namei-interface; aborting\n", part); return -1; } #ifdef AFS_SGI_XFS_IOPS_ENV if (VerifyXFSInodeSize(part, status.st_fstype) < 0) return -1; #endif + #endif /* AFS_NAMEI_ENV */ + #endif #if defined(AFS_DUX40_ENV) && !defined(AFS_NAMEI_ENV) if (status.st_ino != ROOTINO) {