Changeset 426

Show
Ignore:
Timestamp:
18/10/07 07:44:14 (14 months ago)
Author:
markdoliner
Message:

I believe this fixes ANONYMOUS SASL authentication when using gsasl.
The problem was that we were calling gsasl_step() with an empty
input string, but the first step of ANONYMOUS SASL login requires
an arbitrary token. I think the token is just any random string
that can optionally be used to track the user.

In our case we call the ctx->cb with "sx_sasl_cb_GEN_AUTHZID" as
the type. This causes c2s to generate a random node that can be
used for this user. It looked like this is what the cyrus and
sasl code do. I was only able to test this a little... by
hacking some SASL ANONYMOUS support into Pidgin.

Does anyone know of a jabber client with SASL anonymous support?

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r423 r426  
     12007-10-18 Mark Doliner <mark@meebo.com> 
     2        * Fix gsasl ANONYMOUS login 
     3 
    142007-10-16 Mark Doliner <mark@meebo.com> 
    25        * Minor comments and whitespace changes 
  • trunk/sx/sasl_gsasl.c

    r418 r426  
    153153/** move the stream to the auth state */ 
    154154void _sx_sasl_open(sx_t s, Gsasl_session *sd) { 
    155     char *method, *authzid, *realm = NULL; 
     155    char *method, *authzid; 
     156    const char *realm = NULL; 
    156157    struct sx_sasl_creds_st creds = {NULL, NULL, NULL, NULL}; 
    157158    _sx_sasl_t ctx = gsasl_session_hook_get(sd); 
     
    337338        /* decode and process */ 
    338339        _sx_sasl_decode(in, inlen, &buf, &buflen); 
     340        if(buflen == 0 && strcmp(mech, "ANONYMOUS") == 0) { 
     341            if(buf != NULL) free(buf); 
     342            (ctx->cb)(sx_sasl_cb_GEN_AUTHZID, NULL, (void **)&out, s, ctx->cbarg); 
     343            buf = strdup(out); 
     344            buflen = strlen(buf); 
     345        } 
    339346        ret = gsasl_step(sd, buf, buflen, &out, (size_t *) &outlen); 
    340347        if(ret != GSASL_OK && ret != GSASL_NEEDS_MORE) {