gss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gss branch, master, updated. gss-0-1-3-10-g6bff401


From: Simon Josefsson
Subject: [SCM] GNU gss branch, master, updated. gss-0-1-3-10-g6bff401
Date: Mon, 22 Mar 2010 08:52:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gss".

http://git.savannah.gnu.org/cgit/gss.git/commit/?id=6bff401dc7fe0dd1853eb4fc408218890a65c7a8

The branch, master has been updated
       via  6bff401dc7fe0dd1853eb4fc408218890a65c7a8 (commit)
       via  0e5880c07e2728a8d5036b80f020321e66904d37 (commit)
       via  6415113df77ba9edfe58d080084007def26c1a32 (commit)
      from  ec52111d8aff86cdda5167b4b973702ae225de39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6bff401dc7fe0dd1853eb4fc408218890a65c7a8
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 09:26:43 2010 +0100

    Document SASL GS2 functions.

commit 0e5880c07e2728a8d5036b80f020321e66904d37
Author: Simon Josefsson <address@hidden>
Date:   Mon Mar 22 09:23:00 2010 +0100

    Add new interfaces defined in RFC 5801.
    
    The APIs are gss_inquire_mech_for_saslname and 
gss_inquire_saslname_for_mech.

commit 6415113df77ba9edfe58d080084007def26c1a32
Author: Simon Josefsson <address@hidden>
Date:   Sun Mar 21 20:11:40 2010 +0100

    Fix warning.

-----------------------------------------------------------------------

Summary of changes:
 NEWS                        |    7 ++-
 doc/gss.texi                |    7 ++
 doc/reference/gss-docs.sgml |    9 ++-
 lib/Makefile.am             |    5 +-
 lib/headers/gss/api.h       |   17 ++++-
 lib/krb5/checksum.c         |    2 +-
 lib/libgss.map              |    9 ++-
 lib/meta.c                  |   46 ++++++++++--
 lib/meta.h                  |   12 +++-
 lib/saslname.c              |  181 +++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in              |    1 +
 tests/Makefile.am           |    2 +-
 tests/saslname.c            |  176 +++++++++++++++++++++++++++++++++++++++++
 13 files changed, 457 insertions(+), 17 deletions(-)
 create mode 100644 lib/saslname.c
 create mode 100644 tests/saslname.c

diff --git a/NEWS b/NEWS
index 7a7f7fe..2c3c0c2 100644
--- a/NEWS
+++ b/NEWS
@@ -4,10 +4,15 @@ See the end for copying conditions.
 
 * Version 0.1.4 (unreleased)
 
+** Add new interfaces defined in RFC 5801.
+The APIs are gss_inquire_mech_for_saslname and
+gss_inquire_saslname_for_mech.
+
 ** KRB5: Fix bug in channel binding computation.
 
 ** API and ABI modifications.
-No changes since last version.
+gss_inquire_mech_for_saslname: ADDED.
+gss_inquire_saslname_for_mech: ADDED.
 
 * Version 0.1.3 (released 2010-03-15)
 
diff --git a/doc/gss.texi b/doc/gss.texi
index 559ea1a..37591ce 100644
--- a/doc/gss.texi
+++ b/doc/gss.texi
@@ -702,6 +702,7 @@ set @code{minor_status} to ENOMEM.
 * Per-Message Routines::       Standard GSS per-message functions.
 * Name Manipulation::          Standard GSS name manipulation functions.
 * Miscellaneous Routines::     Standard miscellaneous functions.
+* SASL GS2 Routines::          Standard SASL GS2 related functions.
 @end menu
 
 @node Simple Data Types
