summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-05-07 18:37:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:30 -0500
commite0da56a84808c522bc7324b5d636f1cbd317a2c5 (patch)
tree5522c069c408792851c5eb747feb5b5981373131 /source3
parent5cb65233cd5c4f3c740ff3d06807296c2032377d (diff)
downloadsamba-e0da56a84808c522bc7324b5d636f1cbd317a2c5.tar.gz
samba-e0da56a84808c522bc7324b5d636f1cbd317a2c5.tar.bz2
samba-e0da56a84808c522bc7324b5d636f1cbd317a2c5.zip
r570: Remove lots of globals to handle case issues - move them
to connection struct entries (as they should have been from the start). Jerry, once you've cut over to 3.0.4 release branch I'll add this to 3.0 also. - Jerry cut over :-). Jeremy. (This used to be commit 578a508509d21226ad3332fc54c3ab54cd8ae452)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/mangle.h2
-rw-r--r--source3/include/smb.h5
-rw-r--r--source3/include/smb_macros.h6
-rw-r--r--source3/lib/util.c17
-rw-r--r--source3/lib/util_str.c6
-rw-r--r--source3/lib/util_unistr.c12
-rw-r--r--source3/param/loadparm.c4
-rw-r--r--source3/smbd/filename.c31
-rw-r--r--source3/smbd/mangle.c2
-rw-r--r--source3/smbd/mangle_hash.c22
-rw-r--r--source3/smbd/mangle_hash2.c2
-rw-r--r--source3/smbd/nttrans.c53
-rw-r--r--source3/smbd/reply.c23
-rw-r--r--source3/smbd/service.c18
-rw-r--r--source3/smbd/statcache.c6
-rw-r--r--source3/smbd/trans2.c13
16 files changed, 89 insertions, 133 deletions
diff --git a/source3/include/mangle.h b/source3/include/mangle.h
index 769278d828..1d7cdf7362 100644
--- a/source3/include/mangle.h
+++ b/source3/include/mangle.h
@@ -9,6 +9,6 @@ struct mangle_fns {
BOOL (*is_8_3)(const char *fname, BOOL check_case, BOOL allow_wildcards);
void (*reset)(void);
BOOL (*check_cache)(char *s);
- void (*name_map)(char *OutName, BOOL need83, BOOL cache83);
+ void (*name_map)(char *OutName, BOOL need83, BOOL cache83, int default_case);
};
#endif /* _MANGLE_H_ */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 30eb82ddf5..54a69d1433 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -503,6 +503,11 @@ typedef struct connection_struct
time_t lastused;
BOOL used;
int num_files_open;
+
+ BOOL case_sensitive;
+ BOOL case_preserve;
+ BOOL short_case_preserve;
+
name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index e847714443..bcbaa64f86 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -122,9 +122,9 @@
#define MAP_HIDDEN(conn) ((conn) && lp_map_hidden((conn)->service))
#define MAP_SYSTEM(conn) ((conn) && lp_map_system((conn)->service))
#define MAP_ARCHIVE(conn) ((conn) && lp_map_archive((conn)->service))
-#define IS_HIDDEN_PATH(conn,path) ((conn) && is_in_path((path),(conn)->hide_list))
-#define IS_VETO_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_list))
-#define IS_VETO_OPLOCK_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_oplock_list))
+#define IS_HIDDEN_PATH(conn,path) ((conn) && is_in_path((path),(conn)->hide_list,(conn)->case_sensitive))
+#define IS_VETO_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_list,(conn)->case_sensitive))
+#define IS_VETO_OPLOCK_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_oplock_list,(conn)->case_sensitive))
/*
* Used by the stat cache code to check if a returned
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 3f57048a00..527e1376d1 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -63,19 +63,6 @@ int chain_size = 0;
int trans_num = 0;
-/*
- case handling on filenames
-*/
-int case_default = CASE_LOWER;
-
-/* the following control case operations - they are put here so the
- client can link easily */
-BOOL case_sensitive;
-BOOL case_preserve;
-BOOL use_mangled_map = False;
-BOOL short_case_preserve;
-BOOL case_mangle;
-
static enum remote_arch_types ra_type = RA_UNKNOWN;
pstring user_socket_options=DEFAULT_SOCKET_OPTIONS;
@@ -609,7 +596,7 @@ void unix_clean_name(char *s)
Make a dir struct.
****************************************************************************/
-void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T size,int mode,time_t date)
+void make_dir_struct(char *buf, const char *mask, const char *fname,SMB_OFF_T size,int mode,time_t date, BOOL case_sensitive)
{
char *p;
pstring mask2;
@@ -1500,7 +1487,7 @@ const char *readdirname(DIR *p)
of a path matches a (possibly wildcarded) entry in a namelist.
********************************************************************/
-BOOL is_in_path(const char *name, name_compare_entry *namelist)
+BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensitive)
{
pstring last_component;
char *p;
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 600c830ace..65ef306ed1 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -334,9 +334,8 @@ char *strupper_static(const char *s)
Convert a string to "normal" form.
**/
-void strnorm(char *s)
+void strnorm(char *s, int case_default)
{
- extern int case_default;
if (case_default == CASE_UPPER)
strupper_m(s);
else
@@ -347,9 +346,8 @@ void strnorm(char *s)
Check if a string is in "normal" case.
**/
-BOOL strisnormal(const char *s)
+BOOL strisnormal(const char *s, int case_default)
{
- extern int case_default;
if (case_default == CASE_UPPER)
return(!strhaslower(s));
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 005f10a4c0..bfb5288826 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -506,13 +506,13 @@ BOOL strupper_w(smb_ucs2_t *s)
/*******************************************************************
convert a string to "normal" form
********************************************************************/
-void strnorm_w(smb_ucs2_t *s)
+
+void strnorm_w(smb_ucs2_t *s, int case_default)
{
- extern int case_default;
- if (case_default == CASE_UPPER)
- strupper_w(s);
- else
- strlower_w(s);
+ if (case_default == CASE_UPPER)
+ strupper_w(s);
+ else
+ strlower_w(s);
}
int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b)
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index e47fc3ebad..b378342372 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -365,7 +365,6 @@ typedef struct
BOOL bCaseSensitive;
BOOL bCasePreserve;
BOOL bShortCasePreserve;
- BOOL bCaseMangle;
BOOL bHideDotFiles;
BOOL bHideSpecialFiles;
BOOL bHideUnReadable;
@@ -489,7 +488,6 @@ static service sDefault = {
False, /* case sensitive */
True, /* case preserve */
True, /* short case preserve */
- False, /* case mangle */
True, /* bHideDotFiles */
False, /* bHideSpecialFiles */
False, /* bHideUnReadable */
@@ -982,7 +980,6 @@ static struct parm_struct parm_table[] = {
{"casesignames", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, FLAG_HIDE},
{"preserve case", P_BOOL, P_LOCAL, &sDefault.bCasePreserve, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
{"short preserve case", P_BOOL, P_LOCAL, &sDefault.bShortCasePreserve, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
- {"mangle case", P_BOOL, P_LOCAL, &sDefault.bCaseMangle, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
{"mangling char", P_CHAR, P_LOCAL, &sDefault.magic_char, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
{"hide dot files", P_BOOL, P_LOCAL, &sDefault.bHideDotFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
{"hide special files", P_BOOL, P_LOCAL, &sDefault.bHideSpecialFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
@@ -1833,7 +1830,6 @@ FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
FN_LOCAL_BOOL(lp_casesensitive, bCaseSensitive)
FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
-FN_LOCAL_BOOL(lp_casemangle, bCaseMangle)
FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 805af9c494..692c7f7610 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -26,11 +26,6 @@
#include "includes.h"
-extern BOOL case_sensitive;
-extern BOOL case_preserve;
-extern BOOL short_case_preserve;
-extern BOOL use_mangled_map;
-
static BOOL scan_directory(const char *path, char *name,size_t maxlength,
connection_struct *conn,BOOL docache);
@@ -39,7 +34,7 @@ static BOOL scan_directory(const char *path, char *name,size_t maxlength,
This needs to be careful about whether we are case sensitive.
****************************************************************************/
-static BOOL fname_equal(const char *name1, const char *name2)
+static BOOL fname_equal(const char *name1, const char *name2, BOOL case_sensitive)
{
/* Normal filename handling */
if (case_sensitive)
@@ -152,13 +147,17 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
pstrcpy(saved_last_component, name);
}
- if (!case_sensitive && (!case_preserve || (mangle_is_8_3(name, False) && !short_case_preserve)))
- strnorm(name);
+#if 1
+ if (!conn->case_preserve || (mangle_is_8_3(name, False) && !conn->short_case_preserve))
+#else
+ if (!conn->case_sensitive && (!conn->case_preserve || (mangle_is_8_3(name, False) && !conn->short_case_preserve)))
+#endif
+ strnorm(name, lp_defaultcase(SNUM(conn)));
start = name;
pstrcpy(orig_path, name);
- if(!case_sensitive && stat_cache_lookup(conn, name, dirpath, &start, &st)) {
+ if(!conn->case_sensitive && stat_cache_lookup(conn, name, dirpath, &start, &st)) {
*pst = st;
return True;
}
@@ -168,7 +167,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
*/
if (SMB_VFS_STAT(conn,name,&st) == 0) {
- stat_cache_add(orig_path, name);
+ stat_cache_add(orig_path, name, conn->case_sensitive);
DEBUG(5,("conversion finished %s -> %s\n",orig_path, name));
*pst = st;
return(True);
@@ -181,7 +180,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
* sensitive then searching won't help.
*/
- if (case_sensitive && !mangle_is_mangled(name) && !use_mangled_map)
+ if (conn->case_sensitive && !mangle_is_mangled(name) && !*lp_mangled_map(SNUM(conn)))
return(False);
name_has_wildcard = ms_has_wild(start);
@@ -297,8 +296,8 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
* don't normalise it.
*/
- if (!case_preserve && (!strhasupper(start) || !strhaslower(start)))
- strnorm(start);
+ if (!conn->case_preserve && (!strhasupper(start) || !strhaslower(start)))
+ strnorm(start, lp_defaultcase(SNUM(conn)));
/*
* check on the mangled stack to see if we can recover the
@@ -353,7 +352,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
*/
if(!component_was_mangled && !name_has_wildcard)
- stat_cache_add(orig_path, dirpath);
+ stat_cache_add(orig_path, dirpath, conn->case_sensitive);
/*
* Restore the / that we wiped out earlier.
@@ -368,7 +367,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
*/
if(!component_was_mangled && !name_has_wildcard)
- stat_cache_add(orig_path, name);
+ stat_cache_add(orig_path, name, conn->case_sensitive);
/*
* The name has been resolved.
@@ -482,7 +481,7 @@ static BOOL scan_directory(const char *path, char *name, size_t maxlength,
* against unmangled name.
*/
- if ((mangled && mangled_equal(name,dname,SNUM(conn))) || fname_equal(name, dname)) {
+ if ((mangled && mangled_equal(name,dname,SNUM(conn))) || fname_equal(name, dname, conn->case_sensitive)) {
/* we've found the file, change it's name and return */
if (docache)
DirCacheAdd(path,name,dname,SNUM(conn));
diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c
index c5d7582c03..b77fe601b6 100644
--- a/source3/smbd/mangle.c
+++ b/source3/smbd/mangle.c
@@ -120,5 +120,5 @@ void mangle_map(pstring OutName, BOOL need83, BOOL cache83, int snum)
/* invoke the inane "mangled map" code */
mangle_map_filename(OutName, snum);
- mangle_fns->name_map(OutName, need83, cache83);
+ mangle_fns->name_map(OutName, need83, cache83, lp_defaultcase(snum));
}
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c
index 16722ae6e9..7b8cbdbddb 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -51,13 +51,6 @@
/* -------------------------------------------------------------------------- **
- * External Variables...
- */
-
-extern int case_default; /* Are conforming 8.3 names all upper or lower? */
-extern BOOL case_mangle; /* If true, all chars in 8.3 should be same case. */
-
-/* -------------------------------------------------------------------------- **
* Other stuff...
*
* magic_char - This is the magic char used for mangling. It's
@@ -130,13 +123,6 @@ static BOOL mc_initialized = False;
#define MANGLED_CACHE_MAX_ENTRIES 1024
#define MANGLED_CACHE_MAX_MEMORY 0
-/* -------------------------------------------------------------------------- **
- * External Variables...
- */
-
-extern int case_default; /* Are conforming 8.3 names all upper or lower? */
-extern BOOL case_mangle; /* If true, all chars in 8.3 should be same case. */
-
/* -------------------------------------------------------------------- */
static NTSTATUS has_valid_83_chars(const smb_ucs2_t *s, BOOL allow_wildcards)
@@ -639,7 +625,7 @@ static BOOL check_cache( char *s )
* the buffer must be able to hold 13 characters (including the null)
*****************************************************************************
*/
-static void to_8_3(char *s)
+static void to_8_3(char *s, int default_case)
{
int csum;
char *p;
@@ -653,7 +639,7 @@ static void to_8_3(char *s)
p = strrchr(s,'.');
if( p && (strlen(p+1) < (size_t)4) ) {
- BOOL all_normal = ( strisnormal(p+1) ); /* XXXXXXXXX */
+ BOOL all_normal = ( strisnormal(p+1, default_case) ); /* XXXXXXXXX */
if( all_normal && p[1] != 0 ) {
*p = 0;
@@ -728,7 +714,7 @@ static void to_8_3(char *s)
* ****************************************************************************
*/
-static void name_map(char *OutName, BOOL need83, BOOL cache83)
+static void name_map(char *OutName, BOOL need83, BOOL cache83, int default_case)
{
smb_ucs2_t *OutName_ucs2;
DEBUG(5,("name_map( %s, need83 = %s, cache83 = %s)\n", OutName,
@@ -750,7 +736,7 @@ static void name_map(char *OutName, BOOL need83, BOOL cache83)
if (cache83)
tmp = strdup(OutName);
- to_8_3(OutName);
+ to_8_3(OutName, default_case);
if(tmp != NULL) {
cache_mangled_name(OutName, tmp);
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index 62087e7e59..dcfd7663ba 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -501,7 +501,7 @@ static BOOL is_legal_name(const char *name)
the name parameter must be able to hold 13 bytes
*/
-static void name_map(fstring name, BOOL need83, BOOL cache83)
+static void name_map(fstring name, BOOL need83, BOOL cache83, int default_case)
{
char *dot_p;
char lead_chars[7];
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index e4ddda104e..26be4434fd 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -24,9 +24,6 @@
extern int Protocol;
extern int smb_read_error;
extern int global_oplock_break;
-extern BOOL case_sensitive;
-extern BOOL case_preserve;
-extern BOOL short_case_preserve;
extern struct current_user current_user;
static const char *known_nt_pipes[] = {
@@ -274,33 +271,33 @@ static BOOL saved_short_case_preserve;
Save case semantics.
****************************************************************************/
-static void set_posix_case_semantics(uint32 file_attributes)
+static void set_posix_case_semantics(connection_struct *conn, uint32 file_attributes)
{
if(!(file_attributes & FILE_FLAG_POSIX_SEMANTICS))
return;
- saved_case_sensitive = case_sensitive;
- saved_case_preserve = case_preserve;
- saved_short_case_preserve = short_case_preserve;
+ saved_case_sensitive = conn->case_sensitive;
+ saved_case_preserve = conn->case_preserve;
+ saved_short_case_preserve = conn->short_case_preserve;
/* Set to POSIX. */
- case_sensitive = True;
- case_preserve = True;
- short_case_preserve = True;
+ conn->case_sensitive = True;
+ conn->case_preserve = True;
+ conn->short_case_preserve = True;
}
/****************************************************************************
Restore case semantics.
****************************************************************************/
-static void restore_case_semantics(uint32 file_attributes)
+static void restore_case_semantics(connection_struct *conn, uint32 file_attributes)
{
if(!(file_attributes & FILE_FLAG_POSIX_SEMANTICS))
return;
- case_sensitive = saved_case_sensitive;
- case_preserve = saved_case_preserve;
- short_case_preserve = saved_short_case_preserve;
+ conn->case_sensitive = saved_case_sensitive;
+ conn->case_preserve = saved_case_preserve;
+ conn->short_case_preserve = saved_short_case_preserve;
}
/****************************************************************************
@@ -762,7 +759,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
* Check if POSIX semantics are wanted.
*/
- set_posix_case_semantics(file_attributes);
+ set_posix_case_semantics(conn, file_attributes);
unix_convert(fname,conn,0,&bad_path,&sbuf);
@@ -781,7 +778,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, &smb_action);
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
if(!fsp) {
END_PROFILE(SMBntcreateX);
@@ -847,7 +844,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
*/
if (create_options & FILE_NON_DIRECTORY_FILE) {
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
SSVAL(outbuf, smb_flg2,
SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
END_PROFILE(SMBntcreateX);
@@ -858,20 +855,20 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, &smb_action);
if(!fsp) {
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
END_PROFILE(SMBntcreateX);
return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
}
} else {
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
END_PROFILE(SMBntcreateX);
return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
}
}
}
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
file_len = sbuf.st_size;
fmode = dos_mode(conn,fname,&sbuf);
@@ -1285,7 +1282,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
* Check if POSIX semantics are wanted.
*/
- set_posix_case_semantics(file_attributes);
+ set_posix_case_semantics(conn, file_attributes);
RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
@@ -1313,7 +1310,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, &smb_action);
if(!fsp) {
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
}
@@ -1336,7 +1333,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
*/
if (create_options & FILE_NON_DIRECTORY_FILE) {
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
return ERROR_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
}
@@ -1345,11 +1342,11 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, &smb_action);
if(!fsp) {
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
}
} else {
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
}
}
@@ -1361,7 +1358,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
if (fmode & aDIR) {
close_file(fsp,False);
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
return ERROR_DOS(ERRDOS,ERRnoaccess);
}
@@ -1384,11 +1381,11 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
if (sd_len && !NT_STATUS_IS_OK(status = set_sd( fsp, data, sd_len, ALL_SECURITY_INFORMATION))) {
close_file(fsp,False);
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
return ERROR_NT(status);
}
- restore_case_semantics(file_attributes);
+ restore_case_semantics(conn, file_attributes);
/* Save the requested allocation size. */
allocation_size = (SMB_BIG_UINT)IVAL(params,12);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index ac239c7e04..2046f2370a 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -31,9 +31,6 @@ extern int Protocol;
extern int max_send;
extern int max_recv;
extern char magic_char;
-extern BOOL case_sensitive;
-extern BOOL case_preserve;
-extern BOOL short_case_preserve;
extern int global_oplock_break;
unsigned int smb_echo_count = 0;
@@ -881,7 +878,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if (ok) {
if ((dirtype&0x1F) == aVOLID) {
memcpy(p,status,21);
- make_dir_struct(p,"???????????",volume_label(SNUM(conn)),0,aVOLID,0);
+ make_dir_struct(p,"???????????",volume_label(SNUM(conn)),0,aVOLID,0,conn->case_sensitive);
dptr_fill(p+12,dptr_num);
if (dptr_zero(p+12) && (status_len==0))
numentries = 1;
@@ -901,7 +898,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
finished = !get_dir_entry(conn,mask,dirtype,fname,&size,&mode,&date,check_descend);
if (!finished) {
memcpy(p,status,21);
- make_dir_struct(p,mask,fname,size,mode,date);
+ make_dir_struct(p,mask,fname,size,mode,date,conn->case_sensitive);
dptr_fill(p+12,dptr_num);
numentries++;
}
@@ -1570,7 +1567,7 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name)
}
}
- if(!mask_match(fname, mask, case_sensitive))
+ if(!mask_match(fname, mask, conn->case_sensitive))
continue;
if (sys_direntry) {
@@ -3515,7 +3512,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, char *
* filename).
*/
- if((case_sensitive == False) && (case_preserve == True) &&
+ if((conn->case_sensitive == False) && (conn->case_preserve == True) &&
strequal(newname, fsp->fsp_name)) {
char *p;
pstring newname_modified_last_component;
@@ -3689,7 +3686,7 @@ NTSTATUS rename_internals(connection_struct *conn, char *name, char *newname, ui
DEBUG(3,("rename_internals: case_sensitive = %d, case_preserve = %d, short case preserve = %d, \
directory = %s, newname = %s, last_component_dest = %s, is_8_3 = %d\n",
- case_sensitive, case_preserve, short_case_preserve, directory,
+ conn->case_sensitive, conn->case_preserve, conn->short_case_preserve, directory,
newname, last_component_dest, is_short_name));
/*
@@ -3700,10 +3697,10 @@ directory = %s, newname = %s, last_component_dest = %s, is_8_3 = %d\n",
* the rename (user is trying to change the case of the
* filename).
*/
- if((case_sensitive == False) &&
- (((case_preserve == True) &&
+ if((conn->case_sensitive == False) &&
+ (((conn->case_preserve == True) &&
(is_short_name == False)) ||
- ((short_case_preserve == True) &&
+ ((conn->short_case_preserve == True) &&
(is_short_name == True))) &&
strcsequal(directory, newname)) {
pstring modified_last_component;
@@ -3839,7 +3836,7 @@ directory = %s, newname = %s, last_component_dest = %s, is_8_3 = %d\n",
}
}
- if(!mask_match(fname, mask, case_sensitive))
+ if(!mask_match(fname, mask, conn->case_sensitive))
continue;
if (sysdir_entry) {
@@ -4172,7 +4169,7 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
pstring fname;
pstrcpy(fname,dname);
- if(!mask_match(fname, mask, case_sensitive))
+ if(!mask_match(fname, mask, conn->case_sensitive))
continue;
error = ERRnoaccess;
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 08b6648249..93b017e94c 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -21,12 +21,6 @@
#include "includes.h"
extern struct timeval smb_last_time;
-extern int case_default;
-extern BOOL case_preserve;
-extern BOOL short_case_preserve;
-extern BOOL case_mangle;
-extern BOOL case_sensitive;
-extern BOOL use_mangled_map;
extern userdom_struct current_user_info;
@@ -62,13 +56,7 @@ BOOL set_current_service(connection_struct *conn,BOOL do_chdir)
last_conn = conn;
- case_default = lp_defaultcase(snum);
- case_preserve = lp_preservecase(snum);
- short_case_preserve = lp_shortpreservecase(snum);
- case_mangle = lp_casemangle(snum);
- case_sensitive = lp_casesensitive(snum);
magic_char = lp_magicchar(snum);
- use_mangled_map = (*lp_mangled_map(snum) ? True:False);
return(True);
}
@@ -357,6 +345,12 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
conn->printer = (strncmp(dev,"LPT",3) == 0);
conn->ipc = ((strncmp(dev,"IPC",3) == 0) || strequal(dev,"ADMIN$"));
conn->dirptr = NULL;
+
+ /* Case options for the share. */
+ conn->case_sensitive = lp_casesensitive(snum);
+ conn->case_preserve = lp_preservecase(snum);
+ conn->short_case_preserve = lp_shortpreservecase(snum);
+
conn->veto_list = NULL;
conn->hide_list = NULL;
conn->veto_oplock_list = NULL;
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index d996f5e493..5e78e9a499 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -22,8 +22,6 @@
#include "includes.h"
-extern BOOL case_sensitive;
-
/****************************************************************************
Stat cache code used in unix_convert.
*****************************************************************************/
@@ -50,7 +48,7 @@ static hash_table stat_cache;
*
*/
-void stat_cache_add( const char *full_orig_name, const char *orig_translated_path)
+void stat_cache_add( const char *full_orig_name, const char *orig_translated_path, BOOL case_sensitive)
{
stat_cache_entry *scp;
stat_cache_entry *found_scp;
@@ -222,7 +220,7 @@ BOOL stat_cache_lookup(connection_struct *conn, pstring name, pstring dirpath,
(name[1] == '.' && name[1] == '\0'))))
return False;
- if (case_sensitive) {
+ if (conn->case_sensitive) {
chk_name = strdup(name);
if (!chk_name) {
DEBUG(0, ("stat_cache_lookup: strdup failed!\n"));
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 0c6026392c..25954d4433 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -24,7 +24,6 @@
#include "includes.h"
extern int Protocol;
-extern BOOL case_sensitive;
extern int smb_read_error;
extern fstring local_machine;
extern int global_oplock_break;
@@ -883,8 +882,8 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
pstrcpy(fname,dname);
- if(!(got_match = *got_exact_match = exact_match(fname, mask, case_sensitive)))
- got_match = mask_match(fname, mask, case_sensitive);
+ if(!(got_match = *got_exact_match = exact_match(fname, mask, conn->case_sensitive)))
+ got_match = mask_match(fname, mask, conn->case_sensitive);
if(!got_match && !mangle_is_8_3(fname, False)) {
@@ -898,8 +897,8 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
pstring newname;
pstrcpy( newname, fname);
mangle_map( newname, True, False, SNUM(conn));
- if(!(got_match = *got_exact_match = exact_match(newname, mask, case_sensitive)))
- got_match = mask_match(newname, mask, case_sensitive);
+ if(!(got_match = *got_exact_match = exact_match(newname, mask, conn->case_sensitive)))
+ got_match = mask_match(newname, mask, conn->case_sensitive);
}
if(got_match) {
@@ -1433,7 +1432,7 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
a different TRANS2 call. */
DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n", conn->dirpath,lp_dontdescend(SNUM(conn))));
- if (in_list(conn->dirpath,lp_dontdescend(SNUM(conn)),case_sensitive))
+ if (in_list(conn->dirpath,lp_dontdescend(SNUM(conn)),conn->case_sensitive))
dont_descend = True;
p = pdata;
@@ -1633,7 +1632,7 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
a different TRANS2 call. */
DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n",conn->dirpath,lp_dontdescend(SNUM(conn))));
- if (in_list(conn->dirpath,lp_dontdescend(SNUM(conn)),case_sensitive))
+ if (in_list(conn->dirpath,lp_dontdescend(SNUM(conn)),conn->case_sensitive))
dont_descend = True;
p = pdata;