コード例 #1
0
 internal static int GetSecInfoOption(ConnectionHandle ldapHandle, LdapOption option, SecurityPackageContextConnectionInformation outValue) => Interop.Ldap.ldap_get_option_secInfo(ldapHandle, option, outValue);
コード例 #2
0
ファイル: LdapConnection.cs プロジェクト: nickchal/pash
		internal LdapConnection(LdapDirectoryIdentifier identifier, NetworkCredential credential, AuthType authType, IntPtr handle)
		{
			this.connectionAuthType = AuthType.Negotiate;
			this.automaticBind = true;
			this.needDispose = true;
			this.directoryIdentifier = identifier;
			this.ldapHandle = new ConnectionHandle(handle);
			this.directoryCredential = credential;
			this.connectionAuthType = authType;
			this.options = new LdapSessionOptions(this);
			this.needDispose = false;
			this.clientCertificateRoutine = new QUERYCLIENTCERT(this.ProcessClientCertificate);
		}
コード例 #3
0
ファイル: LdapConnection.cs プロジェクト: chcosta/corefx
        internal void Init()
        {
            string hostname = null;
            string[] servers = (directoryIdentifier == null ? null : ((LdapDirectoryIdentifier)directoryIdentifier).Servers);
            if (servers != null && servers.Length != 0)
            {
                StringBuilder temp = new StringBuilder(200);
                for (int i = 0; i < servers.Length; i++)
                {
                    if (servers[i] != null)
                    {
                        temp.Append(servers[i]);
                        if (i < servers.Length - 1)
                            temp.Append(" ");
                    }
                }
                if (temp.Length != 0)
                    hostname = temp.ToString();
            }

            // user wants to setup a connectionless session with server
            if (((LdapDirectoryIdentifier)directoryIdentifier).Connectionless == true)
            {
                ldapHandle = new ConnectionHandle(Wldap32.cldap_open(hostname, ((LdapDirectoryIdentifier)directoryIdentifier).PortNumber), needDispose);
            }
            else
            {
                ldapHandle = new ConnectionHandle(Wldap32.ldap_init(hostname, ((LdapDirectoryIdentifier)directoryIdentifier).PortNumber), needDispose);
            }

            // create a WeakReference object with the target of ldapHandle and put it into our handle table.
            lock (objectLock)
            {
                if (handleTable[ldapHandle.DangerousGetHandle()] != null)
                    handleTable.Remove(ldapHandle.DangerousGetHandle());

                handleTable.Add(ldapHandle.DangerousGetHandle(), new WeakReference(this));
            }
        }
