aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/connect.c3
-rw-r--r--fs/cifs/netmisc.c32
3 files changed, 5 insertions, 32 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index a249a29109a5..d481f6c5a2be 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -70,7 +70,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr);
70extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); 70extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
71extern int decode_negTokenInit(unsigned char *security_blob, int length, 71extern int decode_negTokenInit(unsigned char *security_blob, int length,
72 enum securityEnum *secType); 72 enum securityEnum *secType);
73extern int cifs_inet_pton(int, char *source, void *dst); 73extern int cifs_inet_pton(const int, const char *source, void *dst);
74extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); 74extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr);
75extern void header_assemble(struct smb_hdr *, char /* command */ , 75extern void header_assemble(struct smb_hdr *, char /* command */ ,
76 const struct cifsTconInfo *, int /* length of 76 const struct cifsTconInfo *, int /* length of
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 957998e8477e..791ca5c1a116 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1302,6 +1302,9 @@ cifs_parse_mount_options(char *options, const char *devname,
1302 "begin with // or \\\\ \n"); 1302 "begin with // or \\\\ \n");
1303 return 1; 1303 return 1;
1304 } 1304 }
1305 value = strpbrk(vol->UNC+2, "/\\");
1306 if (value)
1307 *value = '\\';
1305 } else { 1308 } else {
1306 printk(KERN_WARNING "CIFS: UNC name too long\n"); 1309 printk(KERN_WARNING "CIFS: UNC name too long\n");
1307 return 1; 1310 return 1;
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 3b5a5ce882b6..00f4cff400b3 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -132,47 +132,17 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
132 {0, 0} 132 {0, 0}
133}; 133};
134 134
135
136/* if the mount helper is missing we need to reverse the 1st slash
137 from '/' to backslash in order to format the UNC properly for
138 ip address parsing and for tree connect (unless the user
139 remembered to put the UNC name in properly). Fortunately we do
140 not have to call this twice (we check for IPv4 addresses
141 first, so it is already converted by the time we
142 try IPv6 addresses */
143static int canonicalize_unc(char *cp)
144{
145 int i;
146
147 for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) {
148 if (cp[i] == 0)
149 break;
150 if (cp[i] == '\\')
151 break;
152 if (cp[i] == '/') {
153 cFYI(DBG2, ("change slash to \\ in malformed UNC"));
154 cp[i] = '\\';
155 return 1;
156 }
157 }
158 return 0;
159}
160
161/* Convert string containing dotted ip address to binary form */ 135/* Convert string containing dotted ip address to binary form */
162/* returns 0 if invalid address */ 136/* returns 0 if invalid address */
163 137
164int 138int
165cifs_inet_pton(int address_family, char *cp, void *dst) 139cifs_inet_pton(const int address_family, const char *cp, void *dst)
166{ 140{
167 int ret = 0; 141 int ret = 0;
168 142
169 /* calculate length by finding first slash or NULL */ 143 /* calculate length by finding first slash or NULL */
170 if (address_family == AF_INET) { 144 if (address_family == AF_INET) {
171 ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); 145 ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL);
172 if (ret == 0) {
173 if (canonicalize_unc(cp))
174 ret = in4_pton(cp, -1, dst, '\\', NULL);
175 }
176 } else if (address_family == AF_INET6) { 146 } else if (address_family == AF_INET6) {
177 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); 147 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
178 } 148 }