axe imap module artifacts
This commit is contained in:
parent
ac66e2eb0b
commit
2f3014e62f
3 changed files with 48 additions and 48 deletions
|
@ -70,9 +70,9 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
ngx_conf_t pcf;
|
ngx_conf_t pcf;
|
||||||
ngx_array_t in_ports;
|
ngx_array_t in_ports;
|
||||||
ngx_listening_t *ls;
|
ngx_listening_t *ls;
|
||||||
ngx_mail_listen_t *imls;
|
ngx_mail_listen_t *mls;
|
||||||
ngx_mail_module_t *module;
|
ngx_mail_module_t *module;
|
||||||
ngx_mail_in_port_t *imip;
|
ngx_mail_in_port_t *mip;
|
||||||
ngx_mail_conf_ctx_t *ctx;
|
ngx_mail_conf_ctx_t *ctx;
|
||||||
ngx_mail_conf_in_port_t *in_port;
|
ngx_mail_conf_in_port_t *in_port;
|
||||||
ngx_mail_conf_in_addr_t *in_addr;
|
ngx_mail_conf_in_addr_t *in_addr;
|
||||||
|
@ -223,7 +223,7 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
imls = cmcf->listen.elts;
|
mls = cmcf->listen.elts;
|
||||||
|
|
||||||
for (l = 0; l < cmcf->listen.nelts; l++) {
|
for (l = 0; l < cmcf->listen.nelts; l++) {
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
|
|
||||||
in_port = in_ports.elts;
|
in_port = in_ports.elts;
|
||||||
for (p = 0; p < in_ports.nelts; p++) {
|
for (p = 0; p < in_ports.nelts; p++) {
|
||||||
if (in_port[p].port == imls[l].port) {
|
if (in_port[p].port == mls[l].port) {
|
||||||
in_port = &in_port[p];
|
in_port = &in_port[p];
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_port->port = imls[l].port;
|
in_port->port = mls[l].port;
|
||||||
|
|
||||||
if (ngx_array_init(&in_port->addrs, cf->temp_pool, 2,
|
if (ngx_array_init(&in_port->addrs, cf->temp_pool, 2,
|
||||||
sizeof(ngx_mail_conf_in_addr_t))
|
sizeof(ngx_mail_conf_in_addr_t))
|
||||||
|
@ -258,11 +258,11 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_addr->addr = imls[l].addr;
|
in_addr->addr = mls[l].addr;
|
||||||
in_addr->ctx = imls[l].ctx;
|
in_addr->ctx = mls[l].ctx;
|
||||||
in_addr->bind = imls[l].bind;
|
in_addr->bind = mls[l].bind;
|
||||||
#if (NGX_MAIL_SSL)
|
#if (NGX_MAIL_SSL)
|
||||||
in_addr->ssl = imls[l].ssl;
|
in_addr->ssl = mls[l].ssl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,27 +318,27 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
ls->log.data = &ls->addr_text;
|
ls->log.data = &ls->addr_text;
|
||||||
ls->log.handler = ngx_accept_log_error;
|
ls->log.handler = ngx_accept_log_error;
|
||||||
|
|
||||||
imip = ngx_palloc(cf->pool, sizeof(ngx_mail_in_port_t));
|
mip = ngx_palloc(cf->pool, sizeof(ngx_mail_in_port_t));
|
||||||
if (imip == NULL) {
|
if (mip == NULL) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ls->servers = imip;
|
ls->servers = mip;
|
||||||
|
|
||||||
in_addr = in_port[p].addrs.elts;
|
in_addr = in_port[p].addrs.elts;
|
||||||
|
|
||||||
if (in_addr[a].bind && in_addr[a].addr != INADDR_ANY) {
|
if (in_addr[a].bind && in_addr[a].addr != INADDR_ANY) {
|
||||||
imip->naddrs = 1;
|
mip->naddrs = 1;
|
||||||
done = 0;
|
done = 0;
|
||||||
|
|
||||||
} else if (in_port[p].addrs.nelts > 1
|
} else if (in_port[p].addrs.nelts > 1
|
||||||
&& in_addr[last - 1].addr == INADDR_ANY)
|
&& in_addr[last - 1].addr == INADDR_ANY)
|
||||||
{
|
{
|
||||||
imip->naddrs = last;
|
mip->naddrs = last;
|
||||||
done = 1;
|
done = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
imip->naddrs = 1;
|
mip->naddrs = 1;
|
||||||
done = 0;
|
done = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,18 +346,18 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
|
ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
|
||||||
"%ui: %V %d %ui %ui",
|
"%ui: %V %d %ui %ui",
|
||||||
a, &ls->addr_text, in_addr[a].bind,
|
a, &ls->addr_text, in_addr[a].bind,
|
||||||
imip->naddrs, last);
|
mip->naddrs, last);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
imip->addrs = ngx_pcalloc(cf->pool,
|
mip->addrs = ngx_pcalloc(cf->pool,
|
||||||
imip->naddrs * sizeof(ngx_mail_in_addr_t));
|
mip->naddrs * sizeof(ngx_mail_in_addr_t));
|
||||||
if (imip->addrs == NULL) {
|
if (mip->addrs == NULL) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < imip->naddrs; i++) {
|
for (i = 0; i < mip->naddrs; i++) {
|
||||||
imip->addrs[i].addr = in_addr[i].addr;
|
mip->addrs[i].addr = in_addr[i].addr;
|
||||||
imip->addrs[i].ctx = in_addr[i].ctx;
|
mip->addrs[i].ctx = in_addr[i].ctx;
|
||||||
|
|
||||||
text = ngx_pnalloc(cf->pool,
|
text = ngx_pnalloc(cf->pool,
|
||||||
NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
|
NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
|
||||||
|
@ -370,11 +370,11 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
|
|
||||||
len = ngx_sprintf(text + len, ":%d", in_port[p].port) - text;
|
len = ngx_sprintf(text + len, ":%d", in_port[p].port) - text;
|
||||||
|
|
||||||
imip->addrs[i].addr_text.len = len;
|
mip->addrs[i].addr_text.len = len;
|
||||||
imip->addrs[i].addr_text.data = text;
|
mip->addrs[i].addr_text.data = text;
|
||||||
|
|
||||||
#if (NGX_MAIL_SSL)
|
#if (NGX_MAIL_SSL)
|
||||||
imip->addrs[i].ssl = in_addr[i].ssl;
|
mip->addrs[i].ssl = in_addr[i].ssl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
ngx_str_t *value;
|
ngx_str_t *value;
|
||||||
ngx_url_t u;
|
ngx_url_t u;
|
||||||
ngx_uint_t i, m;
|
ngx_uint_t i, m;
|
||||||
ngx_mail_listen_t *imls;
|
ngx_mail_listen_t *ls;
|
||||||
ngx_mail_module_t *module;
|
ngx_mail_module_t *module;
|
||||||
ngx_mail_core_main_conf_t *cmcf;
|
ngx_mail_core_main_conf_t *cmcf;
|
||||||
|
|
||||||
|
@ -312,11 +312,11 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
|
|
||||||
cmcf = ngx_mail_conf_get_module_main_conf(cf, ngx_mail_core_module);
|
cmcf = ngx_mail_conf_get_module_main_conf(cf, ngx_mail_core_module);
|
||||||
|
|
||||||
imls = cmcf->listen.elts;
|
ls = cmcf->listen.elts;
|
||||||
|
|
||||||
for (i = 0; i < cmcf->listen.nelts; i++) {
|
for (i = 0; i < cmcf->listen.nelts; i++) {
|
||||||
|
|
||||||
if (imls[i].addr != u.addr.in_addr || imls[i].port != u.port) {
|
if (ls[i].addr != u.addr.in_addr || ls[i].port != u.port) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,17 +325,17 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
imls = ngx_array_push(&cmcf->listen);
|
ls = ngx_array_push(&cmcf->listen);
|
||||||
if (imls == NULL) {
|
if (ls == NULL) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_memzero(imls, sizeof(ngx_mail_listen_t));
|
ngx_memzero(ls, sizeof(ngx_mail_listen_t));
|
||||||
|
|
||||||
imls->addr = u.addr.in_addr;
|
ls->addr = u.addr.in_addr;
|
||||||
imls->port = u.port;
|
ls->port = u.port;
|
||||||
imls->family = u.family;
|
ls->family = u.family;
|
||||||
imls->ctx = cf->ctx;
|
ls->ctx = cf->ctx;
|
||||||
|
|
||||||
for (m = 0; ngx_modules[m]; m++) {
|
for (m = 0; ngx_modules[m]; m++) {
|
||||||
if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
|
if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
|
||||||
|
@ -359,13 +359,13 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
for (i = 2; i < cf->args->nelts; i++) {
|
for (i = 2; i < cf->args->nelts; i++) {
|
||||||
|
|
||||||
if (ngx_strcmp(value[i].data, "bind") == 0) {
|
if (ngx_strcmp(value[i].data, "bind") == 0) {
|
||||||
imls->bind = 1;
|
ls->bind = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_strcmp(value[i].data, "ssl") == 0) {
|
if (ngx_strcmp(value[i].data, "ssl") == 0) {
|
||||||
#if (NGX_MAIL_SSL)
|
#if (NGX_MAIL_SSL)
|
||||||
imls->ssl = 1;
|
ls->ssl = 1;
|
||||||
continue;
|
continue;
|
||||||
#else
|
#else
|
||||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
|
|
|
@ -26,20 +26,20 @@ ngx_mail_init_connection(ngx_connection_t *c)
|
||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
ngx_mail_log_ctx_t *ctx;
|
ngx_mail_log_ctx_t *ctx;
|
||||||
ngx_mail_in_port_t *imip;
|
ngx_mail_in_port_t *mip;
|
||||||
ngx_mail_in_addr_t *imia;
|
ngx_mail_in_addr_t *mia;
|
||||||
ngx_mail_session_t *s;
|
ngx_mail_session_t *s;
|
||||||
|
|
||||||
/* find the server configuration for the address:port */
|
/* find the server configuration for the address:port */
|
||||||
|
|
||||||
/* AF_INET only */
|
/* AF_INET only */
|
||||||
|
|
||||||
imip = c->listening->servers;
|
mip = c->listening->servers;
|
||||||
imia = imip->addrs;
|
mia = mip->addrs;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
if (imip->naddrs > 1) {
|
if (mip->naddrs > 1) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are several addresses on this port and one of them
|
* There are several addresses on this port and one of them
|
||||||
|
@ -70,8 +70,8 @@ ngx_mail_init_connection(ngx_connection_t *c)
|
||||||
|
|
||||||
/* the last address is "*" */
|
/* the last address is "*" */
|
||||||
|
|
||||||
for ( /* void */ ; i < imip->naddrs - 1; i++) {
|
for ( /* void */ ; i < mip->naddrs - 1; i++) {
|
||||||
if (in_addr == imia[i].addr) {
|
if (in_addr == mia[i].addr) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,10 @@ ngx_mail_init_connection(ngx_connection_t *c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->main_conf = imia[i].ctx->main_conf;
|
s->main_conf = mia[i].ctx->main_conf;
|
||||||
s->srv_conf = imia[i].ctx->srv_conf;
|
s->srv_conf = mia[i].ctx->srv_conf;
|
||||||
|
|
||||||
s->addr_text = &imia[i].addr_text;
|
s->addr_text = &mia[i].addr_text;
|
||||||
|
|
||||||
c->data = s;
|
c->data = s;
|
||||||
s->connection = c;
|
s->connection = c;
|
||||||
|
@ -124,7 +124,7 @@ ngx_mail_init_connection(ngx_connection_t *c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imia[i].ssl) {
|
if (mia[i].ssl) {
|
||||||
|
|
||||||
c->log->action = "SSL handshaking";
|
c->log->action = "SSL handshaking";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue