Exemplo n.º 1
0
        public void LdapSimpleBindS(string dn, string passwd)
        {
            SetVersion(LDAPOption.LDAP_VERSION);
            var returnError = LdapClientLibrary.ldap_simple_bind_s(this._connection, dn, passwd);

            ErrorCheckerHelper.Validate(returnError);
        }
Exemplo n.º 2
0
        public void ModifyObject(string basedn, LdapMod[] attrs)
        {
            IntPtr basednPtr = IntPtr.Zero;

            basednPtr = Marshal.StringToHGlobalAnsi(basedn);

            IntPtr[] umattrs = new IntPtr[attrs.Length + 1];
            for (int i = 0; i < attrs.Length; i++)
            {
                umattrs[i] = attrs[i].convertToUnmanaged();
            }

            umattrs[attrs.Length] = IntPtr.Zero; /* NULL Termination */

            var returnError = LdapClientLibrary.ldap_modify_ext_s(this._connection, basednPtr, umattrs, null, null);

            for (int i = 0; i < attrs.Length; i++)
            {
                attrs[i].Free();
                Marshal.FreeHGlobal(umattrs[i]);
            }

            Marshal.FreeHGlobal(basednPtr);

            ErrorCheckerHelper.Validate((int)returnError);
        }
Exemplo n.º 3
0
        public void VmDirSafeLDAPBind(string host, string upn, string passwd)
        {
            SetVersion(LDAPOption.LDAP_VERSION);
            var VmDirError  = LdapClientLibrary.VmDirSafeLDAPBind(out this._connection, host, upn, passwd);
            var returnError = LdapError.VmDirMapLdapError((int)VmDirError);

            ErrorCheckerHelper.Validate(returnError);
        }
Exemplo n.º 4
0
        public void LdapParsePageControl(IntPtr serverControls, ref IntPtr cookie)
        {
            ulong totalCount = 0;

            var returnError = LdapClientLibrary.ldap_parse_page_control(
                _connection,
                serverControls,
                out totalCount,
                ref cookie);

            ErrorCheckerHelper.Validate((int)returnError);
        }
Exemplo n.º 5
0
        public ILdapMessage LdapSearchExtS(string querybase, int scope, string filter, string[] attrs, int attrsonly, IntPtr timeout, int sizelimit)
        {
            ILdapMessage message;

            if (attrs != null)
            {
                Array.Resize(ref attrs, attrs.Length + 1);/* NULL Termination */
            }
            var returnError = LdapClientLibrary.ldap_search_ext_s(this._connection, querybase, scope, filter, attrs, 0, 0, 0, timeout, sizelimit, ref this._result);

            ErrorCheckerHelper.Validate(returnError);
            message = new LdapMessage(this, _result);
            return(message);
        }
Exemplo n.º 6
0
        public IntPtr LdapCreatePageControl(int pageSize, IntPtr cookie, bool isCritical)
        {
            IntPtr pageControl = IntPtr.Zero;

            var returnError = LdapClientLibrary.ldap_create_page_control(
                _connection,
                pageSize,
                cookie,
                isCritical ? 1 : 0,
                out pageControl);

            ErrorCheckerHelper.Validate((int)returnError);

            return(pageControl);
        }
Exemplo n.º 7
0
        public void LdapParseResult(ILdapMessage msg, ref IntPtr serverControls, bool fFreeIt)
        {
            int errorCode = 0;

            var returnError = LdapClientLibrary.ldap_parse_result(
                _connection,
                _result,
                out errorCode,
                null,
                null,
                null,
                ref serverControls,
                fFreeIt ? 1 : 0);

            ErrorCheckerHelper.Validate((int)returnError);
        }
Exemplo n.º 8
0
        public void SetOption(int option, IntPtr ptrVersion)
        {
            var returnError = LdapClientLibrary.ldap_set_option(this._connection, (int)option, ptrVersion);

            ErrorCheckerHelper.Validate(returnError);
        }
Exemplo n.º 9
0
        public void LdapUnbindS()
        {
            var returnError = LdapClientLibrary.ldap_unbind_s(this._connection);

            ErrorCheckerHelper.Validate(returnError);
        }
Exemplo n.º 10
0
        public void DeleteObject(string dn)
        {
            var returnError = LdapClientLibrary.ldap_delete_ext_s(this._connection, dn, null, null);

            ErrorCheckerHelper.Validate((int)returnError);
        }