Skip to content

Commit

Permalink
completed ldap support
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@precise64 committed Mar 10, 2012
1 parent bd15fd9 commit e8d96b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
7 changes: 1 addition & 6 deletions ldap.c
Expand Up @@ -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;
Expand All @@ -248,18 +248,13 @@ void uwsgi_ldap_config() {
char *attr;
char *uwsgi_attr;

char *url = "ldap:///";
char *url_slash;

int desired_version = LDAP_VERSION3;
int ret;

LDAPURLDesc *ldap_url;

if (uwsgi.ldap) {
url = uwsgi.ldap;
}

if (!ldap_is_ldap_url(url)) {
uwsgi_log("invalid LDAP url.\n");
exit(1);
Expand Down
8 changes: 7 additions & 1 deletion uwsgi.c
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions uwsgi.h
Expand Up @@ -1449,10 +1449,6 @@ struct uwsgi_server {
int no_server;
int command_mode;

#ifdef UWSGI_LDAP
char *ldap;
#endif

int xml_round2;

char *cwd;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 *);
Expand Down

0 comments on commit e8d96b8

Please sign in to comment.