Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73498
b: refs/heads/master
c: 1fb64bf
h: refs/heads/master
v: v3
  • Loading branch information
Steve French committed Nov 1, 2007
1 parent f9c81c1 commit 8096064
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 953f868138dbf4300196780379476ab9f07f263a
refs/heads/master: 1fb64bfc45b9ee5092b72474a5df216b8a0c7ff9
5 changes: 4 additions & 1 deletion trunk/fs/cifs/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ bigendian architectures. Fix possible memory corruption when
EAGAIN returned on kern_recvmsg. Return better error if server
requires packet signing but client has disabled it. When mounted
with cifsacl mount option - mode bits are approximated based
on the contents of the files ACL.
on the contents of the ACL of the file or directory. When cifs
mount helper is missing convert make sure that UNC name
has backslash (not forward slash) between ip address of server
and the share name.

Version 1.50
------------
Expand Down
40 changes: 35 additions & 5 deletions trunk/fs/cifs/netmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,34 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
{0, 0}
};


/* if the mount helper is missing we need to reverse the 1st slash
from '/' to backslash in order to format the UNC properly for
ip address parsing and for tree connect (unless the user
remembered to put the UNC name in properly). Fortunately we do
not have to call this twice (we check for IPv4 addresses
first, so it is already converted by the time we
try IPv6 addresses */
static int canonicalize_unc(char *cp)
{
int i;

for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) {
if (cp[i] == 0)
break;
if (cp[i] == '\\')
break;
if (cp[i] == '/') {
#ifdef CONFIG_CIFS_DEBUG2
cFYI(1, ("change slash to backslash in malformed UNC"));
#endif
cp[i] = '\\';
return 1;
}
}
return 0;
}

/* Convert string containing dotted ip address to binary form */
/* returns 0 if invalid address */

Expand All @@ -141,11 +169,13 @@ cifs_inet_pton(int address_family, char *cp, void *dst)
int ret = 0;

/* calculate length by finding first slash or NULL */
/* BB Should we convert '/' slash to '\' here since it seems already
* done before this */
if ( address_family == AF_INET ) {
ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
} else if ( address_family == AF_INET6 ) {
if (address_family == AF_INET) {
ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL);
if (ret == 0) {
if (canonicalize_unc(cp))
ret = in4_pton(cp, -1, dst, '\\', NULL);
}
} else if (address_family == AF_INET6) {
ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
}
#ifdef CONFIG_CIFS_DEBUG2
Expand Down

0 comments on commit 8096064

Please sign in to comment.