summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>2009-01-16 16:41:36 -0500
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>2009-01-16 16:41:36 -0500
commit1c77c7f3d5b6cb29fac4606299c237c0e299f836 (patch)
treef50abf80313313ef68781f9550d7ae434092874c /source3
parent3fe974c4feed33187294a0cb922c20f7dbfeaf43 (diff)
downloadsamba-1c77c7f3d5b6cb29fac4606299c237c0e299f836.tar.gz
samba-1c77c7f3d5b6cb29fac4606299c237c0e299f836.tar.bz2
samba-1c77c7f3d5b6cb29fac4606299c237c0e299f836.zip
Treat file names in POSIX-like case-sensitive fashion by default
*** THIS COMMIT CAUSES A CHANGE OF DEFAULT BEHAVIOR IN libsmbclient!!! *** - libsmbclient now calls cli_set_case_sensitive() for a new CLI. By default, it requests case-sensitive, but the old behavior of case-insensitive can be requested with smbc_setOptionCaseSensitive(context, False); The change of behavior is considered a bug fix, as it was previously possible to accidentally overwrite a file that had the same case-insensitive name but a different case-sensitive name as a previously-existing file, while creating a new file. Derrell
Diffstat (limited to 'source3')
-rw-r--r--source3/include/libsmb_internal.h5
-rw-r--r--source3/include/libsmbclient.h9
-rw-r--r--source3/libsmb/libsmb_context.c1
-rw-r--r--source3/libsmb/libsmb_server.c7
-rw-r--r--source3/libsmb/libsmb_setget.c14
5 files changed, 36 insertions, 0 deletions
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index b488116939..8b410b4f7f 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -176,6 +176,11 @@ struct SMBC_internal_data {
*/
smbc_smb_encrypt_level smb_encryption_level;
+ /*
+ * Should we request case sensitivity of file names?
+ */
+ bool case_sensitive;
+
struct smbc_server_cache * server_cache;
/* POSIX emulation functions */
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index a8b27b709e..4a8accbf4e 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -550,6 +550,15 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c);
void
smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level);
+/** Get whether to treat file names as case-sensitive. */
+smbc_bool
+smbc_getOptionCaseSensitive(SMBCCTX *c);
+
+/** Set whether to treat file names as case-sensitive. */
+void
+smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b);
+
+
/**
* Get from how many local master browsers should the list of workgroups be
* retrieved. It can take up to 12 minutes or longer after a server becomes a
diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c
index 66329e2860..ca8ceedbc2 100644
--- a/source3/libsmb/libsmb_context.c
+++ b/source3/libsmb/libsmb_context.c
@@ -69,6 +69,7 @@ smbc_new_context(void)
smbc_setOptionFullTimeNames(context, False);
smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE);
smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE);
+ smbc_setOptionCaseSensitive(context, True);
smbc_setOptionBrowseMaxLmbCount(context, 3); /* # LMBs to query */
smbc_setOptionUrlEncodeReaddirEntries(context, False);
smbc_setOptionOneSharePerServer(context, False);
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index f4714346d1..e2cc07118b 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -356,6 +356,13 @@ again:
return NULL;
}
+ /* POSIX-like - always request case-sensitivity by default. */
+ if (smbc_getOptionCaseSensitive(context)) {
+ cli_set_case_sensitive(c, True);
+ } else {
+ cli_set_case_sensitive(c, False);
+ }
+
if (smbc_getOptionUseKerberos(context)) {
c->use_kerberos = True;
}
diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c
index d0823bd77e..bca2a80d14 100644
--- a/source3/libsmb/libsmb_setget.c
+++ b/source3/libsmb/libsmb_setget.c
@@ -193,6 +193,20 @@ smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level)
c->internal->smb_encryption_level = level;
}
+/** Get whether to treat file names as case-sensitive. */
+smbc_bool
+smbc_getOptionCaseSensitive(SMBCCTX *c)
+{
+ return c->internal->case_sensitive;
+}
+
+/** Set whether to treat file names as case-sensitive. */
+void
+smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b)
+{
+ c->internal->case_sensitive = b;
+}
+
/**
* Get from how many local master browsers should the list of workgroups be
* retrieved. It can take up to 12 minutes or longer after a server becomes a