diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/pydsdb.c | 247 |
1 files changed, 110 insertions, 137 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index 16a4cd4360..e5e6767da8 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -706,150 +706,123 @@ void initdsdb(void) if (m == NULL) return; +#define ADD_DSDB_FLAG(val) PyModule_AddObject(m, #val, PyInt_FromLong(val)) + /* "userAccountControl" flags */ - PyModule_AddObject(m, "UF_NORMAL_ACCOUNT", - PyInt_FromLong(UF_NORMAL_ACCOUNT)); - PyModule_AddObject(m, "UF_TEMP_DUPLICATE_ACCOUNT", - PyInt_FromLong(UF_TEMP_DUPLICATE_ACCOUNT)); - PyModule_AddObject(m, "UF_SERVER_TRUST_ACCOUNT", - PyInt_FromLong(UF_SERVER_TRUST_ACCOUNT)); - PyModule_AddObject(m, "UF_WORKSTATION_TRUST_ACCOUNT", - PyInt_FromLong(UF_WORKSTATION_TRUST_ACCOUNT)); - PyModule_AddObject(m, "UF_INTERDOMAIN_TRUST_ACCOUNT", - PyInt_FromLong(UF_INTERDOMAIN_TRUST_ACCOUNT)); - PyModule_AddObject(m, "UF_PASSWD_NOTREQD", - PyInt_FromLong(UF_PASSWD_NOTREQD)); - PyModule_AddObject(m, "UF_ACCOUNTDISABLE", - PyInt_FromLong(UF_ACCOUNTDISABLE)); - - PyModule_AddObject(m, "UF_SCRIPT", PyInt_FromLong(UF_SCRIPT)); - PyModule_AddObject(m, "UF_ACCOUNTDISABLE", PyInt_FromLong(UF_ACCOUNTDISABLE)); - PyModule_AddObject(m, "UF_00000004", PyInt_FromLong(UF_00000004)); - PyModule_AddObject(m, "UF_HOMEDIR_REQUIRED", PyInt_FromLong(UF_HOMEDIR_REQUIRED)); - PyModule_AddObject(m, "UF_LOCKOUT", PyInt_FromLong(UF_LOCKOUT)); - PyModule_AddObject(m, "UF_PASSWD_NOTREQD", PyInt_FromLong(UF_PASSWD_NOTREQD)); - PyModule_AddObject(m, "UF_PASSWD_CANT_CHANGE", PyInt_FromLong(UF_PASSWD_CANT_CHANGE)); - PyModule_AddObject(m, "UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED", PyInt_FromLong(UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED)); - PyModule_AddObject(m, "UF_TEMP_DUPLICATE_ACCOUNT", PyInt_FromLong(UF_TEMP_DUPLICATE_ACCOUNT)); - PyModule_AddObject(m, "UF_NORMAL_ACCOUNT", PyInt_FromLong(UF_NORMAL_ACCOUNT)); - PyModule_AddObject(m, "UF_00000400", PyInt_FromLong(UF_00000400)); - PyModule_AddObject(m, "UF_INTERDOMAIN_TRUST_ACCOUNT", PyInt_FromLong(UF_INTERDOMAIN_TRUST_ACCOUNT)); - PyModule_AddObject(m, "UF_WORKSTATION_TRUST_ACCOUNT", PyInt_FromLong(UF_WORKSTATION_TRUST_ACCOUNT)); - PyModule_AddObject(m, "UF_SERVER_TRUST_ACCOUNT", PyInt_FromLong(UF_SERVER_TRUST_ACCOUNT)); - PyModule_AddObject(m, "UF_00004000", PyInt_FromLong(UF_00004000)); - PyModule_AddObject(m, "UF_00008000", PyInt_FromLong(UF_00008000)); - PyModule_AddObject(m, "UF_DONT_EXPIRE_PASSWD", PyInt_FromLong(UF_DONT_EXPIRE_PASSWD)); - PyModule_AddObject(m, "UF_MNS_LOGON_ACCOUNT", PyInt_FromLong(UF_MNS_LOGON_ACCOUNT)); - PyModule_AddObject(m, "UF_SMARTCARD_REQUIRED", PyInt_FromLong(UF_SMARTCARD_REQUIRED)); - PyModule_AddObject(m, "UF_TRUSTED_FOR_DELEGATION", PyInt_FromLong(UF_TRUSTED_FOR_DELEGATION)); - PyModule_AddObject(m, "UF_NOT_DELEGATED", PyInt_FromLong(UF_NOT_DELEGATED)); - PyModule_AddObject(m, "UF_USE_DES_KEY_ONLY", PyInt_FromLong(UF_USE_DES_KEY_ONLY)); - PyModule_AddObject(m, "UF_DONT_REQUIRE_PREAUTH", PyInt_FromLong(UF_DONT_REQUIRE_PREAUTH)); - PyModule_AddObject(m, "UF_PASSWORD_EXPIRED", PyInt_FromLong(UF_PASSWORD_EXPIRED)); - PyModule_AddObject(m, "UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION", PyInt_FromLong(UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION)); - PyModule_AddObject(m, "UF_NO_AUTH_DATA_REQUIRED", PyInt_FromLong(UF_NO_AUTH_DATA_REQUIRED)); - PyModule_AddObject(m, "UF_PARTIAL_SECRETS_ACCOUNT", PyInt_FromLong(UF_PARTIAL_SECRETS_ACCOUNT)); - - /* "groupType" flags */ - PyModule_AddObject(m, "GTYPE_SECURITY_BUILTIN_LOCAL_GROUP", - PyInt_FromLong(GTYPE_SECURITY_BUILTIN_LOCAL_GROUP)); - PyModule_AddObject(m, "GTYPE_SECURITY_GLOBAL_GROUP", - PyInt_FromLong(GTYPE_SECURITY_GLOBAL_GROUP)); - PyModule_AddObject(m, "GTYPE_SECURITY_DOMAIN_LOCAL_GROUP", - PyInt_FromLong(GTYPE_SECURITY_DOMAIN_LOCAL_GROUP)); - PyModule_AddObject(m, "GTYPE_SECURITY_UNIVERSAL_GROUP", - PyInt_FromLong(GTYPE_SECURITY_UNIVERSAL_GROUP)); - PyModule_AddObject(m, "GTYPE_DISTRIBUTION_GLOBAL_GROUP", - PyInt_FromLong(GTYPE_DISTRIBUTION_GLOBAL_GROUP)); - PyModule_AddObject(m, "GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP", - PyInt_FromLong(GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP)); - PyModule_AddObject(m, "GTYPE_DISTRIBUTION_UNIVERSAL_GROUP", - PyInt_FromLong(GTYPE_DISTRIBUTION_UNIVERSAL_GROUP)); + ADD_DSDB_FLAG(UF_NORMAL_ACCOUNT); + ADD_DSDB_FLAG(UF_TEMP_DUPLICATE_ACCOUNT); + ADD_DSDB_FLAG(UF_SERVER_TRUST_ACCOUNT); + ADD_DSDB_FLAG(UF_WORKSTATION_TRUST_ACCOUNT); + ADD_DSDB_FLAG(UF_INTERDOMAIN_TRUST_ACCOUNT); + ADD_DSDB_FLAG(UF_PASSWD_NOTREQD); + ADD_DSDB_FLAG(UF_ACCOUNTDISABLE); + + ADD_DSDB_FLAG(UF_SCRIPT); + ADD_DSDB_FLAG(UF_ACCOUNTDISABLE); + ADD_DSDB_FLAG(UF_00000004); + ADD_DSDB_FLAG(UF_HOMEDIR_REQUIRED); + ADD_DSDB_FLAG(UF_LOCKOUT); + ADD_DSDB_FLAG(UF_PASSWD_NOTREQD); + ADD_DSDB_FLAG(UF_PASSWD_CANT_CHANGE); + ADD_DSDB_FLAG(UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED); + ADD_DSDB_FLAG(UF_TEMP_DUPLICATE_ACCOUNT); + ADD_DSDB_FLAG(UF_NORMAL_ACCOUNT); + ADD_DSDB_FLAG(UF_00000400); + ADD_DSDB_FLAG(UF_INTERDOMAIN_TRUST_ACCOUNT); + ADD_DSDB_FLAG(UF_WORKSTATION_TRUST_ACCOUNT); + ADD_DSDB_FLAG(UF_SERVER_TRUST_ACCOUNT); + ADD_DSDB_FLAG(UF_00004000); + ADD_DSDB_FLAG(UF_00008000); + ADD_DSDB_FLAG(UF_DONT_EXPIRE_PASSWD); + ADD_DSDB_FLAG(UF_MNS_LOGON_ACCOUNT); + ADD_DSDB_FLAG(UF_SMARTCARD_REQUIRED); + ADD_DSDB_FLAG(UF_TRUSTED_FOR_DELEGATION); + ADD_DSDB_FLAG(UF_NOT_DELEGATED); + ADD_DSDB_FLAG(UF_USE_DES_KEY_ONLY); + ADD_DSDB_FLAG(UF_DONT_REQUIRE_PREAUTH); + ADD_DSDB_FLAG(UF_PASSWORD_EXPIRED); + ADD_DSDB_FLAG(UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION); + ADD_DSDB_FLAG(UF_NO_AUTH_DATA_REQUIRED); + ADD_DSDB_FLAG(UF_PARTIAL_SECRETS_ACCOUNT); + + /* groupType flags */ + ADD_DSDB_FLAG(GTYPE_SECURITY_BUILTIN_LOCAL_GROUP); + ADD_DSDB_FLAG(GTYPE_SECURITY_GLOBAL_GROUP); + ADD_DSDB_FLAG(GTYPE_SECURITY_DOMAIN_LOCAL_GROUP); + ADD_DSDB_FLAG(GTYPE_SECURITY_UNIVERSAL_GROUP); + ADD_DSDB_FLAG(GTYPE_DISTRIBUTION_GLOBAL_GROUP); + ADD_DSDB_FLAG(GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP); + ADD_DSDB_FLAG(GTYPE_DISTRIBUTION_UNIVERSAL_GROUP); /* "sAMAccountType" flags */ - PyModule_AddObject(m, "ATYPE_NORMAL_ACCOUNT", - PyInt_FromLong(ATYPE_NORMAL_ACCOUNT)); - PyModule_AddObject(m, "ATYPE_WORKSTATION_TRUST", - PyInt_FromLong(ATYPE_WORKSTATION_TRUST)); - PyModule_AddObject(m, "ATYPE_INTERDOMAIN_TRUST", - PyInt_FromLong(ATYPE_INTERDOMAIN_TRUST)); - PyModule_AddObject(m, "ATYPE_SECURITY_GLOBAL_GROUP", - PyInt_FromLong(ATYPE_SECURITY_GLOBAL_GROUP)); - PyModule_AddObject(m, "ATYPE_SECURITY_LOCAL_GROUP", - PyInt_FromLong(ATYPE_SECURITY_LOCAL_GROUP)); - PyModule_AddObject(m, "ATYPE_SECURITY_UNIVERSAL_GROUP", - PyInt_FromLong(ATYPE_SECURITY_UNIVERSAL_GROUP)); - PyModule_AddObject(m, "ATYPE_DISTRIBUTION_GLOBAL_GROUP", - PyInt_FromLong(ATYPE_DISTRIBUTION_GLOBAL_GROUP)); - PyModule_AddObject(m, "ATYPE_DISTRIBUTION_LOCAL_GROUP", - PyInt_FromLong(ATYPE_DISTRIBUTION_LOCAL_GROUP)); - PyModule_AddObject(m, "ATYPE_DISTRIBUTION_UNIVERSAL_GROUP", - PyInt_FromLong(ATYPE_DISTRIBUTION_UNIVERSAL_GROUP)); + ADD_DSDB_FLAG(ATYPE_NORMAL_ACCOUNT); + ADD_DSDB_FLAG(ATYPE_WORKSTATION_TRUST); + ADD_DSDB_FLAG(ATYPE_INTERDOMAIN_TRUST); + ADD_DSDB_FLAG(ATYPE_SECURITY_GLOBAL_GROUP); + ADD_DSDB_FLAG(ATYPE_SECURITY_LOCAL_GROUP); + ADD_DSDB_FLAG(ATYPE_SECURITY_UNIVERSAL_GROUP); + ADD_DSDB_FLAG(ATYPE_DISTRIBUTION_GLOBAL_GROUP); + ADD_DSDB_FLAG(ATYPE_DISTRIBUTION_LOCAL_GROUP); + ADD_DSDB_FLAG(ATYPE_DISTRIBUTION_UNIVERSAL_GROUP); /* "domainFunctionality", "forestFunctionality" flags in the rootDSE */ - PyModule_AddObject(m, "DS_DOMAIN_FUNCTION_2000", - PyInt_FromLong(DS_DOMAIN_FUNCTION_2000)); - PyModule_AddObject(m, "DS_DOMAIN_FUNCTION_2003_MIXED", - PyInt_FromLong(DS_DOMAIN_FUNCTION_2003_MIXED)); - PyModule_AddObject(m, "DS_DOMAIN_FUNCTION_2003", - PyInt_FromLong(DS_DOMAIN_FUNCTION_2003)); - PyModule_AddObject(m, "DS_DOMAIN_FUNCTION_2008", - PyInt_FromLong(DS_DOMAIN_FUNCTION_2008)); - PyModule_AddObject(m, "DS_DOMAIN_FUNCTION_2008_R2", - PyInt_FromLong(DS_DOMAIN_FUNCTION_2008_R2)); + ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2000); + ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2003_MIXED); + ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2003); + ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2008); + ADD_DSDB_FLAG(DS_DOMAIN_FUNCTION_2008_R2); /* "systemFlags" */ - PyModule_AddObject(m, "SYSTEM_FLAG_CR_NTDS_NC", - PyInt_FromLong(SYSTEM_FLAG_CR_NTDS_NC)); - PyModule_AddObject(m, "SYSTEM_FLAG_CR_NTDS_DOMAIN", - PyInt_FromLong(SYSTEM_FLAG_CR_NTDS_DOMAIN)); - PyModule_AddObject(m, "SYSTEM_FLAG_CR_NTDS_NOT_GC_REPLICATED", - PyInt_FromLong(SYSTEM_FLAG_CR_NTDS_NOT_GC_REPLICATED)); - PyModule_AddObject(m, "SYSTEM_FLAG_SCHEMA_BASE_OBJECT", - PyInt_FromLong(SYSTEM_FLAG_SCHEMA_BASE_OBJECT)); - PyModule_AddObject(m, "SYSTEM_FLAG_ATTR_IS_RDN", - PyInt_FromLong(SYSTEM_FLAG_ATTR_IS_RDN)); - PyModule_AddObject(m, "SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE", - PyInt_FromLong(SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE)); - PyModule_AddObject(m, "SYSTEM_FLAG_DOMAIN_DISALLOW_MOVE", - PyInt_FromLong(SYSTEM_FLAG_DOMAIN_DISALLOW_MOVE)); - PyModule_AddObject(m, "SYSTEM_FLAG_DOMAIN_DISALLOW_RENAME", - PyInt_FromLong(SYSTEM_FLAG_DOMAIN_DISALLOW_RENAME)); - PyModule_AddObject(m, "SYSTEM_FLAG_CONFIG_ALLOW_LIMITED_MOVE", - PyInt_FromLong(SYSTEM_FLAG_CONFIG_ALLOW_LIMITED_MOVE)); - PyModule_AddObject(m, "SYSTEM_FLAG_CONFIG_ALLOW_MOVE", - PyInt_FromLong(SYSTEM_FLAG_CONFIG_ALLOW_MOVE)); - PyModule_AddObject(m, "SYSTEM_FLAG_CONFIG_ALLOW_RENAME", - PyInt_FromLong(SYSTEM_FLAG_CONFIG_ALLOW_RENAME)); - PyModule_AddObject(m, "SYSTEM_FLAG_DISALLOW_DELETE", - PyInt_FromLong(SYSTEM_FLAG_DISALLOW_DELETE)); + ADD_DSDB_FLAG(SYSTEM_FLAG_CR_NTDS_NC); + ADD_DSDB_FLAG(SYSTEM_FLAG_CR_NTDS_DOMAIN); + ADD_DSDB_FLAG(SYSTEM_FLAG_CR_NTDS_NOT_GC_REPLICATED); + ADD_DSDB_FLAG(SYSTEM_FLAG_SCHEMA_BASE_OBJECT); + ADD_DSDB_FLAG(SYSTEM_FLAG_ATTR_IS_RDN); + ADD_DSDB_FLAG(SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE); + ADD_DSDB_FLAG(SYSTEM_FLAG_DOMAIN_DISALLOW_MOVE); + ADD_DSDB_FLAG(SYSTEM_FLAG_DOMAIN_DISALLOW_RENAME); + ADD_DSDB_FLAG(SYSTEM_FLAG_CONFIG_ALLOW_LIMITED_MOVE); + ADD_DSDB_FLAG(SYSTEM_FLAG_CONFIG_ALLOW_MOVE); + ADD_DSDB_FLAG(SYSTEM_FLAG_CONFIG_ALLOW_RENAME); + ADD_DSDB_FLAG(SYSTEM_FLAG_DISALLOW_DELETE); /* Kerberos encryption type constants */ - PyModule_AddObject(m, "ENC_ALL_TYPES", - PyInt_FromLong(ENC_ALL_TYPES)); - PyModule_AddObject(m, "ENC_CRC32", - PyInt_FromLong(ENC_CRC32)); - PyModule_AddObject(m, "ENC_RSA_MD5", - PyInt_FromLong(ENC_RSA_MD5)); - PyModule_AddObject(m, "ENC_RC4_HMAC_MD5", - PyInt_FromLong(ENC_RC4_HMAC_MD5)); - PyModule_AddObject(m, "ENC_HMAC_SHA1_96_AES128", - PyInt_FromLong(ENC_HMAC_SHA1_96_AES128)); - PyModule_AddObject(m, "ENC_HMAC_SHA1_96_AES256", - PyInt_FromLong(ENC_HMAC_SHA1_96_AES256)); - - PyModule_AddObject(m, "SEARCH_FLAG_ATTINDEX", PyInt_FromLong(SEARCH_FLAG_ATTINDEX)); - PyModule_AddObject(m, "SEARCH_FLAG_PDNTATTINDEX", PyInt_FromLong(SEARCH_FLAG_PDNTATTINDEX)); - PyModule_AddObject(m, "SEARCH_FLAG_ANR", PyInt_FromLong(SEARCH_FLAG_ANR)); - PyModule_AddObject(m, "SEARCH_FLAG_PRESERVEONDELETE", PyInt_FromLong(SEARCH_FLAG_PRESERVEONDELETE)); - PyModule_AddObject(m, "SEARCH_FLAG_COPY", PyInt_FromLong(SEARCH_FLAG_COPY)); - PyModule_AddObject(m, "SEARCH_FLAG_TUPLEINDEX", PyInt_FromLong(SEARCH_FLAG_TUPLEINDEX)); - PyModule_AddObject(m, "SEARCH_FLAG_SUBTREEATTRINDEX", PyInt_FromLong(SEARCH_FLAG_SUBTREEATTRINDEX)); - PyModule_AddObject(m, "SEARCH_FLAG_CONFIDENTIAL", PyInt_FromLong(SEARCH_FLAG_CONFIDENTIAL)); - PyModule_AddObject(m, "SEARCH_FLAG_NEVERVALUEAUDIT", PyInt_FromLong(SEARCH_FLAG_NEVERVALUEAUDIT)); - PyModule_AddObject(m, "SEARCH_FLAG_RODC_ATTRIBUTE", PyInt_FromLong(SEARCH_FLAG_RODC_ATTRIBUTE)); - - PyModule_AddObject(m, "DS_FLAG_ATTR_NOT_REPLICATED", PyInt_FromLong(DS_FLAG_ATTR_NOT_REPLICATED)); - PyModule_AddObject(m, "DS_FLAG_ATTR_REQ_PARTIAL_SET_MEMBER", PyInt_FromLong(DS_FLAG_ATTR_REQ_PARTIAL_SET_MEMBER)); - PyModule_AddObject(m, "DS_FLAG_ATTR_IS_CONSTRUCTED", PyInt_FromLong(DS_FLAG_ATTR_IS_CONSTRUCTED)); + ADD_DSDB_FLAG(ENC_ALL_TYPES); + ADD_DSDB_FLAG(ENC_CRC32); + ADD_DSDB_FLAG(ENC_RSA_MD5); + ADD_DSDB_FLAG(ENC_RC4_HMAC_MD5); + ADD_DSDB_FLAG(ENC_HMAC_SHA1_96_AES128); + ADD_DSDB_FLAG(ENC_HMAC_SHA1_96_AES256); + + ADD_DSDB_FLAG(SEARCH_FLAG_ATTINDEX); + ADD_DSDB_FLAG(SEARCH_FLAG_PDNTATTINDEX); + ADD_DSDB_FLAG(SEARCH_FLAG_ANR); + ADD_DSDB_FLAG(SEARCH_FLAG_PRESERVEONDELETE); + ADD_DSDB_FLAG(SEARCH_FLAG_COPY); + ADD_DSDB_FLAG(SEARCH_FLAG_TUPLEINDEX); + ADD_DSDB_FLAG(SEARCH_FLAG_SUBTREEATTRINDEX); + ADD_DSDB_FLAG(SEARCH_FLAG_CONFIDENTIAL); + ADD_DSDB_FLAG(SEARCH_FLAG_NEVERVALUEAUDIT); + ADD_DSDB_FLAG(SEARCH_FLAG_RODC_ATTRIBUTE); + + ADD_DSDB_FLAG(DS_FLAG_ATTR_NOT_REPLICATED); + ADD_DSDB_FLAG(DS_FLAG_ATTR_REQ_PARTIAL_SET_MEMBER); + ADD_DSDB_FLAG(DS_FLAG_ATTR_IS_CONSTRUCTED); + + ADD_DSDB_FLAG(DS_NTDSDSA_OPT_IS_GC); + ADD_DSDB_FLAG(DS_NTDSDSA_OPT_DISABLE_INBOUND_REPL); + ADD_DSDB_FLAG(DS_NTDSDSA_OPT_DISABLE_OUTBOUND_REPL); + ADD_DSDB_FLAG(DS_NTDSDSA_OPT_DISABLE_NTDSCONN_XLATE); + ADD_DSDB_FLAG(DS_NTDSDSA_OPT_DISABLE_SPN_REGISTRATION); + + ADD_DSDB_FLAG(NTDSCONN_KCC_GC_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_RING_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_MINIMIZE_HOPS_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_STALE_SERVERS_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_OSCILLATING_CONNECTION_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_INTERSITE_GC_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_INTERSITE_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY); + ADD_DSDB_FLAG(NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY); } |