Merge git://git.samba.org/sfrench/cifs-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 23 Jan 2012 16:59:49 +0000 (08:59 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 23 Jan 2012 16:59:49 +0000 (08:59 -0800)
* git://git.samba.org/sfrench/cifs-2.6:
  CIFS: Rename *UCS* functions to *UTF16*
  [CIFS] ACL and FSCACHE support no longer EXPERIMENTAL
  [CIFS] Fix build break with multiuser patch when LANMAN disabled
  cifs: warn about impending deprecation of legacy MultiuserMount code
  cifs: fetch credentials out of keyring for non-krb5 auth multiuser mounts
  cifs: sanitize username handling
  keys: add a "logon" key type
  cifs: lower default wsize when unix extensions are not used
  cifs: better instrumentation for coalesce_t2
  cifs: integer overflow in parse_dacl()
  cifs: Fix sparse warning when calling cifs_strtoUCS
  CIFS: Add descriptions to the brlock cache functions

1  2 
security/keys/user_defined.c

index 2aee3c5a3b9912a6648bacd82d89392a9f501f20,6e1a6276649fdbd12289221decdd6ce83d11fb1f..c7660a25a3e4502673714b39553a0d9d00873672
@@@ -18,6 -18,8 +18,8 @@@
  #include <asm/uaccess.h>
  #include "internal.h"
  
+ static int logon_vet_description(const char *desc);
  /*
   * user defined keys take an arbitrary string as the description and an
   * arbitrary blob of data as the payload
@@@ -35,6 -37,24 +37,24 @@@ struct key_type key_type_user = 
  
  EXPORT_SYMBOL_GPL(key_type_user);
  
+ /*
+  * This key type is essentially the same as key_type_user, but it does
+  * not define a .read op. This is suitable for storing username and
+  * password pairs in the keyring that you do not want to be readable
+  * from userspace.
+  */
+ struct key_type key_type_logon = {
+       .name                   = "logon",
+       .instantiate            = user_instantiate,
+       .update                 = user_update,
+       .match                  = user_match,
+       .revoke                 = user_revoke,
+       .destroy                = user_destroy,
+       .describe               = user_describe,
+       .vet_description        = logon_vet_description,
+ };
+ EXPORT_SYMBOL_GPL(key_type_logon);
  /*
   * instantiate a user defined key
   */
@@@ -59,7 -79,7 +79,7 @@@ int user_instantiate(struct key *key, c
        /* attach the data */
        upayload->datalen = datalen;
        memcpy(upayload->data, data, datalen);
 -      rcu_assign_pointer(key->payload.data, upayload);
 +      rcu_assign_keypointer(key, upayload);
        ret = 0;
  
  error:
@@@ -98,7 -118,7 +118,7 @@@ int user_update(struct key *key, const 
        if (ret == 0) {
                /* attach the new data, displacing the old */
                zap = key->payload.data;
 -              rcu_assign_pointer(key->payload.data, upayload);
 +              rcu_assign_keypointer(key, upayload);
                key->expiry = 0;
        }
  
@@@ -133,7 -153,7 +153,7 @@@ void user_revoke(struct key *key
        key_payload_reserve(key, 0);
  
        if (upayload) {
 -              rcu_assign_pointer(key->payload.data, NULL);
 +              rcu_assign_keypointer(key, NULL);
                kfree_rcu(upayload, rcu);
        }
  }
@@@ -189,3 -209,20 +209,20 @@@ long user_read(const struct key *key, c
  }
  
  EXPORT_SYMBOL_GPL(user_read);
+ /* Vet the description for a "logon" key */
+ static int logon_vet_description(const char *desc)
+ {
+       char *p;
+       /* require a "qualified" description string */
+       p = strchr(desc, ':');
+       if (!p)
+               return -EINVAL;
+       /* also reject description with ':' as first char */
+       if (p == desc)
+               return -EINVAL;
+       return 0;
+ }