Beispiel #1
0
        internal override void Process(XmlNode provisionResponseNode)
        {
            ProvisionCommandPhaseTwo.AcknowledgementType acknowledgementType = this.ParseProvisionRequest();
            if ((acknowledgementType & ProvisionCommandPhaseTwo.AcknowledgementType.ForceRemoteWipe) == ProvisionCommandPhaseTwo.AcknowledgementType.ForceRemoteWipe)
            {
                base.GenerateRemoteWipeResponse(provisionResponseNode, ProvisionCommand.ProvisionStatusCode.ProtocolError);
                return;
            }
            bool flag  = (acknowledgementType & ProvisionCommandPhaseTwo.AcknowledgementType.RemoteWipe) == ProvisionCommandPhaseTwo.AcknowledgementType.RemoteWipe;
            bool flag2 = (acknowledgementType & ProvisionCommandPhaseTwo.AcknowledgementType.Policy) == ProvisionCommandPhaseTwo.AcknowledgementType.Policy;

            if (flag)
            {
                this.ProcessRemoteWipeAck(provisionResponseNode);
                if (this.remoteWipeServerStatusCode != ProvisionCommandPhaseTwo.RemoteWipeServerStatusCode.Success)
                {
                    base.GenerateRemoteWipeResponse(provisionResponseNode, ProvisionCommand.ProvisionStatusCode.ProtocolError);
                    return;
                }
                if (!flag2)
                {
                    XmlNode xmlNode = this.owningCommand.XmlResponse.CreateElement("Status", "Provision:");
                    provisionResponseNode.AppendChild(xmlNode);
                    xmlNode.InnerText = 1.ToString(CultureInfo.InvariantCulture);
                    return;
                }
            }
            if (flag2)
            {
                this.ProcessPolicy(provisionResponseNode);
            }
        }
Beispiel #2
0
        private ProvisionCommandPhaseTwo.AcknowledgementType ParseProvisionRequest()
        {
            ProvisionCommandPhaseTwo.AcknowledgementType acknowledgementType = ProvisionCommandPhaseTwo.AcknowledgementType.None;
            XmlNode xmlRequest = base.XmlRequest;
            uint    num        = 0U;
            XmlNode xmlNode    = xmlRequest["RemoteWipe", "Provision:"];

            if (xmlNode != null)
            {
                if (!base.RemoteWipeRequired)
                {
                    throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false)
                          {
                              ErrorStringForProtocolLogger = "RemoteWipeWasNotRequested"
                          };
                }
                XmlNode xmlNode2 = xmlNode["Status", "Provision:"];
                if (xmlNode2 != null)
                {
                    if (!uint.TryParse(xmlNode2.InnerText, out num) || num < 1U || num > 2U)
                    {
                        this.requestRemoteWipeStatus = ProvisionCommandPhaseTwo.RemoteWipeStatusCodeFromClient.Invalid;
                    }
                    else
                    {
                        this.requestRemoteWipeStatus = (ProvisionCommandPhaseTwo.RemoteWipeStatusCodeFromClient)num;
                    }
                }
                acknowledgementType = ProvisionCommandPhaseTwo.AcknowledgementType.RemoteWipe;
            }
            if (base.RemoteWipeRequired && this.requestRemoteWipeStatus == ProvisionCommandPhaseTwo.RemoteWipeStatusCodeFromClient.NotPresent)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "[ProvisionCommandPhaseTwo.ParseProvisionRequest] Client responded to policy ack, but there is a remoteWipe request pending.");
                return(ProvisionCommandPhaseTwo.AcknowledgementType.ForceRemoteWipe);
            }
            XmlNode xmlNode3 = xmlRequest["Policies", "Provision:"];

            if (xmlNode3 != null)
            {
                XmlNode xmlNode4 = xmlNode3["Policy", "Provision:"];
                XmlNode xmlNode5 = xmlNode4["PolicyKey", "Provision:"];
                XmlNode xmlNode6 = xmlNode4["Status", "Provision:"];
                if (xmlNode5 != null && uint.TryParse(xmlNode5.InnerText, out num))
                {
                    this.requestPolicyKey = new uint?(num);
                }
                XmlNode xmlNode7 = xmlNode4["PolicyType", "Provision:"];
                this.requestPolicyType = xmlNode7.InnerText;
                if (xmlNode6 != null)
                {
                    if (!uint.TryParse(xmlNode6.InnerText, out num) || num < 1U || num > 4U)
                    {
                        this.requestPolicyStatus = ProvisionCommandPhaseTwo.PolicyStatusCodeFromClient.Invalid;
                    }
                    else
                    {
                        this.requestPolicyStatus = (ProvisionCommandPhaseTwo.PolicyStatusCodeFromClient)num;
                    }
                    this.owningCommand.ProtocolLogger.SetValue(ProtocolLoggerData.PolicyAckStatus, (int)this.requestPolicyStatus);
                }
                acknowledgementType |= ProvisionCommandPhaseTwo.AcknowledgementType.Policy;
            }
            return(acknowledgementType);
        }