コード例 #4
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_bind_s(ConnectionHandle ldapHandle, string dn, SEC_WINNT_AUTH_IDENTITY_EX credentials, BindMethod method);
コード例 #5
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_extended_operation(ConnectionHandle ldapHandle, string oid, berval data, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
コード例 #6
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_search(ConnectionHandle ldapHandle, string dn, int scope, string filter, IntPtr attributes, bool attributeOnly, IntPtr servercontrol, IntPtr clientcontrol, int timelimit, int sizelimit, ref int messageNumber);
コード例 #7
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_set_option_referral(ConnectionHandle ldapHandle, LdapOption option, ref LdapReferralCallback outValue);
コード例 #8
0
 internal static int ParseExtendedResult(ConnectionHandle ldapHandle, IntPtr result, ref IntPtr oid, ref IntPtr data, byte freeIt) => Interop.Ldap.ldap_parse_extended_result(ldapHandle, result, ref oid, ref data, freeIt);
コード例 #9
0
 internal static int ParseReference(ConnectionHandle ldapHandle, IntPtr result, ref IntPtr referrals) => Interop.Ldap.ldap_parse_reference(ldapHandle, result, ref referrals);
コード例 #10
0
 internal static IntPtr GetNextEntryFromResult(ConnectionHandle ldapHandle, IntPtr result) => Interop.Ldap.ldap_next_entry(ldapHandle, result);
コード例 #11
0
 internal static IntPtr GetNextReferenceFromResult(ConnectionHandle ldapHandle, IntPtr result) => Interop.Ldap.ldap_next_reference(ldapHandle, result);
コード例 #12
0
 internal static IntPtr GetNextAttributeFromResult(ConnectionHandle ldapHandle, IntPtr result, IntPtr address) => Interop.Ldap.ldap_next_attribute(ldapHandle, result, address);
コード例 #13
0
 internal static int ModifyDirectoryEntry(ConnectionHandle ldapHandle, string dn, IntPtr attrs, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber) =>
 Interop.Ldap.ldap_modify(ldapHandle, dn, attrs, servercontrol, clientcontrol, ref messageNumber);
コード例 #14
0
 internal static IntPtr GetValuesFromAttribute(ConnectionHandle ldapHandle, IntPtr result, string name) => Interop.Ldap.ldap_get_values_len(ldapHandle, result, name);
コード例 #15
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_parse_result_referral(ConnectionHandle ldapHandle, IntPtr result, IntPtr serverError, IntPtr dn, IntPtr message, ref IntPtr referral, IntPtr control, byte freeIt);
コード例 #16
0
 internal static int ParseResult(ConnectionHandle ldapHandle, IntPtr result, ref int serverError, ref IntPtr dn, ref IntPtr message, ref IntPtr referral, ref IntPtr control, byte freeIt) =>
 Interop.Ldap.ldap_parse_result(ldapHandle, result, ref serverError, ref dn, ref message, ref referral, ref control, freeIt);
コード例 #17
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_result(ConnectionHandle ldapHandle, int messageId, int all, LDAP_TIMEVAL timeout, ref IntPtr Mesage);
コード例 #18
0
 internal static int ParseResultReferral(ConnectionHandle ldapHandle, IntPtr result, IntPtr serverError, IntPtr dn, IntPtr message, ref IntPtr referral, IntPtr control, byte freeIt)
 => Interop.Ldap.ldap_parse_result_referral(ldapHandle, result, serverError, dn, message, ref referral, control, freeIt);
コード例 #19
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_set_option_int(ConnectionHandle ldapHandle, LdapOption option, ref int inValue);
コード例 #20
0
 internal static int RenameDirectoryEntry(ConnectionHandle ldapHandle, string dn, string newRdn, string newParentDn, int deleteOldRdn, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber) =>
 Interop.Ldap.ldap_rename(ldapHandle, dn, newRdn, newParentDn, deleteOldRdn, servercontrol, clientcontrol, ref messageNumber);
コード例 #21
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_simple_bind_s(ConnectionHandle ldapHandle, string distinguishedName, string password);
コード例 #22
0
 internal static int GetResultFromAsyncOperation(ConnectionHandle ldapHandle, int messageId, int all, LDAP_TIMEVAL timeout, ref IntPtr Message) => Interop.Ldap.ldap_result(ldapHandle, messageId, all, timeout, ref Message);
コード例 #23
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_connect(ConnectionHandle ldapHandle, LDAP_TIMEVAL timeout);
コード例 #24
0
 internal static int ResultToErrorCode(ConnectionHandle ldapHandle, IntPtr result, int freeIt) => Interop.Ldap.ldap_result2error(ldapHandle, result, freeIt);
コード例 #25
0
ファイル: LdapConnection.cs プロジェクト: nickchal/pash
		protected virtual void Dispose(bool disposing)
		{
			if (disposing)
			{
				lock (LdapConnection.objectLock)
				{
					LdapConnection.handleTable.Remove(this.ldapHandle);
				}
			}
			if (this.needDispose && this.ldapHandle != null && !this.ldapHandle.IsInvalid)
			{
				this.ldapHandle.Dispose();
			}
			this.ldapHandle = null;
			this.disposed = true;
		}
コード例 #26
0
 internal static int SearchDirectory(ConnectionHandle ldapHandle, string dn, int scope, string filter, IntPtr attributes, bool attributeOnly, IntPtr servercontrol, IntPtr clientcontrol, int timelimit, int sizelimit, ref int messageNumber) =>
 Interop.Ldap.ldap_search(ldapHandle, dn, scope, filter, attributes, attributeOnly, servercontrol, clientcontrol, timelimit, sizelimit, ref messageNumber);
コード例 #27
0
ファイル: LdapConnection.cs プロジェクト: chcosta/corefx
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // free other state (managed objects)                

                // we need to remove the handle from the handle table
                lock (objectLock)
                {
                    if (null != ldapHandle)
                    {
                        handleTable.Remove(ldapHandle.DangerousGetHandle());
                    }
                }
            }
            // free your own state (unmanaged objects)        	           

            // close the ldap connection
            if (needDispose && ldapHandle != null && !ldapHandle.IsInvalid)
                ldapHandle.Dispose();
            ldapHandle = null;

            disposed = true;

            Debug.WriteLine("Connection object is disposed\n");
        }
コード例 #28
0
 internal static int SetClientCertOption(ConnectionHandle ldapHandle, LdapOption option, QUERYCLIENTCERT outValue) => Interop.Ldap.ldap_set_option_clientcert(ldapHandle, option, outValue);
コード例 #29
0
ファイル: Wldap32UnsafeMethods.cs プロジェクト: hughbe/corefx
 public static extern byte ldap_stop_tls(ConnectionHandle ldapHandle);
