static NTSTATUS unix_convert_step(struct uc_state *state)
{
- NTSTATUS status;
int ret;
/*
if (ISDOT(state->name)) {
if (!state->end) {
/* Error code at the end of a pathname. */
- status = NT_STATUS_OBJECT_NAME_INVALID;
- } else {
- status = determine_path_error(state->end+1,
- state->allow_wcard_last_component,
- state->posix_pathnames);
+ return NT_STATUS_OBJECT_NAME_INVALID;
}
- goto fail;
+ return determine_path_error(state->end+1,
+ state->allow_wcard_last_component,
+ state->posix_pathnames);
}
/* The name cannot have a wildcard if it's not
/* Wildcards never valid within a pathname. */
if (state->name_has_wildcard && state->end) {
- status = NT_STATUS_OBJECT_NAME_INVALID;
- goto fail;
+ return NT_STATUS_OBJECT_NAME_INVALID;
}
/* Skip the stat call if it's a wildcard end. */
if (state->name_has_wildcard) {
DBG_DEBUG("Wildcard [%s]\n", state->name);
- goto done;
+ state->done = true;
+ return NT_STATUS_OK;
}
/*
* applications depend on the difference between
* these two errors.
*/
- status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
- goto fail;
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
} else {
*/
morepath = strchr(state->end + 1, '/');
if (morepath != NULL) {
- status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
- goto fail;
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
}
if (errno == ENOENT) {
/* New file or directory. */
- goto done;
+ state->done = true;
+ return NT_STATUS_OK;
}
if ((errno == EACCES) &&
(state->ucf_flags & UCF_PREP_CREATEFILE)) {
/* POSIX Dropbox case. */
errno = 0;
- goto done;
+ state->done = true;
+ return NT_STATUS_OK;
}
- status = map_nt_error_from_unix(errno);
- goto fail;
+ return map_nt_error_from_unix(errno);
}
/*
if (errno == ENOENT ||
errno == ENOTDIR ||
- errno == ELOOP) {
- status =
- NT_STATUS_OBJECT_PATH_NOT_FOUND;
- }
- else {
- status =
- map_nt_error_from_unix(errno);
+ errno == ELOOP)
+ {
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
- goto fail;
+ return map_nt_error_from_unix(errno);
}
/*
if (errno == EACCES) {
if ((state->ucf_flags & UCF_PREP_CREATEFILE) == 0) {
- status = NT_STATUS_ACCESS_DENIED;
- goto fail;
+ return NT_STATUS_ACCESS_DENIED;
} else {
/*
* This is the dropbox
* NT_STATUS_OBJECT_PATH_NOT_FOUND
* in the filename walk.
*/
- if (errno == ENOTDIR ||
- errno == ELOOP) {
- status =
- NT_STATUS_OBJECT_PATH_NOT_FOUND;
- } else {
- status =
- map_nt_error_from_unix(errno);
+ if (errno == ENOTDIR || errno == ELOOP) {
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
- goto fail;
+ return map_nt_error_from_unix(errno);
}
/*
lp_default_case(SNUM(state->conn)))) {
DBG_DEBUG("strnorm %s failed\n",
state->name);
- status = NT_STATUS_INVALID_PARAMETER;
- goto fail;
+ return NT_STATUS_INVALID_PARAMETER;
}
}
}
if (tmp == NULL) {
DBG_ERR("talloc failed\n");
- status = NT_STATUS_NO_MEMORY;
- goto err;
+ return NT_STATUS_NO_MEMORY;
}
TALLOC_FREE(state->smb_fname->base_name);
state->smb_fname->base_name = tmp;
}
DBG_DEBUG("New file [%s]\n", state->name);
- goto done;
+ state->done = true;
+ return NT_STATUS_OK;
}
}
if (tmp == NULL) {
DBG_ERR("talloc_asprintf failed\n");
- status = NT_STATUS_NO_MEMORY;
- goto err;
+ return NT_STATUS_NO_MEMORY;
}
TALLOC_FREE(state->smb_fname->base_name);
state->smb_fname->base_name = tmp;
}
if (tmp == NULL) {
DBG_ERR("talloc failed\n");
- status = NT_STATUS_NO_MEMORY;
- goto err;
+ return NT_STATUS_NO_MEMORY;
}
TALLOC_FREE(state->smb_fname->base_name);
state->smb_fname->base_name = tmp;
"%s/%s", state->dirpath, state->name);
if (!tmp) {
DBG_ERR("talloc_asprintf failed\n");
- status = NT_STATUS_NO_MEMORY;
- goto err;
+ return NT_STATUS_NO_MEMORY;
}
TALLOC_FREE(state->dirpath);
state->dirpath = tmp;
TALLOC_FREE(state->dirpath);
if (!(state->dirpath = talloc_strdup(state->mem_ctx,state->name))) {
DBG_ERR("talloc_strdup failed\n");
- status = NT_STATUS_NO_MEMORY;
- goto err;
+ return NT_STATUS_NO_MEMORY;
}
}
}
return NT_STATUS_OK;
-done:
- state->done = true;
- return NT_STATUS_OK;
-err:
-fail:
- return status;
}
NTSTATUS unix_convert(TALLOC_CTX *mem_ctx,