1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3: Rename server_messaging_context() to global_messaging_context()

This reflects that the messaging context is also used outside of the
server processes.

The command used for the rename:
find . -name '*.[hc]' -print0 | xargs -0 sed -i 's/server_messaging_context/global_messaging_context/'

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Christof Schmitt 2018-08-21 11:09:16 -07:00 committed by Andreas Schneider
parent ae7db3e543
commit cc76aaeb62
25 changed files with 76 additions and 76 deletions

View File

@ -59,7 +59,7 @@ static struct server_id *new_server_id_task(TALLOC_CTX *mem_ctx)
}
}
msg_ctx = server_messaging_context();
msg_ctx = global_messaging_context();
if (msg_ctx == NULL) {
return NULL;
}

View File

@ -890,8 +890,8 @@ char* get_string_param( const char* param );
/* The following definitions come from lib/server_contexts.c */
struct tevent_context *global_event_context(void);
void global_event_context_free(void);
struct messaging_context *server_messaging_context(void);
void server_messaging_context_free(void);
struct messaging_context *global_messaging_context(void);
void global_messaging_context_free(void);
/* The following definitions come from lib/sessionid_tdb.c */
struct sessionid;

View File

@ -46,7 +46,7 @@ struct messaging_context *cmdline_messaging_context(const char *config_file)
exit(1);
}
msg_ctx = server_messaging_context();
msg_ctx = global_messaging_context();
if (msg_ctx == NULL) {
if (geteuid() == 0) {
fprintf(stderr,
@ -66,5 +66,5 @@ struct messaging_context *cmdline_messaging_context(const char *config_file)
void cmdline_messaging_context_free(void)
{
server_messaging_context_free();
global_messaging_context_free();
}

View File

@ -146,7 +146,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
errno = EIO;
return NULL;
}
msg_ctx = server_messaging_context();
msg_ctx = global_messaging_context();
result = db_open_ctdb(mem_ctx, msg_ctx, base,
hash_size,

View File

@ -46,7 +46,7 @@ void global_event_context_free(void)
static struct messaging_context *server_msg_ctx = NULL;
struct messaging_context *server_messaging_context(void)
struct messaging_context *global_messaging_context(void)
{
if (server_msg_ctx == NULL) {
/*
@ -60,7 +60,7 @@ struct messaging_context *server_messaging_context(void)
return server_msg_ctx;
}
void server_messaging_context_free(void)
void global_messaging_context_free(void)
{
TALLOC_FREE(server_msg_ctx);
}

View File

@ -86,7 +86,7 @@ static bool locking_init_internal(bool read_only)
return False;
}
lock_db = db_open_watched(NULL, &backend, server_messaging_context());
lock_db = db_open_watched(NULL, &backend, global_messaging_context());
if (lock_db == NULL) {
DBG_ERR("db_open_watched failed\n");
TALLOC_FREE(backend);

View File

@ -648,7 +648,7 @@ NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct)
* just return */
return status;
}
messaging_send_all(server_messaging_context(),
messaging_send_all(global_messaging_context(),
ID_CACHE_DELETE,
msg_data,
strlen(msg_data) + 1);

View File

@ -1050,7 +1050,7 @@ static uint32_t get_correct_cversion(const struct auth_session_info *session_inf
driver_directory);
}
nt_status = create_conn_struct_tos_cwd(server_messaging_context(),
nt_status = create_conn_struct_tos_cwd(global_messaging_context(),
printdollar_snum,
working_dir,
session_info,
@ -1525,7 +1525,7 @@ WERROR move_driver_to_download_area(const struct auth_session_info *session_info
return WERR_BAD_NET_NAME;
}
nt_status = create_conn_struct_tos_cwd(server_messaging_context(),
nt_status = create_conn_struct_tos_cwd(global_messaging_context(),
printdollar_snum,
lp_path(frame, printdollar_snum),
session_info,
@ -2067,7 +2067,7 @@ bool delete_driver_files(const struct auth_session_info *session_info,
return false;
}
nt_status = create_conn_struct_tos_cwd(server_messaging_context(),
nt_status = create_conn_struct_tos_cwd(global_messaging_context(),
printdollar_snum,
lp_path(frame, printdollar_snum),
session_info,

View File

@ -258,7 +258,7 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
{
NTSTATUS status;
struct rpc_srv_callbacks spoolss_cb;
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx, true, "spoolssd-child");

View File

@ -243,7 +243,7 @@ static bool lsasd_child_init(struct tevent_context *ev_ctx,
struct pf_worker_data *pf)
{
NTSTATUS status;
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx,

View File

@ -200,7 +200,7 @@ static bool mdssd_child_init(struct tevent_context *ev_ctx,
struct pf_worker_data *pf)
{
NTSTATUS status;
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx,

View File

@ -2345,7 +2345,7 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
goto error_exit;
}
nt_status = create_conn_struct_tos_cwd(server_messaging_context(),
nt_status = create_conn_struct_tos_cwd(global_messaging_context(),
snum,
lp_path(frame, snum),
p->session_info,
@ -2478,7 +2478,7 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
goto error_exit;
}
nt_status = create_conn_struct_tos_cwd(server_messaging_context(),
nt_status = create_conn_struct_tos_cwd(global_messaging_context(),
snum,
lp_path(frame, snum),
p->session_info,

View File

@ -1210,7 +1210,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
status = create_conn_struct_tos_cwd(server_messaging_context(),
status = create_conn_struct_tos_cwd(global_messaging_context(),
snum,
lp_path(frame, snum),
NULL,
@ -1424,7 +1424,7 @@ static bool junction_to_local_path_tos(const struct junction_map *jucn,
if(snum < 0) {
return False;
}
status = create_conn_struct_tos_cwd(server_messaging_context(),
status = create_conn_struct_tos_cwd(global_messaging_context(),
snum,
lp_path(talloc_tos(), snum),
NULL,
@ -1594,7 +1594,7 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum)
* Fake up a connection struct for the VFS layer.
*/
status = create_conn_struct_tos_cwd(server_messaging_context(),
status = create_conn_struct_tos_cwd(global_messaging_context(),
snum,
connect_path,
NULL,
@ -1691,7 +1691,7 @@ static int form_junctions(TALLOC_CTX *ctx,
* Fake up a connection struct for the VFS layer.
*/
status = create_conn_struct_tos_cwd(server_messaging_context(),
status = create_conn_struct_tos_cwd(global_messaging_context(),
snum,
connect_path,
NULL,

View File

@ -4614,7 +4614,7 @@ NTSTATUS get_nt_acl_no_snum(TALLOC_CTX *ctx, const char *fname,
return NT_STATUS_NO_MEMORY;
}
status = create_conn_struct_tos(server_messaging_context(),
status = create_conn_struct_tos(global_messaging_context(),
-1,
"/",
NULL,

View File

@ -1785,7 +1785,7 @@ extern void build_options(bool screen);
* Init the messaging context
* FIXME: This should only call messaging_init()
*/
msg_ctx = server_messaging_context();
msg_ctx = global_messaging_context();
if (msg_ctx == NULL) {
exit(1);
}

View File

@ -92,7 +92,7 @@ static void exit_server_common(enum server_exit_reason how,
struct smbXsrv_connection *xconn = NULL;
struct smbXsrv_connection *xconn_next = NULL;
struct smbd_server_connection *sconn = NULL;
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
if (client != NULL) {
sconn = client->sconn;
@ -217,7 +217,7 @@ static void exit_server_common(enum server_exit_reason how,
netlogon_creds_cli_close_global_db();
TALLOC_FREE(global_smbXsrv_client);
smbprofile_dump();
server_messaging_context_free();
global_messaging_context_free();
global_event_context_free();
TALLOC_FREE(smbd_memcache_ctx);

View File

@ -89,7 +89,7 @@ NTSTATUS smbXsrv_session_global_init(struct messaging_context *msg_ctx)
return status;
}
db_ctx = db_open_watched(NULL, &backend, server_messaging_context());
db_ctx = db_open_watched(NULL, &backend, global_messaging_context());
if (db_ctx == NULL) {
TALLOC_FREE(backend);
return NT_STATUS_NO_MEMORY;

View File

@ -34,7 +34,7 @@ bool run_local_dbwrap_ctdb(int dummy)
uint32_t val;
struct messaging_context *msg_ctx;
msg_ctx = server_messaging_context();
msg_ctx = global_messaging_context();
db = db_open_ctdb(talloc_tos(), msg_ctx, "torture.tdb",
0, TDB_DEFAULT,

View File

@ -83,9 +83,9 @@ bool run_dbwrap_do_locked1(int dummy)
fprintf(stderr, "global_event_context() failed\n");
return false;
}
msg = server_messaging_context();
msg = global_messaging_context();
if (msg == NULL) {
fprintf(stderr, "server_messaging_context() failed\n");
fprintf(stderr, "global_messaging_context() failed\n");
return false;
}

View File

@ -36,7 +36,7 @@ static bool get_g_lock_ctx(TALLOC_CTX *mem_ctx,
fprintf(stderr, "tevent_context_init failed\n");
return false;
}
*msg = server_messaging_context();
*msg = global_messaging_context();
if (*msg == NULL) {
fprintf(stderr, "messaging_init failed\n");
TALLOC_FREE(*ev);

View File

@ -536,7 +536,7 @@ int main(int argc, const char *argv[])
return 1;
}
status = create_conn_struct_tos(server_messaging_context(),
status = create_conn_struct_tos(global_messaging_context(),
-1,
getcwd(cwd, sizeof(cwd)),
session_info,

View File

@ -72,9 +72,9 @@ struct imessaging_context *winbind_imessaging_context(void)
return msg;
}
msg_ctx = server_messaging_context();
msg_ctx = global_messaging_context();
if (msg_ctx == NULL) {
smb_panic("server_messaging_context failed\n");
smb_panic("global_messaging_context failed\n");
}
myself = messaging_server_id(msg_ctx);
@ -1417,9 +1417,9 @@ static void winbindd_register_handlers(struct messaging_context *msg_ctx,
MSG_WINBIND_ONLINESTATUS, winbind_msg_onlinestatus);
/* Handle domain online/offline messages for domains */
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_DOMAIN_OFFLINE, winbind_msg_domain_offline);
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_DOMAIN_ONLINE, winbind_msg_domain_online);
messaging_register(msg_ctx, NULL,
@ -1745,7 +1745,7 @@ int main(int argc, const char **argv)
/* Initialise messaging system */
if (server_messaging_context() == NULL) {
if (global_messaging_context() == NULL) {
exit(1);
}
@ -1839,7 +1839,7 @@ int main(int argc, const char **argv)
* winbindd-specific resources we must free yet. JRA.
*/
status = reinit_after_fork(server_messaging_context(),
status = reinit_after_fork(global_messaging_context(),
global_event_context(),
false, NULL);
if (!NT_STATUS_IS_OK(status)) {
@ -1857,9 +1857,9 @@ int main(int argc, const char **argv)
exit_daemon(nt_errstr(status), map_errno_from_nt_status(status));
}
winbindd_register_handlers(server_messaging_context(), !Fork);
winbindd_register_handlers(global_messaging_context(), !Fork);
if (!messaging_parent_dgm_cleanup_init(server_messaging_context())) {
if (!messaging_parent_dgm_cleanup_init(global_messaging_context())) {
exit(1);
}
@ -1872,7 +1872,7 @@ int main(int argc, const char **argv)
rpc_samr_init(NULL);
winbindd_init_addrchange(NULL, global_event_context(),
server_messaging_context());
global_messaging_context());
/* setup listen sockets */

View File

@ -225,10 +225,10 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
if (domain->dc_probe_pid != (pid_t)0) {
/* Parent */
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_TRY_TO_GO_ONLINE,
msg_try_to_go_online);
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_FAILED_TO_GO_ONLINE,
msg_failed_to_go_online);
return True;
@ -249,7 +249,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("winbindd_reinit_after_fork failed: %s\n",
nt_errstr(status)));
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(parent_pid),
MSG_WINBIND_FAILED_TO_GO_ONLINE,
(const uint8_t *)domain->name,
@ -263,7 +263,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
mem_ctx = talloc_init("fork_child_dc_connect");
if (!mem_ctx) {
DEBUG(0,("talloc_init failed.\n"));
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(parent_pid),
MSG_WINBIND_FAILED_TO_GO_ONLINE,
(const uint8_t *)domain->name,
@ -275,7 +275,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
TALLOC_FREE(mem_ctx);
if (!ok || (num_dcs == 0)) {
/* Still offline ? Can't find DC's. */
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(parent_pid),
MSG_WINBIND_FAILED_TO_GO_ONLINE,
(const uint8_t *)domain->name,
@ -286,7 +286,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
/* We got a DC. Send a message to our parent to get it to
try and do the same. */
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(parent_pid),
MSG_WINBIND_TRY_TO_GO_ONLINE,
(const uint8_t *)domain->name,
@ -450,7 +450,7 @@ void set_domain_offline(struct winbindd_domain *domain)
/* Send a message to the parent that the domain is offline. */
if (parent_pid > 1 && !domain->internal) {
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(parent_pid),
MSG_WINBIND_DOMAIN_OFFLINE,
(uint8_t *)domain->name,
@ -464,7 +464,7 @@ void set_domain_offline(struct winbindd_domain *domain)
struct winbindd_child *idmap = idmap_child();
if ( idmap->pid != 0 ) {
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(idmap->pid),
MSG_WINBIND_OFFLINE,
(const uint8_t *)domain->name,
@ -527,16 +527,16 @@ static void set_domain_online(struct winbindd_domain *domain)
TALLOC_FREE(domain->check_online_event);
/* Ensure we ignore any pending child messages. */
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_TRY_TO_GO_ONLINE, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_FAILED_TO_GO_ONLINE, NULL);
domain->online = True;
/* Send a message to the parent that the domain is online. */
if (parent_pid > 1 && !domain->internal) {
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(parent_pid),
MSG_WINBIND_DOMAIN_ONLINE,
(uint8_t *)domain->name,
@ -550,7 +550,7 @@ static void set_domain_online(struct winbindd_domain *domain)
struct winbindd_child *idmap = idmap_child();
if ( idmap->pid != 0 ) {
messaging_send_buf(server_messaging_context(),
messaging_send_buf(global_messaging_context(),
pid_to_procid(idmap->pid),
MSG_WINBIND_ONLINE,
(const uint8_t *)domain->name,
@ -1475,7 +1475,7 @@ static bool dcip_check_name(TALLOC_CTX *mem_ctx,
"%s$",
lp_netbios_name());
status = nbt_getdc(server_messaging_context(), 10, pss,
status = nbt_getdc(global_messaging_context(), 10, pss,
domain->name, &domain->sid,
my_acct_name, ACB_WSTRUST,
nt_version, mem_ctx, &nt_version,
@ -1849,7 +1849,7 @@ NTSTATUS wb_open_internal_pipe(TALLOC_CTX *mem_ctx,
session_info,
NULL,
NULL,
server_messaging_context(),
global_messaging_context(),
&cli);
} else {
status = rpc_pipe_open_internal(mem_ctx,
@ -1857,7 +1857,7 @@ NTSTATUS wb_open_internal_pipe(TALLOC_CTX *mem_ctx,
session_info,
NULL,
NULL,
server_messaging_context(),
global_messaging_context(),
&cli);
}
if (!NT_STATUS_IS_OK(status)) {
@ -3293,7 +3293,7 @@ static NTSTATUS cm_connect_netlogon_transport(struct winbindd_domain *domain,
enum dcerpc_transport_t transport,
struct rpc_pipe_client **cli)
{
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
struct winbindd_cm_conn *conn;
NTSTATUS result;
enum netr_SchannelType sec_chan_type;

View File

@ -1271,7 +1271,7 @@ static void machine_password_change_handler(struct tevent_context *ctx,
struct timeval now,
void *private_data)
{
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
struct winbindd_child *child =
(struct winbindd_child *)private_data;
struct rpc_pipe_client *netlogon_pipe = NULL;
@ -1497,7 +1497,7 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
NTSTATUS status;
status = reinit_after_fork(
server_messaging_context(),
global_messaging_context(),
global_event_context(),
true, NULL);
if (!NT_STATUS_IS_OK(status)) {
@ -1523,24 +1523,24 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
CatchChild();
/* Don't handle the same messages as our parent. */
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_SMB_CONF_UPDATED, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_SHUTDOWN, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_OFFLINE, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_ONLINE, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_ONLINESTATUS, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_DUMP_DOMAIN_LIST, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_DEBUG, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_DOMAIN_OFFLINE, NULL);
messaging_deregister(server_messaging_context(),
messaging_deregister(global_messaging_context(),
MSG_WINBIND_DOMAIN_ONLINE, NULL);
/* We have destroyed all events in the winbindd_event_context
@ -1718,16 +1718,16 @@ static bool fork_domain_child(struct winbindd_child *child)
}
/* Handle online/offline messages. */
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_OFFLINE, child_msg_offline);
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_ONLINE, child_msg_online);
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_DEBUG, debug_message);
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_IP_DROPPED,
winbind_msg_ip_dropped);
messaging_register(server_messaging_context(), NULL,
messaging_register(global_messaging_context(), NULL,
MSG_WINBIND_DISCONNECT_DC,
winbind_msg_disconnect_dc);

View File

@ -552,7 +552,7 @@ NTSTATUS _wbint_DsGetDcName(struct pipes_struct *p, struct wbint_DsGetDcName *r)
bool try_dsrgetdcname = false;
if (domain == NULL) {
return dsgetdcname(p->mem_ctx, server_messaging_context(),
return dsgetdcname(p->mem_ctx, global_messaging_context(),
r->in.domain_name, r->in.domain_guid,
r->in.site_name ? r->in.site_name : "",
r->in.flags,
@ -746,7 +746,7 @@ again:
NTSTATUS _wbint_ChangeMachineAccount(struct pipes_struct *p,
struct wbint_ChangeMachineAccount *r)
{
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
struct winbindd_domain *domain;
NTSTATUS status;
struct rpc_pipe_client *netlogon_pipe = NULL;
@ -1501,7 +1501,7 @@ static WERROR _winbind_LogonControl_CHANGE_PASSWORD(struct pipes_struct *p,
struct winbindd_domain *domain,
struct winbind_LogonControl *r)
{
struct messaging_context *msg_ctx = server_messaging_context();
struct messaging_context *msg_ctx = global_messaging_context();
NTSTATUS status;
struct rpc_pipe_client *netlogon_pipe = NULL;
struct netlogon_creds_cli_context *netlogon_creds_ctx = NULL;