summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-29 16:35:52 -0700
committerAndrew Tridgell <tridge@samba.org>2010-09-29 16:36:23 -0700
commit1f3f75f747cc6388013360bff06574f3299090d3 (patch)
tree9022b1679ffe06bf4c5e7958747a35006a9ca05a /source4/dsdb
parent768df75ed915bf588426316857885abddaaf5701 (diff)
downloadsamba-1f3f75f747cc6388013360bff06574f3299090d3.tar.gz
samba-1f3f75f747cc6388013360bff06574f3299090d3.tar.bz2
samba-1f3f75f747cc6388013360bff06574f3299090d3.zip
s4-samldb: also set a password on the krbtgt_NNNN account
when we setup the krbtgt_NNNN account using the DCPROMO_OID control, we also need to set an initial password for this account Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 269952a896..06f70a5311 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -361,6 +361,7 @@ static int samldb_rodc_add(struct samldb_ctx *ac)
struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
unsigned krbtgt_number, i_start, i;
int ret;
+ char *newpass;
/* find a unused msDC-SecondaryKrbTgtNumber */
i_start = generate_random() & 0xFFFF;
@@ -402,6 +403,16 @@ found:
return ldb_operr(ldb);
}
+ newpass = generate_random_password(ac, 128, 255);
+ if (newpass == NULL) {
+ return ldb_operr(ldb);
+ }
+
+ ret = ldb_msg_add_steal_string(ac->msg, "clearTextPassword", newpass);
+ if (ret != LDB_SUCCESS) {
+ return ldb_operr(ldb);
+ }
+
return samldb_next_step(ac);
}