/// <summary> /// Composes the RopLogon Request Buffer. /// This ROP logs on to a mailbox or public folder. More detailed information about this operation can be found in [MS-OXCSTOR]. /// </summary> /// <param name="uDN">User's distinguished name (DN).</param> /// <param name="openFlags">Contains additional flags that control the behavior of the logon.</param> /// <returns>The rgbIn buffer generated by this method.</returns> public byte[] ComposeLogonRequest(string uDN, uint openFlags) { RopLogonRequest logonRequest = new RopLogonRequest { RopId = (byte)RopId.RopLogon, LogonId = Convert.ToByte(0), OutputHandleIndex = Convert.ToByte(0), LogonFlags = (byte)LogonFlags.Private, OpenFlags = openFlags, StoreState = 0, EssdnSize = (ushort)Encoding.ASCII.GetByteCount(uDN), Essdn = Encoding.ASCII.GetBytes(uDN) }; List <ISerializable> requestRops = new List <ISerializable> { logonRequest }; List <uint> requestSOH = new List <uint> { // The default value for server output object handle. ConstValues.DefaultOutputHandle }; return(this.BuildRequestBuffer(requestRops, requestSOH)); }
/// <summary> /// Logon Mail server. /// </summary> /// <param name="logonType">Logon Type.</param> /// <param name="objHandle">Server response handle.</param> /// <param name="openFlags">The possible values are specified in [MS-OXCSTOR]. This structure contains more flags that control the behavior of the logon.</param> /// <returns>Logon Response.</returns> protected RopLogonResponse Logon(LogonFlags logonType, out uint objHandle, uint openFlags) { RopLogonRequest logonRequest = new RopLogonRequest(); object ropResponse = null; string userDN = Common.GetConfigurationPropertyValue("AdminUserEssdn", this.Site) + Constants.StringNullTerminated; logonRequest.RopId = (byte)RopId.RopLogon; logonRequest.LogonId = Constants.CommonLogonId; logonRequest.OutputHandleIndex = 0x0; logonRequest.StoreState = 0; logonRequest.LogonFlags = (byte)logonType; logonRequest.OpenFlags = openFlags; if (LogonFlags.PublicFolder == logonType) { logonRequest.EssdnSize = 0; logonRequest.Essdn = null; } else if (LogonFlags.Private == logonType) { logonRequest.EssdnSize = (ushort)Encoding.ASCII.GetByteCount(userDN); logonRequest.Essdn = Encoding.ASCII.GetBytes(userDN); } this.Adapter.DoRopCall(logonRequest, this.LogonHandle, ref ropResponse, ref this.responseHandles); RopLogonResponse logonResponse = (RopLogonResponse)ropResponse; objHandle = this.responseHandles[0][logonResponse.OutputHandleIndex]; this.defaultFolderIds = logonResponse.FolderIds; return(logonResponse); }
/// <summary> /// This ROP logs on to a private mailbox or public folder. /// </summary> /// <param name="logonType">This type specifies ongoing action on the private mailbox or public folder.</param> /// <param name="logonResponse">The response of this ROP.</param> /// <param name="userDN">This string specifies which mailbox to log on to.</param> /// <param name="needVerify">Whether need to verify the response.</param> /// <returns>The handle of logon object.</returns> private uint RopLogon(LogonType logonType, out RopLogonResponse logonResponse, string userDN, bool needVerify) { this.rawDataValue = null; this.responseValue = null; this.responseSOHsValue = null; userDN += "\0"; uint insideObjHandle = 0; RopLogonRequest logonRequest = new RopLogonRequest() { RopId = (byte)RopId.RopLogon, LogonId = LogonId, OutputHandleIndex = (byte)HandleIndex.FirstIndex, StoreState = (uint)StoreState.None, // Set parameters for public folder logon type. LogonFlags = logonType == LogonType.PublicFolder ? (byte)LogonFlags.PublicFolder : (byte)LogonFlags.Private, OpenFlags = logonType == LogonType.PublicFolder ? (uint)(OpenFlags.UsePerMDBReplipMapping | OpenFlags.Public) : (uint)OpenFlags.UsePerMDBReplipMapping, // Set EssdnSize to 0, which specifies the size of the ESSDN field. EssdnSize = logonType == LogonType.PublicFolder ? (ushort)0 : (ushort)Encoding.ASCII.GetByteCount(userDN), Essdn = logonType == LogonType.PublicFolder ? null : Encoding.ASCII.GetBytes(userDN), }; this.responseSOHsValue = this.ProcessSingleRop(logonRequest, insideObjHandle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse); logonResponse = (RopLogonResponse)this.responseValue; if (needVerify) { this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, logonResponse.ReturnValue, string.Format("Logon Failed! Error: 0x{0:X8}", logonResponse.ReturnValue)); } return(this.responseSOHsValue[0][logonResponse.OutputHandleIndex]); }