cifs: we do not allow changing username/password/unc/... during remount
[linux-2.6-microblaze.git] / fs / cifs / sess.c
index de56436..00ca687 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/slab.h>
 #include "cifs_spnego.h"
 #include "smb2proto.h"
+#include "fs_context.h"
 
 bool
 is_server_using_iface(struct TCP_Server_Info *server,
@@ -170,7 +171,7 @@ int
 cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)
 {
        struct cifs_chan *chan;
-       struct smb_vol vol = {NULL};
+       struct smb3_fs_context ctx = {NULL};
        static const char unc_fmt[] = "\\%s\\foo";
        char unc[sizeof(unc_fmt)+SERVER_NAME_LEN_WITH_NULL] = {0};
        struct sockaddr_in *ipv4 = (struct sockaddr_in *)&iface->sockaddr;
@@ -188,42 +189,42 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)
                         &ipv6->sin6_addr);
 
        /*
-        * Setup a smb_vol with mostly the same info as the existing
+        * Setup a ctx with mostly the same info as the existing
         * session and overwrite it with the requested iface data.
         *
         * We need to setup at least the fields used for negprot and
         * sesssetup.
         *
-        * We only need the volume here, so we can reuse memory from
+        * We only need the ctx here, so we can reuse memory from
         * the session and server without caring about memory
         * management.
         */
 
        /* Always make new connection for now (TODO?) */
-       vol.nosharesock = true;
+       ctx.nosharesock = true;
 
        /* Auth */
-       vol.domainauto = ses->domainAuto;
-       vol.domainname = ses->domainName;
-       vol.username = ses->user_name;
-       vol.password = ses->password;
-       vol.sectype = ses->sectype;
-       vol.sign = ses->sign;
+       ctx.domainauto = ses->domainAuto;
+       ctx.domainname = ses->domainName;
+       ctx.username = ses->user_name;
+       ctx.password = ses->password;
+       ctx.sectype = ses->sectype;
+       ctx.sign = ses->sign;
 
        /* UNC and paths */
        /* XXX: Use ses->server->hostname? */
        sprintf(unc, unc_fmt, ses->serverName);
-       vol.UNC = unc;
-       vol.prepath = "";
+       ctx.UNC = unc;
+       ctx.prepath = "";
 
        /* Reuse same version as master connection */
-       vol.vals = ses->server->vals;
-       vol.ops = ses->server->ops;
+       ctx.vals = ses->server->vals;
+       ctx.ops = ses->server->ops;
 
-       vol.noblocksnd = ses->server->noblocksnd;
-       vol.noautotune = ses->server->noautotune;
-       vol.sockopt_tcp_nodelay = ses->server->tcp_nodelay;
-       vol.echo_interval = ses->server->echo_interval / HZ;
+       ctx.noblocksnd = ses->server->noblocksnd;
+       ctx.noautotune = ses->server->noautotune;
+       ctx.sockopt_tcp_nodelay = ses->server->tcp_nodelay;
+       ctx.echo_interval = ses->server->echo_interval / HZ;
 
        /*
         * This will be used for encoding/decoding user/domain/pw
@@ -234,21 +235,21 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)
         * stored. This might break when dealing with non-ascii
         * strings.
         */
-       vol.local_nls = load_nls_default();
+       ctx.local_nls = load_nls_default();
 
        /* Use RDMA if possible */
-       vol.rdma = iface->rdma_capable;
-       memcpy(&vol.dstaddr, &iface->sockaddr, sizeof(struct sockaddr_storage));
+       ctx.rdma = iface->rdma_capable;
+       memcpy(&ctx.dstaddr, &iface->sockaddr, sizeof(struct sockaddr_storage));
 
        /* reuse master con client guid */
-       memcpy(&vol.client_guid, ses->server->client_guid,
+       memcpy(&ctx.client_guid, ses->server->client_guid,
               SMB2_CLIENT_GUID_SIZE);
-       vol.use_client_guid = true;
+       ctx.use_client_guid = true;
 
        mutex_lock(&ses->session_mutex);
 
        chan = ses->binding_chan = &ses->chans[ses->chan_count];
-       chan->server = cifs_get_tcp_session(&vol);
+       chan->server = cifs_get_tcp_session(&ctx);
        if (IS_ERR(chan->server)) {
                rc = PTR_ERR(chan->server);
                chan->server = NULL;
@@ -274,7 +275,7 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)
        if (rc)
                goto out;
 
-       rc = cifs_setup_session(xid, ses, vol.local_nls);
+       rc = cifs_setup_session(xid, ses, ctx.local_nls);
        if (rc)
                goto out;
 
@@ -297,7 +298,7 @@ out:
 
        if (rc && chan->server)
                cifs_put_tcp_session(chan->server, 0);
-       unload_nls(vol.local_nls);
+       unload_nls(ctx.local_nls);
 
        return rc;
 }
@@ -812,6 +813,7 @@ cifs_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                                return NTLMv2;
                        if (global_secflags & CIFSSEC_MAY_NTLM)
                                return NTLM;
+                       break;
                default:
                        break;
                }