Exemple #1
0
		public static bool IsAddressBookEntryId(byte[] entryId, out Eidt eidt, out string emailAddr)
		{
			eidt = Eidt.User;
			emailAddr = null;
			if (entryId == null)
			{
				return false;
			}
			int num = 0;
			int num2 = entryId.Length;
			bool result = false;
			if (num2 <= AddressBookEntryId.AddressBookEntryIdSize || !AddressBookEntryId.ArrayMatch(entryId, AddressBookEntryId.SkipEntryIdFlagsOffset, AddressBookEntryId.ExchAddrGuid) || entryId[num2 - 1] != 0)
			{
				return result;
			}
			num += AddressBookEntryId.SkipEntryIdFlagsOffset + AddressBookEntryId.ExchAddrGuid.Length + AddressBookEntryId.BinaryHelper.DWordSize;
			try
			{
				eidt = (Eidt)AddressBookEntryId.BinaryHelper.GetDword(entryId, ref num, num2);
				emailAddr = AddressBookEntryId.BinaryHelper.GetStringFromASCII(entryId, ref num, num2);
				result = true;
			}
			catch (ArgumentOutOfRangeException)
			{
			}
			return result;
		}
		private static bool TryGetEidt(RecipientDisplayType type, out Eidt eidt)
		{
			if (type <= RecipientDisplayType.ArbitrationMailbox)
			{
				if (type <= RecipientDisplayType.ACLableSyncedUSGasContact)
				{
					if (type != RecipientDisplayType.ACLableSyncedRemoteMailUser && type != RecipientDisplayType.ACLableSyncedUSGasContact)
					{
						goto IL_76;
					}
				}
				else
				{
					if (type == RecipientDisplayType.MailboxUser)
					{
						goto IL_71;
					}
					switch (type)
					{
					case RecipientDisplayType.RemoteMailUser:
						break;
					case RecipientDisplayType.ConferenceRoomMailbox:
					case RecipientDisplayType.EquipmentMailbox:
					case RecipientDisplayType.ArbitrationMailbox:
						goto IL_71;
					case (RecipientDisplayType)9:
						goto IL_76;
					default:
						goto IL_76;
					}
				}
			}
			else if (type <= RecipientDisplayType.ACLableMailboxUser)
			{
				if (type != RecipientDisplayType.TeamMailboxUser && type != RecipientDisplayType.ACLableMailboxUser)
				{
					goto IL_76;
				}
				goto IL_71;
			}
			else if (type != RecipientDisplayType.ACLableRemoteMailUser)
			{
				if (type != RecipientDisplayType.ACLableTeamMailboxUser)
				{
					goto IL_76;
				}
				goto IL_71;
			}
			eidt = Eidt.RemoteUser;
			return true;
			IL_71:
			eidt = Eidt.User;
			return true;
			IL_76:
			eidt = Eidt.User;
			return false;
		}
Exemple #3
0
		public static byte[] MakeAddressBookEntryID(string legacyDN, Eidt eidt)
		{
			Util.ThrowOnNullOrEmptyArgument(legacyDN, "legacyDN");
			EnumValidator.ThrowIfInvalid<Eidt>(eidt, "eidt");
			byte[] array = new byte[AddressBookEntryId.AddressBookEntryIdSize + legacyDN.Length + 1];
			int num = 0;
			AddressBookEntryId.BinaryHelper.SetDword(array, ref num, 0U);
			Buffer.BlockCopy(AddressBookEntryId.ExchAddrGuid, 0, array, num, AddressBookEntryId.ExchAddrGuid.Length);
			num += AddressBookEntryId.ExchAddrGuid.Length;
			AddressBookEntryId.BinaryHelper.SetDword(array, ref num, AddressBookEntryId.AddressBookEntryIdVersion);
			AddressBookEntryId.BinaryHelper.SetDword(array, ref num, (uint)eidt);
			AddressBookEntryId.BinaryHelper.SetASCIIString(array, ref num, legacyDN);
			return array;
		}
Exemple #4
0
		public static byte[] MakeAddressBookEntryIDFromLocalDirectorySid(SecurityIdentifier sid)
		{
			if (!ExternalUser.IsExternalUserSid(sid))
			{
				throw new InvalidParamException(ServerStrings.InvalidLocalDirectorySecurityIdentifier(sid.ToString()));
			}
			byte[] array = new byte[AddressBookEntryId.AddressBookEntryIdSize + sid.BinaryLength];
			Eidt dw = Eidt.User;
			int num = 0;
			AddressBookEntryId.BinaryHelper.SetDword(array, ref num, 0U);
			Buffer.BlockCopy(AddressBookEntryId.MuidLocalDirectoryUser, 0, array, num, AddressBookEntryId.MuidLocalDirectoryUser.Length);
			num += AddressBookEntryId.ExchAddrGuid.Length;
			AddressBookEntryId.BinaryHelper.SetDword(array, ref num, AddressBookEntryId.AddressBookEntryIdVersion);
			AddressBookEntryId.BinaryHelper.SetDword(array, ref num, (uint)dw);
			sid.GetBinaryForm(array, num);
			return array;
		}
Exemple #5
0
		public static byte[] MakeAddressBookEntryID(string legacyDN, bool isDL)
		{
			Eidt eidt = isDL ? Eidt.List : Eidt.User;
			return AddressBookEntryId.MakeAddressBookEntryID(legacyDN, eidt);
		}