X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/04cb4dfc7c19b726f69c4dfbfa5148d4e5013e8b..625ccd4e28eb61b229663b3dc531a649762012bb:/src/nickserv.c diff --git a/src/nickserv.c b/src/nickserv.c index b40d61b..4e0d1bd 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -128,6 +128,7 @@ #define KEY_LDAP_FIELD_EMAIL "ldap_field_email" #define KEY_LDAP_OBJECT_CLASSES "ldap_object_classes" #define KEY_LDAP_OPER_GROUP_DN "ldap_oper_group_dn" +#define KEY_LDAP_OPER_GROUP_LEVEL "ldap_oper_group_level" #define KEY_LDAP_FIELD_GROUP_MEMBER "ldap_field_group_member" #define KEY_LDAP_TIMEOUT "ldap_timeout" #endif @@ -1944,7 +1945,6 @@ struct handle_info *loc_auth(char *handle, char *password, char *userhost) #ifdef WITH_LDAP int ldap_result = LDAP_SUCCESS; char *email = NULL; - #endif hi = dict_find(nickserv_handle_dict, handle, NULL); @@ -1957,7 +1957,6 @@ struct handle_info *loc_auth(char *handle, char *password, char *userhost) return NULL; } } -// else #else if (!hi) { return NULL; @@ -1968,7 +1967,16 @@ struct handle_info *loc_auth(char *handle, char *password, char *userhost) } #endif #ifdef WITH_LDAP - if( (!hi) && nickserv_conf.ldap_enable && ldap_result == LDAP_SUCCESS && nickserv_conf.ldap_autocreate) { + /* ldap libs are present but we are not using them... */ + if( !nickserv_conf.ldap_enable ) { + if (!hi) { + return NULL; + } + if (!checkpass(password, hi->passwd)) { + return NULL; + } + } + else if( (!hi) && ldap_result == LDAP_SUCCESS && nickserv_conf.ldap_autocreate) { /* user not found, but authed to ldap successfully.. * create the account. */ @@ -3258,7 +3266,7 @@ oper_try_set_access(struct userNode *user, struct userNode *bot, struct handle_i #ifdef WITH_LDAP if(nickserv_conf.ldap_enable && nickserv_conf.ldap_oper_group_dn && nickserv_conf.ldap_admin_dn) { int rc; - if(new_level > 0) + if(new_level > nickserv_conf.ldap_oper_group_level) rc = ldap_add2group(target->handle, nickserv_conf.ldap_oper_group_dn); else rc = ldap_delfromgroup(target->handle, nickserv_conf.ldap_oper_group_dn); @@ -4794,6 +4802,9 @@ nickserv_conf_read(void) str = database_get_data(conf_node, KEY_LDAP_OPER_GROUP_DN, RECDB_QSTRING); nickserv_conf.ldap_oper_group_dn = str ? str : ""; + str = database_get_data(conf_node, KEY_LDAP_OPER_GROUP_LEVEL, RECDB_QSTRING); + nickserv_conf.ldap_oper_group_level = str ? strtoul(str, NULL, 0) : 99; + str = database_get_data(conf_node, KEY_LDAP_FIELD_GROUP_MEMBER, RECDB_QSTRING); nickserv_conf.ldap_field_group_member = str ? str : "";