s3:param: don't reference conn_snum_used directly in load_usershare_shares()
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2011 10:50:04 +0000 (11:50 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2011 14:45:36 +0000 (15:45 +0100)
This uses the same logic as lp_killunused().

metze

source3/include/proto.h
source3/param/loadparm.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/lanman.c
source3/smbd/msdfs.c

index 15cd7f9be0048629ab0323b44adab1a482309262..448aa5df75aace2ea2c9f37b03d80adeece455c9 100644 (file)
@@ -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,
index d4064835acb9e1a08b03ed75db0c37ea6d12187f..e0da6fdf1dac4bebf47ad0a9cb3df8797dc09657 100644 (file)
@@ -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. */
index fca616e66b4d7c36cf76f154e69a77a02925fa30..f4f37c3b0067df9a69e6363e939a1abae1da946d 100644 (file)
@@ -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();
index 292ebf43853f7146b60eb7a9513c77bdb7421a51..8fa248c8cb58fa9d1da7bfd3eccdea22010a084f 100644 (file)
@@ -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;
index de700423aeef4cc8c6fa78d62b7a90104944cc7c..fa3d28cf44d179113962a0ef5bb3fc938e2b99fe 100644 (file)
@@ -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++) {