files_struct *fsp = NULL;
ssize_t nwritten;
- status = string_replace_allocate(handle->conn,
- e->adx_name,
- string_replace_cmaps,
- talloc_tos(),
- &mapped_name,
- vfs_translate_to_windows);
- if (!NT_STATUS_IS_OK(status) &&
- !NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED))
- {
- DBG_ERR("string_replace_allocate failed\n");
+ rc = string_replace_allocate(handle->conn,
+ e->adx_name,
+ string_replace_cmaps,
+ talloc_tos(),
+ &mapped_name,
+ vfs_translate_to_windows);
+ if (rc != 0) {
+ DBG_ERR("string_replace_allocate failed: %s\n",
+ strerror(rc));
ok = false;
goto fail;
}
ssize_t nread;
NTSTATUS status;
bool ok;
+ int rc;
sname = synthetic_smb_fname(ad,
smb_fname->base_name,
*p = '\0';
}
- status = string_replace_allocate(handle->conn,
- e->adx_name,
- cmaps,
- ad,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status) &&
- !NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED))
- {
- DBG_ERR("string_replace_allocate failed\n");
+ rc = string_replace_allocate(handle->conn,
+ e->adx_name,
+ cmaps,
+ ad,
+ &mapped_name,
+ vfs_translate_to_unix);
+ if (rc != 0) {
+ DBG_ERR("string_replace_allocate failed: %s\n", strerror(rc));
ok = false;
goto out;
}
return cmaps;
}
-NTSTATUS string_replace_allocate(connection_struct *conn,
- const char *name_in,
- struct char_mappings **cmaps,
- TALLOC_CTX *mem_ctx,
- char **mapped_name,
- enum vfs_translate_direction direction)
+int string_replace_allocate(connection_struct *conn,
+ const char *name_in,
+ struct char_mappings **cmaps,
+ TALLOC_CTX *mem_ctx,
+ char **mapped_name,
+ enum vfs_translate_direction direction)
{
static smb_ucs2_t *tmpbuf = NULL;
smb_ucs2_t *ptr = NULL;
ok = push_ucs2_talloc(talloc_tos(), &tmpbuf, name_in,
&converted_size);
if (!ok) {
- return map_nt_error_from_unix(errno);
+ return errno;
}
for (ptr = tmpbuf; *ptr; ptr++) {
ok = pull_ucs2_talloc(mem_ctx, mapped_name, tmpbuf,
&converted_size);
- TALLOC_FREE(tmpbuf);
+ {
+ int err = errno;
+ TALLOC_FREE(tmpbuf);
+ errno = err;
+ }
if (!ok) {
- return map_nt_error_from_unix(errno);
+ return errno;
}
- return NT_STATUS_OK;
+ return 0;
}
const char *macos_string_replace_map =
struct char_mappings **string_replace_init_map(TALLOC_CTX *mem_ctx,
const char **mappings);
-NTSTATUS string_replace_allocate(connection_struct *conn,
- const char *name_in,
- struct char_mappings **cmaps,
- TALLOC_CTX *mem_ctx,
- char **mapped_name,
- enum vfs_translate_direction direction);
+int string_replace_allocate(connection_struct *conn,
+ const char *name_in,
+ struct char_mappings **cmaps,
+ TALLOC_CTX *mem_ctx,
+ char **mapped_name,
+ enum vfs_translate_direction direction);
extern const char *macos_string_replace_map;
enum vfs_translate_direction direction)
{
struct share_mapping_entry *selected;
- NTSTATUS status;
+ int ret;
if (!init_mappings(conn, &selected)) {
/* No mappings found. Just use the old name */
return NT_STATUS_OK;
}
- status = string_replace_allocate(conn,
- name_in,
- selected->mappings,
- talloc_tos(),
- mapped_name,
- direction);
- return status;
+ ret = string_replace_allocate(conn,
+ name_in,
+ selected->mappings,
+ talloc_tos(),
+ mapped_name,
+ direction);
+ if (ret != 0) {
+ return map_nt_error_from_unix(ret);
+ }
+ return NT_STATUS_OK;
}
static int catia_connect(struct vfs_handle_struct *handle,