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-7-2-14-g8c266e8


From: Simon Josefsson
Subject: [SCM] GNU gsasl branch, master, updated. gsasl-1-7-2-14-g8c266e8
Date: Tue, 03 Apr 2012 08:55:09 +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=8c266e8740a8d949caf14c484302e3c68f28c450

The branch, master has been updated
       via  8c266e8740a8d949caf14c484302e3c68f28c450 (commit)
      from  679f6bbfeda074cfdb384e29b73f50b8ed9222d5 (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 8c266e8740a8d949caf14c484302e3c68f28c450
Author: Simon Josefsson <address@hidden>
Date:   Tue Apr 3 10:53:53 2012 +0200

    Fix build errors.

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

Summary of changes:
 examples/openid20/smtp-server-openid20.c |  100 +++++++++++++++++++++++++-----
 1 files changed, 83 insertions(+), 17 deletions(-)

diff --git a/examples/openid20/smtp-server-openid20.c 
b/examples/openid20/smtp-server-openid20.c
index 542db68..6676548 100644
--- a/examples/openid20/smtp-server-openid20.c
+++ b/examples/openid20/smtp-server-openid20.c
@@ -91,37 +91,79 @@ get_redirect_url (Gsasl_session * sctx)
   char *line = NULL;
   size_t n = 0;
   const char *nonce = gsasl_session_hook_get (sctx);
+  int rc;
 
-  asprintf (&tmp, "%s", store_path);
+  rc = asprintf (&tmp, "%s", store_path);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   mkdir (tmp, 0770);
   free (tmp);
 
-  asprintf (&tmp, "%s/state", store_path);
+  rc = asprintf (&tmp, "%s/state", store_path);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   mkdir (tmp, 0770);
   free (tmp);
 
-  asprintf (&tmp, "%s/state/%s", store_path, nonce);
+  rc = asprintf (&tmp, "%s/state/%s", store_path, nonce);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   mkdir (tmp, 0770);
   free (tmp);
 
-  asprintf (&tmp, "%s/state/%s/openid_url", store_path, nonce);
+  rc = asprintf (&tmp, "%s/state/%s/openid_url", store_path, nonce);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   if (write_file (tmp, gsasl_property_fast (sctx, GSASL_AUTHID)))
     return NULL;
   free (tmp);
 
-  asprintf (&tmp, "%s/state/%s/realm", store_path, nonce);
+  rc = asprintf (&tmp, "%s/state/%s/realm", store_path, nonce);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   if (write_file (tmp, realm))
     return NULL;
   free (tmp);
 
-  asprintf (&tmp, "%s/state/%s/return_to", store_path, nonce);
-  asprintf (&tmp2, "%s/%s", return_to, nonce);
+  rc = asprintf (&tmp, "%s/state/%s/return_to", store_path, nonce);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
+  rc = asprintf (&tmp2, "%s/%s", return_to, nonce);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   if (write_file (tmp, tmp2))
     return NULL;
   free (tmp);
   free (tmp2);
 
-  asprintf (&tmp, "gsasl-openid20-redirect.php %s %s", store_path, nonce);
+  rc =
+    asprintf (&tmp, "gsasl-openid20-redirect.php %s %s", store_path, nonce);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   fh = popen (tmp, "r");
   free (tmp);
   if (!fh)
@@ -133,7 +175,12 @@ get_redirect_url (Gsasl_session * sctx)
     printf ("gsasl-openid20-redirect.php: %s", line);
   pclose (fh);
 
-  asprintf (&tmp, "%s/state/%s/redirect_url", store_path, nonce);
+  rc = asprintf (&tmp, "%s/state/%s/redirect_url", store_path, nonce);
+  if (rc <= 0)
+    {
+      perror ("asprintf");
+      return NULL;
+    }
   fh = fopen (tmp, "r");
   if (!fh)
     {
@@ -165,9 +212,13 @@ callback (Gsasl * ctx, Gsasl_session * sctx, 
Gsasl_property prop)
     case GSASL_REDIRECT_URL:
       {
        line = get_redirect_url (sctx);
-
-       gsasl_property_set (sctx, prop, line);
-       rc = GSASL_OK;
+       if (line == NULL)
+         rc = GSASL_AUTHENTICATION_ERROR;
+       else
+         {
+           rc = GSASL_OK;
+           gsasl_property_set (sctx, prop, line);
+         }
       }
       break;
 
@@ -179,13 +230,23 @@ callback (Gsasl * ctx, Gsasl_session * sctx, 
Gsasl_property prop)
        do
          {
            sleep (1);
-           
-           asprintf (&tmp, "%s/state/%s/success", store_path, nonce);
+
+           rc = asprintf (&tmp, "%s/state/%s/success", store_path, nonce);
+           if (rc <= 0)
+             {
+               perror ("asprintf");
+               break;
+             }
            fh = fopen (tmp, "r");
            free (tmp);
            if (!fh)
              {
-               asprintf (&tmp, "%s/state/%s/fail", store_path, nonce);
+               rc = asprintf (&tmp, "%s/state/%s/fail", store_path, nonce);
+               if (rc <= 0)
+                 {
+                   perror ("asprintf");
+                   break;
+                 }
                fh = fopen (tmp, "r");
                free (tmp);
                if (!fh)
@@ -208,7 +269,12 @@ callback (Gsasl * ctx, Gsasl_session * sctx, 
Gsasl_property prop)
 
            gsasl_property_set (sctx, GSASL_AUTHID, line);
 
-           asprintf (&tmp, "%s/state/%s/sreg", store_path, nonce);
+           rc = asprintf (&tmp, "%s/state/%s/sreg", store_path, nonce);
+           if (rc <= 0)
+             {
+               perror ("asprintf");
+               break;
+             }
            fh = fopen (tmp, "r");
            free (tmp);
            if (fh)
@@ -276,7 +342,7 @@ server_auth (FILE * fh, Gsasl_session * session)
      handle well in excess of the number of concurrent transactions a
      SASL server shall see. */
   char bin_nonce[32];
-  char nonce[2*sizeof(bin_nonce) + 1];
+  char nonce[2 * sizeof (bin_nonce) + 1];
 
   gsasl_nonce (bin_nonce, sizeof (bin_nonce));
   hex_encode (nonce, bin_nonce, sizeof (bin_nonce));


hooks/post-receive
-- 
GNU gsasl



reply via email to

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