From: Nick Porter Date: Fri, 28 Apr 2023 13:15:59 +0000 (+0100) Subject: Ensure LDAP group attribute exists X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3d830214a210f3b566903cf17e9067f6a43d9a3;p=thirdparty%2Ffreeradius-server.git Ensure LDAP group attribute exists --- diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index edc80b0c3b3..8a33e7097c0 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -1851,6 +1851,22 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->group_da = fr_dict_attr_by_name(NULL, fr_dict_root(dict_freeradius), group_attribute); + /* + * If the group attribute was not in the dictionary, create it + */ + if (!inst->group_da) { + fr_dict_attr_flags_t flags; + + memset(&flags, 0, sizeof(flags)); + if (fr_dict_attr_add(fr_dict_unconst(dict_freeradius), fr_dict_root(dict_freeradius), + group_attribute, -1, FR_TYPE_STRING, &flags) < 0) { + PERROR("Error creating group attribute"); + return -1; + + } + inst->group_da = fr_dict_attr_by_name(NULL, fr_dict_root(dict_freeradius), group_attribute); + } + /* * Setup the cache attribute */