summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h7
-rw-r--r--source3/lib/dummysmbd.c3
-rw-r--r--source3/param/loadparm.c11
-rw-r--r--source3/rpc_server/dfs/srv_dfs_nt.c4
-rw-r--r--source3/rpc_server/spoolss/srv_spoolss_nt.c1
-rw-r--r--source3/rpc_server/srvsvc/srv_srvsvc_nt.c3
-rw-r--r--source3/smbd/conn.c5
-rw-r--r--source3/smbd/lanman.c2
-rw-r--r--source3/smbd/msdfs.c5
-rw-r--r--source3/smbd/proto.h5
-rw-r--r--source3/smbd/server.c2
-rw-r--r--source3/smbd/server_reload.c6
12 files changed, 33 insertions, 21 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 76d9b64e01..ac5e755360 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1635,7 +1635,8 @@ bool lp_snum_ok(int iService);
void lp_add_one_printer(const char *name, const char *comment,
const char *location, void *pdata);
bool lp_loaded(void);
-void lp_killunused(bool (*snumused) (int));
+void lp_killunused(struct smbd_server_connection *sconn,
+ bool (*snumused) (struct smbd_server_connection *, int));
void lp_kill_all_services(void);
void lp_killservice(int iServiceIn);
const char* server_role_str(uint32 role);
@@ -1651,7 +1652,7 @@ enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
struct security_descriptor **ppsd,
bool *pallow_guest);
int load_usershare_service(const char *servicename);
-int load_usershare_shares(void);
+int load_usershare_shares(struct smbd_server_connection *sconn);
void gfree_loadparm(void);
void lp_set_in_client(bool b);
bool lp_is_in_client(void);
@@ -1842,7 +1843,7 @@ void unbecome_root(void);
/* The following definitions come from lib/dummysmbd.c */
int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out);
-bool conn_snum_used(int snum);
+bool conn_snum_used(struct smbd_server_connection *sconn, int snum);
void cancel_pending_lock_requests_by_fid(files_struct *fsp,
struct byte_range_lock *br_lck,
enum file_close_type close_type);
diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c
index 2465e6552b..7a6c2cd319 100644
--- a/source3/lib/dummysmbd.c
+++ b/source3/lib/dummysmbd.c
@@ -28,7 +28,8 @@ int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out)
return -1;
}
-bool conn_snum_used(int snum)
+bool conn_snum_used(struct smbd_server_connection *sconn,
+ int snum)
{
return False;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 58ead5bbf7..8aff0cfdbe 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -8676,7 +8676,8 @@ bool lp_loaded(void)
Unload unused services.
***************************************************************************/
-void lp_killunused(bool (*snumused) (int))
+void lp_killunused(struct smbd_server_connection *sconn,
+ bool (*snumused) (struct smbd_server_connection *, int))
{
int i;
for (i = 0; i < iNumServices; i++) {
@@ -8689,7 +8690,7 @@ void lp_killunused(bool (*snumused) (int))
continue;
}
- if (!snumused || !snumused(i)) {
+ if (!snumused || !snumused(sconn, i)) {
free_service_byindex(i);
}
}
@@ -8700,7 +8701,7 @@ void lp_killunused(bool (*snumused) (int))
*/
void lp_kill_all_services(void)
{
- lp_killunused(NULL);
+ lp_killunused(NULL, NULL);
}
/***************************************************************************
@@ -9314,7 +9315,7 @@ int load_usershare_service(const char *servicename)
been removed.
***************************************************************************/
-int load_usershare_shares(void)
+int load_usershare_shares(struct smbd_server_connection *sconn)
{
SMB_STRUCT_DIR *dp;
SMB_STRUCT_STAT sbuf;
@@ -9452,7 +9453,7 @@ int load_usershare_shares(void)
not currently in use. */
for (iService = iNumServices - 1; iService >= 0; iService--) {
if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
- if (conn_snum_used(iService)) {
+ if (conn_snum_used(sconn, iService)) {
continue;
}
/* Remove from the share ACL db. */
diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c
index 324af534c9..6ca35a5dcc 100644
--- a/source3/rpc_server/dfs/srv_dfs_nt.c
+++ b/source3/rpc_server/dfs/srv_dfs_nt.c
@@ -26,6 +26,7 @@
#include "../librpc/gen_ndr/srv_dfs.h"
#include "msdfs.h"
#include "smbd/smbd.h"
+#include "smbd/globals.h"
#include "auth.h"
#undef DBGC_CLASS
@@ -278,7 +279,8 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r)
size_t i;
TALLOC_CTX *ctx = talloc_tos();
- jn = enum_msdfs_links(ctx, &num_jn);
+ jn = enum_msdfs_links(msg_ctx_to_sconn(p->msg_ctx),
+ ctx, &num_jn);
if (!jn || num_jn == 0) {
num_jn = 0;
jn = NULL;
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index fce4fd8648..f7fa189af5 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -47,6 +47,7 @@
#include "serverid.h"
#include "../libcli/registry/util_reg.h"
#include "smbd/smbd.h"
+#include "smbd/globals.h"
#include "auth.h"
#include "messages.h"
#include "rpc_server/spoolss/srv_spoolss_nt.h"
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 472a31860e..7251d70dd9 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -33,6 +33,7 @@
#include "session.h"
#include "../lib/util/util_pw.h"
#include "smbd/smbd.h"
+#include "smbd/globals.h"
#include "auth.h"
#include "messages.h"
@@ -568,7 +569,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
/* Ensure all the usershares are loaded. */
become_root();
- load_usershare_shares();
+ load_usershare_shares(msg_ctx_to_sconn(p->msg_ctx));
load_registry_shares();
num_services = lp_numservices();
unbecome_root();
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 833147b1a6..c4ab5c1793 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -54,10 +54,9 @@ int conn_num_open(struct smbd_server_connection *sconn)
Check if a snum is in use.
****************************************************************************/
-bool conn_snum_used(int snum)
+bool conn_snum_used(struct smbd_server_connection *sconn,
+ int snum)
{
- struct smbd_server_connection *sconn = smbd_server_conn;
-
if (sconn->using_smb2) {
/* SMB2 */
struct smbd_smb2_session *sess;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index b012e09f5e..5958bb9746 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -2092,7 +2092,7 @@ static bool api_RNetShareEnum(struct smbd_server_connection *sconn,
/* Ensure all the usershares are loaded. */
become_root();
load_registry_shares();
- count = load_usershare_shares();
+ count = load_usershare_shares(sconn);
unbecome_root();
data_len = fixed_len = string_len = 0;
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 82abda79de..085834b4ee 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -1709,7 +1709,8 @@ out:
return cnt;
}
-struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn)
+struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn,
+ TALLOC_CTX *ctx, size_t *p_num_jn)
{
struct junction_map *jn = NULL;
int i=0;
@@ -1724,7 +1725,7 @@ struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn)
/* Ensure all the usershares are loaded. */
become_root();
load_registry_shares();
- sharecount = load_usershare_shares();
+ sharecount = load_usershare_shares(sconn);
unbecome_root();
for(i=0;i < sharecount;i++) {
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 589d45dade..5b45574bc5 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -94,7 +94,7 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
void conn_init(struct smbd_server_connection *sconn);
int conn_num_open(struct smbd_server_connection *sconn);
-bool conn_snum_used(int snum);
+bool conn_snum_used(struct smbd_server_connection *sconn, int snum);
connection_struct *conn_find(struct smbd_server_connection *sconn,
unsigned cnum);
connection_struct *conn_new(struct smbd_server_connection *sconn);
@@ -407,7 +407,8 @@ bool create_junction(TALLOC_CTX *ctx,
struct junction_map *jucn);
bool create_msdfs_link(const struct junction_map *jucn);
bool remove_msdfs_link(const struct junction_map *jucn);
-struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
+struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn,
+ TALLOC_CTX *ctx, size_t *p_num_jn);
NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
connection_struct *conn,
bool dfs_pathnames,
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 4125aebeb4..10edb5ef45 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1033,7 +1033,7 @@ extern void build_options(bool screen);
* Reloading of the printers will not work here as we don't have a
* server info and rpc services set up. It will be called later.
*/
- if (!reload_services(smbd_messaging_context(), -1, False)) {
+ if (!reload_services(NULL, -1, False)) {
exit(1);
}
diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c
index 82b0cb03e9..fef66dac6a 100644
--- a/source3/smbd/server_reload.c
+++ b/source3/smbd/server_reload.c
@@ -113,7 +113,11 @@ bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
if (test && !lp_file_list_changed())
return(True);
- lp_killunused(conn_snum_used);
+ if (msg_ctx) {
+ lp_killunused(msg_ctx_to_sconn(msg_ctx), conn_snum_used);
+ } else {
+ lp_killunused(NULL, NULL);
+ }
ret = lp_load(get_dyn_CONFIGFILE(), False, False, True, True);