Commit c2ccdf15 authored by Steve French's avatar Steve French Committed by Steve French

add missing mount option iocharset to cifs vfs

parent 19517de1
Version 0.93
------------
Add missing mount options including iocharset. SMP fixes in write and open.
Fix errors in reconnecting after TCP session failure. Fix module unloading
of default nls codepage
Version 0.92
------------
Active smb transactions should never go negative (fix double FreeXid). Fix
......
......@@ -127,6 +127,13 @@ A partial list of the supported mount options follows:
this overrides the default mode for directory inodes.
port attempt to contact the server on this tcp port, before
trying the usual ports (port 445, then 139).
iocharset Codepage used to convert local path names to and from
Unicode. Unicode is used by default for network path
names if the server supports it. If iocharset is
not specified then the nls_default specified
during the local client kernel build will be used.
If server does not support Unicode, this parameter is
unused.
rsize default read size
wsize default write size
rw mount the network share read-write (note that the
......
......@@ -81,7 +81,6 @@ cifs_read_super(struct super_block *sb, void *data,
cifs_sb = CIFS_SB(sb);
if(cifs_sb == NULL)
return -ENOMEM;
cifs_sb->local_nls = load_nls_default(); /* needed for ASCII cp to Unicode converts */
rc = cifs_mount(sb, cifs_sb, data, devname);
......
......@@ -62,6 +62,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
if(!rc)
reopen_files(tcon,nls_codepage);
}
unload_nls(nls_codepage);
}
}
if(rc)
......
......@@ -52,6 +52,7 @@ struct smb_vol {
char *domainname;
char *UNC;
char *UNCip;
char *iocharset; /* local code page for mapping to and from Unicode */
char *source_rfc1001_name; /* netbios name of client */
uid_t linux_uid;
gid_t linux_gid;
......@@ -434,6 +435,20 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
printk(KERN_WARNING "CIFS: domain name too long\n");
return 1;
}
} else if (strnicmp(data, "iocharset", 9) == 0) {
if (!value || !*value) {
printk(KERN_WARNING "CIFS: invalid iocharset specified\n");
return 1; /* needs_arg; */
}
if (strnlen(value, 65) < 65) {
if(strnicmp(value,"default",7))
vol->iocharset = value;
/* if iocharset not set load_nls_default used by caller */
cFYI(1, ("iocharset set to %s",value));
} else {
printk(KERN_WARNING "CIFS: iocharset name too long.\n");
return 1;
}
} else if (strnicmp(data, "uid", 3) == 0) {
if (value && *value) {
vol->linux_uid =
......@@ -878,6 +893,19 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
return -EINVAL;
}
/* this is needed for ASCII cp to Unicode converts */
if(volume_info.iocharset == NULL) {
cifs_sb->local_nls = load_nls_default();
/* load_nls_default can not return null */
} else {
cifs_sb->local_nls = load_nls(volume_info.iocharset);
if(cifs_sb->local_nls == NULL) {
cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset));
FreeXid(xid);
return -ELIBACC;
}
}
existingCifsSes =
find_tcp_session(sin_server.sin_addr.s_addr,
volume_info.username, &srvTcp);
......
......@@ -6,7 +6,7 @@
SMB authentication protocol
Copyright (C) Andrew Tridgell 1998
Modified by Steve French (sfrench@us.ibm.com) 2002
Modified by Steve French (sfrench@us.ibm.com) 2002,2003
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -376,41 +376,3 @@ cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
key2[0] = key[7];
smbhash(out + 8, in + 8, key2, forw);
}
void
SamOEMhash(unsigned char *data, unsigned char *key, int val)
{
unsigned char s_box[256];
unsigned char index_i = 0;
unsigned char index_j = 0;
unsigned char j = 0;
int ind;
for (ind = 0; ind < 256; ind++) {
s_box[ind] = (unsigned char) ind;
}
for (ind = 0; ind < 256; ind++) {
unsigned char tc;
j += (s_box[ind] + key[ind % 16]);
tc = s_box[ind];
s_box[ind] = s_box[j];
s_box[j] = tc;
}
for (ind = 0; ind < val; ind++) {
unsigned char tc;
unsigned char t;
index_i++;
index_j += s_box[index_i];
tc = s_box[index_i];
s_box[index_i] = s_box[index_j];
s_box[index_j] = tc;
t = s_box[index_i] + s_box[index_j];
data[ind] = data[ind] ^ s_box[t];
}
}
......@@ -63,7 +63,6 @@ void cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key);
void cred_hash2(unsigned char *out, unsigned char *in, unsigned char *key);
void cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key,
int forw);
void SamOEMhash(unsigned char *data, unsigned char *key, int val);
/*The following definitions come from libsmb/smbencrypt.c */
......@@ -75,8 +74,6 @@ void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
void NTLMSSPOWFencrypt(unsigned char passwd[8],
unsigned char *ntlmchalresp, unsigned char p24[24]);
void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
int make_oem_passwd_hash(char data[516], const char *passwd,
unsigned char old_pw_hash[16], int unicode);
int decode_pw_buffer(char in_buffer[516], char *new_pwrd,
int new_pwrd_size, __u32 * new_pw_len);
......@@ -346,46 +343,6 @@ static struct data_blob LMv2_generate_response(const unsigned char ntlm_v2_hash[
return final_response;
}
int make_oem_passwd_hash(char data[516], const char *passwd,
unsigned char old_pw_hash[16], int unicode)
{
int new_pw_len = strlen(passwd) * (unicode ? 2 : 1);
if (new_pw_len > 512) {
cERROR(1,
("CIFS make_oem_passwd_hash: new password is too long."));
return FALSE;
}
/*
* Now setup the data area.
* We need to generate a random fill
* for this area to make it harder to
* decrypt. JRA.
*
*/
get_random_bytes(data, sizeof (data));
if (unicode) {
/* Note that passwd should be in DOS oem character set. */
/* dos_struni2( &data[512 - new_pw_len], passwd, 512); */
cifs_strtoUCS((wchar_t *) & data[512 - new_pw_len], passwd, 512, /* struct nls_table */
load_nls_default());
/* BB call unload_nls now or get nls differntly */
} else {
/* Note that passwd should be in DOS oem character set. */
strcpy(&data[512 - new_pw_len], passwd);
}
SIVAL(data, 512, new_pw_len);
#ifdef DEBUG_PASSWORD
DEBUG(100, ("make_oem_passwd_hash\n"));
dump_data(100, data, 516);
#endif
SamOEMhash((unsigned char *) data, (unsigned char *) old_pw_hash, 516);
return TRUE;
}
void
SMBsesskeygen_ntv2(const unsigned char kr[16],
const unsigned char *nt_resp, __u8 sess_key[16])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment