comparison src/mail/ngx_mail_handler.c @ 2495:a59b26eee816

compatibility with Microsoft's AUTH LOGIN [base64 encoded user name ] patch by Maxim Dounin
author Igor Sysoev <igor@sysoev.ru>
date Mon, 09 Feb 2009 12:03:55 +0000
parents 722b5aff05ae
children 268d8d3faa34
comparison
equal deleted inserted replaced
2494:693132294e21 2495:a59b26eee816
354 return NGX_DONE; 354 return NGX_DONE;
355 } 355 }
356 356
357 357
358 ngx_int_t 358 ngx_int_t
359 ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c) 359 ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c,
360 ngx_uint_t n)
360 { 361 {
361 ngx_str_t *arg; 362 ngx_str_t *arg;
362 363
363 arg = s->args.elts; 364 arg = s->args.elts;
364 365
365 ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0, 366 ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
366 "mail auth login username: \"%V\"", &arg[0]); 367 "mail auth login username: \"%V\"", &arg[n]);
367 368
368 s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[0].len)); 369 s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[n].len));
369 if (s->login.data == NULL){ 370 if (s->login.data == NULL){
370 return NGX_ERROR; 371 return NGX_ERROR;
371 } 372 }
372 373
373 if (ngx_decode_base64(&s->login, &arg[0]) != NGX_OK) { 374 if (ngx_decode_base64(&s->login, &arg[n]) != NGX_OK) {
374 ngx_log_error(NGX_LOG_INFO, c->log, 0, 375 ngx_log_error(NGX_LOG_INFO, c->log, 0,
375 "client sent invalid base64 encoding in AUTH LOGIN command"); 376 "client sent invalid base64 encoding in AUTH LOGIN command");
376 return NGX_MAIL_PARSE_INVALID_COMMAND; 377 return NGX_MAIL_PARSE_INVALID_COMMAND;
377 } 378 }
378 379