Beispiel #1
0
 public static extern int DsBindWithCred(
     string DomainControllerName,
     string DnsDomainName,
     SafeDsCredentialsHandle AuthIdentity,
     out SafeDsHandle phDS
 );
Beispiel #2
0
 public static extern int DsMakePasswordCredentials(
     string User,
     string Domain,
     string Password,
     out SafeDsCredentialsHandle pAuthIdentity
 );
Beispiel #3
0
 private SafeDsHandle Bind(SafeDsCredentialsHandle credential)
 {
     return Bind(_serverName, _domainName, credential);
 }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #6
0
 public static extern int DsMakePasswordCredentials(
     string User,
     string Domain,
     string Password,
     out SafeDsCredentialsHandle pAuthIdentity
     );
Beispiel #7
0
 public static extern int DsBindWithCred(
     string DomainControllerName,
     string DnsDomainName,
     SafeDsCredentialsHandle AuthIdentity,
     out SafeDsHandle phDS
     );