gsasl-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gsasl branch, master, updated. gsasl-1-4-1-58-g239669a


From: Simon Josefsson
Subject: [SCM] GNU gsasl branch, master, updated. gsasl-1-4-1-58-g239669a
Date: Fri, 19 Mar 2010 10:41:18 +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 gsasl".

http://git.savannah.gnu.org/cgit/gsasl.git/commit/?id=239669a59a0c18fe1b00500f94f366345f9ec52f

The branch, master has been updated
       via  239669a59a0c18fe1b00500f94f366345f9ec52f (commit)
       via  f82fe9e11a1ea7093cc3ec5df97468e154d76fa3 (commit)
      from  7959565a46cb2b4c147f10f8eb3ffd2507501939 (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 239669a59a0c18fe1b00500f94f366345f9ec52f
Author: Simon Josefsson <address@hidden>
Date:   Fri Mar 19 11:35:55 2010 +0100

    Make server-first logic more correct.

commit f82fe9e11a1ea7093cc3ec5df97468e154d76fa3
Author: Simon Josefsson <address@hidden>
Date:   Fri Mar 19 11:16:28 2010 +0100

    Properly call GSS-API validate callback.

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

Summary of changes:
 lib/gs2/server.c |   36 ++++++++++++++----------------------
 tests/gs2-krb5.c |   37 ++++++++++++++++++++++++++++++-------
 2 files changed, 44 insertions(+), 29 deletions(-)

diff --git a/lib/gs2/server.c b/lib/gs2/server.c
index f8e4aeb..80795e4 100644
--- a/lib/gs2/server.c
+++ b/lib/gs2/server.c
@@ -283,9 +283,23 @@ _gsasl_gs2_server_step (Gsasl_session * sctx,
 
       if (maj_stat == GSS_S_COMPLETE)
        {
+         state->step++;
+
          if (!(ret_flags & GSS_C_MUTUAL_FLAG))
            return GSASL_MECHANISM_PARSE_ERROR;
+
+         maj_stat = gss_display_name (&min_stat, state->client,
+                                      &client_name, &mech_type);
+         if (GSS_ERROR (maj_stat))
+           return GSASL_GSSAPI_DISPLAY_NAME_ERROR;
+
+         gsasl_property_set_raw (sctx, GSASL_GSSAPI_DISPLAY_NAME,
+                                 client_name.value, client_name.length);
+
+         res = gsasl_callback (NULL, sctx, GSASL_VALIDATE_GSSAPI);
        }
+      else
+       res = GSASL_NEEDS_MORE;
 
       if (free_bufdesc1)
        {
@@ -303,28 +317,6 @@ _gsasl_gs2_server_step (Gsasl_session * sctx,
       maj_stat = gss_release_buffer (&min_stat, &bufdesc2);
       if (GSS_ERROR (maj_stat))
        return GSASL_GSSAPI_RELEASE_BUFFER_ERROR;
-
-      if (maj_stat == GSS_S_COMPLETE)
-       state->step++;
-
-      if (maj_stat == GSS_S_COMPLETE)
-       res = GSASL_OK;
-      else
-       res = GSASL_NEEDS_MORE;
-      break;
-
-    case 3:
-      maj_stat = gss_display_name (&min_stat, state->client,
-                                  &client_name, &mech_type);
-      if (GSS_ERROR (maj_stat))
-       return GSASL_GSSAPI_DISPLAY_NAME_ERROR;
-
-      gsasl_property_set_raw (sctx, GSASL_GSSAPI_DISPLAY_NAME,
-                             client_name.value, client_name.length);
-
-      res = gsasl_callback (NULL, sctx, GSASL_VALIDATE_GSSAPI);
-
-      state->step++;
       break;
 
     default:
diff --git a/tests/gs2-krb5.c b/tests/gs2-krb5.c
index 4241f17..7032f56 100644
--- a/tests/gs2-krb5.c
+++ b/tests/gs2-krb5.c
@@ -91,6 +91,17 @@ callback (Gsasl * ctx, Gsasl_session * sctx, Gsasl_property 
prop)
   return rc;
 }
 
+static char
+ret_char (int rc)
+{
+  if (rc == GSASL_OK)
+    return 'O';
+  else if (rc == GSASL_NEEDS_MORE)
+    return 'N';
+  else
+    return '?';
+}
+
 void
 doit (void)
 {
@@ -118,7 +129,7 @@ doit (void)
 
   for (i = 0; i < 5; i++)
     {
-      bool server_first = (i % 2) == 0;
+      bool client_first = (i % 2) == 0;
 
       rc = gsasl_server_start (ctx, "GS2-KRB5", &server);
       if (rc != GSASL_OK)
@@ -133,9 +144,23 @@ doit (void)
          return;
        }
 
+      if (client_first)
+       {
+         rc = gsasl_step64 (client, NULL, &s1);
+         if (rc != GSASL_OK && rc != GSASL_NEEDS_MORE)
+           {
+             fail ("gsasl_step64 failed (%d):\n%s\n", rc,
+                   gsasl_strerror (rc));
+             return;
+           }
+
+         if (debug)
+           printf ("C: %s [%c]\n", s1, ret_char (rc));
+       }
+
       do
        {
-         res1 = gsasl_step64 (server_first ? server : client, s1, &s2);
+         res1 = gsasl_step64 (server, s1, &s2);
          if (s1 == NULL && res1 == GSASL_OK)
            fail("gsasl_step64 direct success?\n");
          if (s1)
@@ -151,10 +176,9 @@ doit (void)
            }
 
          if (debug)
-           printf ("%c: %s [%c]\n", server_first ? 'S' : 'C',
-                   s2, res1 == GSASL_OK ? 'O' : 'N');
+           printf ("S: %s [%c]\n", s2, ret_char (res1));
 
-         res2 = gsasl_step64 (server_first ? client : server, s2, &s1);
+         res2 = gsasl_step64 (client, s2, &s1);
          gsasl_free (s2);
          if (res2 != GSASL_OK && res2 != GSASL_NEEDS_MORE)
            {
@@ -164,8 +188,7 @@ doit (void)
            }
 
          if (debug)
-           printf ("%c: %s [%c]\n", server_first ? 'C' : 'S',
-                   s1, res2 == GSASL_OK ? 'O' : 'N');
+           printf ("C: %s [%c]\n", s1, ret_char (res2));
        }
       while (res1 != GSASL_OK || res2 != GSASL_OK);
 


hooks/post-receive
-- 
GNU gsasl




reply via email to

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