comparison src/mail/ngx_mail_handler.c @ 2862:62c95a6b143b stable-0.6

r2496, r2749 merge: compatibility with Microsoft's AUTH LOGIN [base64 encoded user name ] patch by Maxim Dounin
author Igor Sysoev <igor@sysoev.ru>
date Mon, 18 May 2009 15:58:46 +0000
parents e584e946e198
children
comparison
equal deleted inserted replaced
2861:771ca4480b4d 2862:62c95a6b143b
333 return NGX_DONE; 333 return NGX_DONE;
334 } 334 }
335 335
336 336
337 ngx_int_t 337 ngx_int_t
338 ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c) 338 ngx_mail_auth_login_username(ngx_mail_session_t *s, ngx_connection_t *c,
339 ngx_uint_t n)
339 { 340 {
340 ngx_str_t *arg; 341 ngx_str_t *arg;
341 342
342 arg = s->args.elts; 343 arg = s->args.elts;
343 344
344 ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0, 345 ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
345 "mail auth login username: \"%V\"", &arg[0]); 346 "mail auth login username: \"%V\"", &arg[n]);
346 347
347 s->login.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[0].len)); 348 s->login.data = ngx_palloc(c->pool, ngx_base64_decoded_length(arg[n].len));
348 if (s->login.data == NULL){ 349 if (s->login.data == NULL){
349 return NGX_ERROR; 350 return NGX_ERROR;
350 } 351 }
351 352
352 if (ngx_decode_base64(&s->login, &arg[0]) != NGX_OK) { 353 if (ngx_decode_base64(&s->login, &arg[n]) != NGX_OK) {
353 ngx_log_error(NGX_LOG_INFO, c->log, 0, 354 ngx_log_error(NGX_LOG_INFO, c->log, 0,
354 "client sent invalid base64 encoding in AUTH LOGIN command"); 355 "client sent invalid base64 encoding in AUTH LOGIN command");
355 return NGX_MAIL_PARSE_INVALID_COMMAND; 356 return NGX_MAIL_PARSE_INVALID_COMMAND;
356 } 357 }
357 358