add krb5 glue for userok
authorLuke Howard <lukeh@padl.com>
Sun, 20 Mar 2011 09:57:24 +0000 (20:57 +1100)
committerLuke Howard <lukeh@padl.com>
Sun, 20 Mar 2011 09:57:24 +0000 (20:57 +1100)
lib/gssapi/Makefile.am
lib/gssapi/gssapi_mech.h
lib/gssapi/krb5/external.c
lib/gssapi/krb5/userok.c [new file with mode: 0644]
lib/gssapi/libgssapi-exports.def

index 5b525d849a7e8e3d15702fb8941180f925e0ca3a..a321efd019f4241d4ad24ea0fa6448f02cf4298a 100644 (file)
@@ -70,6 +70,7 @@ krb5src = \
        krb5/set_sec_context_option.c \
        krb5/ticket_flags.c \
        krb5/unwrap.c \
+       krb5/userok.c \
        krb5/verify_mic.c \
        krb5/wrap.c
 
index 241be1391a438b8f346fedc952fa41a820e55ab8..43d737ef93605ccdd97881f1a57026d6f95d0981 100644 (file)
@@ -564,6 +564,8 @@ typedef struct gssapi_mech_interface_desc {
        _gss_cred_label_set_t           *gm_cred_label_set;
         gss_mo_desc                    *gm_mo;
         size_t                          gm_mo_num;
+        _gss_pname_to_uid_t             *gm_pname_to_uid;
+        _gss_userok_t                   *gm_userok;
         _gss_display_name_ext_t         *gm_display_name_ext;
         _gss_inquire_name_t             *gm_inquire_name;
         _gss_get_name_attribute_t       *gm_get_name_attribute;
@@ -572,8 +574,6 @@ typedef struct gssapi_mech_interface_desc {
         _gss_export_name_composite_t    *gm_export_name_composite;
         _gss_acquire_cred_with_password_t   *gm_acquire_cred_with_password;
         _gss_add_cred_with_password_t   *gm_add_cred_with_password;
-        _gss_pname_to_uid_t             *gm_pname_to_uid;
-        _gss_userok_t                   *gm_userok;
         struct gss_mech_compat_desc_struct  *gm_compat;
 } gssapi_mech_interface_desc, *gssapi_mech_interface;
 
index d6f14a48f7c7f01a3c1e2d7dcdfc13349aa80160..43d17dbe5543a4bcceadd92ed06c6ca287f7fdea 100644 (file)
@@ -323,7 +323,10 @@ static gssapi_mech_interface_desc krb5_mech = {
     NULL,
     NULL,
     krb5_mo,
-    sizeof(krb5_mo) / sizeof(krb5_mo[0])
+    sizeof(krb5_mo) / sizeof(krb5_mo[0]),
+    NULL,
+    _gsskrb5_userok,
+    NULL
 };
 
 gssapi_mech_interface
diff --git a/lib/gssapi/krb5/userok.c b/lib/gssapi/krb5/userok.c
new file mode 100644 (file)
index 0000000..af53ea7
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2011, PADL Software Pty Ltd.
+ * All rights reserved.
+ *
+ * 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
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of PADL Software nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY PADL SOFTWARE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL PADL SOFTWARE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "gsskrb5_locl.h"
+
+OM_uint32
+_gsskrb5_userok(OM_uint32 *minor_status,
+                const gss_name_t input_name,
+                const char *user,
+                int *user_ok)
+{
+    krb5_context context;
+    krb5_const_principal princ = (krb5_const_principal)input_name;
+
+    GSSAPI_KRB5_INIT(&context);
+
+    *minor_status = 0;
+    *user_ok = krb5_kuserok(context, princ, user);
+
+    return GSS_S_COMPLETE;
+}
index ee3aaf3b3dc52fdc64c58db7c3e8a215962464aa..ed31953a6558bb0c09f951d59339f9b878b378a3 100644 (file)
@@ -11,8 +11,10 @@ EXPORTS
        __gss_c_attr_stream_sizes_oid_desc      DATA
        gss_accept_sec_context
        gss_acquire_cred
+       gss_acquire_cred_with_password
        gss_add_buffer_set_member
        gss_add_cred
+       gss_add_cred_with_password
        gss_add_oid_set_member
        gss_canonicalize_name
        gss_compare_name
@@ -21,17 +23,21 @@ EXPORTS
        gss_create_empty_buffer_set
        gss_create_empty_oid_set
        gss_decapsulate_token
+       gss_delete_name_attribute
        gss_delete_sec_context
         gss_display_mech_attr
        gss_display_name
+       gss_display_name_ext
        gss_display_status
        gss_duplicate_name
        gss_duplicate_oid
        gss_encapsulate_token
         gss_export_cred
        gss_export_name
+       gss_export_name_composite
        gss_export_sec_context
        gss_get_mic
+       gss_get_name_attribute
         gss_import_cred
        gss_import_name
        gss_import_sec_context
@@ -45,6 +51,7 @@ EXPORTS
        gss_inquire_cred_by_oid
         gss_inquire_mech_for_saslname
        gss_inquire_mechs_for_name
+       gss_inquire_name
        gss_inquire_names_for_mech
         gss_inquire_saslname_for_mech
        gss_inquire_sec_context_by_oid  ;!
@@ -64,6 +71,7 @@ EXPORTS
         gss_oid_to_name
        gss_oid_equal
        gss_oid_to_str
+       gss_pname_to_uid
        gss_process_context_token
        gss_pseudo_random
        gss_release_buffer
@@ -75,12 +83,14 @@ EXPORTS
        gss_release_oid_set
        gss_seal
        gss_set_cred_option
+       gss_set_name_attribute
        gss_set_sec_context_option
        gss_sign
        gss_test_oid_set_member
        gss_unseal
        gss_unwrap
        gss_unwrap_iov
+       gss_userok
        gss_verify
        gss_verify_mic
        gss_wrap