public AddRequest(string distinguishedName, string objectClass) : this() { if (objectClass == null) { throw new ArgumentNullException("objectClass"); } this.dn = distinguishedName; DirectoryAttribute attribute = new DirectoryAttribute { Name = "objectClass" }; attribute.Add(objectClass); this.attributeList.Add(attribute); }
public AddRequest(string distinguishedName, string objectClass) : this() { if (objectClass == null) { throw new ArgumentNullException("objectClass"); } this.dn = distinguishedName; DirectoryAttribute attribute = new DirectoryAttribute { Name = "objectClass" }; attribute.Add(objectClass); this.attributeList.Add(attribute); }
public AddRequest(string distinguishedName, string objectClass) : this() { if (objectClass != null) { this.dn = distinguishedName; DirectoryAttribute directoryAttribute = new DirectoryAttribute(); directoryAttribute.Name = "objectClass"; directoryAttribute.Add(objectClass); this.attributeList.Add(directoryAttribute); return; } else { throw new ArgumentNullException("objectClass"); } }
public AddRequest(string distinguishedName, string objectClass) : this() { if (objectClass != null) { this.dn = distinguishedName; DirectoryAttribute directoryAttribute = new DirectoryAttribute(); directoryAttribute.Name = "objectClass"; directoryAttribute.Add(objectClass); this.attributeList.Add(directoryAttribute); return; } else { throw new ArgumentNullException("objectClass"); } }
public AddRequest(string distinguishedName, string objectClass) : this() { // parameter validation if (objectClass == null) { throw new ArgumentNullException("objectClass"); } // Store off the distinguished name _dn = distinguishedName; // Store off the objectClass in an object class attribute DirectoryAttribute objClassAttr = new DirectoryAttribute(); objClassAttr.Name = "objectClass"; objClassAttr.Add(objectClass); _attributeList.Add(objClassAttr); }
internal DirectoryAttribute ConstructAttribute(IntPtr entryMessage, IntPtr attributeName) { DirectoryAttribute attribute = new DirectoryAttribute(); attribute.isSearchResult = true; // get name string name = Marshal.PtrToStringUni(attributeName); attribute.Name = name; // get values IntPtr valuesArray = Wldap32.ldap_get_values_len(ldapHandle, entryMessage, name); try { IntPtr tempPtr = (IntPtr)0; int count = 0; if (valuesArray != (IntPtr)0) { tempPtr = Marshal.ReadIntPtr(valuesArray, Marshal.SizeOf(typeof(IntPtr)) * count); while (tempPtr != (IntPtr)0) { berval bervalue = new berval(); Marshal.PtrToStructure(tempPtr, bervalue); byte[] byteArray = null; if (bervalue.bv_len > 0 && bervalue.bv_val != (IntPtr)0) { byteArray = new byte[bervalue.bv_len]; Marshal.Copy(bervalue.bv_val, byteArray, 0, bervalue.bv_len); attribute.Add(byteArray); } count++; tempPtr = Marshal.ReadIntPtr(valuesArray, Marshal.SizeOf(typeof(IntPtr)) * count); } } } finally { if (valuesArray != (IntPtr)0) Wldap32.ldap_value_free_len(valuesArray); } return attribute; }
internal DirectoryAttribute ConstructAttribute(IntPtr entryMessage, IntPtr attributeName) { DirectoryAttribute directoryAttribute = new DirectoryAttribute(); directoryAttribute.isSearchResult = true; string stringUni = Marshal.PtrToStringUni(attributeName); directoryAttribute.Name = stringUni; IntPtr intPtr = Wldap32.ldap_get_values_len(this.ldapHandle, entryMessage, stringUni); try { int num = 0; if (intPtr != (IntPtr)0) { for (IntPtr i = Marshal.ReadIntPtr(intPtr, Marshal.SizeOf(typeof(IntPtr)) * num); i != (IntPtr)0; i = Marshal.ReadIntPtr(intPtr, Marshal.SizeOf(typeof(IntPtr)) * num)) { berval _berval = new berval(); Marshal.PtrToStructure(i, _berval); if (_berval.bv_len > 0 && _berval.bv_val != (IntPtr)0) { byte[] numArray = new byte[_berval.bv_len]; Marshal.Copy(_berval.bv_val, numArray, 0, _berval.bv_len); directoryAttribute.Add(numArray); } num++; } } } finally { if (intPtr != (IntPtr)0) { Wldap32.ldap_value_free_len(intPtr); } } return directoryAttribute; }
internal DirectoryAttribute ConstructAttribute(IntPtr entryMessage, IntPtr attributeName) { DirectoryAttribute attribute = new DirectoryAttribute { isSearchResult = true }; string name = Marshal.PtrToStringUni(attributeName); attribute.Name = name; IntPtr ptr = Wldap32.ldap_get_values_len(this.ldapHandle, entryMessage, name); try { IntPtr zero = IntPtr.Zero; int num = 0; if (!(ptr != IntPtr.Zero)) { return attribute; } for (zero = Marshal.ReadIntPtr(ptr, Marshal.SizeOf(typeof(IntPtr)) * num); zero != IntPtr.Zero; zero = Marshal.ReadIntPtr(ptr, Marshal.SizeOf(typeof(IntPtr)) * num)) { berval structure = new berval(); Marshal.PtrToStructure(zero, structure); byte[] destination = null; if ((structure.bv_len > 0) && (structure.bv_val != IntPtr.Zero)) { destination = new byte[structure.bv_len]; Marshal.Copy(structure.bv_val, destination, 0, structure.bv_len); attribute.Add(destination); } num++; } } finally { if (ptr != IntPtr.Zero) { Wldap32.ldap_value_free_len(ptr); } } return attribute; }