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