diff --git a/ldap.c b/ldap.c index 13dba6f05a..fd905dd152 100644 --- a/ldap.c +++ b/ldap.c @@ -239,7 +239,7 @@ void uwsgi_opt_ldap_dump(char *opt, char *foo, void *bar) { exit(0); } -void uwsgi_ldap_config() { +void uwsgi_ldap_config(char *url) { LDAP *ldp; LDAPMessage *results, *entry; @@ -248,7 +248,6 @@ void uwsgi_ldap_config() { char *attr; char *uwsgi_attr; - char *url = "ldap:///"; char *url_slash; int desired_version = LDAP_VERSION3; @@ -256,10 +255,6 @@ void uwsgi_ldap_config() { LDAPURLDesc *ldap_url; - if (uwsgi.ldap) { - url = uwsgi.ldap; - } - if (!ldap_is_ldap_url(url)) { uwsgi_log("invalid LDAP url.\n"); exit(1); diff --git a/uwsgi.c b/uwsgi.c index c1bb688a41..4dcd810b4d 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -223,7 +223,7 @@ static struct uwsgi_option uwsgi_base_options[] = { {"zmq", required_argument, 0, "create a zeromq pub/sub pair", uwsgi_opt_set_str, &uwsgi.zeromq,0}, #endif #ifdef UWSGI_LDAP - {"ldap", required_argument, 0, "load configuration from ldap server", uwsgi_opt_set_str, &uwsgi.ldap, 0}, + {"ldap", required_argument, 0, "load configuration from ldap server", uwsgi_opt_load_ldap, NULL, UWSGI_OPT_IMMEDIATE}, {"ldap-schema", no_argument, 0, "dump uWSGI ldap schema", uwsgi_opt_ldap_dump, NULL, UWSGI_OPT_IMMEDIATE}, {"ldap-schema-ldif", no_argument, 0, "dump uWSGI ldap schema in ldif format", uwsgi_opt_ldap_dump_ldif, NULL, UWSGI_OPT_IMMEDIATE}, #endif @@ -3864,6 +3864,12 @@ void uwsgi_opt_load_json(char *opt, char *filename, void *none) { } #endif +#ifdef UWSGI_LDAP +void uwsgi_opt_load_ldap(char *opt, char *url, void *none) { + uwsgi_ldap_config(url); +} +#endif + void uwsgi_opt_flock(char *opt, char *filename, void *none) { int fd = open(filename, O_RDWR); diff --git a/uwsgi.h b/uwsgi.h index 0f87ddcdd4..bd6ae3b41b 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -1449,10 +1449,6 @@ struct uwsgi_server { int no_server; int command_mode; -#ifdef UWSGI_LDAP - char *ldap; -#endif - int xml_round2; char *cwd; @@ -2026,7 +2022,7 @@ void uwsgi_sqlite3_config(char *, char *[]); #ifdef UWSGI_LDAP void uwsgi_opt_ldap_dump(char *, char *, void *); void uwsgi_opt_ldap_dump_ldif(char *, char *, void *); -void uwsgi_ldap_config(void); +void uwsgi_ldap_config(char *); #endif inline int uwsgi_strncmp(char *, int, char *, int); @@ -2653,6 +2649,9 @@ void uwsgi_opt_load_sqlite3(char *, char *, void *); #ifdef UWSGI_JSON void uwsgi_opt_load_json(char *, char *, void *); #endif +#ifdef UWSGI_LDAP +void uwsgi_opt_load_ldap(char *, char *, void *); +#endif void uwsgi_opt_set_umask(char *, char *, void *); void uwsgi_opt_add_spooler(char *, char *, void *);