]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sunrpc/auth_gss/gss_mech_switch.c
Pull dock-bay into release branch
[linux-2.6-omap-h63xx.git] / net / sunrpc / auth_gss / gss_mech_switch.c
index d88468d21c3783ebecc6bf0f25fbf835854fcf42..61801a069ff02c69d91313ea75df3d542ffff0e2 100644 (file)
@@ -6,14 +6,14 @@
  *
  *  J. Bruce Fields   <bfields@umich.edu>
  *
- *  Redistribution and use in source and binary forms, with or without 
+ *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
  *
  *  1. Redistributions of source code must retain the above copyright
  *     notice, this list of conditions and the following disclaimer.
  *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the 
+ *     notice, this list of conditions and the following disclaimer in the
  *     documentation and/or other materials provided with the distribution.
  *  3. Neither the name of the University nor the names of its
  *     contributors may be used to endorse or promote products derived
@@ -113,7 +113,7 @@ gss_mech_register(struct gss_api_mech *gm)
        spin_lock(&registered_mechs_lock);
        list_add(&gm->gm_list, &registered_mechs);
        spin_unlock(&registered_mechs_lock);
-       dprintk("RPC:      registered gss mechanism %s\n", gm->gm_name);
+       dprintk("RPC:       registered gss mechanism %s\n", gm->gm_name);
        return 0;
 }
 
@@ -125,7 +125,7 @@ gss_mech_unregister(struct gss_api_mech *gm)
        spin_lock(&registered_mechs_lock);
        list_del(&gm->gm_list);
        spin_unlock(&registered_mechs_lock);
-       dprintk("RPC:      unregistered gss mechanism %s\n", gm->gm_name);
+       dprintk("RPC:       unregistered gss mechanism %s\n", gm->gm_name);
        gss_mech_free(gm);
 }
 
@@ -193,6 +193,20 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
 
 EXPORT_SYMBOL(gss_mech_get_by_pseudoflavor);
 
+u32
+gss_svc_to_pseudoflavor(struct gss_api_mech *gm, u32 service)
+{
+       int i;
+
+       for (i = 0; i < gm->gm_pf_num; i++) {
+               if (gm->gm_pfs[i].service == service) {
+                       return gm->gm_pfs[i].pseudoflavor;
+               }
+       }
+       return RPC_AUTH_MAXFLAVOR; /* illegal value */
+}
+EXPORT_SYMBOL(gss_svc_to_pseudoflavor);
+
 u32
 gss_pseudoflavor_to_service(struct gss_api_mech *gm, u32 pseudoflavor)
 {
@@ -237,9 +251,8 @@ gss_import_sec_context(const void *input_token, size_t bufsize,
                       struct gss_api_mech      *mech,
                       struct gss_ctx           **ctx_id)
 {
-       if (!(*ctx_id = kmalloc(sizeof(**ctx_id), GFP_KERNEL)))
+       if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL)))
                return GSS_S_FAILURE;
-       memset(*ctx_id, 0, sizeof(**ctx_id));
        (*ctx_id)->mech_type = gss_mech_get(mech);
 
        return mech->gm_ops
@@ -299,7 +312,7 @@ gss_unwrap(struct gss_ctx   *ctx_id,
 u32
 gss_delete_sec_context(struct gss_ctx  **context_handle)
 {
-       dprintk("RPC:      gss_delete_sec_context deleting %p\n",
+       dprintk("RPC:       gss_delete_sec_context deleting %p\n",
                        *context_handle);
 
        if (!*context_handle)