Exemple #1
0
 public static extern int DsBindWithCred(
     string DomainControllerName,
     string DnsDomainName,
     SafeDsCredentialsHandle AuthIdentity,
     out SafeDsHandle phDS
 );
Exemple #2
0
 public static extern int DsMakePasswordCredentials(
     string User,
     string Domain,
     string Password,
     out SafeDsCredentialsHandle pAuthIdentity
 );
Exemple #3
0
 private SafeDsHandle Bind(SafeDsCredentialsHandle credential)
 {
     return Bind(_serverName, _domainName, credential);
 }
Exemple #4
0
        private static int TryBind(string server, string domain, SafeDsCredentialsHandle credentials, out SafeDsHandle handle)
        {
            if (credentials != null)
            {
                return NativeMethods.DsBindWithCred(server, domain, credentials, out handle);
            }

            return NativeMethods.DsBind(server, domain, out handle);
        }
Exemple #5
0
        private static SafeDsHandle Bind(string server, string domain, SafeDsCredentialsHandle credentials)
        {
            SafeDsHandle handle;
            int retval = TryBind(server, domain, credentials, out handle);

            if (retval == NativeMethods.ERROR_INVALID_PARAMETER)
            {
                // HACK: you must specify port number for AD LDS instances, but you MUST NOT
                // specify it when connecting to AD DS domain

                int colon = server.LastIndexOf(':');
                if (colon > -1)
                {
                    server = server.Substring(0, colon);
                }

                retval = TryBind(server, domain, credentials, out handle);
            }

            NativeMethods.EnforceSuccess(retval);

            return handle;
        }
Exemple #6
0
 public static extern int DsMakePasswordCredentials(
     string User,
     string Domain,
     string Password,
     out SafeDsCredentialsHandle pAuthIdentity
     );
Exemple #7
0
 public static extern int DsBindWithCred(
     string DomainControllerName,
     string DnsDomainName,
     SafeDsCredentialsHandle AuthIdentity,
     out SafeDsHandle phDS
     );