protected override void TestInitialize() { base.TestInitialize(); testConfig = new DFSCTestConfig(BaseTestSite); BaseTestSite.DefaultProtocolDocShortName = "MS-DFSC"; BaseTestSite.Log.Add(LogEntryKind.Debug, "SecurityPackage for authentication: " + TestConfig.DefaultSecurityPackage); client = new DfscClient(); utility = new DFSCTestUtility(BaseTestSite, TestConfig); }
protected override void TestInitialize() { base.TestInitialize(); testConfig = new DFSCTestConfig(BaseTestSite); BaseTestSite.DefaultProtocolDocShortName = "MS-DFSC"; BaseTestSite.Log.Add(LogEntryKind.Debug, "SecurityPackage for authentication: " + TestConfig.DefaultSecurityPackage); client = new DfscClient(); utility = new DFSCTestUtility(BaseTestSite, TestConfig); }
/// <summary> /// It's a general function used to connect server, create DFS referral packet and send packet. /// </summary> /// <param name="status">Returned status from server</param> /// <param name="client">Client instance</param> /// <param name="entryType">Version of DFS referral request</param> /// <param name="reqPath">The requested DFS Path to resolve</param> /// <param name="dcOrDFSServer">Server is DC or DFS server</param> /// <param name="isEx">The request is REQ_GET_DFS_REFERRAL_EX or REQ_GET_DFS_REFERRAL</param> /// <param name="containSiteName">If REQ_GET_DFS_REFERRAL_EX contains "SiteName" field</param> /// <returns>The response packet</returns> public DfscReferralResponsePacket SendAndReceiveDFSReferral( out uint status, DfscClient client, ReferralEntryType_Values entryType, string reqPath, bool dcOrDFSServer, bool isEx = false, bool containSiteName = false) { string serverName; if (dcOrDFSServer) { serverName = testConfig.DCServerName; } else { serverName = testConfig.DFSServerName; } baseTestSite.Log.Add(LogEntryKind.Debug, "Server name is {0}", serverName); baseTestSite.Log.Add(LogEntryKind.Debug, "Request path is {0}", reqPath); if (isEx) { baseTestSite.Log.Add(LogEntryKind.Debug, "The message is extended."); } else { baseTestSite.Log.Add(LogEntryKind.Debug, "The message is NOT extended."); } if (containSiteName) { baseTestSite.Log.Add(LogEntryKind.Debug, "The structure contains SiteName."); } else { baseTestSite.Log.Add(LogEntryKind.Debug, "The structure does not contain SiteName."); } client.Connect(serverName, testConfig.ClientComputerName, testConfig.DomainName, testConfig.UserName, testConfig.UserPassword, testConfig.Timeout, testConfig.DefaultSecurityPackage, testConfig.UseServerGssToken, testConfig.TransportPreferredSMB); DfscReferralRequestPacket reqPacket = null; DfscReferralRequestEXPacket reqPacketEX = null; if (isEx) { if (containSiteName) { reqPacketEX = client.CreateDfscReferralRequestPacketEX((ushort)entryType, reqPath, REQ_GET_DFS_REFERRAL_RequestFlags.SiteName, testConfig.SiteName); } else { reqPacketEX = client.CreateDfscReferralRequestPacketEX((ushort)entryType, reqPath, REQ_GET_DFS_REFERRAL_RequestFlags.None); } } else { reqPacket = client.CreateDfscReferralRequestPacket((ushort)entryType, reqPath); } DfscReferralResponsePacket respPacket = client.SendAndRecieveDFSCReferralMessages(out status, testConfig.Timeout, reqPacketEX, reqPacket); return(respPacket); }
/// <summary> /// It's a general function used to connect server, create DFS referral packet and send packet. /// </summary> /// <param name="status">Returned status from server</param> /// <param name="client">Client instance</param> /// <param name="entryType">Version of DFS referral request</param> /// <param name="reqPath">The requested DFS Path to resolve</param> /// <param name="dcOrDFSServer">Server is DC or DFS server</param> /// <param name="isEx">The request is REQ_GET_DFS_REFERRAL_EX or REQ_GET_DFS_REFERRAL</param> /// <param name="containSiteName">If REQ_GET_DFS_REFERRAL_EX contains "SiteName" field</param> /// <returns>The response packet</returns> public DfscReferralResponsePacket SendAndReceiveDFSReferral( out uint status, DfscClient client, ReferralEntryType_Values entryType, string reqPath, bool dcOrDFSServer, bool isEx = false, bool containSiteName = false) { string serverName; if (dcOrDFSServer) { serverName = testConfig.DCServerName; } else { serverName = testConfig.DFSServerName; } baseTestSite.Log.Add(LogEntryKind.Debug, "Server name is {0}", serverName); baseTestSite.Log.Add(LogEntryKind.Debug, "Request path is {0}", reqPath); if (isEx) { baseTestSite.Log.Add(LogEntryKind.Debug, "The message is extended."); } else { baseTestSite.Log.Add(LogEntryKind.Debug, "The message is NOT extended."); } if (containSiteName) { baseTestSite.Log.Add(LogEntryKind.Debug, "The structure contains SiteName."); } else { baseTestSite.Log.Add(LogEntryKind.Debug, "The structure does not contain SiteName."); } client.Connect(serverName, testConfig.ClientComputerName, testConfig.DomainName, testConfig.UserName, testConfig.UserPassword, testConfig.Timeout, testConfig.DefaultSecurityPackage, testConfig.UseServerGssToken, testConfig.TransportPreferredSMB); DfscReferralRequestPacket reqPacket = null; DfscReferralRequestEXPacket reqPacketEX = null; if (isEx) { if (containSiteName) { reqPacketEX = client.CreateDfscReferralRequestPacketEX((ushort)entryType, reqPath, REQ_GET_DFS_REFERRAL_RequestFlags.SiteName, testConfig.SiteName); } else { reqPacketEX = client.CreateDfscReferralRequestPacketEX((ushort)entryType, reqPath, REQ_GET_DFS_REFERRAL_RequestFlags.None); } } else { reqPacket = client.CreateDfscReferralRequestPacket((ushort)entryType, reqPath); } DfscReferralResponsePacket respPacket = client.SendAndRecieveDFSCReferralMessages(out status, testConfig.Timeout, reqPacketEX, reqPacket); return respPacket; }