~ubuntu-branches/ubuntu/edgy/dovecot/edgy-security

« back to all changes in this revision

Viewing changes to src/imap-login/client-authenticate.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-06-30 15:13:37 UTC
  • mfrom: (1.10.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060630151337-l772crcoe5hfd4hw
Tags: 1.0.rc1-1ubuntu1
Merge from debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
 
234
234
int cmd_authenticate(struct imap_client *client, struct imap_arg *args)
235
235
{
236
 
        const char *mech_name;
 
236
        const char *mech_name, *init_resp = NULL;
237
237
 
238
238
        /* we want only one argument: authentication mechanism name */
239
239
        if (args[0].type != IMAP_ARG_ATOM && args[0].type != IMAP_ARG_STRING)
240
240
                return -1;
241
 
        if (args[1].type != IMAP_ARG_EOL)
242
 
                return -1;
 
241
        if (args[1].type != IMAP_ARG_EOL) {
 
242
                /* optional SASL initial response */
 
243
                if (args[1].type != IMAP_ARG_ATOM ||
 
244
                    args[2].type != IMAP_ARG_EOL)
 
245
                        return -1;
 
246
                init_resp = IMAP_ARG_STR(&args[1]);
 
247
        }
243
248
 
244
249
        mech_name = IMAP_ARG_STR(&args[0]);
245
250
        if (*mech_name == '\0')
246
251
                return 0;
247
252
 
248
253
        client_ref(client);
249
 
        sasl_server_auth_begin(&client->common, "IMAP", mech_name, NULL,
250
 
                               sasl_callback);
 
254
        sasl_server_auth_begin(&client->common, "IMAP", mech_name,
 
255
                               init_resp, sasl_callback);
251
256
        if (!client->common.authenticating)
252
257
                return 1;
253
258