libds:flag_mapping.c - introduce a call which maps the "userAccountControl" to the...
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 12 Sep 2010 16:00:21 +0000 (18:00 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 12 Sep 2010 17:23:06 +0000 (19:23 +0200)
libds/common/flag_mapping.c

index d95780ed5443b12be2ad7db1a4e8b948d84e73e2..dfe619971f8382d4449fca5e933c495c0991224b 100644 (file)
@@ -4,6 +4,7 @@
 
    Copyright (C) Stefan (metze) Metzmacher 2002
    Copyright (C) Andrew Tridgell 2004
+   Copyright (C) Matthias Dieter Wallnöfer 2010
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -145,3 +146,15 @@ enum lsa_SidType ds_atype_map(uint32_t atype)
        }
        return SID_NAME_UNKNOWN;
 }
+
+/* get the default primary group RID for a given userAccountControl
+ * (informations according to MS-SAMR 3.1.1.8.1) */
+uint32_t ds_uf2prim_group_rid(uint32_t uf)
+{
+       uint32_t prim_group_rid = DOMAIN_RID_USERS;
+
+       if (uf & UF_SERVER_TRUST_ACCOUNT)           prim_group_rid = DOMAIN_RID_DCS;
+       else if (uf & UF_WORKSTATION_TRUST_ACCOUNT) prim_group_rid = DOMAIN_RID_DOMAIN_MEMBERS;
+
+       return prim_group_rid;
+}