gsasl-commit
[Top][All Lists]
Advanced

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

CVS gsasl/lib/src


From: gsasl-commit
Subject: CVS gsasl/lib/src
Date: Wed, 15 Dec 2004 01:41:12 +0100

Update of /home/cvs/gsasl/lib/src
In directory dopio:/tmp/cvs-serv2926

Modified Files:
        saslprep.c 
Log Message:
Work (as much as possible) when libidn isn't available.


--- /home/cvs/gsasl/lib/src/saslprep.c  2004/11/30 03:04:41     1.3
+++ /home/cvs/gsasl/lib/src/saslprep.c  2004/12/15 00:41:12     1.4
@@ -21,7 +21,9 @@
 
 #include "internal.h"
 
-#include <stringprep.h>
+#if WITH_SASLPREP
+# include <stringprep.h>
+#endif
 
 /**
  * gsasl_saslprep - prepare internationalized string
@@ -42,6 +44,7 @@
 gsasl_saslprep (const char *in, Gsasl_saslprep_flags flags,
                char **out, int *stringpreprc)
 {
+#if WITH_SASLPREP
   int rc;
 
   rc = stringprep_profile (in, out, "SASLprep",
@@ -56,6 +59,21 @@
       *out = NULL;
       return GSASL_SASLPREP_ERROR;
     }
+#else
+  size_t i, inlen = strlen (in);
+
+  for (i = 0; i < inlen; i++)
+    if (in[i] & 0x80)
+      {
+       *out = NULL;
+       return GSASL_SASLPREP_ERROR;
+      }
+
+  *out = malloc (inlen + 1);
+  if (!*out)
+    return GSASL_MALLOC_ERROR;
+  strcpy (*out, in);
+#endif
 
   return GSASL_OK;
 }





reply via email to

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