aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2011-02-25 02:11:56 -0500
committerSteve French <sfrench@us.ibm.com>2011-04-11 20:42:06 -0400
commit8727c8a85f3951ef0eef36a665f5dceebb4c495d (patch)
treef35b215604127ebb05a977a1b8c093b7b441b6af /fs/cifs/connect.c
parentbdf1b03e093bdbc571f404e751c7b0e2dca412ea (diff)
Allow user names longer than 32 bytes
We artificially limited the user name to 32 bytes, but modern servers handle larger. Set the maximum length to a reasonable 256, and make the user name string dynamically allocated rather than a fixed size in session structure. Also clean up old checkpatch warning. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6e2b2addfc78..54436a3a3348 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -881,7 +881,8 @@ cifs_parse_mount_options(char *options, const char *devname,
881 /* null user, ie anonymous, authentication */ 881 /* null user, ie anonymous, authentication */
882 vol->nullauth = 1; 882 vol->nullauth = 1;
883 } 883 }
884 if (strnlen(value, 200) < 200) { 884 if (strnlen(value, MAX_USERNAME_SIZE) <
885 MAX_USERNAME_SIZE) {
885 vol->username = value; 886 vol->username = value;
886 } else { 887 } else {
887 printk(KERN_WARNING "CIFS: username too long\n"); 888 printk(KERN_WARNING "CIFS: username too long\n");
@@ -1808,7 +1809,9 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
1808 break; 1809 break;
1809 default: 1810 default:
1810 /* anything else takes username/password */ 1811 /* anything else takes username/password */
1811 if (strncmp(ses->userName, vol->username, 1812 if (ses->user_name == NULL)
1813 continue;
1814 if (strncmp(ses->user_name, vol->username,
1812 MAX_USERNAME_SIZE)) 1815 MAX_USERNAME_SIZE))
1813 continue; 1816 continue;
1814 if (strlen(vol->username) != 0 && 1817 if (strlen(vol->username) != 0 &&
@@ -1906,9 +1909,11 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
1906 else 1909 else
1907 sprintf(ses->serverName, "%pI4", &addr->sin_addr); 1910 sprintf(ses->serverName, "%pI4", &addr->sin_addr);
1908 1911
1909 if (volume_info->username) 1912 if (volume_info->username) {
1910 strncpy(ses->userName, volume_info->username, 1913 ses->user_name = kstrdup(volume_info->username, GFP_KERNEL);
1911 MAX_USERNAME_SIZE); 1914 if (!ses->user_name)
1915 goto get_ses_fail;
1916 }
1912 1917
1913 /* volume_info->password freed at unmount */ 1918 /* volume_info->password freed at unmount */
1914 if (volume_info->password) { 1919 if (volume_info->password) {