gsasl-commit
[Top][All Lists]
Advanced

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

CVS gsasl/lib/plain


From: gsasl-commit
Subject: CVS gsasl/lib/plain
Date: Mon, 20 Dec 2004 02:33:39 +0100

Update of /home/cvs/gsasl/lib/plain
In directory dopio:/tmp/cvs-serv4514

Modified Files:
        server.c 
Log Message:
SASLprep client string too.


--- /home/cvs/gsasl/lib/plain/server.c  2004/12/20 00:55:01     1.13
+++ /home/cvs/gsasl/lib/plain/server.c  2004/12/20 01:33:39     1.14
@@ -43,6 +43,7 @@
   char *authentication_id = NULL;
   char *passwordptr = NULL;
   char *password = NULL;
+  char *passprep;
   int res;
 
   *output_len = 0;
@@ -77,9 +78,16 @@
   memcpy (password, passwordptr, input_len - (passwordptr - input));
   password[input_len - (passwordptr - input)] = '\0';
 
+  /* FIXME: Specificaiton is unclear on whether unassigned code
+     points are allowed or not.  We don't allow them. */
+  res = gsasl_saslprep (password, 0, &passprep, NULL);
+  free (password);
+  if (res != GSASL_OK)
+    return res;
+
   gsasl_property_set (sctx, GSASL_AUTHID, authentication_id);
   gsasl_property_set (sctx, GSASL_AUTHZID, authorization_id);
-  gsasl_property_set (sctx, GSASL_PASSWORD, password);
+  gsasl_property_set (sctx, GSASL_PASSWORD, passprep);
 
   res = gsasl_callback (NULL, sctx, GSASL_VALIDATE_SIMPLE);
   if (res == GSASL_NO_CALLBACK)
@@ -92,27 +100,27 @@
       key = gsasl_property_get (sctx, GSASL_PASSWORD);
       if (!key)
        {
-         free (password);
+         free (passprep);
          return GSASL_NO_PASSWORD;
        }
 
-      /* FIXME: Specificaiton is unclear on whether unassigned code
+      /* FIXME: Specification is unclear on whether unassigned code
         points are allowed or not.  We don't allow them. */
       res = gsasl_saslprep (key, 0, &normkey, NULL);
       if (res != GSASL_OK)
        {
-         free (password);
+         free (passprep);
          return res;
        }
 
-      if (strlen (password) == strlen (normkey) &&
-         memcmp (normkey, password, strlen (normkey)) == 0)
+      if (strlen (passprep) == strlen (normkey) &&
+         memcmp (normkey, passprep, strlen (normkey)) == 0)
        res = GSASL_OK;
       else
        res = GSASL_AUTHENTICATION_ERROR;
       free (normkey);
     }
-  free (password);
+  free (passprep);
 
   return res;
 }





reply via email to

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