summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-12-10 03:03:51 +0100
committerVolker Lendecke <vl@samba.org>2008-12-10 17:45:43 +0100
commit31543640e6227e8dc808e365ba0bf6d2d5b08727 (patch)
tree3bd97fde1f30dcfc779ac9e843e001698af3f3dd /source3
parentc7521b25e9f364ced3fbdee3ccb463e93e97a1c3 (diff)
downloadsamba-31543640e6227e8dc808e365ba0bf6d2d5b08727.tar.gz
samba-31543640e6227e8dc808e365ba0bf6d2d5b08727.tar.bz2
samba-31543640e6227e8dc808e365ba0bf6d2d5b08727.zip
Change get_real_filename() to unix syscall conventions, make it non-static
It sets errno, so it might as well return 0/-1.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/filename.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index a5800aa85b..c803e40649 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,