diff options
author | Günther Deschner <gd@samba.org> | 2008-11-22 00:35:20 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-02-02 15:45:20 +0100 |
commit | 6e0498d0e289ed596a86a1b084475bdeec9b7105 (patch) | |
tree | f4ca97c23d26cb66007785ae9143f4af55863ae2 | |
parent | 41ba1d3a1cdb1ecf3f3e607cea73c35dc19a3deb (diff) | |
download | samba-6e0498d0e289ed596a86a1b084475bdeec9b7105.tar.gz samba-6e0498d0e289ed596a86a1b084475bdeec9b7105.tar.bz2 samba-6e0498d0e289ed596a86a1b084475bdeec9b7105.zip |
s3-dssync-passdb: fill in passdb_process_objects
Guenther
Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | source3/libnet/libnet_dssync_passdb.c | 137 |
1 files changed, 136 insertions, 1 deletions
diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c index a8e502a46c..2388b1a67a 100644 --- a/source3/libnet/libnet_dssync_passdb.c +++ b/source3/libnet/libnet_dssync_passdb.c @@ -19,6 +19,7 @@ #include "includes.h" #include "libnet/libnet_dssync.h" +#include "../libds/common/flags.h" /**************************************************************** ****************************************************************/ @@ -61,12 +62,146 @@ static NTSTATUS passdb_finish(struct dssync_context *ctx, TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ +static NTSTATUS handle_account_object(TALLOC_CTX *mem_ctx, + struct pdb_methods *methods, + struct drsuapi_DsReplicaObjectListItemEx *cur) +{ + return NT_STATUS_OK; +} + +/**************************************************************** +****************************************************************/ + +static NTSTATUS handle_alias_object(TALLOC_CTX *mem_ctx, + struct pdb_methods *methods, + struct drsuapi_DsReplicaObjectListItemEx *cur) +{ + return NT_STATUS_OK; +} + +/**************************************************************** +****************************************************************/ + +static NTSTATUS handle_group_object(TALLOC_CTX *mem_ctx, + struct pdb_methods *methods, + struct drsuapi_DsReplicaObjectListItemEx *cur) +{ + return NT_STATUS_OK; +} + +/**************************************************************** +****************************************************************/ + +static NTSTATUS handle_interdomain_trust_object(TALLOC_CTX *mem_ctx, + struct pdb_methods *methods, + struct drsuapi_DsReplicaObjectListItemEx *cur) +{ + return NT_STATUS_OK; +} + +/**************************************************************** +****************************************************************/ + +struct dssync_object_table_t { + uint32_t type; + NTSTATUS (*fn) (TALLOC_CTX *mem_ctx, + struct pdb_methods *methods, + struct drsuapi_DsReplicaObjectListItemEx *cur); +}; + +static const struct dssync_object_table_t dssync_object_table[] = { + { ATYPE_NORMAL_ACCOUNT, handle_account_object }, + { ATYPE_WORKSTATION_TRUST, handle_account_object }, + { ATYPE_SECURITY_LOCAL_GROUP, handle_alias_object }, + { ATYPE_SECURITY_GLOBAL_GROUP, handle_group_object }, + { ATYPE_INTERDOMAIN_TRUST, handle_interdomain_trust_object }, +}; + +/**************************************************************** +****************************************************************/ + +static NTSTATUS parse_object(TALLOC_CTX *mem_ctx, + struct pdb_methods *methods, + struct drsuapi_DsReplicaObjectListItemEx *cur) +{ + NTSTATUS status = NT_STATUS_OK; + DATA_BLOB *blob; + int i = 0; + int a = 0; + struct drsuapi_DsReplicaAttribute *attr; + + char *name = NULL; + uint32_t uacc = 0; + uint32_t sam_type = 0; + + DEBUG(3, ("parsing object '%s'\n", cur->object.identifier->dn)); + + for (i=0; i < cur->object.attribute_ctr.num_attributes; i++) { + + attr = &cur->object.attribute_ctr.attributes[i]; + + if (attr->value_ctr.num_values != 1) { + continue; + } + + if (!attr->value_ctr.values[0].blob) { + continue; + } + + blob = attr->value_ctr.values[0].blob; + + switch (attr->attid) { + case DRSUAPI_ATTID_sAMAccountName: + pull_string_talloc(mem_ctx, NULL, 0, &name, + blob->data, blob->length, + STR_UNICODE); + break; + case DRSUAPI_ATTID_sAMAccountType: + sam_type = IVAL(blob->data, 0); + break; + case DRSUAPI_ATTID_userAccountControl: + uacc = IVAL(blob->data, 0); + break; + default: + break; + } + } + + for (a=0; a < ARRAY_SIZE(dssync_object_table); a++) { + if (sam_type == dssync_object_table[a].type) { + if (dssync_object_table[a].fn) { + status = dssync_object_table[a].fn(mem_ctx, + methods, + cur); + break; + } + } + } + + return status; +} + +/**************************************************************** +****************************************************************/ + static NTSTATUS passdb_process_objects(struct dssync_context *ctx, TALLOC_CTX *mem_ctx, struct drsuapi_DsReplicaObjectListItemEx *cur, struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr) { - return NT_STATUS_NOT_SUPPORTED; + NTSTATUS status = NT_STATUS_OK; + struct pdb_methods *methods = + (struct pdb_methods *)ctx->private_data; + + for (; cur; cur = cur->next_object) { + status = parse_object(mem_ctx, methods, cur); + if (!NT_STATUS_IS_OK(status)) { + goto out; + } + } + + out: + return status; } /**************************************************************** |