Fix crash in rlm_ldap if server goes away whilst processing profiles
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 22 Sep 2015 18:38:38 +0000 (19:38 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 22 Sep 2015 18:39:36 +0000 (19:39 +0100)
src/modules/rlm_ldap/rlm_ldap.c

index 13207ed..d70d005 100644 (file)
@@ -1608,11 +1608,18 @@ skip_edir:
                values = ldap_get_values_len(conn->handle, entry, inst->profile_attr);
                if (values != NULL) {
                        for (i = 0; values[i] != NULL; i++) {
+                               rlm_rcode_t ret;
                                char *value;
 
                                value = rlm_ldap_berval_to_string(request, values[i]);
-                               rlm_ldap_map_profile(inst, request, &conn, value, &expanded);
+                               ret = rlm_ldap_map_profile(inst, request, &conn, value, &expanded);
                                talloc_free(value);
+                               if (ret == RLM_MODULE_FAIL) {
+                                       ldap_value_free_len(values);
+                                       rcode = ret;
+                                       goto finish;
+                               }
+
                        }
                        ldap_value_free_len(values);
                }