summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-12-13 11:50:04 +0100
committerStefan Metzmacher <metze@samba.org>2011-12-13 15:45:36 +0100
commit1399e6bdf52d2ef08d1cea918a171108c502900a (patch)
tree3726c790f8354742f877cfd6c2d0f135f4d5c908
parent1cf54ef4a69e78dff5a812d447b0f385b56c5ebd (diff)
downloadsamba-1399e6bdf52d2ef08d1cea918a171108c502900a.tar.gz
samba-1399e6bdf52d2ef08d1cea918a171108c502900a.tar.bz2
samba-1399e6bdf52d2ef08d1cea918a171108c502900a.zip
s3:param: don't reference conn_snum_used directly in load_usershare_shares()
This uses the same logic as lp_killunused(). metze
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/param/loadparm.c5
-rw-r--r--source3/rpc_server/srvsvc/srv_srvsvc_nt.c2
-rw-r--r--source3/smbd/lanman.c2
-rw-r--r--source3/smbd/msdfs.c2
5 files changed, 8 insertions, 6 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 15cd7f9be0..448aa5df75 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1592,7 +1592,8 @@ 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(struct smbd_server_connection *sconn);
+int load_usershare_shares(struct smbd_server_connection *sconn,
+ bool (*snumused) (struct smbd_server_connection *, int));
void gfree_loadparm(void);
bool lp_load(const char *pszFname,
bool global_only,
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d4064835ac..e0da6fdf1d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -8731,7 +8731,8 @@ int load_usershare_service(const char *servicename)
been removed.
***************************************************************************/
-int load_usershare_shares(struct smbd_server_connection *sconn)
+int load_usershare_shares(struct smbd_server_connection *sconn,
+ bool (*snumused) (struct smbd_server_connection *, int))
{
SMB_STRUCT_DIR *dp;
SMB_STRUCT_STAT sbuf;
@@ -8869,7 +8870,7 @@ int load_usershare_shares(struct smbd_server_connection *sconn)
not currently in use. */
for (iService = iNumServices - 1; iService >= 0; iService--) {
if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
- if (conn_snum_used(sconn, iService)) {
+ if (snumused && snumused(sconn, iService)) {
continue;
}
/* Remove from the share ACL db. */
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index fca616e66b..f4f37c3b00 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -574,7 +574,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
/* Ensure all the usershares are loaded. */
become_root();
- load_usershare_shares(msg_ctx_to_sconn(p->msg_ctx));
+ load_usershare_shares(msg_ctx_to_sconn(p->msg_ctx), conn_snum_used);
load_registry_shares();
num_services = lp_numservices();
unbecome_root();
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 292ebf4385..8fa248c8cb 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(sconn);
+ count = load_usershare_shares(sconn, conn_snum_used);
unbecome_root();
data_len = fixed_len = string_len = 0;
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index de700423ae..fa3d28cf44 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -1491,7 +1491,7 @@ struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn,
/* Ensure all the usershares are loaded. */
become_root();
load_registry_shares();
- sharecount = load_usershare_shares(sconn);
+ sharecount = load_usershare_shares(sconn, conn_snum_used);
unbecome_root();
for(i=0;i < sharecount;i++) {