}
struct share_entry_forall_state {
- void (*fn)(const struct share_mode_entry *e,
- const char *service_path, const char *base_name,
- void *private_data);
+ int (*fn)(const struct share_mode_entry *e,
+ const char *service_path, const char *base_name,
+ void *private_data);
void *private_data;
};
uint32_t i;
for (i=0; i<data->num_share_modes; i++) {
- state->fn(&data->share_modes[i],
- data->servicepath, data->base_name,
- state->private_data);
+ int ret;
+
+ ret = state->fn(&data->share_modes[i],
+ data->servicepath, data->base_name,
+ state->private_data);
+ if (ret != 0) {
+ return ret;
+ }
}
return 0;
share mode system.
********************************************************************/
-int share_entry_forall(void (*fn)(const struct share_mode_entry *,
- const char *, const char *, void *),
- void *private_data)
+int share_entry_forall(int (*fn)(const struct share_mode_entry *,
+ const char *, const char *, void *),
+ void *private_data)
{
struct share_entry_forall_state state = {
.fn = fn, .private_data = private_data };
/*******************************************************************
********************************************************************/
-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;
/* 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;
sharepath, fname );
}
if (!fullpath) {
- return;
+ return 0;
}
string_replace( fullpath, '/', '\\' );
fenum->ctr3->array[i].user = username;
fenum->ctr3->count++;
+
+ return 0;
}
/*******************************************************************
* 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;
serverid_equal(&e->pid, &sess->pid)) {
info->ctr->array[i].num_open++;
- return;
+ return 0;
}
}
+ return 0;
}
/*******************************************************************
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;
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;
}
/*******************************************************************
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 =
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. */
messaging_send_buf(state->msg_ctx,
e->pid, MSG_SMB_CLOSE_FILE,
(uint8 *)msg, sizeof(msg)));
+
+ return 0;
}
/********************************************************************