mirror of
https://github.com/mainnika/nginx-auth-ldap.git
synced 2026-06-12 18:03:36 +00:00
added directive for number of LDAP configs
This commit is contained in:
@@ -64,6 +64,8 @@ extern int ldap_init_fd(ber_socket_t fd, int proto, const char *url, LDAP **ld);
|
|||||||
#define OUTCOME_CACHED_ALLOW 3
|
#define OUTCOME_CACHED_ALLOW 3
|
||||||
#define OUTCOME_UNCERTAIN 4 /* Not yet decided */
|
#define OUTCOME_UNCERTAIN 4 /* Not yet decided */
|
||||||
|
|
||||||
|
#define NGX_HTTP_AUTH_LDAP_MAX_SERVERS_SIZE 7
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
LDAPURLDesc *ludpp;
|
LDAPURLDesc *ludpp;
|
||||||
@@ -101,6 +103,7 @@ typedef struct {
|
|||||||
ngx_flag_t cache_enabled;
|
ngx_flag_t cache_enabled;
|
||||||
ngx_msec_t cache_expiration_time;
|
ngx_msec_t cache_expiration_time;
|
||||||
size_t cache_size;
|
size_t cache_size;
|
||||||
|
ngx_int_t servers_size;
|
||||||
#if (NGX_OPENSSL)
|
#if (NGX_OPENSSL)
|
||||||
ngx_ssl_t ssl;
|
ngx_ssl_t ssl;
|
||||||
#endif
|
#endif
|
||||||
@@ -248,6 +251,14 @@ static ngx_command_t ngx_http_auth_ldap_commands[] = {
|
|||||||
offsetof(ngx_http_auth_ldap_main_conf_t, cache_size),
|
offsetof(ngx_http_auth_ldap_main_conf_t, cache_size),
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ngx_string("auth_ldap_servers_size"),
|
||||||
|
NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
|
||||||
|
ngx_conf_set_num_slot,
|
||||||
|
NGX_HTTP_MAIN_CONF_OFFSET,
|
||||||
|
offsetof(ngx_http_auth_ldap_main_conf_t, servers_size),
|
||||||
|
NULL
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ngx_string("auth_ldap"),
|
ngx_string("auth_ldap"),
|
||||||
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LMT_CONF | NGX_CONF_TAKE1,
|
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LMT_CONF | NGX_CONF_TAKE1,
|
||||||
@@ -318,7 +329,10 @@ ngx_http_auth_ldap_ldap_server_block(ngx_conf_t *cf, ngx_command_t *cmd, void *c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cnf->servers == NULL) {
|
if (cnf->servers == NULL) {
|
||||||
cnf->servers = ngx_array_create(cf->pool, 7, sizeof(ngx_http_auth_ldap_server_t));
|
if (cnf->servers_size == NGX_CONF_UNSET) {
|
||||||
|
cnf->servers_size = NGX_HTTP_AUTH_LDAP_MAX_SERVERS_SIZE;
|
||||||
|
}
|
||||||
|
cnf->servers = ngx_array_create(cf->pool, cnf->servers_size, sizeof(ngx_http_auth_ldap_server_t));
|
||||||
if (cnf->servers == NULL) {
|
if (cnf->servers == NULL) {
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
@@ -706,6 +720,7 @@ ngx_http_auth_ldap_create_main_conf(ngx_conf_t *cf)
|
|||||||
conf->cache_enabled = NGX_CONF_UNSET;
|
conf->cache_enabled = NGX_CONF_UNSET;
|
||||||
conf->cache_expiration_time = NGX_CONF_UNSET_MSEC;
|
conf->cache_expiration_time = NGX_CONF_UNSET_MSEC;
|
||||||
conf->cache_size = NGX_CONF_UNSET_SIZE;
|
conf->cache_size = NGX_CONF_UNSET_SIZE;
|
||||||
|
conf->servers_size = NGX_CONF_UNSET;
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user