\pathname.
If returned, remainingpath is untouched. Caller must call
- check_path_syntaxXXX() on it.
+ check_path_syntax() on it.
Called by all non-fileserver processing (DFS RPC, FSCTL_DFS_GET_REFERRALS)
etc. Errors out on any inconsistency in the path.
}
/* Path referrals are always non-POSIX. */
- status = check_path_syntax(reqpath);
+ status = check_path_syntax(reqpath, false);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
return status;
}
/* Junction create paths are always non-POSIX. */
- status = check_path_syntax(reqpath);
+ status = check_path_syntax(reqpath, false);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
/* The following definitions come from smbd/smb2_reply.c */
-NTSTATUS check_path_syntax(char *path);
-NTSTATUS check_path_syntax_posix(char *path);
-NTSTATUS check_path_syntax_smb2(char *path);
-NTSTATUS check_path_syntax_smb2_posix(char *path);
+NTSTATUS check_path_syntax(char *path, bool posix);
NTSTATUS smb1_strip_dfs_path(TALLOC_CTX *mem_ctx,
uint32_t *ucf_flags,
char **in_path);
/****************************************************************************
SMB1 version of smb2_strip_dfs_path()
Differs from SMB2 in that all Windows path separator '\' characters
- have already been converted to '/' by check_path_syntax_internal().
+ have already been converted to '/' by check_path_syntax().
****************************************************************************/
NTSTATUS smb1_strip_dfs_path(TALLOC_CTX *mem_ctx,
}
/* This also converts '\' to '/' */
- if (is_posix) {
- status = check_path_syntax_smb2_posix(filename);
- } else {
- status = check_path_syntax_smb2(filename);
- }
+ status = check_path_syntax(filename, is_posix);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(filename);
return status;
is_posix = (state->posx != NULL);
- if (is_posix) {
- status = check_path_syntax_smb2_posix(state->fname);
- } else {
- /* convert '\\' into '/' */
- status = check_path_syntax_smb2(state->fname);
- }
+ /* convert '\\' into '/' */
+ status = check_path_syntax(state->fname, is_posix);
if (tevent_req_nterror(req, status)) {
return tevent_req_post(req, state->ev);
}
/* Custom version for processing POSIX paths. */
#define IS_PATH_SEP(c,posix_only) ((c) == '/' || (!(posix_only) && (c) == '\\'))
-static NTSTATUS check_path_syntax_internal(char *path,
- bool posix_path)
+NTSTATUS check_path_syntax(char *path, bool posix_path)
{
char *d = path;
const char *s = path;
*d++ = *s++;
break;
default:
- DEBUG(0,("check_path_syntax_internal: character length assumptions invalid !\n"));
+ DBG_ERR("character length assumptions invalid !\n");
*d = '\0';
return NT_STATUS_INVALID_PARAMETER;
}
return ret;
}
-/****************************************************************************
- Ensure we check the path in *exactly* the same way as W2K for regular pathnames.
- No wildcards allowed.
-****************************************************************************/
-
-NTSTATUS check_path_syntax(char *path)
-{
- return check_path_syntax_internal(path, false);
-}
-
-/****************************************************************************
- Check the path for a POSIX client.
- We're assuming here that '/' is not the second byte in any multibyte char
- set (a safe assumption).
-****************************************************************************/
-
-NTSTATUS check_path_syntax_posix(char *path)
-{
- return check_path_syntax_internal(path, true);
-}
-
-NTSTATUS check_path_syntax_smb2(char *path)
-{
- return check_path_syntax_internal(path, false);
-}
-
-NTSTATUS check_path_syntax_smb2_posix(char *path)
-{
- return check_path_syntax_internal(path, true);
-}
-
/****************************************************************************
SMB2-only code to strip an MSDFS prefix from an incoming pathname.
****************************************************************************/
local_path:
- if (posix_pathnames) {
- *err = check_path_syntax_posix(dst);
- } else {
- *err = check_path_syntax(dst);
- }
+ *err = check_path_syntax(dst, posix_pathnames);
return ret;
}
req->flags2 &= ~FLAGS2_DFS_PATHNAMES;
ucf_flags &= ~UCF_DFS_PATHNAME;
- if (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH) {
- status = check_path_syntax_smb2_posix(newname);
- } else {
- status = check_path_syntax_smb2(newname);
- }
+ status = check_path_syntax(newname,
+ fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
req->flags2 &= ~FLAGS2_DFS_PATHNAMES;
ucf_flags &= ~UCF_DFS_PATHNAME;
- if (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH) {
- status = check_path_syntax_smb2_posix(newname);
- } else {
- status = check_path_syntax_smb2(newname);
- }
+ status = check_path_syntax(newname,
+ fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH);
if (!NT_STATUS_IS_OK(status)) {
return status;
}