diff options
Diffstat (limited to 'source/smbd/filename.c')
-rw-r--r-- | source/smbd/filename.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/source/smbd/filename.c b/source/smbd/filename.c index d343db26f6b..51246dbc056 100644 --- a/source/smbd/filename.c +++ b/source/smbd/filename.c @@ -1,5 +1,6 @@ /* - Unix SMB/CIFS implementation. + Unix SMB/Netbios implementation. + Version 1.9. filename handling routines Copyright (C) Andrew Tridgell 1992-1998 Copyright (C) Jeremy Allison 1999-200 @@ -29,6 +30,7 @@ extern BOOL case_sensitive; extern BOOL case_preserve; extern BOOL short_case_preserve; +extern fstring remote_machine; extern BOOL use_mangled_map; static BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL docache); @@ -54,10 +56,10 @@ static BOOL fname_equal(char *name1, char *name2) static BOOL mangled_equal(char *name1, const char *name2, int snum) { pstring tmpname; - - pstrcpy(tmpname, name2); - mangle_map(tmpname, True, False, snum); - return strequal(name1, tmpname); + + pstrcpy(tmpname,name2); + mangle_map(tmpname,True,False,snum); + return strequal(name1,tmpname); } /**************************************************************************** @@ -87,7 +89,7 @@ stat struct will be filled with zeros (and this can be detected by checking for nlinks = 0, which can never be true for any file). ****************************************************************************/ -BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_component, +BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component, BOOL *bad_path, SMB_STRUCT_STAT *pst) { SMB_STRUCT_STAT st; @@ -96,6 +98,10 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen pstring orig_path; BOOL component_was_mangled = False; BOOL name_has_wildcard = False; +#if 0 + /* Andrew's conservative code... JRA. */ + extern char magic_char; +#endif ZERO_STRUCTP(pst); @@ -143,7 +149,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen */ if(saved_last_component) { - end = strrchr_m(name, '/'); + end = strrchr(name, '/'); if(end) pstrcpy(saved_last_component, end + 1); else @@ -168,7 +174,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen pstrcpy(orig_path, name); - if(!case_sensitive && stat_cache_lookup(conn, name, dirpath, &start, &st)) { + if(stat_cache_lookup(conn, name, dirpath, &start, &st)) { *pst = st; return True; } @@ -201,7 +207,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen * just a component. JRA. */ - if (mangle_is_mangled(start)) + if(mangle_is_mangled(start)) component_was_mangled = True; /* @@ -218,7 +224,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen /* * Pinpoint the end of this section of the filename. */ - end = strchr_m(start, '/'); + end = strchr(start, '/'); /* * Chop the name at this point. @@ -333,10 +339,10 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen * Don't cache a name with mangled or wildcard components * as this can change the size. */ - + if(!component_was_mangled && !name_has_wildcard) stat_cache_add(orig_path, dirpath); - + /* * Restore the / that we wiped out earlier. */ @@ -381,7 +387,7 @@ BOOL check_name(char *name,connection_struct *conn) errno = 0; - if (IS_VETO_PATH(conn, name)) { + if(IS_VETO_PATH(conn, name)) { if(strcmp(name, ".") && strcmp(name, "..")) { DEBUG(5,("file path name %s vetoed\n",name)); return(0); @@ -397,7 +403,7 @@ BOOL check_name(char *name,connection_struct *conn) #ifdef S_ISLNK if (!lp_symlinks(SNUM(conn))) { SMB_STRUCT_STAT statbuf; - if ( (conn->vfs_ops.lstat(conn,name,&statbuf) != -1) && + if ( (conn->vfs_ops.lstat(conn,dos_to_unix_static(name),&statbuf) != -1) && (S_ISLNK(statbuf.st_mode)) ) { DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name)); ret=0; @@ -436,7 +442,7 @@ static BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL d /* * The incoming name can be mangled, and if we de-mangle it * here it will not compare correctly against the filename (name2) - * read from the directory and then mangled by the mangle_map() + * read from the directory and then mangled by the name_map_mangle() * call. We need to mangle both names or neither. * (JRA). */ |