gsasl-commit
[Top][All Lists]
Advanced

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

CVS gsasl/lib/external


From: gsasl-commit
Subject: CVS gsasl/lib/external
Date: Sat, 01 Jan 2005 23:50:46 +0100

Update of /home/cvs/gsasl/lib/external
In directory dopio:/tmp/cvs-serv24968

Modified Files:
        server.c 
Log Message:
Simplify.


--- /home/cvs/gsasl/lib/external/server.c       2004/12/27 02:12:59     1.10
+++ /home/cvs/gsasl/lib/external/server.c       2005/01/01 22:50:46     1.11
@@ -1,5 +1,5 @@
 /* server.c --- EXTERNAL mechanism as defined in RFC 2222, server side.
- * Copyright (C) 2002, 2003, 2004  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004, 2005  Simon Josefsson
  *
  * This file is part of GNU SASL Library.
  *
@@ -27,10 +27,7 @@
 /* Get specification. */
 #include "external.h"
 
-/* Get malloc, free. */
-#include <stdlib.h>
-
-/* Get memcpy, strlen. */
+/* Get memchr. */
 #include <string.h>
 
 int
@@ -42,26 +39,17 @@
   *output_len = 0;
   *output = NULL;
 
-  if (input_len > 0)
-    {
-      char *p;
-
-      p = malloc (input_len + 1);
-      if (!p)
-       return GSASL_MALLOC_ERROR;
-      memcpy (p, input, input_len);
-      p[input_len] = '\0';
-
-      /* An authorization identity is a string of zero or more Unicode
-         [Unicode] coded characters.  The NUL <U+0000> character is not
-         permitted in authorization identities. */
-      if (input_len != strlen (p))
-       return GSASL_MECHANISM_PARSE_ERROR;
+  /* Quoting rfc2222bis-09:
+   * extern-resp       = *( UTF8-char-no-nul )
+   * UTF8-char-no-nul  = UTF8-1-no-nul / UTF8-2 / UTF8-3 / UTF8-4
+   * UTF8-1-no-nul     = %x01-7F */
+  if (memchr (input, '\0', input_len))
+    return GSASL_MECHANISM_PARSE_ERROR;
 
-      gsasl_property_set (sctx, GSASL_AUTHZID, p);
+  /* FIXME: Validate that input is UTF-8. */
 
-      free (p);
-    }
+  if (input_len > 0)
+    gsasl_property_set_raw (sctx, GSASL_AUTHZID, input, input_len);
   else
     gsasl_property_set (sctx, GSASL_AUTHZID, NULL);
 





reply via email to

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