From 1c77c7f3d5b6cb29fac4606299c237c0e299f836 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Fri, 16 Jan 2009 16:41:36 -0500 Subject: 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 --- source3/libsmb/libsmb_setget.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/libsmb/libsmb_setget.c') 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 -- cgit From 6d300399b52e0921ce205ef2f053b722b21edeeb Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sat, 17 Jan 2009 13:33:25 -0500 Subject: Determine case sensitivity based on file system attributes. - Most of the time, we can determine from the file system we're connecting to whether it supports case sensitivity. In those cases, we now set the internal case sensitivity flag automatically. For those cases where the request to retrieve file system attributes fails, we'll use the user-specified option value. Derrell --- source3/libsmb/libsmb_setget.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source3/libsmb/libsmb_setget.c') diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c index bca2a80d14..9de49a5b3f 100644 --- a/source3/libsmb/libsmb_setget.c +++ b/source3/libsmb/libsmb_setget.c @@ -193,14 +193,26 @@ smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level) c->internal->smb_encryption_level = level; } -/** Get whether to treat file names as case-sensitive. */ +/** + * Get whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ smbc_bool smbc_getOptionCaseSensitive(SMBCCTX *c) { return c->internal->case_sensitive; } -/** Set whether to treat file names as case-sensitive. */ +/** + * Set whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ void smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b) { -- cgit