aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorScott Lovenberg <scott.lovenberg@gmail.com>2013-08-09 08:47:17 -0400
committerSteve French <smfrench@gmail.com>2013-09-08 15:34:11 -0400
commit8c3a2b4c420c5b988005b8697b7404ced076aaaa (patch)
treea680e656fb9bd7632c77ccbef89d24ce805c9ef5 /fs/cifs/connect.c
parentd244bf2dfbebfded05f494ffd53659fa7b1e32c1 (diff)
cifs: Move string length definitions to uapi
The max string length definitions for user name, domain name, password, and share name have been moved into their own header file in uapi so the mount helper can use autoconf to define them instead of keeping the kernel side and userland side definitions in sync manually. The names have also been standardized with a "CIFS" prefix and "LEN" suffix. Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com> Reviewed-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 37950c65453c..b1bab99be83b 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1577,8 +1577,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1577 if (string == NULL) 1577 if (string == NULL)
1578 goto out_nomem; 1578 goto out_nomem;
1579 1579
1580 if (strnlen(string, MAX_USERNAME_SIZE) > 1580 if (strnlen(string, CIFS_MAX_USERNAME_LEN) >
1581 MAX_USERNAME_SIZE) { 1581 CIFS_MAX_USERNAME_LEN) {
1582 printk(KERN_WARNING "CIFS: username too long\n"); 1582 printk(KERN_WARNING "CIFS: username too long\n");
1583 goto cifs_parse_mount_err; 1583 goto cifs_parse_mount_err;
1584 } 1584 }
@@ -2223,13 +2223,13 @@ static int match_session(struct cifs_ses *ses, struct smb_vol *vol)
2223 /* anything else takes username/password */ 2223 /* anything else takes username/password */
2224 if (strncmp(ses->user_name, 2224 if (strncmp(ses->user_name,
2225 vol->username ? vol->username : "", 2225 vol->username ? vol->username : "",
2226 MAX_USERNAME_SIZE)) 2226 CIFS_MAX_USERNAME_LEN))
2227 return 0; 2227 return 0;
2228 if (strlen(vol->username) != 0 && 2228 if (strlen(vol->username) != 0 &&
2229 ses->password != NULL && 2229 ses->password != NULL &&
2230 strncmp(ses->password, 2230 strncmp(ses->password,
2231 vol->password ? vol->password : "", 2231 vol->password ? vol->password : "",
2232 MAX_PASSWORD_SIZE)) 2232 CIFS_MAX_PASSWORD_LEN))
2233 return 0; 2233 return 0;
2234 } 2234 }
2235 return 1; 2235 return 1;
@@ -2354,7 +2354,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2354 } 2354 }
2355 2355
2356 len = delim - payload; 2356 len = delim - payload;
2357 if (len > MAX_USERNAME_SIZE || len <= 0) { 2357 if (len > CIFS_MAX_USERNAME_LEN || len <= 0) {
2358 cifs_dbg(FYI, "Bad value from username search (len=%zd)\n", 2358 cifs_dbg(FYI, "Bad value from username search (len=%zd)\n",
2359 len); 2359 len);
2360 rc = -EINVAL; 2360 rc = -EINVAL;
@@ -2371,7 +2371,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2371 cifs_dbg(FYI, "%s: username=%s\n", __func__, vol->username); 2371 cifs_dbg(FYI, "%s: username=%s\n", __func__, vol->username);
2372 2372
2373 len = key->datalen - (len + 1); 2373 len = key->datalen - (len + 1);
2374 if (len > MAX_PASSWORD_SIZE || len <= 0) { 2374 if (len > CIFS_MAX_PASSWORD_LEN || len <= 0) {
2375 cifs_dbg(FYI, "Bad len for password search (len=%zd)\n", len); 2375 cifs_dbg(FYI, "Bad len for password search (len=%zd)\n", len);
2376 rc = -EINVAL; 2376 rc = -EINVAL;
2377 kfree(vol->username); 2377 kfree(vol->username);