Using email address as login name

Paul Kreiner deacon at thedeacon.org
Fri Oct 17 17:22:00 EDT 2003


> | If you want your username to contain an '@' sign, you need to patch
> SASL to | make this work, otherwise you'll get '(-13) NO User does not
> exist' errors or | something (forget the message off the top of my
> head).  This is because SASL | internally uses the '@' character to
> delimit the SASL realm from the | username, which messes up your
> authentication scheme.
>
> Where would I get this patch for SASL?   This was the problem I was
> encountering and reported last month and no-one mentioned having to
> patch SASL!

Try the following (against cyrus-sasl-2.1.15/plugins/plugin_common.c). 
You'll need to add CFLAGS="-DPKCODE" to your ./configure line, or #define
PKCODE some other way when compiling SASL.  I was going to try to make it
a configurable option, but I've never done autoconf before -- and I
finally decided it wasn't worth my time to try figuring it out for this
little patch.  :)
As the comment says, this will allow a username form of "user at domain" to
work correctly.  It also allows "user at domain@realm", if anyone's setup was
crazy enough to need that to work.
--- plugin_common.c.orig   2003-02-13 12:56:05.000000000 -0700
+++ plugin_common.c       2003-09-22 13:48:01.000000000 -0600
@@ -661,7 +661,19 @@
        return SASL_BADPARAM;
     }

+/* PK: added the following #ifdef'd code, so if there are two or more '@' in
+   the string, it is assumed that the rightmost one specifies a realm.  If
+   there's only one '@' sign, then it's assumed to be a username, NOT a
realm.+*/
+#ifdef PKCODE
+    if (strchr(input, '@') == strrchr(input, '@'))
+        r = NULL;
+    else
+        r = strrchr(input, '@');
+#else
     r = strchr(input, '@');
+#endif
+
     if (!r) {
        /* hmmm, the user didn't specify a realm */
        if(user_realm && user_realm[0]) {







More information about the Info-cyrus mailing list