*
* x3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* x3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
if(!(nickserv_conf.ldap_admin_dn && *nickserv_conf.ldap_admin_dn &&
nickserv_conf.ldap_admin_pass && *nickserv_conf.ldap_admin_pass)) {
log_module(MAIN_LOG, LOG_ERROR, "Tried to admin bind, but no admin credentials configured in config file. ldap_admin_dn/ldap_admin_pass");
return LDAP_OTHER; /* not configured to do this */
}
if(!(nickserv_conf.ldap_admin_dn && *nickserv_conf.ldap_admin_dn &&
nickserv_conf.ldap_admin_pass && *nickserv_conf.ldap_admin_pass)) {
log_module(MAIN_LOG, LOG_ERROR, "Tried to admin bind, but no admin credentials configured in config file. ldap_admin_dn/ldap_admin_pass");
return LDAP_OTHER; /* not configured to do this */
}
memset(buff, 0, MAXLEN);
snprintf(buff, sizeof(buff)-1, nickserv_conf.ldap_dn_fmt /*"uid=%s,ou=Users,dc=afternet,dc=org"*/, account);
memset(buff, 0, MAXLEN);
snprintf(buff, sizeof(buff)-1, nickserv_conf.ldap_dn_fmt /*"uid=%s,ou=Users,dc=afternet,dc=org"*/, account);
}
log_module(MAIN_LOG, LOG_DEBUG, "Search successfull! %s %s\n", nickserv_conf.ldap_base, filter);
if(ldap_count_entries(ld, res) != 1) {
}
log_module(MAIN_LOG, LOG_DEBUG, "Search successfull! %s %s\n", nickserv_conf.ldap_base, filter);
if(ldap_count_entries(ld, res) != 1) {
- log_module(MAIN_LOG, LOG_ERROR, "LDAP search got %d entries when looking for %s", ldap_count_entries(ld, res), account);
+ log_module(MAIN_LOG, LOG_DEBUG, "LDAP search got %d entries when looking for %s", ldap_count_entries(ld, res), account);
return(LDAP_OTHER); /* Search was a success, but user not found.. */
}
log_module(MAIN_LOG, LOG_DEBUG, "LDAP search got %d entries", ldap_count_entries(ld, res));
return(LDAP_OTHER); /* Search was a success, but user not found.. */
}
log_module(MAIN_LOG, LOG_DEBUG, "LDAP search got %d entries", ldap_count_entries(ld, res));
if( (rc = ldap_search_user(account, &res)) == LDAP_SUCCESS) {
entry = ldap_first_entry(ld, res);
value = ldap_get_values(ld, entry, nickserv_conf.ldap_field_email);
if(!value) {
return(LDAP_OTHER);
}
if( (rc = ldap_search_user(account, &res)) == LDAP_SUCCESS) {
entry = ldap_first_entry(ld, res);
value = ldap_get_values(ld, entry, nickserv_conf.ldap_field_email);
if(!value) {
return(LDAP_OTHER);
}
log_module(MAIN_LOG, LOG_DEBUG, "%s: %s\n", nickserv_conf.ldap_field_email, value[0]);
/*
value = ldap_get_values(ld, entry, "description");
log_module(MAIN_LOG, LOG_DEBUG, "%s: %s\n", nickserv_conf.ldap_field_email, value[0]);
/*
value = ldap_get_values(ld, entry, "description");
rc = ldap_add_ext_s(ld, newdn, mods, NULL, NULL);
if(rc != LDAP_SUCCESS && rc!= LDAP_ALREADY_EXISTS) {
log_module(MAIN_LOG, LOG_ERROR, "Error adding ldap account: %s -- %s", account, ldap_err2string(rc));
rc = ldap_add_ext_s(ld, newdn, mods, NULL, NULL);
if(rc != LDAP_SUCCESS && rc!= LDAP_ALREADY_EXISTS) {
log_module(MAIN_LOG, LOG_ERROR, "Error adding ldap account: %s -- %s", account, ldap_err2string(rc));
rc = ldap_modrdn2_s(ld, dn, newdn, true);
if(rc != LDAP_SUCCESS) {
log_module(MAIN_LOG, LOG_ERROR, "Error modifying ldap account: %s -- %s", oldaccount, ldap_err2string(rc));
rc = ldap_modrdn2_s(ld, dn, newdn, true);
if(rc != LDAP_SUCCESS) {
log_module(MAIN_LOG, LOG_ERROR, "Error modifying ldap account: %s -- %s", oldaccount, ldap_err2string(rc));
snprintf(dn, MAXLEN-1, nickserv_conf.ldap_dn_fmt, account);
mods = make_mods_modify(passbuf, email, &num_mods);
if(!mods) {
snprintf(dn, MAXLEN-1, nickserv_conf.ldap_dn_fmt, account);
mods = make_mods_modify(passbuf, email, &num_mods);
if(!mods) {
- log_module(MAIN_LOG, LOG_ERROR, "Error adding ldap account: %s -- %s", account, ldap_err2string(rc));
- return rc;
+ log_module(MAIN_LOG, LOG_ERROR, "Error modifying ldap account: %s -- %s", account, ldap_err2string(rc));
+ // return rc;
log_module(MAIN_LOG, LOG_ERROR, "Error adding %s to group %s: %s", account, group, ldap_err2string(rc));
return rc;
}
log_module(MAIN_LOG, LOG_ERROR, "Error adding %s to group %s: %s", account, group, ldap_err2string(rc));
return rc;
}