SMBC_close_ctx(SMBCCTX *context,
SMBCFILE *file);
-bool
+NTSTATUS
SMBC_getatr(SMBCCTX * context,
SMBCSRV *srv,
const char *path,
*/
path[path_len] = '\0'; /* restore original path */
- if (SMBC_getatr(context,
- srv,
- path,
- &sb) &&
+ status = SMBC_getatr(
+ context,
+ srv,
+ path,
+ &sb);
+ if (NT_STATUS_IS_OK(status) &&
!S_ISDIR(sb.st_mode)) {
/* It is. Correct the error value */
int saverr = errno;
struct stat sb = {0};
- bool ok;
- ok = SMBC_getatr(context, srv, path, &sb);
- if (!ok) {
+ status = SMBC_getatr(context, srv, path, &sb);
+ if (!NT_STATUS_IS_OK(status)) {
/* Hmmm, bad error ... What? */
- errno = SMBC_errno(context, targetcli);
TALLOC_FREE(frame);
+ errno = cli_status_to_errno(status);
return -1;
}
* Get info from an SMB server on a file. Use a qpathinfo call first
* and if that fails, use getatr, as Win95 sometimes refuses qpathinfo
*/
-bool
+NTSTATUS
SMBC_getatr(SMBCCTX * context,
SMBCSRV *srv,
const char *path,
NTSTATUS status;
if (!context || !context->internal->initialized) {
- errno = EINVAL;
TALLOC_FREE(frame);
- return False;
+ return NT_STATUS_INVALID_PARAMETER;
}
/* path fixup for . and .. */
if (ISDOT(path) || ISDOTDOT(path)) {
fixedpath = talloc_strdup(frame, "\\");
if (!fixedpath) {
- errno = ENOMEM;
TALLOC_FREE(frame);
- return False;
+ return NT_STATUS_NO_MEMORY;
}
} else {
fixedpath = talloc_strdup(frame, path);
if (!fixedpath) {
- errno = ENOMEM;
TALLOC_FREE(frame);
- return False;
+ return NT_STATUS_NO_MEMORY;
}
trim_string(fixedpath, NULL, "\\..");
trim_string(fixedpath, NULL, "\\.");
&targetcli, &targetpath);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Couldn't resolve %s\n", path);
- errno = ENOENT;
TALLOC_FREE(frame);
- return False;
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
if (!srv->no_pathinfo2) {
write_time_ts);
TALLOC_FREE(frame);
- return true;
+ return NT_STATUS_OK;
all_failed:
srv->no_pathinfo2 = False;
srv->no_pathinfo3 = False;
- errno = EPERM;
TALLOC_FREE(frame);
- return False;
+ return NT_STATUS_ACCESS_DENIED;
}
/*
char *workgroup = NULL;
char *path = NULL;
uint16_t port = 0;
+ NTSTATUS status;
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
return -1; /* errno set by SMBC_server */
}
- if (!SMBC_getatr(context, srv, path, st)) {
- errno = SMBC_errno(context, srv->cli);
+ status = SMBC_getatr(context, srv, path, st);
+ if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
+ errno = cli_status_to_errno(status);
return -1;
}
{
struct stat sb = {0};
struct DOS_ATTR_DESC *ret = NULL;
+ NTSTATUS status;
ret = talloc(ctx, struct DOS_ATTR_DESC);
if (!ret) {
}
/* Obtain the DOS attributes */
- if (!SMBC_getatr(context, srv, filename, &sb)) {
- errno = SMBC_errno(context, srv->cli);
+ status = SMBC_getatr(context, srv, filename, &sb);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("dos_attr_query Failed to query old attributes\n"));
TALLOC_FREE(ret);
+ errno = cli_status_to_errno(status);
return NULL;
}
off_t size = 0;
uint16_t mode = 0;
SMB_INO_T ino = 0;
+ NTSTATUS status;
/* Point to the portion after "system.dos_attr." */
name += 16; /* if (all) this will be invalid but unused */
/* Obtain the DOS attributes */
- if (!SMBC_getatr(context, srv, filename, &sb)) {
- errno = SMBC_errno(context, srv->cli);
+ status = SMBC_getatr(context, srv, filename, &sb);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = cli_status_to_errno(status);
return -1;
}