Example #1
0
        public override bool Met(MVEntry mventry, CSEntry csentry)
        {
            if (!mventry[this.MVAttributeStartDate].IsPresent)
            {
                Tracer.TraceInformation("Condition failed (Reason: MVAttributeStartDate {0} attribute value is not present) / {0}", this.MVAttributeStartDate, this.Description);
                return(false);
            }
            if (!mventry[this.MVAttributeEndDate].IsPresent)
            {
                Tracer.TraceInformation("Condition failed (Reason: MVAttributeEndDate {0} attribute value is not present) / {0}", this.MVAttributeEndDate, this.Description);
                return(false);
            }

            DateTime startDate;
            DateTime endDate;

            if (!DateTime.TryParse(mventry[this.MVAttributeStartDate].StringValue, out startDate))
            {
                Tracer.TraceWarning("unable-to-parse-start-mvvalue-to-datetime {0}", mventry[this.MVAttributeStartDate].StringValue);
                return(false);
            }
            if (!DateTime.TryParse(mventry[this.MVAttributeEndDate].StringValue, out endDate))
            {
                Tracer.TraceWarning("unable-to-parse-end-mvvalue-to-datetime {0}", mventry[this.MVAttributeEndDate].StringValue);
                return(false);
            }

            DateTime now         = DateTime.Now;
            bool     returnValue = (startDate < now) && (now < endDate);

            Tracer.TraceInformation("compare-dates now: {0}, start: {1}, end: {2}, is-between: {3}", now, startDate, endDate, returnValue);
            return(returnValue);
        }
Example #2
0
        private void CreateConnector(ConnectedMA ma, MVEntry mventry, Rule rule)
        {
            Tracer.TraceInformation("enter-createconnector");
            try
            {
                Tracer.TraceInformation("create-connector: MV: '{0}', MA: '{1}'", mventry.ObjectID, ma.Name);
                IList <string> additionalObjectClasses = this.GetAdditionalObjectClasses(mventry, rule);
                CSEntry        csentry;

                if (additionalObjectClasses.Count > 0)
                {
                    csentry = ma.Connectors.StartNewConnector(rule.TargetObject, additionalObjectClasses.ToArray());
                }
                else
                {
                    csentry = ma.Connectors.StartNewConnector(rule.TargetObject);
                }

                this.SetupInitialValues(ma, csentry, mventry, rule);
                csentry.CommitNewConnector();
            }
            catch (Exception ex)
            {
                Tracer.TraceError("error {0}", ex.GetBaseException());
                throw;
            }
            finally
            {
                Tracer.TraceInformation("exit-createconnector");
            }
        }
Example #3
0
        void RevertImpersonation()
        {
            if (!ShouldImpersonate())
            {
                return;
            }

            Tracer.Enter("revertimpersonation");
            try
            {
                Tracer.TraceInformation("closing-impersonation-context");
                m_ImpersonationContext.Undo();

                Tracer.TraceInformation("closing-impersonation-tokenhandle {0}", impersonationToken);
                NativeMethods.CloseHandle(impersonationToken);
                Tracer.TraceInformation("closing-impersonation-duplicated-tokenhandle {0}", tokenDuplicate);
                NativeMethods.CloseHandle(tokenDuplicate);
            }
            catch (Exception ex)
            {
                Tracer.TraceError("revertimpersonation", ex);
                throw;
            }
            finally
            {
                Tracer.Exit("revertimpersonation");
            }
        }
Example #4
0
 private void SetupInitialValues(ConnectedMA ma, CSEntry csentry, MVEntry mventry, Rule connectorRule)
 {
     Tracer.TraceInformation("enter-setupinitialvalues");
     try
     {
         if (connectorRule.Helpers != null)
         {
             Tracer.TraceInformation("generating-helper-values");
             foreach (HelperValue helper in connectorRule.Helpers)
             {
                 helper.Generate();
             }
         }
         foreach (AttributeFlowBase attributeBase in connectorRule.InitialFlows)
         {
             attributeBase.Generate(ma, csentry, mventry, connectorRule);
         }
     }
     catch (Exception ex)
     {
         Tracer.TraceError("error {0}", ex.GetBaseException());
         throw;
     }
     finally
     {
         Tracer.TraceInformation("exit-setupinitialvalues");
     }
 }
