Mercurial > hg > nginx-vendor-0-7
diff src/imap/ngx_imap_auth_http_module.c @ 252:644510700914 NGINX_0_4_11
nginx 0.4.11
*) Feature: the POP3 proxy supports the AUTH LOGIN PLAIN and CRAM-MD5.
*) Feature: the ngx_http_perl_module supports the $r->allow_ranges
method.
*) Bugfix: if the APOP was enabled in the POP3 proxy, then the
USER/PASS commands might not work; bug appeared in 0.4.10.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 25 Oct 2006 00:00:00 +0400 |
parents | fbf2b2f66c9f |
children | 6ae1357b7b7c |
line wrap: on
line diff
--- a/src/imap/ngx_imap_auth_http_module.c +++ b/src/imap/ngx_imap_auth_http_module.c @@ -133,7 +133,9 @@ ngx_module_t ngx_imap_auth_http_module static char *ngx_imap_auth_http_protocol[] = { "pop3", "imap" }; static ngx_str_t ngx_imap_auth_http_method[] = { - ngx_string("plain"), ngx_string("apop") + ngx_string("plain"), + ngx_string("apop"), + ngx_string("cram-md5") }; @@ -1078,7 +1080,7 @@ ngx_imap_auth_http_create_request(ngx_im b->last = ngx_copy(b->last, passwd.data, passwd.len); *b->last++ = CR; *b->last++ = LF; - if (s->salt.len) { + if (s->auth_method != NGX_IMAP_AUTH_PLAIN && s->salt.len) { b->last = ngx_cpymem(b->last, "Auth-Salt: ", sizeof("Auth-Salt: ") - 1); b->last = ngx_copy(b->last, s->salt.data, s->salt.len); @@ -1247,61 +1249,29 @@ ngx_imap_auth_http(ngx_conf_t *cf, ngx_c { ngx_imap_auth_http_conf_t *ahcf = conf; - ngx_str_t *value, *url; - ngx_inet_upstream_t inet_upstream; -#if (NGX_HAVE_UNIX_DOMAIN) - ngx_unix_domain_upstream_t unix_upstream; -#endif + ngx_str_t *value; + ngx_url_t u; value = cf->args->elts; - url = &value[1]; - - if (ngx_strncasecmp(url->data, "unix:", 5) == 0) { - -#if (NGX_HAVE_UNIX_DOMAIN) - - ngx_memzero(&unix_upstream, sizeof(ngx_unix_domain_upstream_t)); + ngx_memzero(&u, sizeof(ngx_url_t)); - unix_upstream.name = *url; - unix_upstream.url = *url; - unix_upstream.uri_part = 1; - - ahcf->peers = ngx_unix_upstream_parse(cf, &unix_upstream); - if (ahcf->peers == NULL) { - return NGX_CONF_ERROR; - } - - ahcf->host_header.len = sizeof("localhost") - 1; - ahcf->host_header.data = (u_char *) "localhost"; - ahcf->uri = unix_upstream.uri; + u.url = value[1]; + u.default_portn = 80; + u.uri_part = 1; -#else - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "the unix domain sockets are not supported " - "on this platform"); - return NGX_CONF_ERROR; - -#endif - - } else { - ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); + if (ngx_parse_url(cf, &u) != NGX_OK) { + if (u.err) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "%s in auth_http \"%V\"", u.err, &u.url); + } + } - inet_upstream.name = *url; - inet_upstream.url = *url; - inet_upstream.default_port_value = 80; - inet_upstream.uri_part = 1; + ahcf->peers = u.peers; + ahcf->peers->number = 1; - ahcf->peers = ngx_inet_upstream_parse(cf, &inet_upstream); - if (ahcf->peers == NULL) { - return NGX_CONF_ERROR; - } - - ahcf->peers->number = 1; - - ahcf->host_header = inet_upstream.host_header; - ahcf->uri = inet_upstream.uri; - } + ahcf->host_header = u.host_header; + ahcf->uri = u.uri; if (ahcf->uri.len == 0) { ahcf->uri.len = sizeof("/") - 1;