From 31543640e6227e8dc808e365ba0bf6d2d5b08727 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 10 Dec 2008 03:03:51 +0100 Subject: [PATCH] Change get_real_filename() to unix syscall conventions, make it non-static It sets errno, so it might as well return 0/-1. --- source3/smbd/filename.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index a5800aa85b3..c803e406491 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -26,9 +26,9 @@ #include "includes.h" -static bool get_real_filename(connection_struct *conn, const char *path, - const char *name, TALLOC_CTX *mem_ctx, - char **found_name); +static int get_real_filename(connection_struct *conn, const char *path, + const char *name, TALLOC_CTX *mem_ctx, + char **found_name); static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, connection_struct *conn, const char *orig_path, @@ -434,8 +434,9 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, */ if (name_has_wildcard || - !get_real_filename(conn, dirpath, start, - talloc_tos(), &found_name)) { + (get_real_filename( + conn, dirpath, start, + talloc_tos(), &found_name) == -1)) { char *unmangled; if (end) { @@ -769,9 +770,9 @@ static bool fname_equal(const char *name1, const char *name2, If the name looks like a mangled name then try via the mangling functions ****************************************************************************/ -static bool get_real_filename(connection_struct *conn, const char *path, - const char *name, TALLOC_CTX *mem_ctx, - char **found_name) +int get_real_filename(connection_struct *conn, const char *path, + const char *name, TALLOC_CTX *mem_ctx, + char **found_name) { struct smb_Dir *cur_dir; const char *dname; @@ -792,7 +793,7 @@ static bool get_real_filename(connection_struct *conn, const char *path, */ if (!mangled && !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) { errno = ENOENT; - return False; + return -1; } /* @@ -824,7 +825,7 @@ static bool get_real_filename(connection_struct *conn, const char *path, if (!(cur_dir = OpenDir(talloc_tos(), conn, path, NULL, 0))) { DEBUG(3,("scan dir didn't open dir [%s]\n",path)); TALLOC_FREE(unmangled_name); - return(False); + return -1; } /* now scan for matching names */ @@ -855,16 +856,16 @@ static bool get_real_filename(connection_struct *conn, const char *path, TALLOC_FREE(cur_dir); if (!*found_name) { errno = ENOMEM; - return False; + return -1; } - return(True); + return 0; } } TALLOC_FREE(unmangled_name); TALLOC_FREE(cur_dir); errno = ENOENT; - return False; + return -1; } static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, -- 2.34.1