summaryrefslogtreecommitdiffstats
path: root/source3/rpc_server/srvsvc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-09-24 20:46:15 +0200
committerJeremy Allison <jra@samba.org>2014-10-31 03:47:40 +0100
commit9010bbeb00264f4476c3be7d2e8c8420c695cfbb (patch)
treec03448a0c323c99a1d5f55106a7bd5372929ea57 /source3/rpc_server/srvsvc
parent48926b761975a7d9cb6daf30d64d6a4f0a34f38a (diff)
downloadsamba-9010bbeb00264f4476c3be7d2e8c8420c695cfbb.tar.gz
samba-9010bbeb00264f4476c3be7d2e8c8420c695cfbb.tar.xz
samba-9010bbeb00264f4476c3be7d2e8c8420c695cfbb.zip
s3:locking: allow early return for share_entry_forall()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/rpc_server/srvsvc')
-rw-r--r--source3/rpc_server/srvsvc/srv_srvsvc_nt.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index d2f05f30cc..eaa70e784d 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -79,9 +79,9 @@ struct share_conn_stat {
/*******************************************************************
********************************************************************/
-static void enum_file_fn( const struct share_mode_entry *e,
- const char *sharepath, const char *fname,
- void *private_data )
+static int enum_file_fn(const struct share_mode_entry *e,
+ const char *sharepath, const char *fname,
+ void *private_data)
{
struct file_enum_count *fenum =
(struct file_enum_count *)private_data;
@@ -98,21 +98,21 @@ static void enum_file_fn( const struct share_mode_entry *e,
/* If the pid was not found delete the entry from connections.tdb */
if ( !process_exists(e->pid) ) {
- return;
+ return 0;
}
username = uidtoname(e->uid);
if ((fenum->username != NULL)
&& !strequal(username, fenum->username)) {
- return;
+ return 0;
}
f = talloc_realloc(fenum->ctx, fenum->ctr3->array,
struct srvsvc_NetFileInfo3, i+1);
if ( !f ) {
DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
- return;
+ return 0;
}
fenum->ctr3->array = f;
@@ -133,7 +133,7 @@ static void enum_file_fn( const struct share_mode_entry *e,
sharepath, fname );
}
if (!fullpath) {
- return;
+ return 0;
}
string_replace( fullpath, '/', '\\' );
@@ -150,6 +150,8 @@ static void enum_file_fn( const struct share_mode_entry *e,
fenum->ctr3->array[i].user = username;
fenum->ctr3->count++;
+
+ return 0;
}
/*******************************************************************
@@ -826,9 +828,9 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p,
* find out the session on which this file is open and bump up its count
**********************************************************************/
-static void count_sess_files_fn(const struct share_mode_entry *e,
- const char *sharepath, const char *fname,
- void *data)
+static int count_sess_files_fn(const struct share_mode_entry *e,
+ const char *sharepath, const char *fname,
+ void *data)
{
struct sess_file_info *info = data;
uint32_t rh = info->resume_handle;
@@ -846,9 +848,10 @@ static void count_sess_files_fn(const struct share_mode_entry *e,
serverid_equal(&e->pid, &sess->pid)) {
info->ctr->array[i].num_open++;
- return;
+ return 0;
}
}
+ return 0;
}
/*******************************************************************
@@ -950,9 +953,9 @@ static WERROR init_srv_sess_info_1(struct pipes_struct *p,
find the share connection on which this open exists.
********************************************************************/
-static void share_file_fn(const struct share_mode_entry *e,
- const char *sharepath, const char *fname,
- void *data)
+static int share_file_fn(const struct share_mode_entry *e,
+ const char *sharepath, const char *fname,
+ void *data)
{
struct share_file_stat *sfs = data;
uint32_t i;
@@ -962,10 +965,11 @@ static void share_file_fn(const struct share_mode_entry *e,
for (i=0; i < sfs->resp_entries; i++) {
if (serverid_equal(&e->pid, &sfs->svrid_arr[offset + i])) {
sfs->netconn_arr[i].num_open ++;
- return;
+ return 0;
}
}
}
+ return 0;
}
/*******************************************************************
@@ -2690,9 +2694,9 @@ struct enum_file_close_state {
struct messaging_context *msg_ctx;
};
-static void enum_file_close_fn( const struct share_mode_entry *e,
- const char *sharepath, const char *fname,
- void *private_data )
+static int enum_file_close_fn(const struct share_mode_entry *e,
+ const char *sharepath, const char *fname,
+ void *private_data)
{
char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
struct enum_file_close_state *state =
@@ -2700,11 +2704,11 @@ static void enum_file_close_fn( const struct share_mode_entry *e,
uint32_t fid = (((uint32_t)(procid_to_pid(&e->pid))<<16) | e->share_file_id);
if (fid != state->r->in.fid) {
- return; /* Not this file. */
+ return 0; /* Not this file. */
}
if (!process_exists(e->pid) ) {
- return;
+ return 0;
}
/* Ok - send the close message. */
@@ -2718,6 +2722,8 @@ static void enum_file_close_fn( const struct share_mode_entry *e,
messaging_send_buf(state->msg_ctx,
e->pid, MSG_SMB_CLOSE_FILE,
(uint8 *)msg, sizeof(msg)));
+
+ return 0;
}
/********************************************************************