aboutsummaryrefslogtreecommitdiff
path: root/src/mail/ngx_mail_smtp_handler.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-09-14 15:00:19 +0000
committerIgor Sysoev <igor@sysoev.ru>2007-09-14 15:00:19 +0000
commit945af2aac9a154b12d8087b629a6d35edc5415f2 (patch)
treefcc52845e226f9bd2d676f81100d25b188578c6b /src/mail/ngx_mail_smtp_handler.c
parentc95d44bb7301bacf0b7cd6015d26339d6997a935 (diff)
downloadnginx-945af2aac9a154b12d8087b629a6d35edc5415f2.tar.gz
nginx-945af2aac9a154b12d8087b629a6d35edc5415f2.zip
create salt just before it will be used
Diffstat (limited to 'src/mail/ngx_mail_smtp_handler.c')
-rw-r--r--src/mail/ngx_mail_smtp_handler.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mail/ngx_mail_smtp_handler.c b/src/mail/ngx_mail_smtp_handler.c
index 8eb28df2f..9fad45958 100644
--- a/src/mail/ngx_mail_smtp_handler.c
+++ b/src/mail/ngx_mail_smtp_handler.c
@@ -46,13 +46,6 @@ ngx_mail_smtp_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
- if (cscf->smtp_auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) {
- if (ngx_mail_salt(s, c, cscf) != NGX_OK) {
- ngx_mail_session_internal_server_error(s);
- return;
- }
- }
-
timeout = cscf->smtp_greeting_delay ? cscf->smtp_greeting_delay:
cscf->timeout;
ngx_add_timer(c->read, timeout);
@@ -422,6 +415,12 @@ ngx_mail_smtp_auth(ngx_mail_session_t *s, ngx_connection_t *c)
return NGX_MAIL_PARSE_INVALID_COMMAND;
}
+ if (s->salt.data == NULL) {
+ if (ngx_mail_salt(s, c, cscf) != NGX_OK) {
+ return NGX_ERROR;
+ }
+ }
+
if (ngx_mail_auth_cram_md5_salt(s, c, "334 ", 4) == NGX_OK) {
s->mail_state = ngx_smtp_auth_cram_md5;
return NGX_OK;