The branch, master has been updated
       via  3cf275c s3:smbd/msdfs: enum_msdfs_links() doesn't need a 
smbd_server_connection anymore
       via  ae7d877 s3:smbd: use connections_snum_used() instead of 
conn_snum_used() for load_usershare_shares()
       via  cefb797 s3:smbd: add connections_snum_used()
       via  611ab8a s3:lib/dummyparam: remove unused conn_snum_used() dummy
       via  1399e6b s3:param: don't reference conn_snum_used directly in 
load_usershare_shares()
      from  1cf54ef s3: Use talloc_tos() in set_write_time()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3cf275cd754486e07a891fbcb0607afb171d5359
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Dec 13 12:29:54 2011 +0100

    s3:smbd/msdfs: enum_msdfs_links() doesn't need a smbd_server_connection 
anymore
    
    metze
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Tue Dec 13 17:26:20 CET 2011 on sn-devel-104

commit ae7d8778415234eb85df1aceb024875691ccb8ef
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Dec 13 12:24:03 2011 +0100

    s3:smbd: use connections_snum_used() instead of conn_snum_used() for 
load_usershare_shares()
    
    Before removing the share security descriptor, we should make sure there're
    really no active users anymore.
    
    metze

commit cefb797434ef738870b3f2447fdbeea361bdea57
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Dec 13 12:18:01 2011 +0100

    s3:smbd: add connections_snum_used()
    
    This works similar to conn_snum_used(), but instead of
    looking at the current connection only, it looks at
    all active connections in "connections.tdb".
    
    metze

commit 611ab8aaa779c1e426a918eb376b8a8e44bc56ef
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Dec 13 11:53:10 2011 +0100

    s3:lib/dummyparam: remove unused conn_snum_used() dummy
    
    metze

commit 1399e6bdf52d2ef08d1cea918a171108c502900a
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Dec 13 11:50:04 2011 +0100

    s3:param: don't reference conn_snum_used directly in load_usershare_shares()
    
    This uses the same logic as lp_killunused().
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h                   |    4 ++--
 source3/lib/dummyparam.c                  |    5 -----
 source3/param/loadparm.c                  |    5 +++--
 source3/rpc_server/dfs/srv_dfs_nt.c       |    3 +--
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c |    2 +-
 source3/smbd/connection.c                 |   12 ++++++++++++
 source3/smbd/lanman.c                     |    2 +-
 source3/smbd/msdfs.c                      |    5 ++---
 source3/smbd/proto.h                      |    4 ++--
 9 files changed, 24 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 15cd7f9..2c12a5f 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,
@@ -1786,7 +1787,6 @@ 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(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/dummyparam.c b/source3/lib/dummyparam.c
index bad5d56..91dda65 100644
--- a/source3/lib/dummyparam.c
+++ b/source3/lib/dummyparam.c
@@ -28,8 +28,3 @@ int find_service(TALLOC_CTX *ctx, const char *service_in, 
char **p_service_out)
        return -1;
 }
 
-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 d406483..e0da6fd 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/dfs/srv_dfs_nt.c 
b/source3/rpc_server/dfs/srv_dfs_nt.c
index efb0a1e..0a9a7cc 100644
--- a/source3/rpc_server/dfs/srv_dfs_nt.c
+++ b/source3/rpc_server/dfs/srv_dfs_nt.c
@@ -281,8 +281,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r)
        size_t i;
        TALLOC_CTX *ctx = talloc_tos();
 
-       jn = enum_msdfs_links(msg_ctx_to_sconn(p->msg_ctx),
-                             ctx, &num_jn);
+       jn = enum_msdfs_links(ctx, &num_jn);
        if (!jn || num_jn == 0) {
                num_jn = 0;
                jn = NULL;
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c 
b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index fca616e..4435b99 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(NULL, connections_snum_used);
        load_registry_shares();
        num_services = lp_numservices();
        unbecome_root();
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 5da2b08..5a9f407 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -130,6 +130,18 @@ int count_current_connections( const char *sharename, bool 
clear  )
        return cs.curr_connections;
 }
 
+bool connections_snum_used(struct smbd_server_connection *unused, int snum)
+{
+       int active;
+
+       active = count_current_connections(lp_servicename(snum), true);
+       if (active > 0) {
+               return true;
+       }
+
+       return false;
+}
+
 /****************************************************************************
  Claim an entry in the connections database.
 ****************************************************************************/
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 292ebf4..31775bf 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(NULL, connections_snum_used);
        unbecome_root();
 
        data_len = fixed_len = string_len = 0;
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index de70042..a00fd6f 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -1475,8 +1475,7 @@ out:
        return cnt;
 }
 
-struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn,
-                                     TALLOC_CTX *ctx, size_t *p_num_jn)
+struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn)
 {
        struct junction_map *jn = NULL;
        int i=0;
@@ -1491,7 +1490,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(NULL, connections_snum_used);
        unbecome_root();
 
        for(i=0;i < sharecount;i++) {
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 151ae78..e0f48b7 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -164,6 +164,7 @@ void msg_force_tdis(struct messaging_context *msg,
 
 bool yield_connection(connection_struct *conn, const char *name);
 int count_current_connections( const char *sharename, bool clear  );
+bool connections_snum_used(struct smbd_server_connection *unused, int snum);
 bool claim_connection(connection_struct *conn, const char *name);
 
 /* The following definitions come from smbd/dfree.c  */
@@ -458,8 +459,7 @@ 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(struct smbd_server_connection *sconn,
-                                     TALLOC_CTX *ctx, size_t *p_num_jn);
+struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
 NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
                        connection_struct *conn,
                        bool dfs_pathnames,


-- 
Samba Shared Repository

Reply via email to