1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

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
This commit is contained in:
Derrell Lipman 2009-01-16 16:41:36 -05:00
parent 3fe974c4fe
commit 1c77c7f3d5
5 changed files with 36 additions and 0 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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