diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-18 17:33:33 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-18 17:33:33 +0000 |
commit | f0963f006fb26e71cd82fb79f6fa986fc2a472b8 (patch) | |
tree | 984cb45cadde7ee726805eb7011c7989d2c63941 /main | |
parent | 1661f462680113db414aa4b5d3fcf4118e0f9e7b (diff) |
Merged revisions 51233 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r51233 | russell | 2007-01-18 11:18:43 -0600 (Thu, 18 Jan 2007) | 3 lines
Make the "hasmanager" option in users.conf actually have an effect.
(issue #8740, LnxPrgr3)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51234 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/manager.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/main/manager.c b/main/manager.c index a071283b5..a8f356bba 100644 --- a/main/manager.c +++ b/main/manager.c @@ -917,7 +917,41 @@ static int authenticate(struct mansession *s, const struct message *m) } } ast_config_destroy(cfg); - } + cfg = ast_config_load("users.conf"); + if (!cfg) + return -1; + cat = NULL; + while ( (cat = ast_category_browse(cfg, cat)) ) { + if (!strcasecmp(cat, user) && strcasecmp(cat, "general")) + break; + } + if (!cat) { + ast_log(LOG_NOTICE, "%s tried to authenticate with nonexistent user '%s'\n", ast_inet_ntoa(s->sin.sin_addr), user); + ast_config_destroy(cfg); + return -1; + } + /* collect parameters for the user's entry from users.conf */ + for (v = ast_variable_browse(cfg, cat); v; v = v->next) { + if (!strcasecmp(v->name, "secret")) + password = ast_strdupa(v->value); + else if (!strcasecmp(v->name, "read")) + readperm = get_perm(v->value); + else if (!strcasecmp(v->name, "write")) + writeperm = get_perm(v->value); + else if (!strcasecmp(v->name, "permit") || + !strcasecmp(v->name, "deny")) { + ha = ast_append_ha(v->name, v->value, ha, NULL); + } else if (!strcasecmp(v->name, "writetimeout")) { + int val = atoi(v->value); + + if (val < 100) + ast_log(LOG_WARNING, "Invalid writetimeout value '%s' at line %d\n", v->value, v->lineno); + else + s->writetimeout = val; + } + } + ast_config_destroy(cfg); + } if (ha) { int good = ast_apply_ha(ha, &(s->sin)); |