mirror of
https://github.com/nginx/nginx.git
synced 2025-06-17 01:01:28 +08:00
limit CNAME recursion
This commit is contained in:
parent
523e09ee1a
commit
a8372d8a84
@ -435,12 +435,31 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx)
|
|||||||
|
|
||||||
/* NGX_RESOLVE_CNAME */
|
/* NGX_RESOLVE_CNAME */
|
||||||
|
|
||||||
|
if (ctx->recursion++ < NGX_RESOLVER_MAX_RECURSION) {
|
||||||
|
|
||||||
ctx->name.len = rn->cnlen;
|
ctx->name.len = rn->cnlen;
|
||||||
ctx->name.data = rn->u.cname;
|
ctx->name.data = rn->u.cname;
|
||||||
|
|
||||||
return ngx_resolve_name_locked(r, ctx);
|
return ngx_resolve_name_locked(r, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->next = rn->waiting;
|
||||||
|
rn->waiting = NULL;
|
||||||
|
|
||||||
|
/* unlock name mutex */
|
||||||
|
|
||||||
|
do {
|
||||||
|
ctx->state = NGX_RESOLVE_NXDOMAIN;
|
||||||
|
next = ctx->next;
|
||||||
|
|
||||||
|
ctx->handler(ctx);
|
||||||
|
|
||||||
|
ctx = next;
|
||||||
|
} while (ctx);
|
||||||
|
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (rn->waiting) {
|
if (rn->waiting) {
|
||||||
|
|
||||||
ctx->next = rn->waiting;
|
ctx->next = rn->waiting;
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#define NGX_NO_RESOLVER (void *) -1
|
#define NGX_NO_RESOLVER (void *) -1
|
||||||
|
|
||||||
|
#define NGX_RESOLVER_MAX_RECURSION 50
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ngx_connection_t *connection;
|
ngx_connection_t *connection;
|
||||||
@ -128,6 +130,7 @@ struct ngx_resolver_ctx_s {
|
|||||||
ngx_msec_t timeout;
|
ngx_msec_t timeout;
|
||||||
|
|
||||||
ngx_uint_t quick; /* unsigned quick:1; */
|
ngx_uint_t quick; /* unsigned quick:1; */
|
||||||
|
ngx_uint_t recursion;
|
||||||
ngx_event_t *event;
|
ngx_event_t *event;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user