Пример #1
0
        private static Native.Native.LDAPMod ToLdapMod(LdapModifyAttribute attribute)
        {
            var modValue    = attribute.Values ?? new List <string>();
            var modValuePtr = MarshalUtils.AllocHGlobalIntPtrArray(modValue.Count + 1);

            MarshalUtils.ByteArraysToBerValueArray(modValue.Select(GetModValue).ToArray(), modValuePtr);
            return(new Native.Native.LDAPMod
            {
                mod_op = (int)attribute.LdapModOperation | (int)LdapForNet.Native.Native.LdapModOperation.LDAP_MOD_BVALUES,
                mod_type = Encoder.Instance.StringToPtr(attribute.Type),
                mod_vals_u = new Native.Native.LDAPMod.mod_vals
                {
                    modv_bvals = modValuePtr
                },
                mod_next = IntPtr.Zero
            });
        }
Пример #2
0
        private static Native.Native.LDAPMod ToLdapMod(LdapModifyAttribute attribute)
        {
            var modValue    = GetModValue(attribute.Values);
            var modValuePtr = Marshal.AllocHGlobal(IntPtr.Size * (modValue.Count));

            MarshalUtils.StringArrayToPtr(modValue, modValuePtr);
            return(new Native.Native.LDAPMod
            {
                mod_op = (int)attribute.LdapModOperation,
                mod_type = attribute.Type,
                mod_vals_u = new Native.Native.LDAPMod.mod_vals
                {
                    modv_strvals = modValuePtr,
                },
                mod_next = IntPtr.Zero
            });
        }