Example #5
0
 public IEnumerable <AttributeDefinition> GetSchema(string TableName)
 {
     Tracer.Enter("getschema");
     try
     {
         string query = string.Format("select top 1 * from {0}", TableName);
         Tracer.TraceInformation("run-query '{0}'", query);
         SqlCommand command = new SqlCommand(query, con);
         using (SqlDataReader reader = command.ExecuteReader())
         {
             while (reader.Read())
             {
                 for (int n = 0; n < reader.FieldCount; n++)
                 {
                     Tracer.TraceInformation("return-column: name: {0}, type: {1}", reader.GetName(n), reader.GetDataTypeName(n));
                     yield return(new AttributeDefinition(reader.GetName(n), reader.GetDataTypeName(n)));
                 }
             }
         }
     }
     finally
     {
         Tracer.Exit("getschema");
     }
 }
Example #6
0
        public override bool Met(MVEntry mventry, CSEntry csentry)
        {
            if (!mventry[this.MVAttribute].IsPresent)
            {
                Tracer.TraceInformation("Condition failed (Reason: No metaverse value is present) {0}", this.Description);
                return(false);
            }

            if (mventry[this.MVAttribute].Values?.Count > 0)
            {
                var cmpOptions = StringComparison.CurrentCulture;
                if (!CaseSensitive)
                {
                    cmpOptions = StringComparison.CurrentCultureIgnoreCase;
                }

                var entries = mventry[this.MVAttribute].Values.ToStringArray();
                return(entries.Any(x => String.Equals(x, Pattern, cmpOptions)));
            }
            else
            {
                Tracer.TraceInformation("Condition failed (Reason: Metaverse multivalue contains no elements) {0}", this.Description);
                return(false);
            }
        }
Example #7
0
        public override void Generate(ConnectedMA ma, CSEntry csentry, MVEntry mventry, Rule rule)
        {
            Tracer.TraceInformation("enter-attributeflowguid");
            base.Generate(ma, csentry, mventry, rule);
            try
            {
                Guid newGuid = Guid.NewGuid();
                Tracer.TraceInformation("new-guid-'{0}'-to-'{1}'", newGuid.ToString(), this.Target);

                if (this.Target.Equals("[DN]", StringComparison.OrdinalIgnoreCase))
                {
                    csentry.DN = csentry.MA.CreateDN(newGuid.ToString());
                }
                else
                {
                    csentry[this.Target].Value = newGuid.ToString();
                }
            }
            catch (Exception ex)
            {
                Tracer.TraceError("error {0}", ex.GetBaseException());
                throw;
            }
            finally
            {
                Tracer.TraceInformation("exit-attributeflowguid");
            }
        }
 public void RunStoredProcedure(string query, IEnumerable <SqlParameter> parameters)
 {
     Tracer.Enter("runstoredprocedure");
     try
     {
         using (SqlCommand cmd = new SqlCommand(query, con))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             foreach (SqlParameter param in parameters)
             {
                 Tracer.TraceInformation("add-parameter name: {0}, value: '{1}'", param.ParameterName, param.SqlValue);
                 cmd.Parameters.Add(param);
             }
             Tracer.TraceInformation("run-storedprocedure {0}", query);
             Tracer.TraceInformation("rows-affected {0:n0}", cmd.ExecuteNonQuery());
         }
     }
     catch (Exception ex)
     {
         Tracer.TraceError("runstoredprocedure", ex);
     }
     finally
     {
         Tracer.Exit("runstoredprocedure");
     }
 }
