summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-13 12:15:52 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-15 15:39:34 +1000
commit94fb6120d80d05de0f24ea71a93c761517fd4231 (patch)
treed135a1b5cb2e01930c8307c61c63e76ef47734fa /source4/param
parentbd51d30809180b64c5c6fc98c2bd79040b93051c (diff)
downloadsamba-94fb6120d80d05de0f24ea71a93c761517fd4231.tar.gz
samba-94fb6120d80d05de0f24ea71a93c761517fd4231.tar.bz2
samba-94fb6120d80d05de0f24ea71a93c761517fd4231.zip
s4-secrets: fetch secure channel type with domain SID
The secure channel type is needed to work out what DC to connect to Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/secrets.c16
-rw-r--r--source4/param/secrets.h2
2 files changed, 17 insertions, 1 deletions
diff --git a/source4/param/secrets.c b/source4/param/secrets.c
index befe7f3658..8fc595fbb0 100644
--- a/source4/param/secrets.c
+++ b/source4/param/secrets.c
@@ -101,15 +101,17 @@ struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
struct tevent_context *ev_ctx,
struct loadparm_context *lp_ctx,
const char *domain,
+ enum netr_SchannelType *sec_channel_type,
char **errstring)
{
struct ldb_context *ldb;
struct ldb_message *msg;
int ldb_ret;
- const char *attrs[] = { "objectSid", NULL };
+ const char *attrs[] = { "objectSid", "secureChannelType", NULL };
struct dom_sid *result = NULL;
const struct ldb_val *v;
enum ndr_err_code ndr_err;
+
*errstring = NULL;
ldb = secrets_db_connect(mem_ctx, ev_ctx, lp_ctx);
@@ -135,6 +137,18 @@ struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
domain, (char *) ldb_get_opaque(ldb, "ldb_url"));
return NULL;
}
+
+ if (sec_channel_type) {
+ int v;
+ v = ldb_msg_find_attr_as_int(msg, "secureChannelType", -1);
+ if (v == -1) {
+ *errstring = talloc_asprintf(mem_ctx, "Failed to find secureChannelType for %s in %s",
+ domain, (char *) ldb_get_opaque(ldb, "ldb_url"));
+ return NULL;
+ }
+ *sec_channel_type = v;
+ }
+
result = talloc(mem_ctx, struct dom_sid);
if (result == NULL) {
talloc_free(ldb);
diff --git a/source4/param/secrets.h b/source4/param/secrets.h
index c3227dfbcb..018bd36337 100644
--- a/source4/param/secrets.h
+++ b/source4/param/secrets.h
@@ -38,12 +38,14 @@
*/
struct loadparm_context;
struct tevent_context;
+enum netr_SchannelType;
struct tdb_wrap *secrets_init(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx, struct loadparm_context *lp_ctx);
struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
struct tevent_context *ev_ctx,
struct loadparm_context *lp_ctx,
const char *domain,
+ enum netr_SchannelType *sec_channel_type,
char **errstring);