summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-24 02:25:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:25 -0500
commitfc29c3250af5fbcd81725e38fb48ca1ec5ae23bf (patch)
treeabd3cd44a2ccd79507c526c62f9a22b92b508aed
parente2ce6fec9cfb9d3efbe0e97a8faf7f60a8ea3a1d (diff)
downloadsamba-fc29c3250af5fbcd81725e38fb48ca1ec5ae23bf.tar.gz
samba-fc29c3250af5fbcd81725e38fb48ca1ec5ae23bf.tar.bz2
samba-fc29c3250af5fbcd81725e38fb48ca1ec5ae23bf.zip
r13104: Migrate and set secrets keytab values in the 'net join' code. This
avoids falling back to in-memory keytabs. Andrew Bartlett (This used to be commit 59fbce01c6814b8e411e7de6ee66739161520a3c)
-rw-r--r--source4/libnet/libnet_join.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index f4e4091ce3..5d1ba294c6 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -844,6 +844,8 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
"secret",
"priorSecret",
"priorChanged",
+ "krb5Keytab",
+ "privateKeytab",
NULL
};
uint32_t acct_type = 0;
@@ -1036,6 +1038,12 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
"(|" SECRETS_PRIMARY_DOMAIN_FILTER "(realm=%s))",
r2->out.domain_name, r2->out.realm);
if (ret == 0) {
+ rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "secretsKeytab", "secrets.keytab");
+ if (rtn == -1) {
+ r->out.error_string = NULL;
+ talloc_free(tmp_mem);
+ return NT_STATUS_NO_MEMORY;
+ }
} else if (ret == -1) {
r->out.error_string
= talloc_asprintf(mem_ctx,
@@ -1044,6 +1052,8 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
talloc_free(tmp_mem);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else {
+ const struct ldb_val *private_keytab;
+ const struct ldb_val *krb5_keytab;
const struct ldb_val *prior_secret;
const struct ldb_val *prior_modified_time;
int i;
@@ -1093,6 +1103,26 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
talloc_free(tmp_mem);
return NT_STATUS_NO_MEMORY;
}
+
+ /* We will want to keep the keytab names */
+ private_keytab = ldb_msg_find_ldb_val(msgs[0], "privateKeytab");
+ if (private_keytab) {
+ rtn = samdb_msg_set_value(ldb, tmp_mem, msg, "privateKeytab", private_keytab);
+ if (rtn == -1) {
+ r->out.error_string = NULL;
+ talloc_free(tmp_mem);
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
+ krb5_keytab = ldb_msg_find_ldb_val(msgs[0], "krb5Keytab");
+ if (krb5_keytab) {
+ rtn = samdb_msg_set_value(ldb, tmp_mem, msg, "krb5Keytab", krb5_keytab);
+ if (rtn == -1) {
+ r->out.error_string = NULL;
+ talloc_free(tmp_mem);
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
}
/* create the secret */