From ed69aa2a25133a42b0449766cf714051514661af Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Sun, 27 Oct 2013 21:53:15 +0100 Subject: s4:rootdse/netlogon: Pass client ip address This patch may be squashed into "s4:dsdb/rootdse: Support netlogon request". --- source4/cldap_server/cldap_server.c | 2 ++ source4/dsdb/samdb/ldb_modules/rootdse.c | 11 ++++++++++- source4/ldap_server/ldap_backend.c | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index a6248d4493..fbfb947f5e 100644 --- a/source4/cldap_server/cldap_server.c +++ b/source4/cldap_server/cldap_server.c @@ -225,6 +225,8 @@ static void cldapd_task_init(struct task_server *task) return; } + /* FIXME: set ldb opaque remoteAddress here */ + /* start listening on the configured network interfaces */ status = cldapd_startup_interfaces(cldapd, task->lp_ctx, ifaces); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index 99e8844ba1..ebe09ded4a 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -34,6 +34,7 @@ #include "param/param.h" #include "lib/messaging/irpc.h" #include "librpc/gen_ndr/ndr_irpc_c.h" +#include "lib/tsocket/tsocket.h" #include "cldap_server/cldap_server.h" struct private_data { @@ -746,8 +747,10 @@ static int rootdse_handle_netlogon(struct rootdse_context *ac) struct ldb_context *ldb; struct ldb_parse_tree *tree; struct loadparm_context *lp_ctx; + struct tsocket_address *src_addr; TALLOC_CTX *tmp_ctx = talloc_new(ac->req); const char *domain, *host, *user, *domain_guid; + char *src_addr_s = NULL; struct dom_sid *domain_sid; int acct_control = -1; int version = -1; @@ -759,6 +762,12 @@ static int rootdse_handle_netlogon(struct rootdse_context *ac) tree = ac->req->op.search.tree; lp_ctx = talloc_get_type(ldb_get_opaque(ldb, "loadparm"), struct loadparm_context); + src_addr = talloc_get_type(ldb_get_opaque(ldb, "remoteAddress"), + struct tsocket_address); + if (src_addr) { + src_addr_s = tsocket_address_inet_addr_string(src_addr, + tmp_ctx); + } status = parse_netlogon_request(tree, lp_ctx, tmp_ctx, &domain, &host, &user, &domain_guid, @@ -771,7 +780,7 @@ static int rootdse_handle_netlogon(struct rootdse_context *ac) domain, NULL, domain_sid, domain_guid, user, acct_control, - NULL, /* FIXME: How to retrieve client ip addr here? */ + src_addr_s, version, lp_ctx, &netlogon, false); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 2760cdb470..3432594209 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -226,6 +226,9 @@ NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) ldb_set_opaque(conn->ldb, "supportedSASLMechanisms", sasl_mechs); } + ldb_set_opaque(conn->ldb, "remoteAddress", + conn->connection->remote_address); + return NT_STATUS_OK; } -- cgit