create salt just before it will be used
Igor Sysoev
14 years ago
37 | 37 |
|
38 | 38 |
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
|
39 | 39 |
|
40 | |
if (cscf->imap_auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) {
|
41 | |
if (ngx_mail_salt(s, c, cscf) != NGX_OK) {
|
42 | |
ngx_mail_session_internal_server_error(s);
|
43 | |
return;
|
44 | |
}
|
45 | |
}
|
46 | |
|
47 | 40 |
s->out.len = sizeof(imap_greeting) - 1;
|
48 | 41 |
s->out.data = imap_greeting;
|
49 | 42 |
|
|
390 | 383 |
return NGX_MAIL_PARSE_INVALID_COMMAND;
|
391 | 384 |
}
|
392 | 385 |
|
|
386 |
if (s->salt.data == NULL) {
|
|
387 |
if (ngx_mail_salt(s, c, cscf) != NGX_OK) {
|
|
388 |
return NGX_ERROR;
|
|
389 |
}
|
|
390 |
}
|
|
391 |
|
393 | 392 |
if (ngx_mail_auth_cram_md5_salt(s, c, "+ ", 2) == NGX_OK) {
|
394 | 393 |
s->mail_state = ngx_imap_auth_cram_md5;
|
395 | 394 |
return NGX_OK;
|
45 | 45 |
|
46 | 46 |
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
|
47 | 47 |
|
48 | |
if (cscf->smtp_auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) {
|
49 | |
if (ngx_mail_salt(s, c, cscf) != NGX_OK) {
|
50 | |
ngx_mail_session_internal_server_error(s);
|
51 | |
return;
|
52 | |
}
|
53 | |
}
|
54 | |
|
55 | 48 |
timeout = cscf->smtp_greeting_delay ? cscf->smtp_greeting_delay:
|
56 | 49 |
cscf->timeout;
|
57 | 50 |
ngx_add_timer(c->read, timeout);
|
|
421 | 414 |
return NGX_MAIL_PARSE_INVALID_COMMAND;
|
422 | 415 |
}
|
423 | 416 |
|
|
417 |
if (s->salt.data == NULL) {
|
|
418 |
if (ngx_mail_salt(s, c, cscf) != NGX_OK) {
|
|
419 |
return NGX_ERROR;
|
|
420 |
}
|
|
421 |
}
|
|
422 |
|
424 | 423 |
if (ngx_mail_auth_cram_md5_salt(s, c, "334 ", 4) == NGX_OK) {
|
425 | 424 |
s->mail_state = ngx_smtp_auth_cram_md5;
|
426 | 425 |
return NGX_OK;
|