*/
#include "includes.h"
+#include "libsmb/libsmb.h"
#include "libsmbclient.h"
#include "libsmb_internal.h"
const void *buf,
size_t count)
{
- int ret;
off_t offset;
char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
char *path = NULL;
char *targetpath = NULL;
struct cli_state *targetcli = NULL;
TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS status;
/* First check all pointers before dereferencing them */
}
/*d_printf(">>>write: resolved path as %s\n", targetpath);*/
- ret = cli_write(targetcli, file->cli_fd,
- 0, (char *)buf, offset, count);
- if (ret <= 0) {
- errno = SMBC_errno(context, targetcli);
+ status = cli_writeall(targetcli, file->cli_fd,
+ 0, (const uint8_t *)buf, offset, count, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
TALLOC_FREE(frame);
return -1;
}
- file->offset += ret;
+ file->offset += count;
TALLOC_FREE(frame);
- return ret; /* Success, 0 bytes of data ... */
+ return count; /* Success, 0 bytes of data ... */
}
/*
bool
SMBC_getatr(SMBCCTX * context,
SMBCSRV *srv,
- char *path,
+ const char *path,
uint16 *mode,
SMB_OFF_T *size,
struct timespec *create_time_ts,
* attributes manipulated.
*/
if (srv->no_pathinfo ||
- ! cli_setpathinfo(srv->cli, path,
- create_time,
- access_time,
- write_time,
- change_time,
- mode)) {
+ !NT_STATUS_IS_OK(cli_setpathinfo_basic(srv->cli, path,
+ create_time,
+ access_time,
+ write_time,
+ change_time,
+ mode))) {
/*
* setpathinfo is not supported; go to plan B.
}
/*d_printf(">>>lseek: resolved path as %s\n", targetpath);*/
- if (!cli_qfileinfo_basic(targetcli, file->cli_fd, NULL,
- &size, NULL, NULL, NULL, NULL, NULL))
- {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ targetcli, file->cli_fd, NULL,
+ &size, NULL, NULL, NULL, NULL,
+ NULL))) {
SMB_OFF_T b_size = size;
if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd,
NULL, &b_size, NULL, NULL, NULL))) {