Exemplo n.º 1
0
        private static CheckResult CheckServerCredentialsAreEncrypted(ADCredentialsConfigurationSection section)
        {
            try {
                if (section == null)
                {
                    return(CheckResult.FailWith("{0} section is not declared in the config file", section.SectionName));
                }

                if (section.ADServers.Count == 0)
                {
                    return(CheckResult.FailWith("No AD Server servers specified in section " + section.SectionName));
                }

                foreach (ADServerElement bitsServer in section.ADServers)
                {
                    if (!bitsServer.PasswordEncrypted)
                    {
                        return(CheckResult.FailWith("Password is not encrypted for server '" + bitsServer.Url + "' in section " + section.SectionName));
                    }
                }

                return(CheckResult.Success);
            } catch (Exception ex) {
                return(CheckResult.FailWith("AD Server credentials could not be read: " + ex.Message));
            }
        }
Exemplo n.º 2
0
        private CheckResult CheckServerCredentialsSupplied(ADCredentialsConfigurationSection section)
        {
            try {
                if (section == null)
                {
                    return(CheckResult.FailWith("{0} section is not declared in the config file", section.SectionName));
                }

                if (section.ADServers.Count == 0)
                {
                    return(CheckResult.FailWith("No AD servers specified"));
                }

                foreach (ADServerElement srv in section.ADServers)
                {
                    if (string.IsNullOrEmpty(srv.Password))
                    {
                        return(CheckResult.FailWith("password is not specified for server " + srv.Url));
                    }
                }

                return(CheckResult.Success);
            } catch (Exception ex) {
                return(CheckResult.FailWith("AD Server credentials could not be read: " + ex.Message));
            }
        }