예제 #1
0
파일: LdapEntry.cs 프로젝트: wfu8/lightwave
        //Override
        public List <LdapValue> getAttributeValues(string attributeName)
        {
            List <LdapValue> attributeValues  = new List <LdapValue>();
            IntPtr           attributePointer = IntPtr.Zero;
            int i = 0;

            try
            {
                attributePointer = LdapClientLibrary.ldap_get_values(this._message.GetConnection().GetIntPtr(), this._entry, attributeName);
                var count = LdapClientLibrary.ldap_count_values(attributePointer);
                while (i < count)
                {
                    var attributeValuePointer = Marshal.ReadIntPtr(attributePointer, System.Runtime.InteropServices.Marshal.SizeOf(attributePointer) * i);
                    var attributeValue        = new LdapValue(Marshal.PtrToStringAnsi(attributeValuePointer));
                    attributeValues.Add(attributeValue);
                    i++;
                }
                return(attributeValues);
            }
            finally
            {
                LdapClientLibrary.ldap_value_free(attributePointer);
            }
        }
예제 #2
0
 //returns LDAPValue  from string
 public static LdapValue StringToLdapValue (string stringVal)
 {
     LdapValue val = new LdapValue (stringVal);
     return val;
 }
예제 #3
0
 //Override
 public List<LdapValue> getAttributeValues(string attributeName)
 {
     List<LdapValue> attributeValues = new List<LdapValue>();
     IntPtr attributePointer = IntPtr.Zero;
     int i = 0;
     try
     {
         attributePointer = LdapClientLibrary.ldap_get_values(this._message.GetConnection().GetIntPtr(), this._entry, attributeName);
         var count = LdapClientLibrary.ldap_count_values(attributePointer);
         while (i < count)
         {
             var attributeValuePointer = Marshal.ReadIntPtr(attributePointer, System.Runtime.InteropServices.Marshal.SizeOf(attributePointer) * i);
             var attributeValue = new LdapValue(Marshal.PtrToStringAnsi(attributeValuePointer));
             attributeValues.Add(attributeValue);
             i++;
         }
         return attributeValues;
     }
     finally
     {
         LdapClientLibrary.ldap_value_free(attributePointer);
     }
 }