コード例 #30
0
 internal static int SetIntOption(ConnectionHandle ld, LdapOption option, ref int inValue) => Interop.Ldap.ldap_set_option_int(ld, option, ref inValue);
コード例 #31
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_parse_reference(ConnectionHandle ldapHandle, IntPtr result, ref IntPtr referrals);
コード例 #32
0
 internal static int SetPtrOption(ConnectionHandle ldapHandle, LdapOption option, ref IntPtr inValue) => Interop.Ldap.ldap_set_option_ptr(ldapHandle, option, ref inValue);
コード例 #33
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_rename(ConnectionHandle ldapHandle, string dn, string newRdn, string newParentDn, int deleteOldRdn, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
コード例 #34
0
 internal static int SetReferralOption(ConnectionHandle ldapHandle, LdapOption option, ref LdapReferralCallback outValue) => Interop.Ldap.ldap_set_option_referral(ldapHandle, option, ref outValue);
コード例 #35
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_result2error(ConnectionHandle ldapHandle, IntPtr result, int freeIt);
コード例 #36
0
 internal static int SetServerCertOption(ConnectionHandle ldapHandle, LdapOption option, VERIFYSERVERCERT outValue) => Interop.Ldap.ldap_set_option_servercert(ldapHandle, option, outValue);
コード例 #37
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_set_option_clientcert(ConnectionHandle ldapHandle, LdapOption option, QUERYCLIENTCERT outValue);
コード例 #38
0
 internal static void CancelDirectoryAsyncOperation(ConnectionHandle ldapHandle, int messagId) => Interop.Ldap.ldap_abandon(ldapHandle, messagId);
コード例 #39
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_set_option_ptr(ConnectionHandle ldapHandle, LdapOption option, ref IntPtr inValue);
コード例 #40
0
 internal static int BindToDirectory(ConnectionHandle ld, string who, string passwd) => Interop.Ldap.ldap_simple_bind_s(ld, who, passwd);
コード例 #41
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_set_option_servercert(ConnectionHandle ldapHandle, LdapOption option, VERIFYSERVERCERT outValue);
コード例 #42
0
 internal static int StartTls(ConnectionHandle ldapHandle, ref int ServerReturnValue, ref IntPtr Message, IntPtr ServerControls, IntPtr ClientControls) => Interop.Ldap.ldap_start_tls(ldapHandle, ref ServerReturnValue, ref Message, ServerControls, ClientControls);
コード例 #43
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_abandon(ConnectionHandle ldapHandle, int messagId);
コード例 #44
0
 internal static byte StopTls(ConnectionHandle ldapHandle) => Interop.Ldap.ldap_stop_tls(ldapHandle);
コード例 #45
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_compare(ConnectionHandle ldapHandle, string dn, string attributeName, string strValue, berval binaryValue, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
コード例 #46
0
 public static extern int ldap_bind_s([In] ConnectionHandle ldapHandle, string dn, SEC_WINNT_AUTH_IDENTITY_EX credentials, BindMethod method);
コード例 #47
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_delete_ext(ConnectionHandle ldapHandle, string dn, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
コード例 #48
0
 public static extern int ldap_connect([In] ConnectionHandle ldapHandle, LDAP_TIMEVAL timeout);
コード例 #49
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern IntPtr ldap_first_attribute(ConnectionHandle ldapHandle, IntPtr result, ref IntPtr address);
コード例 #50
0
 public static extern int ldap_set_option_int([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref int inValue);
コード例 #51
0
ファイル: LdapConnection.cs プロジェクト: nickchal/pash
		internal void Init()
		{
			string[] servers;
			string str = null;
			if (this.directoryIdentifier == null)
			{
				servers = null;
			}
			else
			{
				servers = ((LdapDirectoryIdentifier)this.directoryIdentifier).Servers;
			}
			string[] strArrays = servers;
			if (strArrays != null && (int)strArrays.Length != 0)
			{
				StringBuilder stringBuilder = new StringBuilder(200);
				for (int i = 0; i < (int)strArrays.Length; i++)
				{
					if (strArrays[i] != null)
					{
						stringBuilder.Append(strArrays[i]);
						if (i < (int)strArrays.Length - 1)
						{
							stringBuilder.Append(" ");
						}
					}
				}
				if (stringBuilder.Length != 0)
				{
					str = stringBuilder.ToString();
				}
			}
			if (!((LdapDirectoryIdentifier)this.directoryIdentifier).Connectionless)
			{
				this.ldapHandle = new ConnectionHandle(Wldap32.ldap_init(str, ((LdapDirectoryIdentifier)this.directoryIdentifier).PortNumber));
			}
			else
			{
				this.ldapHandle = new ConnectionHandle(Wldap32.cldap_open(str, ((LdapDirectoryIdentifier)this.directoryIdentifier).PortNumber));
			}
			lock (LdapConnection.objectLock)
			{
				if (LdapConnection.handleTable[this.ldapHandle] != null)
				{
					LdapConnection.handleTable.Remove(this.ldapHandle);
				}
				LdapConnection.handleTable.Add(this.ldapHandle, new WeakReference(this));
			}
		}
コード例 #52
0
 public static extern int ldap_set_option_ptr([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref IntPtr inValue);
コード例 #53
0
ファイル: LdapSessionOptions.cs プロジェクト: nickchal/pash
		private int ProcessQueryConnection(IntPtr PrimaryConnection, IntPtr ReferralFromConnection, IntPtr NewDNPtr, string HostName, int PortNumber, SEC_WINNT_AUTH_IDENTITY_EX SecAuthIdentity, Luid CurrentUserToken, ref ConnectionHandle ConnectionToUse)
		{
			ConnectionToUse = null;
			string stringUni = null;
			if (this.callbackRoutine.QueryForConnection == null)
			{
				return 1;
			}
			else
			{
				if (NewDNPtr != (IntPtr)0)
				{
					stringUni = Marshal.PtrToStringUni(NewDNPtr);
				}
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.Append(HostName);
				stringBuilder.Append(":");
				stringBuilder.Append(PortNumber);
				LdapDirectoryIdentifier ldapDirectoryIdentifier = new LdapDirectoryIdentifier(stringBuilder.ToString());
				NetworkCredential networkCredential = this.ProcessSecAuthIdentity(SecAuthIdentity);
				LdapConnection ldapConnection = null;
				if (ReferralFromConnection != (IntPtr)0)
				{
					lock (LdapConnection.objectLock)
					{
						WeakReference item = (WeakReference)LdapConnection.handleTable[(object)ReferralFromConnection];
						if (item == null || !item.IsAlive)
						{
							if (item != null)
							{
								LdapConnection.handleTable.Remove(ReferralFromConnection);
							}
							ldapConnection = new LdapConnection((LdapDirectoryIdentifier)this.connection.Directory, this.connection.GetCredential(), this.connection.AuthType, ReferralFromConnection);
							LdapConnection.handleTable.Add(ReferralFromConnection, new WeakReference(ldapConnection));
						}
						else
						{
							ldapConnection = (LdapConnection)item.Target;
						}
					}
				}
				long lowPart = (long)CurrentUserToken.LowPart + ((long)CurrentUserToken.HighPart << 32);
				LdapConnection queryForConnection = this.callbackRoutine.QueryForConnection(this.connection, ldapConnection, stringUni, ldapDirectoryIdentifier, networkCredential, lowPart);
				if (queryForConnection != null)
				{
					ConnectionToUse = queryForConnection.ldapHandle;
				}
				return 0;
			}
		}
コード例 #54
0
 public static extern int ldap_get_option_sechandle([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref SecurityHandle outValue);
コード例 #55
0
ファイル: LdapConnection.cs プロジェクト: chcosta/corefx
 internal LdapConnection(LdapDirectoryIdentifier identifier, NetworkCredential credential, AuthType authType, IntPtr handle)
 {
     directoryIdentifier = identifier;
     needDispose = false;
     ldapHandle = new ConnectionHandle(handle, needDispose);
     directoryCredential = credential;
     _connectionAuthType = authType;
     _options = new LdapSessionOptions(this);
     clientCertificateRoutine = new QUERYCLIENTCERT(ProcessClientCertificate);
 }
コード例 #56
0
 public static extern int ldap_get_option_secInfo([In] ConnectionHandle ldapHandle, [In] LdapOption option, [In, Out] SecurityPackageContextConnectionInformation outValue);
コード例 #57
0
ファイル: Wldap32UnsafeMethods.cs プロジェクト: hughbe/corefx
 public static extern int ldap_start_tls(ConnectionHandle ldapHandle, ref int ServerReturnValue, ref IntPtr Message, IntPtr ServerControls, IntPtr ClientControls);
コード例 #58
0
ファイル: Wldap32.cs プロジェクト: nickchal/pash
		public static extern int ldap_parse_extended_result(ConnectionHandle ldapHandle, IntPtr result, ref IntPtr oid, ref IntPtr data, byte freeIt);
コード例 #59
0
ファイル: Wldap32UnsafeMethods.cs プロジェクト: hughbe/corefx
 public static extern int ldap_create_sort_control(ConnectionHandle handle, IntPtr keys, byte critical, ref IntPtr control);
コード例 #60
0
 internal static int GetSecurityHandleOption(ConnectionHandle ldapHandle, LdapOption option, ref SecurityHandle outValue) => Interop.Ldap.ldap_get_option_sechandle(ldapHandle, option, ref outValue);