The branch, master has been updated
via 92282a8... s3: Remove references to smbd_messaging_context() from
the spoolss server
via a5a0711... s3: Remove a reference to smbd_messaging_context()
via 19a9083... s3: Remove some references to smbd_messaging_context()
via 77c6314... s3: Remove procid_self() from connections_fetch_entry()
via 2122917... s3: Add msg_ctx to pipes_struct
via c9b654f... s3: Remove smbd_messaging_context() from
send_stat_cache_delete_message()
from 4b47245... s4:ntlmssp Merge more aspects of the source3/ NTLMSSP
layer
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 92282a815d2d7351b21fd734a345e1500db89068
Author: Volker Lendecke <[email protected]>
Date: Sat Aug 7 12:35:54 2010 +0200
s3: Remove references to smbd_messaging_context() from the spoolss server
commit a5a0711f0c5e8b3e42301d5b050197a413e86fa7
Author: Volker Lendecke <[email protected]>
Date: Sat Aug 7 12:27:22 2010 +0200
s3: Remove a reference to smbd_messaging_context()
commit 19a908350eef1ae7725e3412da087be8e7cf05b0
Author: Volker Lendecke <[email protected]>
Date: Sat Aug 7 11:58:48 2010 +0200
s3: Remove some references to smbd_messaging_context()
commit 77c63149a3c91798445a56b31624036473e7f570
Author: Volker Lendecke <[email protected]>
Date: Thu Jul 8 18:00:07 2010 +0200
s3: Remove procid_self() from connections_fetch_entry()
commit 21229178bd4703a70f222e102bd2588449ac023b
Author: Volker Lendecke <[email protected]>
Date: Tue Jul 6 22:52:19 2010 +0200
s3: Add msg_ctx to pipes_struct
commit c9b654f5810f46b20e082895499c0bf2a3077173
Author: Volker Lendecke <[email protected]>
Date: Tue Jul 6 22:43:14 2010 +0200
s3: Remove smbd_messaging_context() from send_stat_cache_delete_message()
-----------------------------------------------------------------------
Summary of changes:
source3/include/nt_printing.h | 4 --
source3/include/ntdomain.h | 1 +
source3/include/proto.h | 3 +-
source3/lib/conn_tdb.c | 3 +-
source3/lib/dummysmbd.c | 3 +-
source3/locking/locking.c | 3 +-
source3/rpc_server/rpc_ncacn_np_internal.c | 2 +
source3/rpc_server/srv_netlog_nt.c | 11 +++---
source3/rpc_server/srv_spoolss_nt.c | 47 +++++++++++++++-------------
source3/rpc_server/srv_srvsvc_nt.c | 35 ++++++++++++--------
source3/rpc_server/srv_wkssvc_nt.c | 4 +-
source3/smbd/close.c | 3 +-
source3/smbd/statcache.c | 5 ++-
13 files changed, 69 insertions(+), 55 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index 199236b..a185aab 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -236,10 +236,6 @@ WERROR spoolss_map_to_os2_driver(TALLOC_CTX *mem_ctx,
const char **pdrivername);
const char *get_short_archi(const char *long_archi);
-bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
- struct spoolss_SetPrinterInfo2 *info2,
- const char *remote_machine);
-
bool print_access_check(struct auth_serversupplied_info *server_info, int snum,
int access_type);
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
index f42ff58..071e915 100644
--- a/source3/include/ntdomain.h
+++ b/source3/include/ntdomain.h
@@ -134,6 +134,7 @@ struct pipes_struct {
char client_address[INET6_ADDRSTRLEN];
struct auth_serversupplied_info *server_info;
+ struct messaging_context *msg_ctx;
struct ndr_syntax_id syntax;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 7e56f7d..060776f 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5838,7 +5838,8 @@ bool stat_cache_lookup(connection_struct *conn,
char **pp_dirpath,
char **pp_start,
SMB_STRUCT_STAT *pst);
-void send_stat_cache_delete_message(const char *name);
+void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
+ const char *name);
void stat_cache_delete(const char *name);
unsigned int fast_string_hash(TDB_DATA *key);
bool reset_stat_cache( void );
diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c
index 7f9c746..b95b4cd 100644
--- a/source3/lib/conn_tdb.c
+++ b/source3/lib/conn_tdb.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "smbd/globals.h"
static struct db_context *connections_db_ctx(bool rw)
{
@@ -55,7 +56,7 @@ struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
TDB_DATA key;
ZERO_STRUCT(ckey);
- ckey.pid = procid_self();
+ ckey.pid = sconn_server_id(conn->sconn);
ckey.cnum = conn->cnum;
strlcpy(ckey.name, name, sizeof(ckey.name));
diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c
index 01a5563..c79e080 100644
--- a/source3/lib/dummysmbd.c
+++ b/source3/lib/dummysmbd.c
@@ -44,7 +44,8 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp,
{
}
-void send_stat_cache_delete_message(const char *name)
+void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
+ const char *name)
{
}
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index a9b13d6..24998ab 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -1457,7 +1457,8 @@ bool set_delete_on_close(files_struct *fsp, bool
delete_on_close, const UNIX_USE
if (fsp->is_directory) {
SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
- send_stat_cache_delete_message(fsp->fsp_name->base_name);
+ send_stat_cache_delete_message(fsp->conn->sconn->msg_ctx,
+ fsp->fsp_name->base_name);
}
TALLOC_FREE(lck);
diff --git a/source3/rpc_server/rpc_ncacn_np_internal.c
b/source3/rpc_server/rpc_ncacn_np_internal.c
index 9bb5428..b2b337a 100644
--- a/source3/rpc_server/rpc_ncacn_np_internal.c
+++ b/source3/rpc_server/rpc_ncacn_np_internal.c
@@ -152,6 +152,8 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX
*mem_ctx,
return NULL;
}
+ p->msg_ctx = smbd_messaging_context();
+
DLIST_ADD(InternalPipes, p);
strlcpy(p->client_address, client_address, sizeof(p->client_address));
diff --git a/source3/rpc_server/srv_netlog_nt.c
b/source3/rpc_server/srv_netlog_nt.c
index 56b5027..300d2d4 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -76,11 +76,10 @@ WERROR _netr_LogonControl(struct pipes_struct *p,
Send a message to smbd to do a sam synchronisation
**************************************************************************/
-static void send_sync_message(void)
+static void send_sync_message(struct messaging_context *msg_ctx)
{
DEBUG(3, ("sending sam synchronisation message\n"));
- message_send_all(smbd_messaging_context(), MSG_SMB_SAM_SYNC, NULL, 0,
- NULL);
+ message_send_all(msg_ctx, MSG_SMB_SAM_SYNC, NULL, 0, NULL);
}
/*************************************************************************
@@ -379,7 +378,7 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p,
}
if (lp_server_role() == ROLE_DOMAIN_BDC) {
- send_sync_message();
+ send_sync_message(p->msg_ctx);
}
return WERR_OK;
@@ -1694,7 +1693,7 @@ WERROR _netr_GetDcName(struct pipes_struct *p,
flags = DS_PDC_REQUIRED | DS_IS_FLAT_NAME | DS_RETURN_FLAT_NAME;
status = dsgetdcname(p->mem_ctx,
- smbd_messaging_context(),
+ p->msg_ctx,
r->in.domainname,
NULL,
NULL,
@@ -1739,7 +1738,7 @@ WERROR _netr_GetAnyDCName(struct pipes_struct *p,
flags = DS_IS_FLAT_NAME | DS_RETURN_FLAT_NAME;
status = dsgetdcname(p->mem_ctx,
- smbd_messaging_context(),
+ p->msg_ctx,
r->in.domainname,
NULL,
NULL,
diff --git a/source3/rpc_server/srv_spoolss_nt.c
b/source3/rpc_server/srv_spoolss_nt.c
index d33801e..89b9e7a 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -279,7 +279,9 @@ static bool close_printer_handle(struct pipes_struct *p,
struct policy_handle *h
Delete a printer given a handle.
****************************************************************************/
-static WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const
char *sharename)
+static WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
+ const char *sharename,
+ struct messaging_context *msg_ctx)
{
char *cmd = lp_deleteprinter_cmd();
char *command = NULL;
@@ -310,8 +312,7 @@ static WERROR delete_printer_hook(TALLOC_CTX *ctx,
NT_USER_TOKEN *token, const c
if ( (ret = smbrun(command, NULL)) == 0 ) {
/* Tell everyone we updated smb.conf. */
- message_send_all(smbd_messaging_context(),
- MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
+ message_send_all(msg_ctx, MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
}
if ( is_print_op )
@@ -375,7 +376,7 @@ static WERROR delete_printer_handle(struct pipes_struct *p,
struct policy_handle
}
return delete_printer_hook(p->mem_ctx, p->server_info->ptok,
- Printer->sharename );
+ Printer->sharename, p->msg_ctx);
}
/****************************************************************************
@@ -1266,7 +1267,8 @@ static void receive_notify2_message_list(struct
messaging_context *msg,
driver
********************************************************************/
-static bool srv_spoolss_drv_upgrade_printer(const char *drivername)
+static bool srv_spoolss_drv_upgrade_printer(const char *drivername,
+ struct messaging_context *msg_ctx)
{
int len = strlen(drivername);
@@ -1276,8 +1278,7 @@ static bool srv_spoolss_drv_upgrade_printer(const char
*drivername)
DEBUG(10,("srv_spoolss_drv_upgrade_printer: Sending message about
driver upgrade [%s]\n",
drivername));
- messaging_send_buf(smbd_messaging_context(),
- messaging_server_id(smbd_messaging_context()),
+ messaging_send_buf(msg_ctx, messaging_server_id(msg_ctx),
MSG_PRINTER_DRVUPGRADE,
(uint8_t *)drivername, len+1);
@@ -2273,7 +2274,8 @@ static bool spoolss_connect_to_client(struct
rpc_pipe_client **pp_pipe,
static bool srv_spoolss_replyopenprinter(int snum, const char *printer,
uint32_t localprinter, uint32_t type,
struct policy_handle *handle,
- struct sockaddr_storage *client_ss)
+ struct sockaddr_storage *client_ss,
+ struct messaging_context *msg_ctx)
{
WERROR result;
NTSTATUS status;
@@ -2290,14 +2292,12 @@ static bool srv_spoolss_replyopenprinter(int snum,
const char *printer,
if ( !spoolss_connect_to_client( ¬ify_cli_pipe, client_ss,
unix_printer ))
return false;
- messaging_register(smbd_messaging_context(), NULL,
- MSG_PRINTER_NOTIFY2,
+ messaging_register(msg_ctx, NULL, MSG_PRINTER_NOTIFY2,
receive_notify2_message_list);
/* Tell the connections db we're now interested in printer
* notify messages. */
- serverid_register_msg_flags(
- messaging_server_id(smbd_messaging_context()),
- true, FLAG_MSG_PRINT_NOTIFY);
+ serverid_register_msg_flags(messaging_server_id(msg_ctx),
+ true, FLAG_MSG_PRINT_NOTIFY);
}
/*
@@ -2431,7 +2431,8 @@ WERROR
_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct pipes_struct *p,
if(!srv_spoolss_replyopenprinter(snum, Printer->notify.localmachine,
Printer->notify.printerlocal, 1,
- &Printer->notify.client_hnd,
&client_ss))
+ &Printer->notify.client_hnd,
+ &client_ss, p->msg_ctx))
return WERR_SERVER_UNAVAILABLE;
Printer->notify.client_connected = true;
@@ -5547,9 +5548,10 @@ static WERROR add_port_hook(TALLOC_CTX *ctx,
NT_USER_TOKEN *token, const char *p
/****************************************************************************
****************************************************************************/
-bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
- struct spoolss_SetPrinterInfo2 *info2,
- const char *remote_machine)
+static bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token,
+ struct spoolss_SetPrinterInfo2 *info2,
+ const char *remote_machine,
+ struct messaging_context *msg_ctx)
{
char *cmd = lp_addprinter_cmd();
char **qlines;
@@ -5585,8 +5587,7 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN
*token,
if ( (ret = smbrun(command, &fd)) == 0 ) {
/* Tell everyone we updated smb.conf. */
- message_send_all(smbd_messaging_context(),
- MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
+ message_send_all(msg_ctx, MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
}
if ( is_print_op )
@@ -5966,7 +5967,8 @@ static WERROR update_printer(struct pipes_struct *p,
{
/* add_printer_hook() will call reload_services() */
if (!add_printer_hook(tmp_ctx, p->server_info->ptok,
- printer, p->client_address) ) {
+ printer, p->client_address,
+ p->msg_ctx)) {
result = WERR_ACCESS_DENIED;
goto done;
}
@@ -7256,7 +7258,8 @@ static WERROR spoolss_addprinterex_level_2(struct
pipes_struct *p,
if (*lp_addprinter_cmd() ) {
if ( !add_printer_hook(p->mem_ctx, p->server_info->ptok,
- info2, p->client_address) ) {
+ info2, p->client_address,
+ p->msg_ctx) ) {
return WERR_ACCESS_DENIED;
}
} else {
@@ -7431,7 +7434,7 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
* to update each printer bound to this driver. --jerry
*/
- if (!srv_spoolss_drv_upgrade_printer(driver_name)) {
+ if (!srv_spoolss_drv_upgrade_printer(driver_name, p->msg_ctx)) {
DEBUG(0,("%s: Failed to send message about upgrading driver
[%s]!\n",
fn, driver_name));
}
diff --git a/source3/rpc_server/srv_srvsvc_nt.c
b/source3/rpc_server/srv_srvsvc_nt.c
index 35c030a..af15e7e 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -1327,7 +1327,7 @@ WERROR _srvsvc_NetSessDel(struct pipes_struct *p,
become_root();
}
- ntstat = messaging_send(smbd_messaging_context(),
+ ntstat = messaging_send(p->msg_ctx,
session_list[snum].pid,
MSG_SHUTDOWN, &data_blob_null);
@@ -1705,9 +1705,8 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
if ( (ret = smbrun(command, NULL)) == 0 ) {
/* Tell everyone we updated smb.conf. */
- message_send_all(smbd_messaging_context(),
- MSG_SMB_CONF_UPDATED, NULL, 0,
- NULL);
+ message_send_all(p->msg_ctx, MSG_SMB_CONF_UPDATED,
+ NULL, 0, NULL);
}
if ( is_disk_op )
@@ -1893,8 +1892,8 @@ WERROR _srvsvc_NetShareAdd(struct pipes_struct *p,
if ( (ret = smbrun(command, NULL)) == 0 ) {
/* Tell everyone we updated smb.conf. */
- message_send_all(smbd_messaging_context(),
- MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
+ message_send_all(p->msg_ctx, MSG_SMB_CONF_UPDATED, NULL, 0,
+ NULL);
}
if ( is_disk_op )
@@ -1997,8 +1996,8 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p,
if ( (ret = smbrun(command, NULL)) == 0 ) {
/* Tell everyone we updated smb.conf. */
- message_send_all(smbd_messaging_context(),
- MSG_SMB_CONF_UPDATED, NULL, 0, NULL);
+ message_send_all(p->msg_ctx, MSG_SMB_CONF_UPDATED, NULL, 0,
+ NULL);
}
if ( is_disk_op )
@@ -2473,16 +2472,21 @@ WERROR _srvsvc_NetNameValidate(struct pipes_struct *p,
/*******************************************************************
********************************************************************/
+struct enum_file_close_state {
+ struct srvsvc_NetFileClose *r;
+ struct messaging_context *msg_ctx;
+};
+
static void enum_file_close_fn( const struct share_mode_entry *e,
const char *sharepath, const char *fname,
void *private_data )
{
char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
- struct srvsvc_NetFileClose *r =
- (struct srvsvc_NetFileClose *)private_data;
+ struct enum_file_close_state *state =
+ (struct enum_file_close_state *)private_data;
uint32_t fid = (((uint32_t)(procid_to_pid(&e->pid))<<16) |
e->share_file_id);
- if (fid != r->in.fid) {
+ if (fid != state->r->in.fid) {
return; /* Not this file. */
}
@@ -2497,8 +2501,8 @@ static void enum_file_close_fn( const struct
share_mode_entry *e,
share_mode_entry_to_message(msg, e);
- r->out.result = ntstatus_to_werror(
- messaging_send_buf(smbd_messaging_context(),
+ state->r->out.result = ntstatus_to_werror(
+ messaging_send_buf(state->msg_ctx,
e->pid, MSG_SMB_CLOSE_FILE,
(uint8 *)msg,
MSG_SMB_SHARE_MODE_ENTRY_SIZE));
@@ -2511,6 +2515,7 @@ static void enum_file_close_fn( const struct
share_mode_entry *e,
WERROR _srvsvc_NetFileClose(struct pipes_struct *p,
struct srvsvc_NetFileClose *r)
{
+ struct enum_file_close_state state;
SE_PRIV se_diskop = SE_DISK_OPERATOR;
bool is_disk_op;
@@ -2526,7 +2531,9 @@ WERROR _srvsvc_NetFileClose(struct pipes_struct *p,
* the relevent smbd process. */
r->out.result = WERR_BADFILE;
- share_mode_forall( enum_file_close_fn, (void *)r);
+ state.r = r;
+ state.msg_ctx = p->msg_ctx;
+ share_mode_forall(enum_file_close_fn, &state);
return r->out.result;
}
diff --git a/source3/rpc_server/srv_wkssvc_nt.c
b/source3/rpc_server/srv_wkssvc_nt.c
index 200a02b..a90ac69 100644
--- a/source3/rpc_server/srv_wkssvc_nt.c
+++ b/source3/rpc_server/srv_wkssvc_nt.c
@@ -859,7 +859,7 @@ WERROR _wkssvc_NetrJoinDomain2(struct pipes_struct *p,
j->in.admin_password = cleartext_pwd;
j->in.debug = true;
j->in.modify_config = lp_config_backend_is_registry();
- j->in.msg_ctx = smbd_messaging_context();
+ j->in.msg_ctx = p->msg_ctx;
become_root();
werr = libnet_Join(p->mem_ctx, j);
@@ -925,7 +925,7 @@ WERROR _wkssvc_NetrUnjoinDomain2(struct pipes_struct *p,
u->in.admin_password = cleartext_pwd;
u->in.debug = true;
u->in.modify_config = lp_config_backend_is_registry();
- u->in.msg_ctx = smbd_messaging_context();
+ u->in.msg_ctx = p->msg_ctx;
become_root();
werr = libnet_Unjoin(p->mem_ctx, u);
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index fb0e206..fad9601 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -961,7 +961,8 @@ static NTSTATUS close_directory(struct smb_request *req,
files_struct *fsp,
become_user(fsp->conn, fsp->vuid);
became_user = True;
}
- send_stat_cache_delete_message(fsp->fsp_name->base_name);
+ send_stat_cache_delete_message(fsp->conn->sconn->msg_ctx,
+ fsp->fsp_name->base_name);
set_delete_on_close_lck(lck, True, get_current_utok(fsp->conn));
fsp->delete_on_close = true;
if (became_user) {
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index 88cb97e..cea27d4 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -336,10 +336,11 @@ bool stat_cache_lookup(connection_struct *conn,
Tell all smbd's to delete an entry.
**************************************************************************/
-void send_stat_cache_delete_message(const char *name)
+void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
+ const char *name)
{
#ifdef DEVELOPER
- message_send_all(smbd_messaging_context(),
+ message_send_all(msg_ctx,
MSG_SMB_STAT_CACHE_DELETE,
name,
strlen(name)+1,
--
Samba Shared Repository