Ejemplo n.º 1
0
        //Override
        public string getDN()
        {
            IntPtr dnPointer = IntPtr.Zero;
            string dn;

            try
            {
                dnPointer = LdapClientLibrary.ldap_get_dn(this._message.GetConnection().GetIntPtr(), this._entry);
                dn        = Marshal.PtrToStringAnsi(dnPointer);
                return(dn);
            }
            finally
            {
                LdapClientLibrary.ldap_memfree(dnPointer);
            }
        }
Ejemplo n.º 2
0
        //Override
        public List <string> getAttributeNames()
        {
            IntPtr        attributePointer = IntPtr.Zero, berPointer = IntPtr.Zero;
            List <string> attributeList = new List <string>();

            try
            {
                attributePointer = LdapClientLibrary.ldap_first_attribute(this._message.GetConnection().GetIntPtr(), this._entry, out berPointer);
                while (attributePointer != IntPtr.Zero)
                {
                    var attributeName = Marshal.PtrToStringAnsi(attributePointer);
                    attributeList.Add(attributeName);
                    LdapClientLibrary.ldap_memfree(attributePointer);
                    attributePointer = LdapClientLibrary.ldap_next_attribute(this._message.GetConnection().GetIntPtr(), this._entry, berPointer);
                }
                return(attributeList);
            }
            finally
            {
                LdapClientLibrary.ldap_value_free(attributePointer);
                LdapClientLibrary.ber_free(berPointer, 0);
            }
        }