diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsfs.c | 135 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 2 | ||||
-rw-r--r-- | fs/cifs/connect.c | 21 | ||||
-rw-r--r-- | fs/cifs/dns_resolve.c | 21 | ||||
-rw-r--r-- | fs/cifs/netmisc.c | 34 |
5 files changed, 102 insertions, 111 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 0d92114195ab..8b315708cb3f 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -346,80 +346,73 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) | |||
346 | struct TCP_Server_Info *server; | 346 | struct TCP_Server_Info *server; |
347 | 347 | ||
348 | cifs_sb = CIFS_SB(m->mnt_sb); | 348 | cifs_sb = CIFS_SB(m->mnt_sb); |
349 | tcon = cifs_sb->tcon; | ||
349 | 350 | ||
350 | if (cifs_sb) { | 351 | seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName); |
351 | tcon = cifs_sb->tcon; | 352 | if (tcon->ses->userName) |
352 | if (tcon) { | 353 | seq_printf(s, ",username=%s", tcon->ses->userName); |
353 | seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName); | 354 | if (tcon->ses->domainName) |
354 | if (tcon->ses) { | 355 | seq_printf(s, ",domain=%s", tcon->ses->domainName); |
355 | if (tcon->ses->userName) | 356 | |
356 | seq_printf(s, ",username=%s", | 357 | cifs_show_address(s, tcon->ses->server); |
357 | tcon->ses->userName); | 358 | |
358 | if (tcon->ses->domainName) | 359 | seq_printf(s, ",uid=%d", cifs_sb->mnt_uid); |
359 | seq_printf(s, ",domain=%s", | 360 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) |
360 | tcon->ses->domainName); | 361 | seq_printf(s, ",forceuid"); |
361 | server = tcon->ses->server; | 362 | |
362 | if (server) { | 363 | seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); |
363 | seq_printf(s, ",addr="); | 364 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) |
364 | switch (server->addr.sockAddr6. | 365 | seq_printf(s, ",forcegid"); |
365 | sin6_family) { | 366 | |
366 | case AF_INET6: | 367 | server = tcon->ses->server; |
367 | seq_printf(s, "%pI6", | 368 | seq_printf(s, ",addr="); |
368 | &server->addr.sockAddr6.sin6_addr); | 369 | switch (server->addr.sockAddr6.sin6_family) { |
369 | break; | 370 | case AF_INET6: |
370 | case AF_INET: | 371 | seq_printf(s, "%pI6", &server->addr.sockAddr6.sin6_addr); |
371 | seq_printf(s, "%pI4", | 372 | break; |
372 | &server->addr.sockAddr.sin_addr.s_addr); | 373 | case AF_INET: |
373 | break; | 374 | seq_printf(s, "%pI4", &server->addr.sockAddr.sin_addr.s_addr); |
374 | } | 375 | break; |
375 | } | 376 | } |
376 | } | 377 | |
377 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) || | 378 | if (!tcon->unix_ext) |
378 | !(tcon->unix_ext)) | 379 | seq_printf(s, ",file_mode=0%o,dir_mode=0%o", |
379 | seq_printf(s, ",uid=%d", cifs_sb->mnt_uid); | ||
380 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) || | ||
381 | !(tcon->unix_ext)) | ||
382 | seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); | ||
383 | if (!tcon->unix_ext) { | ||
384 | seq_printf(s, ",file_mode=0%o,dir_mode=0%o", | ||
385 | cifs_sb->mnt_file_mode, | 380 | cifs_sb->mnt_file_mode, |
386 | cifs_sb->mnt_dir_mode); | 381 | cifs_sb->mnt_dir_mode); |
387 | } | 382 | if (tcon->seal) |
388 | if (tcon->seal) | 383 | seq_printf(s, ",seal"); |
389 | seq_printf(s, ",seal"); | 384 | if (tcon->nocase) |
390 | if (tcon->nocase) | 385 | seq_printf(s, ",nocase"); |
391 | seq_printf(s, ",nocase"); | 386 | if (tcon->retry) |
392 | if (tcon->retry) | 387 | seq_printf(s, ",hard"); |
393 | seq_printf(s, ",hard"); | 388 | if (cifs_sb->prepath) |
394 | } | 389 | seq_printf(s, ",prepath=%s", cifs_sb->prepath); |
395 | if (cifs_sb->prepath) | 390 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) |
396 | seq_printf(s, ",prepath=%s", cifs_sb->prepath); | 391 | seq_printf(s, ",posixpaths"); |
397 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | 392 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) |
398 | seq_printf(s, ",posixpaths"); | 393 | seq_printf(s, ",setuids"); |
399 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) | 394 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) |
400 | seq_printf(s, ",setuids"); | 395 | seq_printf(s, ",serverino"); |
401 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | 396 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) |
402 | seq_printf(s, ",serverino"); | 397 | seq_printf(s, ",directio"); |
403 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) | 398 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
404 | seq_printf(s, ",directio"); | 399 | seq_printf(s, ",nouser_xattr"); |
405 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) | 400 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) |
406 | seq_printf(s, ",nouser_xattr"); | 401 | seq_printf(s, ",mapchars"); |
407 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) | 402 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) |
408 | seq_printf(s, ",mapchars"); | 403 | seq_printf(s, ",sfu"); |
409 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) | 404 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
410 | seq_printf(s, ",sfu"); | 405 | seq_printf(s, ",nobrl"); |
411 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 406 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) |
412 | seq_printf(s, ",nobrl"); | 407 | seq_printf(s, ",cifsacl"); |
413 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) | 408 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) |
414 | seq_printf(s, ",cifsacl"); | 409 | seq_printf(s, ",dynperm"); |
415 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) | 410 | if (m->mnt_sb->s_flags & MS_POSIXACL) |
416 | seq_printf(s, ",dynperm"); | 411 | seq_printf(s, ",acl"); |
417 | if (m->mnt_sb->s_flags & MS_POSIXACL) | 412 | |
418 | seq_printf(s, ",acl"); | 413 | seq_printf(s, ",rsize=%d", cifs_sb->rsize); |
419 | 414 | seq_printf(s, ",wsize=%d", cifs_sb->wsize); | |
420 | seq_printf(s, ",rsize=%d", cifs_sb->rsize); | 415 | |
421 | seq_printf(s, ",wsize=%d", cifs_sb->wsize); | ||
422 | } | ||
423 | return 0; | 416 | return 0; |
424 | } | 417 | } |
425 | 418 | ||
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index f9452329bcce..c419416a42ee 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -74,7 +74,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr); | |||
74 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); | 74 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); |
75 | extern int decode_negTokenInit(unsigned char *security_blob, int length, | 75 | extern int decode_negTokenInit(unsigned char *security_blob, int length, |
76 | enum securityEnum *secType); | 76 | enum securityEnum *secType); |
77 | extern int cifs_inet_pton(const int, const char *source, void *dst); | 77 | extern int cifs_convert_address(char *src, void *dst); |
78 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); | 78 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); |
79 | extern void header_assemble(struct smb_hdr *, char /* command */ , | 79 | extern void header_assemble(struct smb_hdr *, char /* command */ , |
80 | const struct cifsTconInfo *, int /* length of | 80 | const struct cifsTconInfo *, int /* length of |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 97f4311b9a8e..c368ad658236 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1433,28 +1433,15 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
1433 | 1433 | ||
1434 | memset(&addr, 0, sizeof(struct sockaddr_storage)); | 1434 | memset(&addr, 0, sizeof(struct sockaddr_storage)); |
1435 | 1435 | ||
1436 | if (volume_info->UNCip && volume_info->UNC) { | 1436 | cFYI(1, ("UNC: %s ip: %s", volume_info->UNC, volume_info->UNCip)); |
1437 | rc = cifs_inet_pton(AF_INET, volume_info->UNCip, | ||
1438 | &sin_server->sin_addr.s_addr); | ||
1439 | |||
1440 | if (rc <= 0) { | ||
1441 | /* not ipv4 address, try ipv6 */ | ||
1442 | rc = cifs_inet_pton(AF_INET6, volume_info->UNCip, | ||
1443 | &sin_server6->sin6_addr.in6_u); | ||
1444 | if (rc > 0) | ||
1445 | addr.ss_family = AF_INET6; | ||
1446 | } else { | ||
1447 | addr.ss_family = AF_INET; | ||
1448 | } | ||
1449 | 1437 | ||
1450 | if (rc <= 0) { | 1438 | if (volume_info->UNCip && volume_info->UNC) { |
1439 | rc = cifs_convert_address(volume_info->UNCip, &addr); | ||
1440 | if (!rc) { | ||
1451 | /* we failed translating address */ | 1441 | /* we failed translating address */ |
1452 | rc = -EINVAL; | 1442 | rc = -EINVAL; |
1453 | goto out_err; | 1443 | goto out_err; |
1454 | } | 1444 | } |
1455 | |||
1456 | cFYI(1, ("UNC: %s ip: %s", volume_info->UNC, | ||
1457 | volume_info->UNCip)); | ||
1458 | } else if (volume_info->UNCip) { | 1445 | } else if (volume_info->UNCip) { |
1459 | /* BB using ip addr as tcp_ses name to connect to the | 1446 | /* BB using ip addr as tcp_ses name to connect to the |
1460 | DFS root below */ | 1447 | DFS root below */ |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index df4a306f697e..91b5500755bf 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -37,24 +37,9 @@ | |||
37 | static int | 37 | static int |
38 | is_ip(const char *name) | 38 | is_ip(const char *name) |
39 | { | 39 | { |
40 | int rc; | 40 | struct sockaddr_storage ss; |
41 | struct sockaddr_in sin_server; | 41 | |
42 | struct sockaddr_in6 sin_server6; | 42 | return cifs_convert_address(name, &ss); |
43 | |||
44 | rc = cifs_inet_pton(AF_INET, name, | ||
45 | &sin_server.sin_addr.s_addr); | ||
46 | |||
47 | if (rc <= 0) { | ||
48 | /* not ipv4 address, try ipv6 */ | ||
49 | rc = cifs_inet_pton(AF_INET6, name, | ||
50 | &sin_server6.sin6_addr.in6_u); | ||
51 | if (rc > 0) | ||
52 | return 1; | ||
53 | } else { | ||
54 | return 1; | ||
55 | } | ||
56 | /* we failed translating address */ | ||
57 | return 0; | ||
58 | } | 43 | } |
59 | 44 | ||
60 | static int | 45 | static int |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 32d6baa0a54f..00e6e357ae88 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -133,10 +133,12 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { | |||
133 | {0, 0} | 133 | {0, 0} |
134 | }; | 134 | }; |
135 | 135 | ||
136 | /* Convert string containing dotted ip address to binary form */ | 136 | /* |
137 | /* returns 0 if invalid address */ | 137 | * Convert a string containing text IPv4 or IPv6 address to binary form. |
138 | 138 | * | |
139 | int | 139 | * Returns 0 on failure. |
140 | */ | ||
141 | static int | ||
140 | cifs_inet_pton(const int address_family, const char *cp, void *dst) | 142 | cifs_inet_pton(const int address_family, const char *cp, void *dst) |
141 | { | 143 | { |
142 | int ret = 0; | 144 | int ret = 0; |
@@ -153,6 +155,30 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst) | |||
153 | return ret; | 155 | return ret; |
154 | } | 156 | } |
155 | 157 | ||
158 | /* | ||
159 | * Try to convert a string to an IPv4 address and then attempt to convert | ||
160 | * it to an IPv6 address if that fails. Set the family field if either | ||
161 | * succeeds. | ||
162 | * | ||
163 | * Returns 0 on failure. | ||
164 | */ | ||
165 | int | ||
166 | cifs_convert_address(char *src, void *dst) | ||
167 | { | ||
168 | struct sockaddr_in *s4 = (struct sockaddr_in *) dst; | ||
169 | struct sockaddr_in6 *s6 = (Struct sockaddr_in6 *) dst; | ||
170 | |||
171 | if (cifs_inet_pton(AF_INET, src, &s4->sin_addr.s_addr)) { | ||
172 | s4->sin_family = AF_INET; | ||
173 | return 1; | ||
174 | } else if (cifs_inet_pton(AF_INET6, src, &s6->sin6_addr.s6_addr)) { | ||
175 | s6->sin6_family = AF_INET6; | ||
176 | return 1; | ||
177 | } | ||
178 | |||
179 | return 0; | ||
180 | } | ||
181 | |||
156 | /***************************************************************************** | 182 | /***************************************************************************** |
157 | convert a NT status code to a dos class/code | 183 | convert a NT status code to a dos class/code |
158 | *****************************************************************************/ | 184 | *****************************************************************************/ |