*/
#include "includes.h"
+#include "libsmb/libsmb.h"
+#include "../lib/util/tevent_ntstatus.h"
+#include "async_smb.h"
+#include "trans2.h"
/****************************************************************************
Calculate a safe next_entry_offset.
bytes = smb_bytes_push_str(bytes, cli_ucs2(cli), mask,
strlen(mask)+1, NULL);
- bytes = smb_bytes_push_bytes(bytes, 5, (uint8_t *)&zero, 2);
+ bytes = smb_bytes_push_bytes(bytes, 5, (const uint8_t *)&zero, 2);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}
dirlist_len = talloc_get_size(state->dirlist);
- tmp = TALLOC_REALLOC_ARRAY(
+ tmp = talloc_realloc(
state, state->dirlist, uint8_t,
dirlist_len + received * DIR_STRUCT_SIZE);
if (tevent_req_nomem(tmp, req)) {
NTSTATUS cli_list_old(struct cli_state *cli, const char *mask,
uint16 attribute,
- void (*fn)(const char *, struct file_info *,
+ NTSTATUS (*fn)(const char *, struct file_info *,
const char *, void *), void *state)
{
TALLOC_CTX *frame = talloc_stackframe();
}
num_finfo = talloc_array_length(finfo);
for (i=0; i<num_finfo; i++) {
- fn(cli->dfs_mountpoint, &finfo[i], mask, state);
+ status = fn(cli->dfs_mountpoint, &finfo[i], mask, state);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto fail;
+ }
}
fail:
TALLOC_FREE(frame);
- if (!NT_STATUS_IS_OK(status)) {
- cli_set_error(cli, status);
- }
return status;
}
old_num_finfo = talloc_array_length(state->finfo);
- tmp = TALLOC_REALLOC_ARRAY(state, state->finfo, struct file_info,
+ tmp = talloc_realloc(state, state->finfo, struct file_info,
old_num_finfo + ff_searchcount);
if (tevent_req_nomem(tmp, req)) {
return;
/*
* Shrink state->finfo to the real length we received
*/
- tmp = TALLOC_REALLOC_ARRAY(state, state->finfo, struct file_info,
+ tmp = talloc_realloc(state, state->finfo, struct file_info,
old_num_finfo + i);
if (tevent_req_nomem(tmp, req)) {
return;
nlen = 2*(strlen(state->mask) + 1);
- param = TALLOC_REALLOC_ARRAY(state, state->param, uint8_t,
+ param = talloc_realloc(state, state->param, uint8_t,
12 + nlen + last_name_raw.length + 2);
if (tevent_req_nomem(param, req)) {
return;
NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
uint16_t attribute, int info_level,
- void (*fn)(const char *mnt, struct file_info *finfo,
+ NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
const char *mask, void *private_data),
void *private_data)
{
}
num_finfo = talloc_array_length(finfo);
for (i=0; i<num_finfo; i++) {
- fn(cli->dfs_mountpoint, &finfo[i], mask, private_data);
+ status = fn(cli->dfs_mountpoint, &finfo[i], mask, private_data);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto fail;
+ }
}
fail:
TALLOC_FREE(frame);
- if (!NT_STATUS_IS_OK(status)) {
- cli_set_error(cli, status);
- }
return status;
}
}
NTSTATUS cli_list(struct cli_state *cli, const char *mask, uint16 attribute,
- void (*fn)(const char *, struct file_info *, const char *,
+ NTSTATUS (*fn)(const char *, struct file_info *, const char *,
void *), void *state)
{
TALLOC_CTX *frame = talloc_stackframe();
}
for (i=0; i<num_finfo; i++) {
- fn(cli->dfs_mountpoint, &finfo[i], mask, state);
+ status = fn(cli->dfs_mountpoint, &finfo[i], mask, state);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto fail;
+ }
}
fail:
TALLOC_FREE(frame);
- if (!NT_STATUS_IS_OK(status)) {
- cli_set_error(cli, status);
- }
return status;
}