Commit 2acd0848 authored by Jeremy Allison's avatar Jeremy Allison Committed by Gerald (Jerry) Carter
Browse files

r1154: Change default setting for case sensitivity to "auto". If set to auto

then is the client supports it (current clients supported are Samba and
CIFSVFS - detected by the negprot strings "Samba", "POSIX 2" and a bare
"NT LM 0.12" string) then the setting of the per packet flag smb_flag
FLAG_CASELESS_PATHNAMES is taken into account per packet. This allows
the linux CIFS client to use Samba in a case sensitive manner.
Additional command in smbclient "case_sensitive", toggles the
flag in subsequent packets.
Docs to follow.
Jeremy.
(This used to be commit cf84c0fe1a061acc0313f7db124b8f947cdf623d)
parent 2895acb6
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1868,6 +1868,21 @@ static int cmd_lowercase(void)
	return 0;
}

/****************************************************************************
 Toggle the case sensitive flag.
****************************************************************************/

static int cmd_setcase(void)
{
	BOOL orig_case_sensitive = cli_set_case_sensitive(cli, False);

	cli_set_case_sensitive(cli, !orig_case_sensitive);
	DEBUG(2,("filename case sensitivity is now %s\n",!orig_case_sensitive ?
		"on":"off"));

	return 0;
}

/****************************************************************************
 Toggle the recurse flag.
****************************************************************************/
@@ -2179,6 +2194,7 @@ static struct
  {"archive",cmd_archive,"<level>\n0=ignore archive bit\n1=only get archive files\n2=only get archive files and reset archive bit\n3=get all files and reset archive bit",{COMPL_NONE,COMPL_NONE}},
  {"blocksize",cmd_block,"blocksize <number> (default 20)",{COMPL_NONE,COMPL_NONE}},
  {"cancel",cmd_cancel,"<jobid> cancel a print queue entry",{COMPL_NONE,COMPL_NONE}},
  {"case_sensitive",cmd_setcase,"toggle the case sensitive flag to server",{COMPL_NONE,COMPL_NONE}},
  {"cd",cmd_cd,"[directory] change/report the remote directory",{COMPL_REMOTE,COMPL_NONE}},
  {"chmod",cmd_chmod,"<src> <mode> chmod a file using UNIX permission",{COMPL_REMOTE,COMPL_REMOTE}},
  {"chown",cmd_chown,"<src> <uid> <gid> chown a file using UNIX uids and gids",{COMPL_REMOTE,COMPL_REMOTE}},
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ struct cli_state {
	BOOL (*oplock_handler)(struct cli_state *cli, int fnum, unsigned char level);

	BOOL force_dos_errors;
	BOOL case_sensitive; /* False by default. */

	/* was this structure allocated by cli_initialise? If so, then
           free in cli_shutdown() */
+2 −1
Original line number Diff line number Diff line
@@ -1349,7 +1349,8 @@ enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS};
enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};

/* Remote architectures we know about. */
enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_SAMBA};
enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT,
			RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_SAMBA, RA_CIFSFS};

/* case handling */
enum case_handling {CASE_LOWER,CASE_UPPER};
+18 −1
Original line number Diff line number Diff line
@@ -176,7 +176,12 @@ void cli_setup_packet(struct cli_state *cli)
	SSVAL(cli->outbuf,smb_mid,cli->mid);
	if (cli->protocol > PROTOCOL_CORE) {
		uint16 flags2;
		if (cli->case_sensitive) {
			SCVAL(cli->outbuf,smb_flg,0x0);
		} else {
			/* Default setting, case insensitive. */
			SCVAL(cli->outbuf,smb_flg,0x8);
		}
		flags2 = FLAGS2_LONG_PATH_COMPONENTS;
		if (cli->capabilities & CAP_UNICODE)
			flags2 |= FLAGS2_UNICODE_STRINGS;
@@ -273,6 +278,7 @@ struct cli_state *cli_initialise(struct cli_state *cli)
	cli->outbuf = (char *)malloc(cli->bufsize+SAFETY_MARGIN);
	cli->inbuf = (char *)malloc(cli->bufsize+SAFETY_MARGIN);
	cli->oplock_handler = cli_oplock_ack;
	cli->case_sensitive = False;

	cli->use_spnego = lp_client_use_spnego();

@@ -440,6 +446,17 @@ uint16 cli_setpid(struct cli_state *cli, uint16 pid)
	return ret;
}

/****************************************************************************
 Set the case sensitivity flag on the packets. Returns old state.
****************************************************************************/

BOOL cli_set_case_sensitive(struct cli_state *cli, BOOL case_sensitive)
{
	BOOL ret = cli->case_sensitive;
	cli->case_sensitive = case_sensitive;
	return ret;
}

/****************************************************************************
Send a keepalive packet to the server
****************************************************************************/
+12 −14
Original line number Diff line number Diff line
@@ -364,7 +364,7 @@ typedef struct
	int iBlock_size;
	BOOL bPreexecClose;
	BOOL bRootpreexecClose;
	BOOL bCaseSensitive;
	int  iCaseSensitive;
	BOOL bCasePreserve;
	BOOL bShortCasePreserve;
	BOOL bHideDotFiles;
@@ -487,7 +487,7 @@ static service sDefault = {
	1024,           /* iBlock_size */
	False,			/* bPreexecClose */
	False,			/* bRootpreexecClose */
	False,			/* case sensitive */
	Auto,			/* case sensitive */
	True,			/* case preserve */
	True,			/* short case preserve */
	True,			/* bHideDotFiles */
@@ -980,8 +980,8 @@ static struct parm_struct parm_table[] = {
	{"mangle prefix", P_INTEGER, P_GLOBAL, &Globals.mangle_prefix, NULL, NULL, FLAG_ADVANCED}, 

	{"default case", P_ENUM, P_LOCAL, &sDefault.iDefaultCase, NULL, enum_case, FLAG_ADVANCED | FLAG_SHARE}, 
	{"case sensitive", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, 
	{"casesignames", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, FLAG_HIDE}, 
	{"case sensitive", P_ENUM, P_LOCAL, &sDefault.iCaseSensitive, NULL, enum_bool_auto, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, 
	{"casesignames", P_ENUM, P_LOCAL, &sDefault.iCaseSensitive, NULL, enum_bool_auto, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | 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}, 
	{"mangling char", P_CHAR, P_LOCAL, &sDefault.magic_char, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, 
@@ -1836,7 +1836,7 @@ FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
FN_LOCAL_BOOL(lp_casesensitive, bCaseSensitive)
FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
@@ -2997,10 +2997,8 @@ static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue
{
	int i;

	for (i = 0; parm->enum_list[i].name; i++) 
	{
		if ( strequal(pszParmValue, parm->enum_list[i].name)) 
		{
	for (i = 0; parm->enum_list[i].name; i++) {
		if ( strequal(pszParmValue, parm->enum_list[i].name)) {
			*ptr = parm->enum_list[i].value;
			break;
		}
@@ -3870,10 +3868,11 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
	
	/* get the username for substituion -- preference to the current_user_info */
	
	if ( strlen( current_user_info.smb_name ) != 0 )
	if ( strlen( current_user_info.smb_name ) != 0 ) {
		username = current_user_info.smb_name;
	else
	} else {
		username = sub_get_smb_name();
	}

	standard_sub_basic( username, n2,sizeof(n2) );

@@ -3889,8 +3888,7 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
	init_globals();
	debug_init();

	if (save_defaults)
	{
	if (save_defaults) {
		init_locals();
		lp_save_defaults();
	}
Loading