@@ -1477,6 +1478,12 @@ allocated.  Any length field associated with such 
pointers (as in a
 @include texi/gss_create_empty_oid_set.texi
 @include texi/gss_test_oid_set_member.texi
 
address@hidden SASL GS2 Routines
address@hidden SASL GS2 Routines
+
address@hidden texi/gss_inquire_mech_for_saslname.texi
address@hidden texi/gss_inquire_saslname_for_mech.texi
+
 @c **********************************************************
 @c ************** Generic Security Services  ****************
 @c **********************************************************
diff --git a/doc/reference/gss-docs.sgml b/doc/reference/gss-docs.sgml
index e8c575f..1e7dd9e 100644
--- a/doc/reference/gss-docs.sgml
+++ b/doc/reference/gss-docs.sgml
@@ -36,10 +36,13 @@
     <xi:include href="xml/krb5-ext.xml"/>
   </chapter>
 
-  <index>
-    <title>Index</title>
+  <index id="api-index-full">
+    <title>Index of all symbols</title>
   </index>
-  <index role="0.1.0">
+  <index role="0.1.0" id="api-index-0-1-0">
     <title>Index of new symbols in 0.1.0</title>
   </index>
+  <index role="0.1.4" id="api-index-0-1-4">
+    <title>Index of new symbols in 0.1.4</title>
+  </index>
 </book>
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2572dc8..e7a3d15 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
+# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon Josefsson
 #
 # This file is part of the Generic Security Service (GSS).
 #
@@ -34,7 +34,8 @@ libgss_la_SOURCES = libgss.map \
        internal.h \
        meta.h meta.c \
        context.c cred.c error.c misc.c msg.c name.c obsolete.c oid.c \
-       asn1.c ext.c version.c
+       asn1.c ext.c version.c \
+       saslname.c
 libgss_la_LIBADD = @LTLIBINTL@ gl/libgnu.la
 libgss_la_LDFLAGS = -no-undefined \
        -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
diff --git a/lib/headers/gss/api.h b/lib/headers/gss/api.h
index 05e580d..2d99dce 100644
--- a/lib/headers/gss/api.h
+++ b/lib/headers/gss/api.h
@@ -1,5 +1,5 @@
 /* api.h --- Header file for GSS-API.
- * Copyright (C) 2003, 2004, 2005, 2006, 2007  Simon Josefsson
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010  Simon Josefsson
  *
  * This file is part of the Generic Security Service (GSS).
  *
@@ -629,4 +629,19 @@ gss_unseal (OM_uint32 * minor_status,
            gss_buffer_t output_message_buffer,
            int *conf_state, int *qop_state);
 
+/* RFC 5801 SASL GS2 interfaces. */
+
+OM_uint32
+gss_inquire_saslname_for_mech (OM_uint32 *minor_status,
+                              const gss_OID desired_mech,
+                              gss_buffer_t sasl_mech_name,
+                              gss_buffer_t mech_name,
+                              gss_buffer_t mech_description);
+
+OM_uint32
+gss_inquire_mech_for_saslname (OM_uint32 *minor_status,
+                              const gss_buffer_t sasl_mech_name,
+                              gss_OID *mech_type);
+
+
 #endif /* GSSAPI_H_ */
diff --git a/lib/krb5/checksum.c b/lib/krb5/checksum.c
index b147bbc..a5513b7 100644
--- a/lib/krb5/checksum.c
+++ b/lib/krb5/checksum.c
@@ -86,7 +86,7 @@ hash_cb (OM_uint32 *minor_status,
     }
   pack_uint32 (input_chan_bindings->application_data.length, p);
   p += sizeof (OM_uint32);
-  if (input_chan_bindings->application_data.value > 0)
+  if (input_chan_bindings->application_data.length > 0)
     memcpy (p, input_chan_bindings->application_data.value,
            input_chan_bindings->application_data.length);
 
diff --git a/lib/libgss.map b/lib/libgss.map
index 472bb0c..b78ffb7 100644
--- a/lib/libgss.map
+++ b/lib/libgss.map
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Simon Josefsson
+# Copyright (C) 2009, 2010 Simon Josefsson
 #
 # This file is part of the Generic Security Service (GSS).
 #
@@ -102,3 +102,10 @@ GSS_0.1.0 {
   local:
     *;
 };
+
+GSS_0.1.4 {
+  global:
+# SASL GS2 interfaces:
+    gss_inquire_mech_for_saslname;
+    gss_inquire_saslname_for_mech;
+} GSS_0.1.0;
diff --git a/lib/meta.c b/lib/meta.c
index 6ed16ad..a01833b 100644
--- a/lib/meta.c
+++ b/lib/meta.c
@@ -1,5 +1,5 @@
 /* meta.c --- Implementation of function selection depending on mechanism.
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009  Simon Josefsson
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Simon 
Josefsson
  *
  * This file is part of the Generic Security Service (GSS).
  *
@@ -28,11 +28,19 @@
 # include "krb5/protos.h"
 #endif
 
+/* Get i18n. */
+#include <gettext.h>
+#define gettext_noop(String) String
+#define N_(String) gettext_noop (String)
+
 static _gss_mech_api_desc _gss_mech_apis[] =
   {
 #ifdef USE_KERBEROS5
     {
       &GSS_KRB5_static,
+      "GS2-KRB5",
+      "Kerberos V5",
+      N_("Kerberos V5 GSS-API mechanism"),
       {
        /* Mandatory name-types. */
        &GSS_KRB5_NT_PRINCIPAL_NAME_static,
@@ -57,6 +65,9 @@ static _gss_mech_api_desc _gss_mech_apis[] =
 #endif
     {
       NULL,
+      NULL,
+      NULL,
+      NULL,
       {
        NULL,
        NULL,
@@ -81,7 +92,7 @@ static _gss_mech_api_desc _gss_mech_apis[] =
   };
 
 _gss_mech_api_t
-_gss_find_mech (const gss_OID oid)
+_gss_find_mech_no_default (const gss_OID oid)
 {
   size_t i;
 
@@ -89,12 +100,35 @@ _gss_find_mech (const gss_OID oid)
     if (gss_oid_equal (oid, _gss_mech_apis[i].mech))
       return &_gss_mech_apis[i];
 
-  if (i == 0)
+  return NULL;
+}
+
+_gss_mech_api_t
+_gss_find_mech (const gss_OID oid)
+{
+  _gss_mech_api_t p = _gss_find_mech_no_default (oid);
+
+  if (!p && _gss_mech_apis[0].mech)
+    /* FIXME.  When we support more than one mechanism, make it possible
+       to configure the default mechanism. */
+    return &_gss_mech_apis[0];
+
+  return p;
+}
+
+_gss_mech_api_t
+_gss_find_mech_by_saslname (const char *saslname)
+{
+  size_t i;
+
+  if (!saslname)
     return NULL;
 
-  /* FIXME.  When we support more than one mechanism, make it possible
-     to configure the default mechanism. */
-  return &_gss_mech_apis[0];
+  for (i = 0; _gss_mech_apis[i].mech; i++)
+    if (strcmp (_gss_mech_apis[i].sasl_name, saslname) == 0)
+      return &_gss_mech_apis[i];
+
+  return NULL;
 }
 
 OM_uint32
diff --git a/lib/meta.h b/lib/meta.h
index af67099..35b3b6a 100644
--- a/lib/meta.h
+++ b/lib/meta.h
@@ -1,5 +1,5 @@
 /* meta.h --- Prototypes for internally visible symbols from meta.c.
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009  Simon Josefsson
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Simon 
Josefsson
  *
  * This file is part of the Generic Security Service (GSS).
  *
@@ -20,6 +20,9 @@
  *
  */
 
+#ifndef META_H
+#define META_H
+
 #include <gss/api.h>
 
 #define MAX_NT 5
@@ -27,6 +30,9 @@
 typedef struct _gss_mech_api_struct
 {
   gss_OID mech;
+  const char *sasl_name;
+  const char *mech_name;
+  const char *mech_description;
   gss_OID name_types[MAX_NT];
     OM_uint32 (*init_sec_context)
     (OM_uint32 * minor_status,
@@ -116,5 +122,9 @@ typedef struct _gss_mech_api_struct
 } _gss_mech_api_desc, *_gss_mech_api_t;
 
 _gss_mech_api_t _gss_find_mech (const gss_OID oid);
+_gss_mech_api_t _gss_find_mech_no_default (const gss_OID oid);
+_gss_mech_api_t _gss_find_mech_by_saslname (const char *saslname);
 OM_uint32 _gss_indicate_mechs1 (OM_uint32 * minor_status,
                                gss_OID_set * mech_set);
+
+#endif /* META_H */
diff --git a/lib/saslname.c b/lib/saslname.c
new file mode 100644
index 0000000..9f152ff
--- /dev/null
+++ b/lib/saslname.c
@@ -0,0 +1,181 @@
+/* saslname.c --- Implementation of the SASL GS2 interfaces.
+ * Copyright (C) 2010  Simon Josefsson
+ *
+ * This file is part of the Generic Security Service (GSS).
+ *
+ * GSS is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS; if not, see http://www.gnu.org/licenses or write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "internal.h"
+
+/* Get i18n. */
+#include <gettext.h>
+#define _(String) dgettext (PACKAGE, String)
+
+/* _gss_find_mech* */
+#include "meta.h"
+
+static OM_uint32
+dup_data (OM_uint32 *minor_status,
+         gss_buffer_t out,
+         const char *str,
+         int translate)
+{
+  if (!out)
+    return GSS_S_COMPLETE;
+
+  if (translate)
+    out->value = strdup (_(str));
+  else
+    out->value = strdup (str);
+  if (!out->value)
+    {
+      if (minor_status)
+       *minor_status = ENOMEM;
+      return GSS_S_FAILURE;
+    }
+  out->length = strlen (str);
+
+  return GSS_S_COMPLETE;
+}
+
+/**
+ * gss_inquire_saslname_for_mech:
+ * @minor_status: (Integer, modify) Mechanism specific status code.
+ * @desired_mech: (OID, read) Identifies the GSS-API mechanism to query.
+ * @sasl_mech_name: (buffer, character-string, modify, optional)
+ *   Buffer to receive SASL mechanism name.  The application must free
+ *   storage associated with this name after use with a call to
+ *   gss_release_buffer().
+ * @mech_name: (buffer, character-string, modify, optional) Buffer to
+ *   receive human readable mechanism name.  The application must free
+ *   storage associated with this name after use with a call to
+ *   gss_release_buffer().
+ * @mech_description: (buffer, character-string, modify, optional)
+ *   Buffer to receive description of mechanism.  The application must
+ *   free storage associated with this name after use with a call to
+ *   gss_release_buffer().
+ *
+ * Output the SASL mechanism name of a GSS-API mechanism.  It also
+ * returns a name and description of the mechanism in a user friendly
+ * form.
+ *
+ * Returns:
+ *
+ * `GSS_S_COMPLETE`: Successful completion.
+ *
+ * `GSS_S_BAD_MECH`: The @desired_mech OID is unsupported.
+ *
+ * Since: 0.1.4
+ **/
+OM_uint32
+gss_inquire_saslname_for_mech (OM_uint32 *minor_status,
+                              const gss_OID desired_mech,
+                              gss_buffer_t sasl_mech_name,
+                              gss_buffer_t mech_name,
+                              gss_buffer_t mech_description)
+{
+  _gss_mech_api_t m;
+
+  if (!desired_mech)
+    {
+      if (minor_status)
+       *minor_status = 0;
+      return GSS_S_CALL_INACCESSIBLE_READ;
+    }
+
+  m = _gss_find_mech_no_default (desired_mech);
+  if (!m)
+    {
+      if (minor_status)
+       *minor_status = 0;
+      return GSS_S_BAD_MECH;
+    }
+
+  if (dup_data (minor_status, sasl_mech_name,
+               m->sasl_name, 0) != GSS_S_COMPLETE)
+    return GSS_S_FAILURE;
+  if (dup_data (minor_status, mech_name,
+               m->mech_name, 0) != GSS_S_COMPLETE)
+    {
+      if (sasl_mech_name)
+       free (sasl_mech_name->value);
+      return GSS_S_FAILURE;
+    }
+  if (dup_data (minor_status, mech_description,
+               m->mech_description, 1) != GSS_S_COMPLETE)
+    {
+      if (sasl_mech_name)
+       free (sasl_mech_name->value);
+      if (mech_name)
+       free (mech_name->value);
+      return GSS_S_FAILURE;
+    }
+
+  return GSS_S_COMPLETE;
+}
+
+/**
+ * gss_inquire_mech_for_saslname:
+ * @minor_status: (Integer, modify) Mechanism specific status code.
+ * @sasl_mech_name: (buffer, character-string, read) Buffer with SASL
+ *   mechanism name.
+ * @mech_type: (OID, modify, optional) Actual mechanism used.  The OID
+ *   returned via this parameter will be a pointer to static storage
+ *   that should be treated as read-only; In particular the
+ *   application should not attempt to free it.  Specify %NULL if not
+ *   required.
+ *
+ * Output GSS-API mechanism OID of mechanism associated with given
+ * @sasl_mech_name.
+ *
+ * Returns:
+ *
+ * `GSS_S_COMPLETE`: Successful completion.
+ *
+ * `GSS_S_BAD_MECH`: There is no GSS-API mechanism known as @sasl_mech_name.
+ *
+ * Since: 0.1.4
+ **/
+OM_uint32
+gss_inquire_mech_for_saslname (OM_uint32 *minor_status,
+                              const gss_buffer_t sasl_mech_name,
+                              gss_OID *mech_type)
+{
+  _gss_mech_api_t m;
+
+  if (!sasl_mech_name)
+    {
+      if (minor_status)
+       *minor_status = 0;
+      return GSS_S_CALL_INACCESSIBLE_READ;
+    }
+
+  m = _gss_find_mech_by_saslname (sasl_mech_name->value);
+
+  if (!m)
+    {
+      if (minor_status)
+       *minor_status = 0;
+      return GSS_S_BAD_MECH;
+    }
+
+  if (mech_type)
+    *mech_type = m->mech;
+
+  return GSS_S_COMPLETE;
+}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4c4bd79..75aaf11 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,5 @@
 # List of source files containing translatable strings for GSS.
+lib/meta.c
 lib/error.c
 lib/krb5/error.c
 src/gss.c
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 53e07fd..65f343d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,7 +32,7 @@ TESTS_ENVIRONMENT = \
        THREADSAFETY_FILES="$(top_srcdir)/lib/*.c $(top_srcdir)/lib/krb5/*.c" \
        $(VALGRIND)
 
-buildtests = basic
+buildtests = basic saslname
 if KRB5
 buildtests += krb5context
 endif
diff --git a/tests/saslname.c b/tests/saslname.c
new file mode 100644
index 0000000..72962f0
--- /dev/null
+++ b/tests/saslname.c
@@ -0,0 +1,176 @@
+/* saslname.c --- Test of new SASL GS2 related GSS-API functions
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010  Simon Josefsson
+ *
+ * This file is part of the Generic Security Service (GSS).
+ *
+ * GSS is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS; if not, see http://www.gnu.org/licenses or write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <string.h>
+
+/* Get GSS prototypes. */
+#include <gss.h>
+
+#include "utils.c"
+
+int
+main (int argc, char *argv[])
+{
+  gss_uint32 maj_stat, min_stat;
+  gss_buffer_desc bufdesc;
+  gss_OID oid;
+
+  do
+    if (strcmp (argv[argc - 1], "-v") == 0 ||
+       strcmp (argv[argc - 1], "--verbose") == 0)
+      debug = 1;
+    else if (strcmp (argv[argc - 1], "-b") == 0 ||
+            strcmp (argv[argc - 1], "--break-on-error") == 0)
+      break_on_error = 1;
+    else if (strcmp (argv[argc - 1], "-h") == 0 ||
+            strcmp (argv[argc - 1], "-?") == 0 ||
+            strcmp (argv[argc - 1], "--help") == 0)
+      {
+       printf ("Usage: %s [-vbh?] [--verbose] [--break-on-error] [--help]\n",
+               argv[0]);
+       return 1;
+      }
+  while (argc-- > 1);
+
+  maj_stat = gss_inquire_mech_for_saslname (&min_stat, NULL, NULL);
+  if (maj_stat == GSS_S_CALL_INACCESSIBLE_READ)
+    success ("gss_inquire_mech_for_saslname (NULL, NULL) success\n");
+  else
+    fail ("gss_inquire_mech_for_saslname (NULL, NULL) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  bufdesc.value = NULL;
+  bufdesc.length = 0;
+
+  maj_stat = gss_inquire_mech_for_saslname (&min_stat, &bufdesc, NULL);
+  if (maj_stat == GSS_S_BAD_MECH)
+    success ("gss_inquire_mech_for_saslname (EMPTY, NULL) success\n");
+  else
+    fail ("gss_inquire_mech_for_saslname (EMPTY, NULL) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+#ifdef USE_KERBEROS5
+  bufdesc.value = (char *) "GS2-KRB5";
+  bufdesc.length = 8;
+
+  maj_stat = gss_inquire_mech_for_saslname (&min_stat, &bufdesc, NULL);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_inquire_mech_for_saslname (GS2-KRB5, NULL) success\n");
+  else
+    fail ("gss_inquire_mech_for_saslname (GS2-KRB5, NULL) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  maj_stat = gss_inquire_mech_for_saslname (&min_stat, &bufdesc, &oid);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_inquire_mech_for_saslname (GS2-KRB5, OID) success\n");
+  else
+    fail ("gss_inquire_mech_for_saslname (GS2-KRB5, OID) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  if (oid != GSS_KRB5 || !gss_oid_equal (oid, GSS_KRB5))
+    fail ("GS2-OID not Krb5?!\n");
+#endif
+
+  maj_stat = gss_inquire_saslname_for_mech (&min_stat, NULL, NULL, NULL, NULL);
+  if (maj_stat == GSS_S_CALL_INACCESSIBLE_READ)
+    success ("gss_inquire_saslname_for_mech (NULL) success\n");
+  else
+    fail ("gss_inquire_saslname_for_mech (NULL) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  maj_stat = gss_inquire_saslname_for_mech (&min_stat, GSS_C_NT_USER_NAME,
+                                           NULL, NULL, NULL);
+  if (maj_stat == GSS_S_BAD_MECH)
+    success ("gss_inquire_saslname_for_mech (NT_USER_NAME) success\n");
+  else
+    fail ("gss_inquire_saslname_for_mech (NT_USER_NAME) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+#ifdef USE_KERBEROS5
+  maj_stat = gss_inquire_saslname_for_mech (&min_stat, GSS_KRB5,
+                                           NULL, NULL, NULL);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_inquire_saslname_for_mech (GSS-KRB5) success\n");
+  else
+    fail ("gss_inquire_saslname_for_mech (GSS-KRB5) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  bufdesc.value = NULL;
+  bufdesc.length = 0;
+
+  maj_stat = gss_inquire_saslname_for_mech (&min_stat, GSS_KRB5,
+                                           &bufdesc, NULL, NULL);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_inquire_saslname_for_mech (GSS-KRB5) success: %.*s\n",
+            bufdesc.length, bufdesc.value);
+  else
+    fail ("gss_inquire_saslname_for_mech (GSS-KRB5) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  maj_stat = gss_release_buffer (&min_stat, &bufdesc);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_release_buffer() OK\n");
+  else
+    fail ("gss_release_buffer() failed (%d,%d)\n", maj_stat, min_stat);
+
+  maj_stat = gss_inquire_saslname_for_mech (&min_stat, GSS_KRB5,
+                                           NULL, &bufdesc, NULL);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_inquire_saslname_for_mech (GSS-KRB5-2) success: %.*s\n",
+            bufdesc.length, bufdesc.value);
+  else
+    fail ("gss_inquire_saslname_for_mech (GSS-KRB5-2) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  maj_stat = gss_release_buffer (&min_stat, &bufdesc);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_release_buffer() OK\n");
+  else
+    fail ("gss_release_buffer() failed (%d,%d)\n", maj_stat, min_stat);
+
+  maj_stat = gss_inquire_saslname_for_mech (&min_stat, GSS_KRB5,
+                                           NULL, NULL, &bufdesc);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_inquire_saslname_for_mech (GSS-KRB5-3) success: %.*s\n",
+            bufdesc.length, bufdesc.value);
+  else
+    fail ("gss_inquire_saslname_for_mech (GSS-KRB5-3) failed (%d,%d)\n",
+         maj_stat, min_stat);
+
+  maj_stat = gss_release_buffer (&min_stat, &bufdesc);
+  if (maj_stat == GSS_S_COMPLETE)
+    success ("gss_release_buffer() OK\n");
+  else
+    fail ("gss_release_buffer() failed (%d,%d)\n", maj_stat, min_stat);
+#endif
+
+  if (debug)
+    printf ("Basic self tests done with %d errors\n", error_count);
+
+  return error_count ? 1 : 0;
+}


hooks/post-receive
-- 
GNU gss




reply via email to

[Prev in Thread] Current Thread [Next in Thread]