cifs: change confusing field serverName (to ip_addr)
ses->serverName is not the server name, but the string form of the ip address of the server. Change the name to ip_addr to avoid confusion (and fix the array length to match maximum length of ipv6 address). Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
af982da9a6
commit
b438fcf128
|
@ -395,7 +395,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
|
||||||
(ses->serverOS == NULL) ||
|
(ses->serverOS == NULL) ||
|
||||||
(ses->serverNOS == NULL)) {
|
(ses->serverNOS == NULL)) {
|
||||||
seq_printf(m, "\n\t%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
|
seq_printf(m, "\n\t%d) Name: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
|
||||||
i, ses->serverName, ses->ses_count,
|
i, ses->ip_addr, ses->ses_count,
|
||||||
ses->capabilities, ses->status);
|
ses->capabilities, ses->status);
|
||||||
if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
|
if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
|
||||||
seq_printf(m, "Guest ");
|
seq_printf(m, "Guest ");
|
||||||
|
@ -406,7 +406,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
|
||||||
"\n\t%d) Name: %s Domain: %s Uses: %d OS: %s "
|
"\n\t%d) Name: %s Domain: %s Uses: %d OS: %s "
|
||||||
"\n\tNOS: %s\tCapability: 0x%x"
|
"\n\tNOS: %s\tCapability: 0x%x"
|
||||||
"\n\tSMB session status: %d ",
|
"\n\tSMB session status: %d ",
|
||||||
i, ses->serverName, ses->serverDomain,
|
i, ses->ip_addr, ses->serverDomain,
|
||||||
ses->ses_count, ses->serverOS, ses->serverNOS,
|
ses->ses_count, ses->serverOS, ses->serverNOS,
|
||||||
ses->capabilities, ses->status);
|
ses->capabilities, ses->status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,15 +568,15 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* We use ses->serverName if no domain name available */
|
/* We use ses->ip_addr if no domain name available */
|
||||||
len = strlen(ses->serverName);
|
len = strlen(ses->ip_addr);
|
||||||
|
|
||||||
server = kmalloc(2 + (len * 2), GFP_KERNEL);
|
server = kmalloc(2 + (len * 2), GFP_KERNEL);
|
||||||
if (server == NULL) {
|
if (server == NULL) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
len = cifs_strtoUTF16((__le16 *)server, ses->serverName, len,
|
len = cifs_strtoUTF16((__le16 *)server, ses->ip_addr, len,
|
||||||
nls_cp);
|
nls_cp);
|
||||||
rc =
|
rc =
|
||||||
crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash,
|
crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash,
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <linux/in.h>
|
#include <linux/in.h>
|
||||||
#include <linux/in6.h>
|
#include <linux/in6.h>
|
||||||
|
#include <linux/inet.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/mempool.h>
|
#include <linux/mempool.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
|
@ -902,7 +903,7 @@ struct cifs_ses {
|
||||||
kuid_t linux_uid; /* overriding owner of files on the mount */
|
kuid_t linux_uid; /* overriding owner of files on the mount */
|
||||||
kuid_t cred_uid; /* owner of credentials */
|
kuid_t cred_uid; /* owner of credentials */
|
||||||
unsigned int capabilities;
|
unsigned int capabilities;
|
||||||
char serverName[SERVER_NAME_LEN_WITH_NULL];
|
char ip_addr[INET6_ADDRSTRLEN + 1]; /* Max ipv6 (or v4) addr string len */
|
||||||
char *user_name; /* must not be null except during init of sess
|
char *user_name; /* must not be null except during init of sess
|
||||||
and after mount option parsing we fill it */
|
and after mount option parsing we fill it */
|
||||||
char *domainName;
|
char *domainName;
|
||||||
|
|
|
@ -1841,9 +1841,9 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
|
||||||
/* new SMB session uses our server ref */
|
/* new SMB session uses our server ref */
|
||||||
ses->server = server;
|
ses->server = server;
|
||||||
if (server->dstaddr.ss_family == AF_INET6)
|
if (server->dstaddr.ss_family == AF_INET6)
|
||||||
sprintf(ses->serverName, "%pI6", &addr6->sin6_addr);
|
sprintf(ses->ip_addr, "%pI6", &addr6->sin6_addr);
|
||||||
else
|
else
|
||||||
sprintf(ses->serverName, "%pI4", &addr->sin_addr);
|
sprintf(ses->ip_addr, "%pI4", &addr->sin_addr);
|
||||||
|
|
||||||
if (ctx->username) {
|
if (ctx->username) {
|
||||||
ses->user_name = kstrdup(ctx->username, GFP_KERNEL);
|
ses->user_name = kstrdup(ctx->username, GFP_KERNEL);
|
||||||
|
|
|
@ -580,7 +580,7 @@ int cifs_open(struct inode *inode, struct file *file)
|
||||||
} else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
|
} else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
|
||||||
if (tcon->ses->serverNOS)
|
if (tcon->ses->serverNOS)
|
||||||
cifs_dbg(VFS, "server %s of type %s returned unexpected error on SMB posix open, disabling posix open support. Check if server update available.\n",
|
cifs_dbg(VFS, "server %s of type %s returned unexpected error on SMB posix open, disabling posix open support. Check if server update available.\n",
|
||||||
tcon->ses->serverName,
|
tcon->ses->ip_addr,
|
||||||
tcon->ses->serverNOS);
|
tcon->ses->serverNOS);
|
||||||
tcon->broken_posix_open = true;
|
tcon->broken_posix_open = true;
|
||||||
} else if ((rc != -EIO) && (rc != -EREMOTE) &&
|
} else if ((rc != -EIO) && (rc != -EREMOTE) &&
|
||||||
|
|
|
@ -218,7 +218,7 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
|
||||||
|
|
||||||
/* UNC and paths */
|
/* UNC and paths */
|
||||||
/* XXX: Use ses->server->hostname? */
|
/* XXX: Use ses->server->hostname? */
|
||||||
sprintf(unc, unc_fmt, ses->serverName);
|
sprintf(unc, unc_fmt, ses->ip_addr);
|
||||||
ctx.UNC = unc;
|
ctx.UNC = unc;
|
||||||
ctx.prepath = "";
|
ctx.prepath = "";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue