Exemplo n.º 1
0
        internal RfriStatus GetFQDNFromLegacyDN(string legacyDN, out string serverFQDN)
        {
            RfriStatus rfriStatus = RfriStatus.Success;

            serverFQDN = null;
            RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "Requested DN: {0}", RfriContext.GetString(legacyDN));
            if (legacyDN.Contains("@"))
            {
                LegacyDN legacyDN2;
                if (LegacyDN.TryParse(legacyDN, out legacyDN2))
                {
                    string text;
                    legacyDN2.GetParentLegacyDN(out text, out serverFQDN);
                    if (string.IsNullOrEmpty(serverFQDN) || !serverFQDN.Contains("@"))
                    {
                        rfriStatus = RfriStatus.NoSuchObject;
                    }
                }
                else
                {
                    rfriStatus = RfriStatus.NoSuchObject;
                }
            }
            else
            {
                legacyDN   = ExchangeRpcClientAccess.FixFakeRedirectLegacyDNIfNeeded(legacyDN);
                rfriStatus = ServerFqdnCache.LookupFQDNByLegacyDN(legacyDN, out serverFQDN);
            }
            if (rfriStatus != RfriStatus.Success || string.IsNullOrEmpty(serverFQDN))
            {
                if (rfriStatus == RfriStatus.Success)
                {
                    rfriStatus = RfriStatus.NoSuchObject;
                }
                this.ProtocolLogSession[ProtocolLog.Field.Failures] = RfriContext.GetString(legacyDN);
            }
            else
            {
                RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "Referring to {0}", serverFQDN);
            }
            return(rfriStatus);
        }
Exemplo n.º 2
0
        internal RfriStatus GetNewDSA(string userDN, out string serverFQDN)
        {
            serverFQDN = null;
            RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "Requested user DN: {0}", RfriContext.GetString(userDN));
            string     str;
            RfriStatus rfriStatus;

            if (this.IsUsingHttp())
            {
                str = userDN;
                if (!this.TryGetPersonalizedServer(userDN, out serverFQDN))
                {
                    rfriStatus = ServerFqdnCache.LookupFQDNByLegacyDN(null, out serverFQDN);
                    RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "ServerFqdnCache.LookupFQDNByLegacyDN(null): {0}", serverFQDN ?? "(null)");
                }
                else
                {
                    rfriStatus = RfriStatus.Success;
                }
            }
            else
            {
                string clientAccessServerLegacyDN = this.GetClientAccessServerLegacyDN(userDN);
                RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "RfriContext.GetClientAccessServerLegacyDN: {0}", clientAccessServerLegacyDN ?? "(null)");
                str        = clientAccessServerLegacyDN;
                rfriStatus = ServerFqdnCache.LookupFQDNByLegacyDN(clientAccessServerLegacyDN, out serverFQDN);
                RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "ServerFqdnCache.LookupFQDNByLegacyDN: {0}", serverFQDN ?? "(null)");
            }
            if (rfriStatus != RfriStatus.Success || string.IsNullOrEmpty(serverFQDN))
            {
                if (rfriStatus == RfriStatus.Success)
                {
                    rfriStatus = RfriStatus.NoSuchObject;
                }
                this.ProtocolLogSession[ProtocolLog.Field.Failures] = RfriContext.GetString(str);
            }
            else
            {
                RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "Referring to {0}", serverFQDN);
            }
            return(rfriStatus);
        }
Exemplo n.º 3
0
        private bool TryGetPersonalizedServer(string userLegacyDN, out string personalizedServer)
        {
            personalizedServer = string.Empty;
            bool          flag = true;
            NspiPrincipal nspiPrincipal;

            if (string.IsNullOrEmpty(userLegacyDN) || LegacyDN.StringComparer.Equals(userLegacyDN, this.LegacyDistinguishedName))
            {
                this.protocolLogSession[ProtocolLog.Field.OperationSpecific] = "Self";
                nspiPrincipal = this.nspiPrincipal;
            }
            else
            {
                this.protocolLogSession[ProtocolLog.Field.OperationSpecific] = "Other";
                nspiPrincipal = this.NspiPrincipalFromLegacyDN(userLegacyDN);
                flag          = false;
                if (nspiPrincipal == null)
                {
                    return(false);
                }
            }
            if (!flag && nspiPrincipal.ExchangeVersion != null && nspiPrincipal.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2012))
            {
                string clientAccessServerLegacyDN = this.GetClientAccessServerLegacyDN(userLegacyDN);
                RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "RfriContext.GetClientAccessServerLegacyDN: {0}", RfriContext.GetString(clientAccessServerLegacyDN));
                ServerFqdnCache.LookupFQDNByLegacyDN(clientAccessServerLegacyDN, out personalizedServer);
                RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "ServerFqdnCache.LookupFQDNByLegacyDN: {0}", RfriContext.GetString(personalizedServer));
                return(true);
            }
            SmtpAddress primarySmtpAddress = nspiPrincipal.PrimarySmtpAddress;

            if (nspiPrincipal.ExchangeGuid != Guid.Empty)
            {
                personalizedServer = ExchangeRpcClientAccess.CreatePersonalizedServer(nspiPrincipal.ExchangeGuid, nspiPrincipal.PrimarySmtpAddress.Domain);
                RfriContext.ReferralTracer.TraceDebug <string>((long)this.ContextHandle, "RfriContext.GetPersonalizedServer: {0}", RfriContext.GetString(personalizedServer));
                return(true);
            }
            return(false);
        }