Skip to content

Commit 7c5e628

Browse files
imammedoSteve French
authored andcommitted
[CIFS] Fixed build warning in is_ip
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
1 parent cf432eb commit 7c5e628

3 files changed

Lines changed: 5 additions & 32 deletions

File tree

‎fs/cifs/cifsproto.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr);
7070
extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
7171
extern int decode_negTokenInit(unsigned char *security_blob, int length,
7272
enum securityEnum *secType);
73-
extern int cifs_inet_pton(int, char *source, void *dst);
73+
extern int cifs_inet_pton(const int, const char *source, void *dst);
7474
extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr);
7575
extern void header_assemble(struct smb_hdr *, char /* command */ ,
7676
const struct cifsTconInfo *, int /* length of

‎fs/cifs/connect.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,9 @@ cifs_parse_mount_options(char *options, const char *devname,
13021302
"begin with // or \\\\ \n");
13031303
return 1;
13041304
}
1305+
value = strpbrk(vol->UNC+2, "/\\");
1306+
if (value)
1307+
*value = '\\';
13051308
} else {
13061309
printk(KERN_WARNING "CIFS: UNC name too long\n");
13071310
return 1;

‎fs/cifs/netmisc.c‎

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -132,47 +132,17 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
132132
{0, 0}
133133
};
134134

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 */
143-
static 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-
161135
/* Convert string containing dotted ip address to binary form */
162136
/* returns 0 if invalid address */
163137

164138
int
165-
cifs_inet_pton(int address_family, char *cp, void *dst)
139+
cifs_inet_pton(const int address_family, const char *cp, void *dst)
166140
{
167141
int ret = 0;
168142

169143
/* calculate length by finding first slash or NULL */
170144
if (address_family == AF_INET) {
171145
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-
}
176146
} else if (address_family == AF_INET6) {
177147
ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
178148
}

0 commit comments

Comments
 (0)