2006-03-14 15:03:25 +00:00
/*
Unix SMB / CIFS implementation .
interface functions for the sam database
Copyright ( C ) Andrew Tridgell 2004
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
2007-07-10 02:07:03 +00:00
the Free Software Foundation ; either version 3 of the License , or
2006-03-14 15:03:25 +00:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 02:07:03 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2006-03-14 15:03:25 +00:00
*/
# ifndef __SAMDB_H__
# define __SAMDB_H__
struct auth_session_info ;
2007-01-16 10:57:55 +00:00
struct dsdb_control_current_partition ;
2007-01-11 10:21:38 +00:00
struct dsdb_extended_replicated_object ;
struct dsdb_extended_replicated_objects ;
2007-12-02 17:09:52 +01:00
struct loadparm_context ;
2008-12-29 20:24:57 +01:00
struct tevent_context ;
2007-01-11 10:21:38 +00:00
2015-02-02 13:12:36 +01:00
struct dsdb_trust_routing_table ;
2007-01-11 10:21:38 +00:00
# include "librpc/gen_ndr/security.h"
2011-02-10 14:12:51 +11:00
# include <ldb.h>
2008-08-18 20:30:27 +10:00
# include "lib/ldb-samba/ldif_handlers.h"
2007-01-11 10:21:38 +00:00
# include "librpc/gen_ndr/samr.h"
# include "librpc/gen_ndr/drsuapi.h"
# include "librpc/gen_ndr/drsblobs.h"
# include "dsdb/schema/schema.h"
# include "dsdb/samdb/samdb_proto.h"
2009-11-05 16:57:20 +11:00
# include "dsdb/common/dsdb_dn.h"
2010-11-27 18:30:12 +01:00
# include "dsdb/common/proto.h"
2009-06-12 14:27:19 +02:00
# include "../libds/common/flags.h"
2006-03-14 15:03:25 +00:00
2007-01-16 10:57:55 +00:00
# define DSDB_CONTROL_CURRENT_PARTITION_OID "1.3.6.1.4.1.7165.4.3.2"
struct dsdb_control_current_partition {
/*
* this is the version of the dsdb_control_current_partition
* version 0 : initial implementation
2009-09-02 13:36:54 +10:00
* version 1 : got rid of backend and module fields
2007-01-16 10:57:55 +00:00
*/
2009-09-02 13:36:54 +10:00
# define DSDB_CONTROL_CURRENT_PARTITION_VERSION 1
2007-01-16 10:57:55 +00:00
uint32_t version ;
struct ldb_dn * dn ;
} ;
2011-09-23 17:27:40 +10:00
/*
flags in dsdb_repl_flags to control replication logic
*/
# define DSDB_REPL_FLAG_PRIORITISE_INCOMING 1
# define DSDB_REPL_FLAG_PARTIAL_REPLICA 2
2011-09-28 09:30:44 +10:00
# define DSDB_REPL_FLAG_ADD_NCNAME 4
2015-08-19 13:26:41 +12:00
# define DSDB_REPL_FLAG_EXPECT_NO_SECRETS 8
2011-09-23 17:27:40 +10:00
2008-09-27 02:27:54 +02:00
# define DSDB_CONTROL_REPLICATED_UPDATE_OID "1.3.6.1.4.1.7165.4.3.3"
2008-12-16 09:21:55 +01:00
# define DSDB_CONTROL_DN_STORAGE_FORMAT_OID "1.3.6.1.4.1.7165.4.3.4"
/* DSDB_CONTROL_DN_STORAGE_FORMAT_OID has NULL data and behaves very
* much like LDB_CONTROL_EXTENDED_DN_OID when the DB stores an
* extended DN , and otherwise returns normal DNs */
2010-06-13 18:19:37 +02:00
# define DSDB_CONTROL_PASSWORD_CHANGE_STATUS_OID "1.3.6.1.4.1.7165.4.3.8"
2009-09-23 19:25:54 +02:00
struct dsdb_control_password_change_status {
struct {
uint32_t pwdProperties ;
uint32_t pwdHistoryLength ;
int64_t maxPwdAge ;
int64_t minPwdAge ;
uint32_t minPwdLength ;
bool store_cleartext ;
const char * netbios_domain ;
const char * dns_domain ;
const char * realm ;
} domain_data ;
enum samPwdChangeReason reject_reason ;
} ;
2010-06-13 18:19:37 +02:00
# define DSDB_CONTROL_PASSWORD_HASH_VALUES_OID "1.3.6.1.4.1.7165.4.3.9"
2009-09-23 19:25:54 +02:00
2010-08-15 19:52:18 +02:00
# define DSDB_CONTROL_PASSWORD_CHANGE_OID "1.3.6.1.4.1.7165.4.3.10"
2010-08-15 20:01:27 +02:00
struct dsdb_control_password_change {
const struct samr_Password * old_nt_pwd_hash ;
const struct samr_Password * old_lm_pwd_hash ;
} ;
2010-06-14 15:30:36 +10:00
/**
DSDB_CONTROL_APPLY_LINKS is internal to Samba4 - a token passed between repl_meta_data and linked_attributes modules
*/
# define DSDB_CONTROL_APPLY_LINKS "1.3.6.1.4.1.7165.4.3.11"
2010-06-30 08:24:35 +02:00
/*
* this should only be used for importing users from Samba3
*/
# define DSDB_CONTROL_BYPASS_PASSWORD_HASH_OID "1.3.6.1.4.1.7165.4.3.12"
2010-06-22 19:56:37 +04:00
/**
OID used to allow the replacement of replPropertyMetaData .
It is used when the current replmetadata needs to be edited .
*/
# define DSDB_CONTROL_CHANGEREPLMETADATA_OID "1.3.6.1.4.1.7165.4.3.14"
2011-10-07 09:49:48 +02:00
/* passed when we want to get the behaviour of the non-global catalog port */
# define DSDB_CONTROL_NO_GLOBAL_CATALOG "1.3.6.1.4.1.7165.4.3.17"
/* passed when we want special behaviour for partial replicas */
# define DSDB_CONTROL_PARTIAL_REPLICA "1.3.6.1.4.1.7165.4.3.18"
/* passed when we want special behaviour for dbcheck */
# define DSDB_CONTROL_DBCHECK "1.3.6.1.4.1.7165.4.3.19"
2012-07-18 17:13:30 +10:00
/* passed when dbcheck wants to modify a read only replica (very special case) */
# define DSDB_CONTROL_DBCHECK_MODIFY_RO_REPLICA "1.3.6.1.4.1.7165.4.3.19.1"
2011-10-05 14:59:59 +02:00
/* passed when importing plain text password on upgrades */
# define DSDB_CONTROL_PASSWORD_BYPASS_LAST_SET_OID "1.3.6.1.4.1.7165.4.3.20"
2012-11-22 17:42:32 +01:00
/*
* passed from the descriptor module in order to
* store the recalucated nTSecurityDescriptor without
* modifying the replPropertyMetaData .
*/
# define DSDB_CONTROL_SEC_DESC_PROPAGATION_OID "1.3.6.1.4.1.7165.4.3.21"
2014-12-04 17:23:29 +13:00
/*
* passed when creating a interdomain trust account through LSA
* to relax constraints in the samldb ldb module .
*/
# define DSDB_CONTROL_PERMIT_INTERDOMAIN_TRUST_UAC_OID "1.3.6.1.4.1.7165.4.3.23"
2014-10-28 15:03:59 +01:00
/*
* Internal control to mark requests as being part of Tombstone restoring
* procedure - it requires slightly special behavior like :
* - a bit different security checks
* - restoring certain attributes to their default values , etc
*/
# define DSDB_CONTROL_RESTORE_TOMBSTONE_OID "1.3.6.1.4.1.7165.4.3.24"
2015-07-23 16:01:14 +12:00
/**
OID used to allow the replacement of replPropertyMetaData .
It is used when the current replmetadata needs only to be re - sorted , but not edited .
*/
# define DSDB_CONTROL_CHANGEREPLMETADATA_RESORT_OID "1.3.6.1.4.1.7165.4.3.25"
2016-02-11 08:31:46 +01:00
/*
* pass the default state of pwdLastSet between the " samldb " and " password_hash "
* modules .
*/
# define DSDB_CONTROL_PASSWORD_DEFAULT_LAST_SET_OID "1.3.6.1.4.1.7165.4.3.26"
2016-05-27 16:52:54 +02:00
/*
* pass the userAccountControl changes between the " samldb " and " password_hash "
* modules .
*/
# define DSDB_CONTROL_PASSWORD_USER_ACCOUNT_CONTROL_OID "1.3.6.1.4.1.7165.4.3.27"
struct dsdb_control_password_user_account_control {
uint32_t req_flags ; /* the flags given by the client request */
uint32_t old_flags ; /* the old flags stored (0 on add) */
uint32_t new_flags ; /* the new flags stored */
} ;
2016-06-30 15:03:39 +12:00
/*
* Ignores strict checking when adding objects to samldb .
* This is used when provisioning , as checking all objects when added
* was slow due to an unindexed search .
*/
# define DSDB_CONTROL_SKIP_DUPLICATES_CHECK_OID "1.3.6.1.4.1.7165.4.3.28"
2016-07-06 11:54:25 +12:00
/* passed when we want to thoroughly delete linked attributes */
# define DSDB_CONTROL_REPLMD_VANISH_LINKS "1.3.6.1.4.1.7165.4.3.29"
2007-01-06 10:15:02 +00:00
# define DSDB_EXTENDED_REPLICATED_OBJECTS_OID "1.3.6.1.4.1.7165.4.4.1"
2007-01-09 11:15:56 +00:00
struct dsdb_extended_replicated_object {
struct ldb_message * msg ;
2015-12-09 17:05:56 +13:00
struct GUID object_guid ;
struct GUID * parent_guid ;
2007-01-13 10:53:12 +00:00
const char * when_changed ;
2007-01-11 09:45:30 +00:00
struct replPropertyMetaDataBlob * meta_data ;
2012-07-28 15:27:26 +10:00
/* Only used for internal processing in repl_meta_data */
struct ldb_dn * last_known_parent ;
2015-12-09 17:05:56 +13:00
struct ldb_dn * local_parent_dn ;
2007-01-09 11:15:56 +00:00
} ;
2007-01-06 10:15:02 +00:00
struct dsdb_extended_replicated_objects {
2007-01-13 11:37:13 +00:00
/*
* this is the version of the dsdb_extended_replicated_objects
* version 0 : initial implementation
*/
2016-07-13 08:15:20 +02:00
# define DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION 3
2007-01-13 11:37:13 +00:00
uint32_t version ;
2011-09-23 17:27:40 +10:00
/* DSDB_REPL_FLAG_* flags */
uint32_t dsdb_repl_flags ;
2007-01-07 19:11:27 +00:00
struct ldb_dn * partition_dn ;
2007-01-09 11:15:56 +00:00
2007-01-12 16:02:10 +00:00
const struct repsFromTo1 * source_dsa ;
2007-01-12 13:17:25 +00:00
const struct drsuapi_DsReplicaCursor2CtrEx * uptodateness_vector ;
2007-01-09 11:15:56 +00:00
uint32_t num_objects ;
struct dsdb_extended_replicated_object * objects ;
2009-09-03 12:52:31 +10:00
uint32_t linked_attributes_count ;
2016-08-08 09:10:48 +02:00
struct drsuapi_DsReplicaLinkedAttribute * linked_attributes ;
2015-12-09 17:05:56 +13:00
WERROR error ;
2016-07-13 08:15:20 +02:00
bool originating_updates ;
2007-01-06 10:15:02 +00:00
} ;
2009-10-02 10:28:29 +10:00
# define DSDB_EXTENDED_CREATE_PARTITION_OID "1.3.6.1.4.1.7165.4.4.4"
struct dsdb_create_partition_exop {
struct ldb_dn * new_dn ;
} ;
2008-07-24 10:00:20 +02:00
/*
* the schema_dn is passed as struct ldb_dn in
* req - > op . extended . data
*/
2008-07-23 09:59:17 +03:00
# define DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID "1.3.6.1.4.1.7165.4.4.2"
2012-04-06 02:20:37 +02:00
# define DSDB_EXTENDED_SCHEMA_UPGRADE_IN_PROGRESS_OID "1.3.6.1.4.1.7165.4.4.6"
2008-12-16 08:28:55 +01:00
# define DSDB_OPENLDAP_DEREFERENCE_CONTROL "1.3.6.1.4.1.4203.666.5.16"
struct dsdb_openldap_dereference {
const char * source_attribute ;
const char * * dereference_attribute ;
} ;
struct dsdb_openldap_dereference_control {
struct dsdb_openldap_dereference * * dereference ;
} ;
struct dsdb_openldap_dereference_result {
const char * source_attribute ;
const char * dereferenced_dn ;
int num_attributes ;
struct ldb_message_element * attributes ;
} ;
struct dsdb_openldap_dereference_result_control {
struct dsdb_openldap_dereference_result * * attributes ;
} ;
2012-05-12 02:13:42 -07:00
struct samldb_msds_intid_persistant {
uint32_t msds_intid ;
} ;
# define SAMLDB_MSDS_INTID_OPAQUE "SAMLDB_MSDS_INTID_OPAQUE"
2009-10-02 10:28:29 +10:00
# define DSDB_PARTITION_DN "@PARTITION"
# define DSDB_PARTITION_ATTR "partition"
2009-11-16 18:46:28 +11:00
# define DSDB_EXTENDED_DN_STORE_FORMAT_OPAQUE_NAME "dsdb_extended_dn_store_format"
struct dsdb_extended_dn_store_format {
bool store_extended_dn_in_ldb ;
} ;
2009-11-23 20:30:35 +11:00
# define DSDB_OPAQUE_PARTITION_MODULE_MSG_OPAQUE_NAME "DSDB_OPAQUE_PARTITION_MODULE_MSG"
2010-01-06 19:34:14 +11:00
/* this takes a struct dsdb_fsmo_extended_op */
# define DSDB_EXTENDED_ALLOCATE_RID_POOL "1.3.6.1.4.1.7165.4.4.5"
struct dsdb_fsmo_extended_op {
uint64_t fsmo_info ;
struct GUID destination_dsa_guid ;
} ;
2016-10-28 16:08:57 +13:00
/* this takes no data */
# define DSDB_EXTENDED_CREATE_OWN_RID_SET "1.3.6.1.4.1.7165.4.4.8"
/* this takes a struct dsdb_extended_allocate_rid */
# define DSDB_EXTENDED_ALLOCATE_RID "1.3.6.1.4.1.7165.4.4.9"
struct dsdb_extended_allocate_rid {
uint32_t rid ;
} ;
2012-11-22 17:42:32 +01:00
/*
* passed from the descriptor module in order to
* store the recalucated nTSecurityDescriptor without
* modifying the replPropertyMetaData .
*/
# define DSDB_EXTENDED_SEC_DESC_PROPAGATION_OID "1.3.6.1.4.1.7165.4.4.7"
struct dsdb_extended_sec_desc_propagation_op {
struct ldb_dn * nc_root ;
struct ldb_dn * dn ;
bool include_self ;
} ;
2011-04-16 11:46:40 +04:00
# define DSDB_ACL_CHECKS_DIRSYNC_FLAG 0x1
2013-10-14 12:38:10 +03:00
# define DSDB_SAMDB_MINIMUM_ALLOWED_RID 1000
2012-05-30 10:43:27 -07:00
# define DSDB_METADATA_SCHEMA_SEQ_NUM "SCHEMA_SEQ_NUM"
2016-06-01 23:13:21 +02:00
/*
* must be in LDB_FLAG_INTERNAL_MASK
* see also the values in lib / ldb / include / ldb_module . h
*/
# define DSDB_FLAG_INTERNAL_FORCE_META_DATA 0x10000
2017-01-12 16:51:45 +13:00
# define SAMBA_COMPATIBLE_FEATURES_ATTR "compatibleFeatures"
# define SAMBA_REQUIRED_FEATURES_ATTR "requiredFeatures"
2017-02-03 16:13:43 +13:00
# define SAMBA_FEATURES_SUPPORTED_FLAG "@SAMBA_FEATURES_SUPPORTED"
2017-02-03 11:25:37 +13:00
# define SAMBA_SORTED_LINKS_FEATURE "sortedLinks"
2006-03-14 15:03:25 +00:00
# endif /* __SAMDB_H__ */