Skip to content

Commit 4ce0407

Browse files
committed
allow radmin to read custom dictionaries, too.
the server and radclient assume that the RADIUS protocol is loaded before reading raddb/dictionary. So radmin should do that, too
1 parent 593a369 commit 4ce0407

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

src/listen/control/radmin.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,26 @@ static char *stack[MAX_STACK];
159159

160160
static fr_cmd_t *local_cmds = NULL;
161161

162+
static fr_dict_t const *dict_freeradius;
163+
static fr_dict_t const *dict_radius;
164+
165+
static const fr_dict_autoload_t radmin_dict[] = {
166+
{ .out = &dict_freeradius, .proto = "freeradius" },
167+
{ .out = &dict_radius, .proto = "radius" },
168+
DICT_AUTOLOAD_TERMINATOR
169+
};
170+
171+
static fr_dict_attr_t const *attr_cleartext_password;
172+
static fr_dict_attr_t const *attr_user_name;
173+
174+
static const fr_dict_attr_autoload_t radmin_dict_attr[] = {
175+
{ .out = &attr_cleartext_password, .name = "Password.Cleartext", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
176+
{ .out = &attr_user_name, .name = "User-Name", .type = FR_TYPE_STRING, .dict = &dict_radius },
177+
178+
DICT_AUTOLOAD_TERMINATOR
179+
};
180+
181+
162182
static NEVER_RETURNS void usage(int status)
163183
{
164184
FILE *output = status ? stderr : stdout;
@@ -985,11 +1005,21 @@ int main(int argc, char **argv)
9851005
fr_exit_now(64);
9861006
}
9871007

988-
if (fr_dict_read(dict, confdir, FR_DICTIONARY_FILE) == -1) {
1008+
if (fr_dict_autoload(radmin_dict) < 0) {
1009+
fr_perror("radmon");
1010+
fr_exit_now(64);
1011+
}
1012+
1013+
if (fr_dict_attr_autoload(radmin_dict_attr) < 0) {
9891014
fr_perror("radmin");
9901015
fr_exit_now(64);
9911016
}
9921017

1018+
if (fr_dict_read(dict, confdir, FR_DICTIONARY_FILE) == -1) {
1019+
fr_perror("radmin 2");
1020+
fr_exit_now(64);
1021+
}
1022+
9931023
cs = cf_section_alloc(autofree, NULL, "main", NULL);
9941024
if (!cs) fr_exit_now(EXIT_FAILURE);
9951025

0 commit comments

Comments
 (0)