summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2018-04-12 06:41:30 +1200
committerAndrew Bartlett <abartlet@samba.org>2018-05-10 20:02:23 +0200
commit5c0345ea9bb34695dcd7be6c913748323bebe937 (patch)
tree91609b666973bd053448269313e9507672f74597
parentdaa7b60a60520c94367e9112246482bae71c5ccd (diff)
downloadsamba-5c0345ea9bb34695dcd7be6c913748323bebe937.tar.gz
samdb: Add remote address to connect
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/modules/vfs_dfs_samba4.c4
-rw-r--r--source3/passdb/pdb_samba_dsdb.c7
-rw-r--r--source4/auth/ntlm/auth.c7
-rw-r--r--source4/cldap_server/cldap_server.c7
-rw-r--r--source4/dns_server/dlz_bind9.c11
-rw-r--r--source4/dns_server/dns_server.c8
-rw-r--r--source4/dsdb/dns/dns_update.c8
-rw-r--r--source4/dsdb/kcc/kcc_service.c7
-rw-r--r--source4/dsdb/repl/drepl_service.c7
-rw-r--r--source4/dsdb/samdb/samdb.c16
-rw-r--r--source4/kdc/db-glue.c8
-rw-r--r--source4/kdc/kdc-heimdal.c8
-rw-r--r--source4/kdc/kdc-service-mit.c1
-rw-r--r--source4/kdc/kpasswd-helper.c1
-rw-r--r--source4/kdc/kpasswd_glue.c8
-rw-r--r--source4/ldap_server/ldap_server.c8
-rw-r--r--source4/libnet/libnet_samsync_ldb.c5
-rw-r--r--source4/nbt_server/nbt_server.c7
-rw-r--r--source4/ntp_signd/ntp_signd.c7
-rw-r--r--source4/rpc_server/backupkey/dcesrv_backupkey.c7
-rw-r--r--source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c7
-rw-r--r--source4/rpc_server/common/server_info.c8
-rw-r--r--source4/rpc_server/dnsserver/dcerpc_dnsserver.c8
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c20
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c22
-rw-r--r--source4/rpc_server/lsa/lsa_init.c7
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c124
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c16
-rw-r--r--source4/rpc_server/samr/samr_password.c28
-rw-r--r--source4/smb_server/smb/trans2.c7
-rw-r--r--source4/smbd/server.c9
-rw-r--r--source4/torture/dns/dlz_bind9.c17
-rw-r--r--source4/torture/gpo/apply.c8
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c7
-rw-r--r--source4/winbind/idmap.c7
35 files changed, 332 insertions, 105 deletions
diff --git a/source3/modules/vfs_dfs_samba4.c b/source3/modules/vfs_dfs_samba4.c
index d7f4edf2dea..1c7b50e99c6 100644
--- a/source3/modules/vfs_dfs_samba4.c
+++ b/source3/modules/vfs_dfs_samba4.c
@@ -76,7 +76,9 @@ static int dfs_samba4_connect(struct vfs_handle_struct *handle,
data->sam_ctx = samdb_connect(data,
data->ev,
data->lp_ctx,
- system_session(data->lp_ctx), 0);
+ system_session(data->lp_ctx),
+ NULL,
+ 0);
if (!data->sam_ctx) {
DEBUG(0, ("samdb_connect failed\n"));
SMB_VFS_NEXT_DISCONNECT(handle);
diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c
index f48f1fd1069..957524ddabc 100644
--- a/source3/passdb/pdb_samba_dsdb.c
+++ b/source3/passdb/pdb_samba_dsdb.c
@@ -3892,8 +3892,11 @@ static NTSTATUS pdb_init_samba_dsdb(struct pdb_methods **pdb_method,
state->ev,
state->lp_ctx,
system_session(state->lp_ctx),
- 0, location,
- NULL, &state->ldb, &errstring);
+ 0,
+ location,
+ NULL,
+ &state->ldb,
+ &errstring);
if (!state->ldb) {
DEBUG(0, ("samdb_connect failed: %s: %s\n",
diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c
index 7e10a554d8c..1293b287e18 100644
--- a/source4/auth/ntlm/auth.c
+++ b/source4/auth/ntlm/auth.c
@@ -713,7 +713,12 @@ _PUBLIC_ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char *
if (sam_ctx) {
ctx->sam_ctx = sam_ctx;
} else {
- ctx->sam_ctx = samdb_connect(ctx, ctx->event_ctx, ctx->lp_ctx, system_session(ctx->lp_ctx), 0);
+ ctx->sam_ctx = samdb_connect(ctx,
+ ctx->event_ctx,
+ ctx->lp_ctx,
+ system_session(ctx->lp_ctx),
+ NULL,
+ 0);
}
for (i=0; methods && methods[i] ; i++) {
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index a0cde776550..d93ac0b35b3 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -221,7 +221,12 @@ static void cldapd_task_init(struct task_server *task)
}
cldapd->task = task;
- cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, system_session(task->lp_ctx), 0);
+ cldapd->samctx = samdb_connect(cldapd,
+ task->event_ctx,
+ task->lp_ctx,
+ system_session(task->lp_ctx),
+ NULL,
+ 0);
if (cldapd->samctx == NULL) {
task_server_terminate(task, "cldapd failed to open samdb", true);
return;
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
index 17afd1fa850..9cb85f62933 100644
--- a/source4/dns_server/dlz_bind9.c
+++ b/source4/dns_server/dlz_bind9.c
@@ -703,10 +703,15 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname,
}
}
- ret = samdb_connect_url(state, state->ev_ctx, state->lp,
- system_session(state->lp), 0,
+ ret = samdb_connect_url(state,
+ state->ev_ctx,
+ state->lp,
+ system_session(state->lp),
+ 0,
state->options.url,
- NULL, &state->samdb, &errstring);
+ NULL,
+ &state->samdb,
+ &errstring);
if (ret != LDB_SUCCESS) {
state->log(ISC_LOG_ERROR,
"samba_dlz: Failed to connect to %s: %s",
diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c
index 5c6aca56207..9db11330e50 100644
--- a/source4/dns_server/dns_server.c
+++ b/source4/dns_server/dns_server.c
@@ -838,8 +838,12 @@ static void dns_task_init(struct task_server *task)
return;
}
- dns->samdb = samdb_connect(dns, dns->task->event_ctx, dns->task->lp_ctx,
- system_session(dns->task->lp_ctx), 0);
+ dns->samdb = samdb_connect(dns,
+ dns->task->event_ctx,
+ dns->task->lp_ctx,
+ system_session(dns->task->lp_ctx),
+ NULL,
+ 0);
if (!dns->samdb) {
task_server_terminate(task, "dns: samdb_connect failed", true);
return;
diff --git a/source4/dsdb/dns/dns_update.c b/source4/dsdb/dns/dns_update.c
index 10be7ce86fc..0655673be1b 100644
--- a/source4/dsdb/dns/dns_update.c
+++ b/source4/dsdb/dns/dns_update.c
@@ -660,8 +660,12 @@ static void dnsupdate_task_init(struct task_server *task)
return;
}
- service->samdb = samdb_connect(service, service->task->event_ctx, task->lp_ctx,
- service->system_session_info, 0);
+ service->samdb = samdb_connect(service,
+ service->task->event_ctx,
+ task->lp_ctx,
+ service->system_session_info,
+ NULL,
+ 0);
if (!service->samdb) {
task_server_terminate(task, "dnsupdate: Failed to connect to local samdb\n",
true);
diff --git a/source4/dsdb/kcc/kcc_service.c b/source4/dsdb/kcc/kcc_service.c
index a5508aff1a5..76423780dc8 100644
--- a/source4/dsdb/kcc/kcc_service.c
+++ b/source4/dsdb/kcc/kcc_service.c
@@ -56,7 +56,12 @@ static WERROR kccsrv_connect_samdb(struct kccsrv_service *service, struct loadpa
{
const struct GUID *ntds_guid;
- service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info, 0);
+ service->samdb = samdb_connect(service,
+ service->task->event_ctx,
+ lp_ctx,
+ service->system_session_info,
+ NULL,
+ 0);
if (!service->samdb) {
return WERR_DS_UNAVAILABLE;
}
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index 8f16a2efb75..10772d47439 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -68,7 +68,12 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo
const struct GUID *ntds_guid;
struct drsuapi_DsBindInfo28 *bind_info28;
- service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info, 0);
+ service->samdb = samdb_connect(service,
+ service->task->event_ctx,
+ lp_ctx,
+ service->system_session_info,
+ NULL,
+ 0);
if (!service->samdb) {
return WERR_DS_UNAVAILABLE;
}
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 7a1bb79b636..10db0c50395 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -54,7 +54,7 @@ int samdb_connect_url(TALLOC_CTX *mem_ctx,
struct auth_session_info *session_info,
unsigned int flags,
const char *url,
- struct tsocket_address *remote_address,
+ const struct tsocket_address *remote_address,
struct ldb_context **ldb_ret,
char **errstring)
{
@@ -107,7 +107,7 @@ int samdb_connect_url(TALLOC_CTX *mem_ctx,
*/
if (remote_address != NULL) {
ldb_set_opaque(ldb, "remoteAddress",
- remote_address);
+ discard_const(remote_address));
*ldb_ret = ldb;
return LDB_SUCCESS;
}
@@ -134,12 +134,20 @@ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
struct tevent_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
+ const struct tsocket_address *remote_address,
unsigned int flags)
{
char *errstring;
struct ldb_context *ldb;
- int ret = samdb_connect_url(mem_ctx, ev_ctx, lp_ctx, session_info, flags,
- "sam.ldb", NULL, &ldb, &errstring);
+ int ret = samdb_connect_url(mem_ctx,
+ ev_ctx,
+ lp_ctx,
+ session_info,
+ flags,
+ "sam.ldb",
+ remote_address,
+ &ldb,
+ &errstring);
if (ret == LDB_SUCCESS) {
return ldb;
}
diff --git a/source4/kdc/db-glue.c b/source4/kdc/db-glue.c
index c2dd236fdb0..bb428e45cbc 100644
--- a/source4/kdc/db-glue.c
+++ b/source4/kdc/db-glue.c
@@ -2774,8 +2774,12 @@ NTSTATUS samba_kdc_setup_db_ctx(TALLOC_CTX *mem_ctx, struct samba_kdc_base_conte
}
/* Setup the link to LDB */
- kdc_db_ctx->samdb = samdb_connect(kdc_db_ctx, base_ctx->ev_ctx,
- base_ctx->lp_ctx, session_info, 0);
+ kdc_db_ctx->samdb = samdb_connect(kdc_db_ctx,
+ base_ctx->ev_ctx,
+ base_ctx->lp_ctx,
+ session_info,
+ NULL,
+ 0);
if (kdc_db_ctx->samdb == NULL) {
DEBUG(1, ("samba_kdc_setup_db_ctx: Cannot open samdb for KDC backend!"));
talloc_free(kdc_db_ctx);
diff --git a/source4/kdc/kdc-heimdal.c b/source4/kdc/kdc-heimdal.c
index fcc1eb02edf..83ace269d5d 100644
--- a/source4/kdc/kdc-heimdal.c
+++ b/source4/kdc/kdc-heimdal.c
@@ -305,8 +305,12 @@ static void kdc_task_init(struct task_server *task)
/* get a samdb connection */
- kdc->samdb = samdb_connect(kdc, kdc->task->event_ctx, kdc->task->lp_ctx,
- system_session(kdc->task->lp_ctx), 0);
+ kdc->samdb = samdb_connect(kdc,
+ kdc->task->event_ctx,
+ kdc->task->lp_ctx,
+ system_session(kdc->task->lp_ctx),
+ NULL,
+ 0);
if (!kdc->samdb) {
DEBUG(1,("kdc_task_init: unable to connect to samdb\n"));
task_server_terminate(task, "kdc: krb5_init_context samdb connect failed", true);
diff --git a/source4/kdc/kdc-service-mit.c b/source4/kdc/kdc-service-mit.c
index e5b20ffb523..1d28fc4e6eb 100644
--- a/source4/kdc/kdc-service-mit.c
+++ b/source4/kdc/kdc-service-mit.c
@@ -303,6 +303,7 @@ void mitkdc_task_init(struct task_server *task)
kdc->task->event_ctx,
kdc->task->lp_ctx,
system_session(kdc->task->lp_ctx),
+ NULL,
0);
if (kdc->samdb == NULL) {
task_server_terminate(task,
diff --git a/source4/kdc/kpasswd-helper.c b/source4/kdc/kpasswd-helper.c
index 6de28375cba..995f54825b5 100644
--- a/source4/kdc/kpasswd-helper.c
+++ b/source4/kdc/kpasswd-helper.c
@@ -180,6 +180,7 @@ NTSTATUS kpasswd_samdb_set_password(TALLOC_CTX *mem_ctx,
event_ctx,
lp_ctx,
session_info,
+ NULL,
0);
if (samdb == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
diff --git a/source4/kdc/kpasswd_glue.c b/source4/kdc/kpasswd_glue.c
index b12a2093314..0addfdf58ea 100644
--- a/source4/kdc/kpasswd_glue.c
+++ b/source4/kdc/kpasswd_glue.c
@@ -79,8 +79,12 @@ NTSTATUS samdb_kpasswd_change_password(TALLOC_CTX *mem_ctx,
}
/* Start a SAM with user privileges for the password change */
- samdb = samdb_connect(mem_ctx, event_ctx, lp_ctx,
- session_info, 0);
+ samdb = samdb_connect(mem_ctx,
+ event_ctx,
+ lp_ctx,
+ session_info,
+ NULL,
+ 0);
if (!samdb) {
*error_string = "Failed to open samdb";
return NT_STATUS_ACCESS_DENIED;
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 91e5d05b7fe..80b8c193be4 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -1055,8 +1055,12 @@ static NTSTATUS add_socket(struct task_server *task,
}
/* Load LDAP database, but only to read our settings */
- ldb = samdb_connect(ldap_service, ldap_service->task->event_ctx,
- lp_ctx, system_session(lp_ctx), 0);
+ ldb = samdb_connect(ldap_service,
+ ldap_service->task->event_ctx,
+ lp_ctx,
+ system_session(lp_ctx),
+ NULL,
+ 0);
if (!ldb) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c
index 5fdef7909f8..9ea7dce041c 100644
--- a/source4/libnet/libnet_samsync_ldb.c
+++ b/source4/libnet/libnet_samsync_ldb.c
@@ -1245,11 +1245,12 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str
state->secrets = NULL;
state->trusted_domains = NULL;
- state->sam_ldb = samdb_connect(mem_ctx,
+ state->sam_ldb = samdb_connect(mem_ctx,
ctx->event_ctx,
ctx->lp_ctx,
r->in.session_info,
- 0);
+ NULL,
+ 0);
if (!state->sam_ldb) {
return NT_STATUS_INTERNAL_DB_ERROR;
}
diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c
index 834c72f5f7c..6bdf9b45374 100644
--- a/source4/nbt_server/nbt_server.c
+++ b/source4/nbt_server/nbt_server.c
@@ -73,7 +73,12 @@ static void nbtd_task_init(struct task_server *task)
return;
}
- nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->event_ctx, task->lp_ctx, system_session(task->lp_ctx), 0);
+ nbtsrv->sam_ctx = samdb_connect(nbtsrv,
+ task->event_ctx,
+ task->lp_ctx,
+ system_session(task->lp_ctx),
+ NULL,
+ 0);
if (nbtsrv->sam_ctx == NULL) {
task_server_terminate(task, "nbtd failed to open samdb", true);
return;
diff --git a/source4/ntp_signd/ntp_signd.c b/source4/ntp_signd/ntp_signd.c
index e09c69346e0..508adcf7b36 100644
--- a/source4/ntp_signd/ntp_signd.c
+++ b/source4/ntp_signd/ntp_signd.c
@@ -515,7 +515,12 @@ static void ntp_signd_task_init(struct task_server *task)
ntp_signd->task = task;
/* Must be system to get at the password hashes */
- ntp_signd->samdb = samdb_connect(ntp_signd, task->event_ctx, task->lp_ctx, system_session(task->lp_ctx), 0);
+ ntp_signd->samdb = samdb_connect(ntp_signd,
+ task->event_ctx,
+ task->lp_ctx,
+ system_session(task->lp_ctx),
+ NULL,
+ 0);
if (ntp_signd->samdb == NULL) {
task_server_terminate(task, "ntp_signd failed to open samdb", true);
return;
diff --git a/source4/rpc_server/backupkey/dcesrv_backupkey.c b/source4/rpc_server/backupkey/dcesrv_backupkey.c
index cf9af1fbc31..d2c3f2a8545 100644
--- a/source4/rpc_server/backupkey/dcesrv_backupkey.c
+++ b/source4/rpc_server/backupkey/dcesrv_backupkey.c
@@ -1774,9 +1774,12 @@ static WERROR dcesrv_bkrp_BackupKey(struct dcesrv_call_state *dce_call,
return WERR_NOT_SUPPORTED;
}
- ldb_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ ldb_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (samdb_rodc(ldb_ctx, &is_rodc) != LDB_SUCCESS) {
talloc_unlink(mem_ctx, ldb_ctx);
diff --git a/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c b/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c
index 5985d52c99b..d2fc4802b08 100644
--- a/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c
+++ b/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c
@@ -1814,9 +1814,12 @@ static WERROR dcesrv_bkrp_BackupKey(struct dcesrv_call_state *dce_call,
return WERR_NOT_SUPPORTED;
}
- ldb_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ ldb_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (samdb_rodc(ldb_ctx, &is_rodc) != LDB_SUCCESS) {
talloc_unlink(mem_ctx, ldb_ctx);
diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c
index 39c75cc49a4..0aabcdaebe7 100644
--- a/source4/rpc_server/common/server_info.c
+++ b/source4/rpc_server/common/server_info.c
@@ -83,7 +83,13 @@ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct tevent_contex
break;
}
/* open main ldb */
- samctx = samdb_connect(tmp_ctx, event_ctx, dce_ctx->lp_ctx, anonymous_session(tmp_ctx, dce_ctx->lp_ctx), 0);
+ samctx = samdb_connect(
+ tmp_ctx,
+ event_ctx,
+ dce_ctx->lp_ctx,
+ anonymous_session(tmp_ctx, dce_ctx->lp_ctx),
+ NULL,
+ 0);
if (samctx == NULL) {
DEBUG(2,("Unable to open samdb in determining server announce flags\n"));
} else {
diff --git a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
index 5d3cb9e2a8e..b9ed3dd5887 100644
--- a/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
+++ b/source4/rpc_server/dnsserver/dcerpc_dnsserver.c
@@ -119,8 +119,12 @@ static struct dnsserver_state *dnsserver_connect(struct dcesrv_call_state *dce_c
dsstate->lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
/* FIXME: create correct auth_session_info for connecting user */
- dsstate->samdb = samdb_connect(dsstate, dce_call->event_ctx, dsstate->lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ dsstate->samdb = samdb_connect(dsstate,
+ dce_call->event_ctx,
+ dsstate->lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (dsstate->samdb == NULL) {
DEBUG(0,("dnsserver: Failed to open samdb"));
goto failed;
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index 026098dcb9f..250b4c74c76 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
@@ -96,8 +96,13 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
/*
* connect to the samdb
*/
- b_state->sam_ctx = samdb_connect(b_state, dce_call->event_ctx,
- dce_call->conn->dce_ctx->lp_ctx, auth_info, 0);
+ b_state->sam_ctx = samdb_connect(
+ b_state,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ auth_info,
+ dce_call->conn->remote_address,
+ 0);
if (!b_state->sam_ctx) {
return WERR_FOOBAR;
}
@@ -110,9 +115,14 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
werr = drs_security_level_check(dce_call, NULL, SECURITY_RO_DOMAIN_CONTROLLER,
samdb_domain_sid(b_state->sam_ctx));
if (W_ERROR_IS_OK(werr)) {
- b_state->sam_ctx_system = samdb_connect(b_state, dce_call->event_ctx,
- dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ b_state->sam_ctx_system
+ = samdb_connect(
+ b_state,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (!b_state->sam_ctx_system) {
return WERR_FOOBAR;
}
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index 9371beec297..8c540ab297e 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -3180,6 +3180,7 @@ static NTSTATUS dcesrv_lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALL
struct lsa_secret_state *secret_state;
struct dcesrv_handle *handle;
struct ldb_message **msgs, *msg;
+ struct ldb_context *samdb = NULL;
const char *attrs[] = {
NULL
};
@@ -3233,8 +3234,14 @@ static NTSTATUS dcesrv_lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALL
/* We need to connect to the database as system, as this is one
* of the rare RPC calls that must read the secrets (and this
* is denied otherwise) */
- secret_state->sam_ldb = talloc_reference(secret_state,
- samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(dce_call->conn->dce_ctx->lp_ctx), 0));
+ samdb = samdb_connect(
+ mem_ctx,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
+ secret_state->sam_ldb = talloc_reference(secret_state, samdb);
NT_STATUS_HAVE_NO_MEMORY(secret_state->sam_ldb);
/* search for the secret record */
@@ -3337,6 +3344,7 @@ static NTSTATUS dcesrv_lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC
struct lsa_secret_state *secret_state;
struct dcesrv_handle *handle;
struct ldb_message **msgs;
+ struct ldb_context *samdb = NULL;
const char *attrs[] = {
NULL
};
@@ -3372,8 +3380,14 @@ static NTSTATUS dcesrv_lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC
if (strncmp("G$", r->in.name.string, 2) == 0) {
name = &r->in.name.string[2];
/* We need to connect to the database as system, as this is one of the rare RPC calls that must read the secrets (and this is denied otherwise) */
- secret_state->sam_ldb = talloc_reference(secret_state,
- samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(dce_call->conn->dce_ctx->lp_ctx), 0));
+ samdb = samdb_connect(
+ mem_ctx,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
+ secret_state->sam_ldb = talloc_reference(secret_state, samdb);
secret_state->global = true;
if (strlen(name) < 1) {
diff --git a/source4/rpc_server/lsa/lsa_init.c b/source4/rpc_server/lsa/lsa_init.c
index 5628c5b45b8..560229494a5 100644
--- a/source4/rpc_server/lsa/lsa_init.c
+++ b/source4/rpc_server/lsa/lsa_init.c
@@ -70,7 +70,12 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call,
}
/* make sure the sam database is accessible */
- state->sam_ldb = samdb_connect(state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info, 0);
+ state->sam_ldb = samdb_connect(state,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (state->sam_ldb == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 638dfc2b13a..c19d33c8892 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -291,8 +291,12 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3_helper(
return NT_STATUS_INVALID_PARAMETER;
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -699,7 +703,12 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call
&creds);
NT_STATUS_NOT_OK_RETURN(nt_status);
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -759,7 +768,12 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
&creds);
NT_STATUS_NOT_OK_RETURN(nt_status);
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -1583,9 +1597,12 @@ static WERROR dcesrv_netr_GetDcName(struct dcesrv_call_state *dce_call, TALLOC_C
*/
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_DS_UNAVAILABLE;
}
@@ -1785,8 +1802,13 @@ static WERROR dcesrv_netr_LogonControl_base_call(struct dcesrv_netr_LogonControl
if (!ok) {
struct ldb_context *sam_ctx;
- sam_ctx = samdb_connect(state, state->dce_call->event_ctx,
- lp_ctx, system_session(lp_ctx), 0);
+ sam_ctx = samdb_connect(
+ state,
+ state->dce_call->event_ctx,
+ lp_ctx,
+ system_session(lp_ctx),
+ state->dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_DS_UNAVAILABLE;
}
@@ -1996,8 +2018,12 @@ static WERROR dcesrv_netr_GetAnyDCName(struct dcesrv_call_state *dce_call, TALLO
r->in.domainname = lpcfg_workgroup(lp_ctx);
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_DS_UNAVAILABLE;
}
@@ -2142,8 +2168,12 @@ static WERROR dcesrv_netr_DsRGetSiteName(struct dcesrv_call_state *dce_call, TAL
struct ldb_context *sam_ctx;
struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_DS_UNAVAILABLE;
}
@@ -2265,9 +2295,12 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
}
NT_STATUS_NOT_OK_RETURN(status);
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -2662,9 +2695,12 @@ static NTSTATUS dcesrv_netr_NetrLogonSendToSam(struct dcesrv_call_state *dce_cal
return NT_STATUS_INVALID_PARAMETER;
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -2788,8 +2824,12 @@ static WERROR dcesrv_netr_DsRGetDCName_base_call(struct dcesrv_netr_DsRGetDCName
ZERO_STRUCTP(r->out.info);
- sam_ctx = samdb_connect(state, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(state,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_DS_UNAVAILABLE;
}
@@ -3259,8 +3299,12 @@ static WERROR dcesrv_netr_DsRAddressToSitenamesExW(struct dcesrv_call_state *dce
const char *res;
uint32_t i;
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_DS_UNAVAILABLE;
}
@@ -3376,8 +3420,12 @@ static WERROR dcesrv_netr_DsrGetDcSiteCoverageW(struct dcesrv_call_state *dce_ca
struct DcSitesCtr *ctr;
struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_DS_UNAVAILABLE;
}
@@ -3544,8 +3592,12 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce
trusts->count = 0;
r->out.trusts = trusts;
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_GEN_FAILURE;
}
@@ -3677,8 +3729,12 @@ static WERROR dcesrv_netr_DsRGetForestTrustInformation(struct dcesrv_call_state
return WERR_INVALID_FLAGS;
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return WERR_GEN_FAILURE;
}
@@ -3829,8 +3885,12 @@ static NTSTATUS dcesrv_netr_GetForestTrustInformation(struct dcesrv_call_state *
return NT_STATUS_NOT_IMPLEMENTED;
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INTERNAL_ERROR;
}
@@ -3924,8 +3984,12 @@ static NTSTATUS dcesrv_netr_ServerGetTrustInfo(struct dcesrv_call_state *dce_cal
return NT_STATUS_INVALID_PARAMETER;
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
- lp_ctx, system_session(lp_ctx), 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ lp_ctx,
+ system_session(lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index c7d692a1b56..bf086f772d3 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -166,7 +166,12 @@ static NTSTATUS dcesrv_samr_Connect(struct dcesrv_call_state *dce_call, TALLOC_C
}
/* make sure the sam database is accessible */
- c_state->sam_ctx = samdb_connect(c_state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info, 0);
+ c_state->sam_ctx = samdb_connect(c_state,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (c_state->sam_ctx == NULL) {
talloc_free(c_state);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -4180,9 +4185,12 @@ static NTSTATUS dcesrv_samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TAL
ZERO_STRUCTP(r->out.info);
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
- dce_call->conn->dce_ctx->lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index 22f456f090b..d7b5e16e34d 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -135,9 +135,12 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
/* Connect to a SAMDB with system privileges for fetching the old pw
* hashes. */
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -212,9 +215,12 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
}
/* Connect to a SAMDB with user privileges for the password change */
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -327,9 +333,12 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
/* Connect to a SAMDB with system privileges for fetching the old pw
* hashes. */
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- system_session(dce_call->conn->dce_ctx->lp_ctx), 0);
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -408,9 +417,12 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
}
/* Connect to a SAMDB with user privileges for the password change */
- sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx,
+ sam_ctx = samdb_connect(mem_ctx,
+ dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx,
- dce_call->conn->auth_state.session_info, 0);
+ dce_call->conn->auth_state.session_info,
+ dce_call->conn->remote_address,
+ 0);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/smb_server/smb/trans2.c b/source4/smb_server/smb/trans2.c
index 89402bac820..447095c5008 100644
--- a/source4/smb_server/smb/trans2.c
+++ b/source4/smb_server/smb/trans2.c
@@ -876,7 +876,12 @@ static NTSTATUS trans2_getdfsreferral(struct smbsrv_request *req,
r = talloc_zero(req, struct dfs_GetDFSReferral);
NT_STATUS_HAVE_NO_MEMORY(r);
- ldb = samdb_connect(r, req->tcon->ntvfs->event_ctx, lp_ctx, system_session(lp_ctx), 0);
+ ldb = samdb_connect(r,
+ req->tcon->ntvfs->event_ctx,
+ lp_ctx,
+ system_session(lp_ctx),
+ NULL,
+ 0);
if (ldb == NULL) {
DEBUG(2,(__location__ ": Failed to open samdb\n"));
talloc_free(r);
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index beac4fff0ca..ed81c01afc1 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -238,10 +238,11 @@ static void prime_ldb_databases(struct tevent_context *event_ctx)
db_context = talloc_new(event_ctx);
samdb_connect(db_context,
- event_ctx,
- cmdline_lp_ctx,
- system_session(cmdline_lp_ctx),
- 0);
+ event_ctx,
+ cmdline_lp_ctx,
+ system_session(cmdline_lp_ctx),
+ NULL,
+ 0);
privilege_connect(db_context, cmdline_lp_ctx);
/* we deliberately leave these open, which allows them to be
diff --git a/source4/torture/dns/dlz_bind9.c b/source4/torture/dns/dlz_bind9.c
index d94848728fc..ef7220b6ef5 100644
--- a/source4/torture/dns/dlz_bind9.c
+++ b/source4/torture/dns/dlz_bind9.c
@@ -88,13 +88,16 @@ static isc_result_t dlz_bind9_writeable_zone_hook(dns_view_t *view,
struct torture_context *tctx = talloc_get_type((void *)view, struct torture_context);
struct ldb_context *samdb = NULL;
char *errstring = NULL;
- int ret = samdb_connect_url(tctx, NULL, tctx->lp_ctx,
- system_session(tctx->lp_ctx),
- 0,
- test_dlz_bind9_binddns_dir(tctx, "dns/sam.ldb"),
- NULL,
- &samdb,
- &errstring);
+ int ret = samdb_connect_url(
+ tctx,
+ NULL,
+ tctx->lp_ctx,
+ system_session(tctx->lp_ctx),
+ 0,
+ test_dlz_bind9_binddns_dir(tctx, "dns/sam.ldb"),
+ NULL,
+ &samdb,
+ &errstring);
struct ldb_message *msg;
const char *attrs[] = {
NULL
diff --git a/source4/torture/gpo/apply.c b/source4/torture/gpo/apply.c
index 88da0b1e5fc..248ddbbc139 100644
--- a/source4/torture/gpo/apply.c
+++ b/source4/torture/gpo/apply.c
@@ -119,8 +119,12 @@ bool torture_gpo_system_access_policies(struct torture_context *tctx)
"Failed to fetch the gpo update command");
/* Open and read the samba db and store the initial password settings */
- samdb = samdb_connect(ctx, tctx->ev, tctx->lp_ctx,
- system_session(tctx->lp_ctx), 0);
+ samdb = samdb_connect(ctx,
+ tctx->ev,
+ tctx->lp_ctx,
+ system_session(tctx->lp_ctx),
+ NULL,
+ 0);
torture_assert(tctx, samdb, "Failed to connect to the samdb");
ret = ldb_search(samdb, ctx, &result, ldb_get_default_basedn(samdb),
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index ffba17c855c..c3d66d575a4 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -148,7 +148,12 @@ bool torture_net_become_dc(struct torture_context *torture)
private_dir = talloc_asprintf(s, "%s/%s", location, "private");
lpcfg_set_cmdline(lp_ctx, "private dir", private_dir);
torture_comment(torture, "Reopen the SAM LDB with system credentials and all replicated data: %s\n", private_dir);
- ldb = samdb_connect(s, torture->ev, lp_ctx, system_session(lp_ctx), 0);
+ ldb = samdb_connect(s,
+ torture->ev,
+ lp_ctx,
+ system_session(lp_ctx),
+ NULL,
+ 0);
torture_assert_goto(torture, ldb != NULL, ret, cleanup,
talloc_asprintf(torture,
"Failed to open '%s/sam.ldb'\n", private_dir));
diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c
index edeb72419bb..86fd354b606 100644
--- a/source4/winbind/idmap.c
+++ b/source4/winbind/idmap.c
@@ -175,7 +175,12 @@ struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx,
goto fail;
}
- idmap_ctx->samdb = samdb_connect(idmap_ctx, ev_ctx, lp_ctx, system_session(lp_ctx), 0);
+ idmap_ctx->samdb = samdb_connect(idmap_ctx,
+ ev_ctx,
+ lp_ctx,
+ system_session(lp_ctx),
+ NULL,
+ 0);
if (idmap_ctx->samdb == NULL) {
DEBUG(0, ("Failed to load sam.ldb in idmap_init\n"));
goto fail;