static ICertConfigEntryD lookInDs(String computerName)
        {
            if (!DsUtils.Ping())
            {
                // we are in workgroup, so try to get DsEntry from whatever source we have using the name caller specified
                return(new CertConfigD().FindConfigEntryByServerName(computerName));
            }

            // we are connected to AD.
            // If name is passed in NetBIOS form, then translate to FQDN, because DS entries reference by FQDN only
            if (!computerName.Contains("."))
            {
                computerName = $"{computerName}.{DsUtils.GetCurrentDomainName()}";
            }
            // try to find by FQDN
            return(new CertConfigD().FindConfigEntryByServerName(computerName));
        }
Esempio n. 2
0
 void lookInDs(String computerName)
 {
     if (!DsUtils.Ping())
     {
         return;
     }
     if (!computerName.Contains("."))
     {
         computerName = computerName + "." + DsUtils.GetCurrentDomainName();
     }
     _certConfig.Reset(0); //TODO
     while (_certConfig.Next() >= 0)
     {
         Int32   flags           = Convert.ToInt32(_certConfig.GetField(CertConfigConstants.FieldFlags));
         Boolean serverNameMatch = String.Equals(_certConfig.GetField(CertConfigConstants.FieldServer), computerName, StringComparison.InvariantCultureIgnoreCase);
         if (serverNameMatch && (flags & 1) > 0)
         {
             foundInDs = true;
             return;
         }
     }
 }