*module_rcode = RLM_MODULE_FAIL;
vp = pairfind(request->config_items, PW_LDAP_USERDN, 0);
- if (vp) return vp->vp_strvalue;
-
+ if (vp) {
+ *module_rcode = RLM_MODULE_OK;
+ return vp->vp_strvalue;
+ }
+
if (!radius_xlat(filter, sizeof(filter), inst->filter,
request, ldap_escape_func, NULL)) {
radlog(L_ERR, "rlm_ldap (%s): Unable to create filter",
return NULL;
}
+ *module_rcode = RLM_MODULE_OK;
+
pairadd(&request->config_items, vp);
ldap_memfree(user_dn);
ldap_msgfree(result);
const char *error_string;
LDAP_CONN *conn;
- LDAPMod *modify[MAX_ATTRMAP];
- LDAPMod **mod_p = modify;
+
+ LDAPMod *mod_p[MAX_ATTRMAP], mod_s[MAX_ATTRMAP];
+ LDAPMod **modify = mod_p;
char *passed[MAX_ATTRMAP * 2];
- int i, last_pass = 0;
+ int i, total = 0, last_pass = 0;
char *expanded[MAX_ATTRMAP];
int last_exp = 0;
FR_TOKEN op;
char path[MAX_STRING_LEN];
- char *p = path;
+ char *p = path;
rad_assert(section);
/*
* Locate the update section were going to be using
*/
- if (section->reference[0] != '.')
+ if (section->reference[0] != '.') {
*p++ = '.';
+ }
if (!radius_xlat(p, (sizeof(path) - (p - path)) - 1,
section->reference, request, NULL, NULL)) {
ci = cf_item_find_next(cs, ci)) {
int do_xlat = FALSE;
- if ((modify - mod_p) == MAX_ATTRMAP) {
+ if (total == MAX_ATTRMAP) {
radlog(L_ERR, "rlm_ldap (%s): Modify map size exceeded",
inst->xlat_name);
passed[last_pass] = p;
} else {
- memcpy(&(passed[last_pass]), value, sizeof(passed[last_pass]));
+ memcpy(&(passed[last_pass]), value,
+ sizeof(passed[last_pass]));
}
passed[last_pass + 1] = NULL;
- (*mod_p)->mod_values = &passed[last_pass];
+ mod_s[total].mod_values = &(passed[last_pass]);
last_pass += 2;
* Now we know the value is ok, copy the pointers into
* the ldapmod struct.
*/
- memcpy(&((*mod_p)->mod_type), &(attr),
- sizeof((*mod_p)->mod_type));
+ memcpy(&(mod_s[total].mod_type), &(attr),
+ sizeof(mod_s[total].mod_type));
op = cf_pair_operator(cp);
switch (op)
* support because of the lack of transactions in LDAP
*/
case T_OP_ADD:
- (*mod_p)->mod_op = LDAP_MOD_ADD;
+ mod_s[total].mod_op = LDAP_MOD_ADD;
break;
case T_OP_SET:
- (*mod_p)->mod_op = LDAP_MOD_REPLACE;
+ mod_s[total].mod_op = LDAP_MOD_REPLACE;
break;
case T_OP_SUB:
- (*mod_p)->mod_op = LDAP_MOD_DELETE;
+ mod_s[total].mod_op = LDAP_MOD_DELETE;
break;
default:
radlog(L_ERR, "rlm_ldap (%s): Operator '%s' "
goto error;
}
- mod_p++;
+ mod_p[total] = &(mod_s[total]);
+ total++;
}
- *mod_p = NULL;
+ mod_p[total] = NULL;
/*
* Perform all modifications as the default admin user.