diff options
author | Simo Sorce <ssorce@redhat.com> | 2010-06-07 14:08:05 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2010-06-07 17:25:48 -0400 |
commit | 5da783f4a79ee0a927f2483ae20b691074bb3007 (patch) | |
tree | 6da8069e95481055ca5c9d51548049305202e2ae | |
parent | f9fc4df0c0a6401d185b057c17d6b30ef549b3d0 (diff) | |
download | samba-5da783f4a79ee0a927f2483ae20b691074bb3007.tar.gz samba-5da783f4a79ee0a927f2483ae20b691074bb3007.tar.bz2 samba-5da783f4a79ee0a927f2483ae20b691074bb3007.zip |
s3:smbd add utility function to check if there are open pipes
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/rpc_server/rpc_ncacn_np_internal.c | 12 | ||||
-rw-r--r-- | source3/smbd/conn.c | 11 |
3 files changed, 16 insertions, 8 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 3d25688cf3..2f68f0efc6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5208,6 +5208,7 @@ bool api_pipe_request(pipes_struct *p); pipes_struct *get_first_internal_pipe(void); pipes_struct *get_next_internal_pipe(pipes_struct *p); +bool check_open_pipes(void); bool fsp_is_np(struct files_struct *fsp); struct tsocket_address; diff --git a/source3/rpc_server/rpc_ncacn_np_internal.c b/source3/rpc_server/rpc_ncacn_np_internal.c index f5a3737844..18251c688e 100644 --- a/source3/rpc_server/rpc_ncacn_np_internal.c +++ b/source3/rpc_server/rpc_ncacn_np_internal.c @@ -68,6 +68,18 @@ static void free_pipe_rpc_context_internal( PIPE_RPC_FNS *list ) return; } +bool check_open_pipes(void) +{ + pipes_struct *p; + + for (p = InternalPipes; p != NULL; p = p->next) { + if (num_pipe_handles(p) != 0) { + return true; + } + } + return false; +} + /**************************************************************************** Close an rpc pipe. ****************************************************************************/ diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index afb7a7fa85..707f6c4aa1 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -213,7 +213,6 @@ bool conn_close_all(struct smbd_server_connection *sconn) bool conn_idle_all(struct smbd_server_connection *sconn,time_t t) { int deadtime = lp_deadtime()*60; - pipes_struct *plist = NULL; connection_struct *conn; if (deadtime <= 0) @@ -243,14 +242,10 @@ bool conn_idle_all(struct smbd_server_connection *sconn,time_t t) * Check all pipes for any open handles. We cannot * idle with a handle open. */ - - for (plist = get_first_internal_pipe(); plist; - plist = get_next_internal_pipe(plist)) { - if (num_pipe_handles(plist->pipe_handles) != 0) { - return False; - } + if (check_open_pipes()) { + return False; } - + return True; } |