Example #9
0
 public bool ExistRecord(object anchor)
 {
     Tracer.Enter("existrecord");
     try
     {
         string query = string.Format("select {0} from {1} where [{0}] = @anchor;", Configuration.AnchorColumn, Configuration.TableNameSingle, Configuration.AnchorColumn);
         using (SqlCommand cmd = new SqlCommand(query, con))
         {
             cmd.Parameters.AddWithValue("@anchor", anchor);
             Tracer.TraceInformation("run-query {0}", query);
             object affectedRecords = (object)cmd.ExecuteScalar();
             Tracer.TraceInformation("exists {0}", affectedRecords != null);
             return(affectedRecords != null);
         }
     }
     catch (Exception ex)
     {
         Tracer.TraceError("existrecord", ex);
     }
     finally
     {
         Tracer.Exit("existrecord");
     }
     return(false);
 }
Example #10
0
        public PSObject InitializeSchemaVariables(Schema Schema)
        {
            if (Schema == null)
            {
                return(null);
            }
            schema = Schema;

            schemaPSObject = new PSObject();
            foreach (SchemaType type in schema.Types)
            {
                PSObject typeObj = new PSObject();
                typeObj.Members.Add(new PSNoteProperty("ObjectType", type.Name));
                typeObj.Members.Add(new PSNoteProperty("PossibleDNComponentsForProvisioning", type.PossibleDNComponentsForProvisioning));
                PSObject attrObj = new PSObject();
                foreach (SchemaAttribute attr in type.AnchorAttributes)
                {
                    Tracer.TraceInformation("{0}-anchor-attribute {1} [{2}]", type.Name, attr.Name, attr.DataType);
                    attrObj.Members.Add(new PSNoteProperty(attr.Name, attr));
                }
                typeObj.Members.Add(new PSNoteProperty("Anchors", attrObj));

                attrObj = new PSObject();
                foreach (SchemaAttribute attr in type.Attributes)
                {
                    Tracer.TraceInformation("{0}-attribute {1} [{2}]", type.Name, attr.Name, attr.DataType);
                    attrObj.Members.Add(new PSNoteProperty(attr.Name, attr));
                }
                typeObj.Members.Add(new PSNoteProperty("Attributes", attrObj));

                // add to general schema object
                schemaPSObject.Members.Add(new PSNoteProperty(type.Name, typeObj));
            }
            return(null);
        }
Example #11
0
        bool ShouldImpersonate()
        {
            bool impersonate = !string.IsNullOrEmpty(impersonationUsername) && !string.IsNullOrEmpty(impersonationUserPassword);

            Tracer.TraceInformation("should-impersonate '{0}'", impersonate);
            return(impersonate);
        }
Example #12
0
        AttributeType GetAttributeOverride(ObjectClass objectClass, AttributeDefinition ad, AttributeType attrType)
        {
            DatabaseColumn ov = objectClass.Overrides.FirstOrDefault(x => x.Name.Equals(ad.Name));

            if (ov != null)
            {
                switch (ov.SchemaType)
                {
                case OverrideType.Binary:
                    attrType = AttributeType.Binary;
                    break;

                case OverrideType.Boolean:
                    attrType = AttributeType.Boolean;
                    break;

                case OverrideType.Integer:
                    attrType = AttributeType.Integer;
                    break;

                case OverrideType.Reference:
                    attrType = AttributeType.Reference;
                    break;

                case OverrideType.String:
                    attrType = AttributeType.String;
                    break;

                default:
                    break;
                }
                Tracer.TraceInformation($"setting-override-type-for name: {ad.Name}, schema-type: {ad.AttributeType}, override-type: {ov.SchemaType}");
            }
            return(attrType);
        }
