struct cli_state *targetcli = NULL;
SMBCSRV *srv = NULL;
SMBCFILE *file = NULL;
- int fd;
+ uint16_t fd;
+ NTSTATUS status = NT_STATUS_OBJECT_PATH_INVALID;
TALLOC_CTX *frame = talloc_stackframe();
if (!context || !context->internal->initialized) {
/* Hmmm, the test for a directory is suspect here ... FIXME */
if (strlen(path) > 0 && path[strlen(path) - 1] == '\\') {
- fd = -1;
+ status = NT_STATUS_OBJECT_PATH_INVALID;
} else {
file = SMB_MALLOC_P(SMBCFILE);
ZERO_STRUCTP(file);
/*d_printf(">>>open: resolving %s\n", path);*/
- if (!cli_resolve_path(frame, "", srv->cli, path,
- &targetcli, &targetpath)) {
+ if (!cli_resolve_path(frame, "", context->internal->auth_info,
+ srv->cli, path,
+ &targetcli, &targetpath)) {
d_printf("Could not resolve %s\n", path);
+ errno = ENOENT;
SAFE_FREE(file);
TALLOC_FREE(frame);
return NULL;
}
/*d_printf(">>>open: resolved %s as %s\n", path, targetpath);*/
- if ((fd = cli_open(targetcli, targetpath, flags,
- context->internal->share_mode)) < 0) {
+ status = cli_open(targetcli, targetpath, flags,
+ context->internal->share_mode, &fd);
+ if (!NT_STATUS_IS_OK(status)) {
/* Handle the error ... */
/* Check if opendir needed ... */
- if (fd == -1) {
+ if (!NT_STATUS_IS_OK(status)) {
int eno = 0;
eno = SMBC_errno(context, srv->cli);
}
/*d_printf(">>>read: resolving %s\n", path);*/
- if (!cli_resolve_path(frame, "", file->srv->cli, path,
- &targetcli, &targetpath)) {
+ if (!cli_resolve_path(frame, "", context->internal->auth_info,
+ file->srv->cli, path,
+ &targetcli, &targetpath)) {
d_printf("Could not resolve %s\n", path);
+ errno = ENOENT;
TALLOC_FREE(frame);
return -1;
}
TALLOC_FREE(frame);
return -1;
}
-
+
/*d_printf(">>>write: resolving %s\n", path);*/
- if (!cli_resolve_path(frame, "", file->srv->cli, path,
- &targetcli, &targetpath)) {
+ if (!cli_resolve_path(frame, "", context->internal->auth_info,
+ file->srv->cli, path,
+ &targetcli, &targetpath)) {
d_printf("Could not resolve %s\n", path);
+ errno = ENOENT;
TALLOC_FREE(frame);
return -1;
}
}
/*d_printf(">>>close: resolving %s\n", path);*/
- if (!cli_resolve_path(frame, "", file->srv->cli, path,
- &targetcli, &targetpath)) {
+ if (!cli_resolve_path(frame, "", context->internal->auth_info,
+ file->srv->cli, path,
+ &targetcli, &targetpath)) {
d_printf("Could not resolve %s\n", path);
+ errno = ENOENT;
TALLOC_FREE(frame);
return -1;
}
}
DEBUG(4,("SMBC_getatr: sending qpathinfo\n"));
- if (!cli_resolve_path(frame, "", srv->cli, fixedpath,
- &targetcli, &targetpath)) {
+ if (!cli_resolve_path(frame, "", context->internal->auth_info,
+ srv->cli, fixedpath,
+ &targetcli, &targetpath)) {
d_printf("Couldn't resolve %s\n", path);
+ errno = ENOENT;
TALLOC_FREE(frame);
return False;
}
time_t change_time,
uint16 mode)
{
- int fd;
+ uint16_t fd;
int ret;
TALLOC_CTX *frame = talloc_stackframe();
srv->no_pathinfo = True;
/* Open the file */
- if ((fd = cli_open(srv->cli, path, O_RDWR, DENY_NONE)) < 0) {
+ if (!NT_STATUS_IS_OK(cli_open(srv->cli, path, O_RDWR, DENY_NONE, &fd))) {
errno = SMBC_errno(context, srv->cli);
TALLOC_FREE(frame);
}
/*d_printf(">>>lseek: resolving %s\n", path);*/
- if (!cli_resolve_path(frame, "", file->srv->cli, path,
- &targetcli, &targetpath)) {
+ if (!cli_resolve_path(frame, "", context->internal->auth_info,
+ file->srv->cli, path,
+ &targetcli, &targetpath)) {
d_printf("Could not resolve %s\n", path);
+ errno = ENOENT;
TALLOC_FREE(frame);
return -1;
}
}
/*d_printf(">>>fstat: resolving %s\n", path);*/
- if (!cli_resolve_path(frame, "", file->srv->cli, path,
- &targetcli, &targetpath)) {
+ if (!cli_resolve_path(frame, "", context->internal->auth_info,
+ file->srv->cli, path,
+ &targetcli, &targetpath)) {
d_printf("Could not resolve %s\n", path);
+ errno = ENOENT;
TALLOC_FREE(frame);
return -1;
}