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);
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);
/* 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);
return -1;
}
-bool conn_snum_used(int snum)
+bool conn_snum_used(struct smbd_server_connection *sconn,
+ int snum)
{
return False;
}
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++) {
continue;
}
- if (!snumused || !snumused(i)) {
+ if (!snumused || !snumused(sconn, i)) {
free_service_byindex(i);
}
}
*/
void lp_kill_all_services(void)
{
- lp_killunused(NULL);
+ lp_killunused(NULL, NULL);
}
/***************************************************************************
been removed.
***************************************************************************/
-int load_usershare_shares(void)
+int load_usershare_shares(struct smbd_server_connection *sconn)
{
SMB_STRUCT_DIR *dp;
SMB_STRUCT_STAT sbuf;
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. */
#include "../librpc/gen_ndr/srv_dfs.h"
#include "msdfs.h"
#include "smbd/smbd.h"
+#include "smbd/globals.h"
#include "auth.h"
#undef DBGC_CLASS
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;
#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"
#include "session.h"
#include "../lib/util/util_pw.h"
#include "smbd/smbd.h"
+#include "smbd/globals.h"
#include "auth.h"
#include "messages.h"
/* 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();
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;
/* 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;
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;
/* 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++) {
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);
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,
* 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);
}
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);