Example #13
0
 void WhoAmI()
 {
     Tracer.Enter("show-identity");
     try
     {
         using (WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent())
         {
             Tracer.TraceInformation("identity-name: {0}", currentIdentity.Name);
             Tracer.TraceInformation("identity-token: {0}", currentIdentity.Token);
             Tracer.TraceInformation("identity-user-value: {0}", currentIdentity.User.Value);
             if (currentIdentity.Actor != null)
             {
                 Tracer.TraceInformation("identity-actor: {0}", currentIdentity.Actor.Name);
                 Tracer.TraceInformation("identity-actor-auth-type: {0}", currentIdentity.Actor.AuthenticationType);
             }
             if (currentIdentity.Groups != null)
             {
                 foreach (IdentityReference group in currentIdentity.Groups)
                 {
                     NTAccount account = group.Translate(typeof(NTAccount)) as NTAccount;
                     Tracer.TraceInformation("group-membership {0}", account.Value);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Tracer.TraceError("error-showing-current-identity", ex);
         throw;
     }
     finally
     {
         Tracer.Exit("show-identity");
     }
 }
Example #14
0
        public CloseImportConnectionResults CloseImportConnection(CloseImportConnectionRunStep importRunStep)
        {
            Tracer.Enter("closeimportconnectionresults");
            try
            {
                CloseRunspace();

                CloseImportConnectionResults cicr = new CloseImportConnectionResults();
                Tracer.TraceInformation("custom-data {0}", importRunStep.CustomData);
                Tracer.TraceInformation("close-reason {0}", importRunStep.Reason);
                if (importRunStep.Reason == CloseReason.Normal)
                {
                    cicr.CustomData = importRunStep.CustomData;
                }
                Dispose();
                return(cicr);
            }
            catch (Exception ex)
            {
                Tracer.TraceError("closeimportconnection", ex);
                throw;
            }
            finally
            {
                Tracer.Exit("closeimportconnectionresults");
            }
        }
Example #15
0
 public void RemoveAllMultiValues(object anchor, string attributeName, bool softDelete)
 {
     Tracer.Enter("removeallmultivalues");
     try
     {
         string query = null;
         if (softDelete)
         {
             query = string.Format("update {0} set [{1}] = 1 where ([{2}] = @anchor and [{3}] is not null and [{1}] <> 1)", Configuration.TableNameMulti, Configuration.DeletedColumn, Configuration.BackReferenceColumn, attributeName);
         }
         else
         {
             query = string.Format("delete from {0} where ([{1}] = @anchor and [{2}] is not null)", Configuration.TableNameMulti, Configuration.BackReferenceColumn, attributeName);
         }
         using (SqlCommand cmd = new SqlCommand(query, con))
         {
             cmd.Parameters.AddWithValue("@anchor", anchor);
             Tracer.TraceInformation("run-query {0}", query);
             Tracer.TraceInformation("rows-affected {0:n0}", cmd.ExecuteNonQuery());
         }
     }
     catch (Exception ex)
     {
         Tracer.TraceError("removeallmultivalues", ex);
     }
     finally
     {
         Tracer.Exit("removeallmultivalues");
     }
 }
Example #16
0
 public void LoadExternalAssembly()
 {
     if (string.IsNullOrEmpty(this.FilenameFull))
     {
         return;
     }
     Tracer.TraceInformation("enter-loadexternalassembly");
     try
     {
         {
             Tracer.TraceInformation("loading-loadexternalassembly {0}", Path.Combine(Utils.ExtensionsDirectory, this.FilenameFull));
             this.Assembly = Assembly.LoadFile(FilenameFull);
             Type[] types = Assembly.GetExportedTypes();
             Type   type  = types.FirstOrDefault(u => u.GetInterface("Microsoft.MetadirectoryServices.IMVSynchronization") != null);
             if (type != null)
             {
                 instance = Activator.CreateInstance(type) as IMVSynchronization;
             }
             else
             {
                 Tracer.TraceError("interface-not-implemented {0}", "Microsoft.MetadirectoryServices.IMVSynchronization");
                 throw new NotImplementedException("interface-not-implemented");
             }
         }
     }
     catch (Exception ex)
     {
         Tracer.TraceError("loadexternalassembly {0}", ex.GetBaseException());
         throw;
     }
     finally
     {
         Tracer.TraceInformation("exit-loadexternalassembly");
     }
 }
Example #17
0
        void IMAExtensible2CallExport.OpenExportConnection(System.Collections.ObjectModel.KeyedCollection <string, ConfigParameter> configParameters, Schema types, OpenExportConnectionRunStep exportRunStep)
        {
            Tracer.IndentLevel = 0;
            Tracer.Enter("openexportconnection");
            Tracer.Indent();
            try
            {
                InitializeConfigParameters(configParameters);

                OpenRunspace();
                schema = types;

                exportType = exportRunStep.ExportType;
                Tracer.TraceInformation("export-type '{0}'", exportType);
                exportBatchSize = exportRunStep.BatchSize;
                Tracer.TraceInformation("export-batch-size '{0}'", exportBatchSize);
            }
            catch (Exception ex)
            {
                Tracer.TraceError("openexportconnection", ex);
                throw new TerminateRunException(ex.Message);
            }
            finally
            {
                Tracer.Unindent();
                Tracer.Exit("openexportconnection");
            }
        }
Example #18
0
        public DataSet ReadObjects(List <object> anchors)
        {
            Tracer.Enter("readobjects");
            DataSet ds = new DataSet();

            try
            {
                string    singleanchor        = Configuration.AnchorColumn;
                string    multivalueanchorref = Configuration.BackReferenceColumn;
                DataTable single = new DataTable(Configuration.TableNameSingle);
                DataTable multi  = Configuration.HasMultivalueTable ? new DataTable(Configuration.TableNameMulti) : null;
                ds.Tables.Add(single);

                StringBuilder anchorList = new StringBuilder();
                for (int i = 0; i < anchors.Count; i++)
                {
                    if (i > 0)
                    {
                        anchorList.Append(",");
                    }
                    anchorList.AppendFormat("'{0}'", anchors[i]);
                }

                StringBuilder query = new StringBuilder();
                query.AppendFormat("select * from {0} where [{1}] in ({2});", Configuration.TableNameSingle, singleanchor, anchorList);
                if (Configuration.HasMultivalueTable)
                {
                    query.AppendFormat("select * from {0} where [{1}] in ({2});", Configuration.TableNameMulti, multivalueanchorref, anchorList);
                    ds.Tables.Add(multi);
                }
                Tracer.TraceInformation("run-query '{0}'", query.ToString());
                using (SqlCommand cmd = new SqlCommand(query.ToString(), con))
                {
                    using (SqlDataReader dr = cmd.ExecuteReader())
                    {
                        if (Configuration.HasMultivalueTable)
                        {
                            ds.Load(dr, LoadOption.OverwriteChanges, single, multi);
                            DataRelation relCustOrder = new DataRelation("mv", single.Columns[singleanchor], multi.Columns[multivalueanchorref]);
                            ds.Relations.Add(relCustOrder);
                        }
                        else
                        {
                            ds.Load(dr, LoadOption.OverwriteChanges, single);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Tracer.TraceError("readobjects {0}", ex.Message);
                throw;
            }
            finally
            {
                Tracer.Exit("readobjects");
            }
            return(ds);
        }
Example #19
0
        public static void Exit(string entryPoint)
        {
            Process currentProc = Process.GetCurrentProcess();

            Tracer.TraceInformation("memory-usage {0:n0}Kb, private memory {1:n0}Kb", GC.GetTotalMemory(true) / 1024, currentProc.PrivateMemorySize64 / 1024);
            Unindent();
            TraceInformation("exit {0}", entryPoint);
        }
Example #20
0
        void SetupImpersonationToken()
        {
            Tracer.Enter("setupimpersonationtoken");
            try
            {
                if (!ShouldImpersonate())
                {
                    Tracer.TraceInformation("impersonation-not-configured-running-as-sync-service-account");
                    WhoAmI();
                    return;
                }
                WindowsIdentity m_ImpersonatedUser;

                Tracer.TraceInformation("user-before-impersonation: {0}", WindowsIdentity.GetCurrent(TokenAccessLevels.MaximumAllowed).Name);

                //bool success = NativeMethods.LogonUser(impersonationUsername, impersonationUserDomain, impersonationUserPassword, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, out impersonationToken);
                bool success = NativeMethods.LogonUser(impersonationUsername, impersonationUserDomain, impersonationUserPassword, (int)LogonType.LOGON32_LOGON_NETWORK_CLEARTEXT, (int)LogonProvider.LOGON32_PROVIDER_WINNT50, out impersonationToken);
                if (!success)
                {
                    SecurityException ex = new SecurityException(string.Format("failed-to-impersonate: domain: '{0}', username: '******', password: **secret***", impersonationUserDomain, impersonationUsername));
                    Tracer.TraceError(ex.ToString());
                    throw ex;
                }
                else
                {
                    Tracer.TraceInformation("succeeded-in-impersonating: domain: '{0}', username: '******', password: **secret***", impersonationUserDomain, impersonationUsername);
                    if (NativeMethods.DuplicateToken(impersonationToken, (int)ImpersonationLevel.SecurityImpersonation, ref tokenDuplicate) != 0)
                    {
                        m_ImpersonatedUser     = new WindowsIdentity(tokenDuplicate);
                        m_ImpersonationContext = m_ImpersonatedUser.Impersonate();
                        Tracer.TraceInformation("succeeded-in-duplicating-impersonation-token");
                        if (m_ImpersonationContext != null)
                        {
                            Tracer.TraceInformation("user-after-impersonation: {0}", WindowsIdentity.GetCurrent(TokenAccessLevels.MaximumAllowed).Name);
                            WhoAmI();
                        }
                        else
                        {
                            throw new Exception("impersonation-context-is-null");
                        }
                    }
                    else
                    {
                        throw new Exception("could-not-duplicate-impersonation-token");
                    }
                }
            }
            catch (Exception ex)
            {
                Tracer.TraceError("setupimpersonationtoken", ex);
                throw;
            }
            finally
            {
                Tracer.Unindent();
                Tracer.Exit("setupimpersonationtoken");
            }
        }
Example #21
0
 PSCredential GetSecureCredentials()
 {
     if (string.IsNullOrEmpty(Username) || (SecureStringPassword == null))
     {
         Tracer.TraceInformation("username-or-password-empty returning-null-pscredentials");
         return(null);
     }
     return(new PSCredential(Username, SecureStringPassword));
 }
Example #22
0
 PSCredential GetSecureClientCredentials()
 {
     if (string.IsNullOrEmpty(ClientId) || (SecureStringSecret == null))
     {
         Tracer.TraceInformation("clientid-or-secret-empty returning-null-pscredentials");
         return(null);
     }
     return(new PSCredential(ClientId, SecureStringSecret));
 }
 public void GetObjectClasses()
 {
     methods.OpenConnection();
     foreach (string str in methods.GetObjectClasses())
     {
         Tracer.TraceInformation("got-objectclass {0}", str);
     }
     methods.Dispose();
 }
        public override bool Met(MVEntry mventry, CSEntry csentry)
        {
            ConnectedMA MA = mventry.ConnectedMAs[this.ManagementAgentName];

            if (MA.Connectors.Count.Equals(0))
            {
                Tracer.TraceInformation("Condition failed (Reason: Not connected to {0}) {1}", this.ManagementAgentName, this.Description);
                return(false);
            }
            return(true);
        }
Example #25
0
        public PowerShellManagementAgent()
        {
            Tracer.IndentLevel = 0;
            Tracer.Enter("initialize");
            Tracer.Indent();
            try
            {
                Tracer.TraceInformation("memory-usage {0:n} Mb", GC.GetTotalMemory(true) / 102400);
                System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
                string version = fvi.FileVersion;
                Tracer.TraceInformation("psma-version {0}", version);
                Tracer.TraceInformation("reading-registry-settings");
                RegistryKey machineRegistry = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
                RegistryKey mreRootKey      = machineRegistry.OpenSubKey(@"SOFTWARE\Granfeldt\FIM\ManagementAgents\PowerShell", false);

                if (mreRootKey != null)
                {
                    Tracer.TraceInformation("adding-eventlog-listener-for name: {0}, source: {1}", EventLogName, EventLogSource);
                    EventLog evl = new EventLog(EventLogName);
                    evl.Log    = EventLogName;
                    evl.Source = EventLogSource;

                    EventLogTraceListener eventLog = new EventLogTraceListener(EventLogSource);
                    eventLog.EventLog = evl;
                    EventTypeFilter filter = new EventTypeFilter(SourceLevels.Warning | SourceLevels.Error | SourceLevels.Critical);
                    eventLog.TraceOutputOptions = TraceOptions.Callstack;
                    eventLog.Filter             = filter;
                    Tracer.Trace.Listeners.Add(eventLog);
                    if (!EventLog.SourceExists(EventLogSource))
                    {
                        Tracer.TraceInformation("creating-eventlog-source '{0}'", EventLogSource);
                        EventLog.CreateEventSource(EventLogSource, EventLogName);
                    }

                    string logFileValue = mreRootKey.GetValue("DebugLogFileName", null) as string;
                    if (logFileValue != null)
                    {
                        Tracer.TraceWarning("Logging to file is no longer supported. Please remove registrykey DebugLogFileName and use DebugView or similar instead to catch traces from this Management Agent");
                    }
                }
            }
            catch (Exception ex)
            {
                Tracer.TraceError("could-not-initialize", ex);
                throw;
            }
            finally
            {
                Tracer.Unindent();
                Tracer.Exit("initialize");
            }
        }
Example #26
0
 public override bool Met(MVEntry mventry, CSEntry csentry)
 {
     if (mventry[this.MVAttribute].IsPresent)
     {
         if (mventry[this.MVAttribute].BooleanValue)
         {
             Tracer.TraceInformation("Condition failed (Reason: Boolean value is true) {0}", this.Description);
             return(false);
         }
     }
     return(true);
 }
Example #27
0
 public override bool Met(MVEntry mventry, CSEntry csentry)
 {
     if (mventry[this.MVAttribute].IsPresent)
     {
         return(true);
     }
     else
     {
         Tracer.TraceInformation("Condition failed (Reason: Metaverse attribute value is not present) {0}", this.Description);
         return(false);
     }
 }
Example #28
0
 public override bool Met(MVEntry mventry, CSEntry csentry)
 {
     if (mventry[this.MVAttribute].IsPresent)
     {
         if (Regex.IsMatch(mventry[this.MVAttribute].Value, this.Pattern, RegexOptions.IgnoreCase))
         {
             Tracer.TraceInformation("Condition failed (Reason: RegEx match) {0}", this.Description);
             return(false);
         }
     }
     return(true); // value not present effectively means not-match
 }
Example #29
0
        string CSValueAsString(object Value, AttributeType DataType)
        {
            Tracer.TraceInformation("CSValueAsString {0}, {1}", Value == null ? "(null)" : Value.GetType().ToString(), DataType);
            switch (DataType)
            {
            case AttributeType.Binary:
                return(new Guid((Byte[])Value).ToString());

            default:
                return(Value.ToString());
            }
        }
Example #30
0
 private bool AreDNsEqual(ReferenceValue dn1, ReferenceValue dn2, ManagementAgent ma, bool strictCompare)
 {
     if (strictCompare)
     {
         Tracer.TraceInformation("performing-strict-DN-comparison");
         return(dn1.ToString() == dn2.ToString());
     }
     else
     {
         Tracer.TraceInformation("performing-RFC-compliant-DN-comparison");
         return(dn1.Equals(dn2));
     }
 }