Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec...
[deliverable/linux.git] / fs / cifs / cifs_spnego.c
index 4a4581cb2b5e3442e1cc0da0f0a7cd2f6de930bd..8ec7736ce954cd63cbe7a1cea7c368d248ad20ba 100644 (file)
@@ -86,6 +86,9 @@ struct key_type cifs_spnego_key_type = {
 /* strlen of ";user=" */
 #define USER_KEY_LEN           6
 
+/* strlen of ";pid=0x" */
+#define PID_KEY_LEN            7
+
 /* get a key struct with a SPNEGO security blob, suitable for session setup */
 struct key *
 cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
@@ -103,7 +106,8 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
                   IP_KEY_LEN + INET6_ADDRSTRLEN +
                   MAX_MECH_STR_LEN +
                   UID_KEY_LEN + (sizeof(uid_t) * 2) +
-                  USER_KEY_LEN + strlen(sesInfo->userName) + 1;
+                  USER_KEY_LEN + strlen(sesInfo->userName) +
+                  PID_KEY_LEN + (sizeof(pid_t) * 2) + 1;
 
        spnego_key = ERR_PTR(-ENOMEM);
        description = kzalloc(desc_len, GFP_KERNEL);
@@ -121,7 +125,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
        if (server->addr.sockAddr.sin_family == AF_INET)
                sprintf(dp, "ip4=%pI4", &server->addr.sockAddr.sin_addr);
        else if (server->addr.sockAddr.sin_family == AF_INET6)
-               sprintf(dp, "ip6=%pi6", &server->addr.sockAddr6.sin6_addr);
+               sprintf(dp, "ip6=%pI6", &server->addr.sockAddr6.sin6_addr);
        else
                goto out;
 
@@ -141,6 +145,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
        dp = description + strlen(description);
        sprintf(dp, ";user=%s", sesInfo->userName);
 
+       dp = description + strlen(description);
+       sprintf(dp, ";pid=0x%x", current->pid);
+
        cFYI(1, ("key description = %s", description));
        spnego_key = request_key(&cifs_spnego_key_type, description, "");
 
This page took 0.024902 seconds and 5 git commands to generate.