diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-01-12 02:40:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:44 -0500 |
commit | c0571f623406ca33a4d5ce616c743479335eeba0 (patch) | |
tree | dc05f1e9787a52a96dfdedcc2727ad8d5bf9ab8d /source4/dsdb | |
parent | 9eaf1b45c0514dd9772059b460a99922c691de9a (diff) | |
download | samba-c0571f623406ca33a4d5ce616c743479335eeba0.tar.gz samba-c0571f623406ca33a4d5ce616c743479335eeba0.tar.bz2 samba-c0571f623406ca33a4d5ce616c743479335eeba0.zip |
r4698: - Initial implementation of trusted domains in LSA.
- Use templates for Secrets and the new trusted domains
- Auto-add modifiedTime, createdTime and objectGUID to records in the
samdb layer.
Andrew Bartlett
(This used to be commit 271c8faadfe2d9e0f3d523a1cdc831f5f9e35d19)
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 0f72f2a1d6..81ce05d9fe 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -23,12 +23,13 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_netlogon.h" #include "lib/ldb/include/ldb.h" +#include "system/time.h" /* connect to the SAM database return an opaque context pointer on success, or NULL on failure */ -void *samdb_connect(TALLOC_CTX *mem_ctx) +struct ldb_wrap *samdb_connect(TALLOC_CTX *mem_ctx) { return ldb_wrap_connect(mem_ctx, lp_sam_url(), 0, NULL); } @@ -604,7 +605,9 @@ int samdb_copy_template(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, strcasecmp((char *)el->values[j].data, "userTemplate") == 0 || strcasecmp((char *)el->values[j].data, "groupTemplate") == 0 || strcasecmp((char *)el->values[j].data, "foreignSecurityTemplate") == 0 || - strcasecmp((char *)el->values[j].data, "aliasTemplate") == 0)) { + strcasecmp((char *)el->values[j].data, "aliasTemplate") == 0 || + strcasecmp((char *)el->values[j].data, "trustedDomainTemplate") == 0 || + strcasecmp((char *)el->values[j].data, "secretTemplate") == 0)) { continue; } samdb_msg_add_string(sam_ctx, mem_ctx, msg, el->name, @@ -919,6 +922,19 @@ int samdb_msg_set_ldaptime(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, struct */ int samdb_add(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg) { + struct GUID guid; + const char *guidstr; + time_t now = time(NULL); + /* a new GUID */ + guid = GUID_random(); + guidstr = GUID_string(mem_ctx, &guid); + if (!guidstr) { + return -1; + } + + samdb_msg_add_string(sam_ctx, mem_ctx, msg, "objectGUID", guidstr); + samdb_msg_set_ldaptime(sam_ctx, mem_ctx, msg, "whenCreated", now); + samdb_msg_set_ldaptime(sam_ctx, mem_ctx, msg, "whenChanged", now); return ldb_add(sam_ctx->ldb, msg); } @@ -935,6 +951,8 @@ int samdb_delete(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, const char *dn) */ int samdb_modify(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg) { + time_t now = time(NULL); + samdb_msg_set_ldaptime(sam_ctx, mem_ctx, msg, "whenChanged", now); return ldb_modify(sam_ctx->ldb, msg); } |