[asterisk-commits] qwell: trunk r68831 - in /trunk:
configs/manager.conf.sample main/manager.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Jun 11 15:07:51 MST 2007
Author: qwell
Date: Mon Jun 11 17:07:50 2007
New Revision: 68831
URL: http://svn.digium.com/view/asterisk?view=rev&rev=68831
Log:
Change displayconnects option in manager.conf to be per-user.
Issue 9932, patch by eliel
Modified:
trunk/configs/manager.conf.sample
trunk/main/manager.c
Modified: trunk/configs/manager.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/manager.conf.sample?view=diff&rev=68831&r1=68830&r2=68831
==============================================================================
--- trunk/configs/manager.conf.sample (original)
+++ trunk/configs/manager.conf.sample Mon Jun 11 17:07:50 2007
@@ -68,6 +68,8 @@
;
; writetimeout = 100
;
+;displayconnects = yes ; Display on CLI user login/logoff
+;
; Authorization for various classes
;read = system,call,log,verbose,command,agent,user,config,dtmf
;write = system,call,log,verbose,command,agent,user,config,dtmf
Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=68831&r1=68830&r2=68831
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Mon Jun 11 17:07:50 2007
@@ -471,6 +471,23 @@
if (!strcasecmp(user->username, name))
break;
return user;
+}
+
+/*! \brief Get displayconnects config option.
+ * \param s manager session to get parameter from.
+ * \return displayconnects config option value.
+ */
+static int manager_displayconnects (struct mansession *s)
+{
+ struct ast_manager_user *user = NULL;
+ int ret = 0;
+
+ AST_LIST_LOCK(&users);
+ if ((user = get_manager_by_name_locked (s->username)))
+ ret = user->displayconnects;
+ AST_LIST_UNLOCK(&users);
+
+ return ret;
}
/*! \note The actionlock is read-locked by the caller of this function */
@@ -1467,7 +1484,7 @@
}
s->authenticated = 1;
if (option_verbose > 1) {
- if (displayconnects) {
+ if (manager_displayconnects(s)) {
ast_verbose(VERBOSE_PREFIX_2 "%sManager '%s' logged on from %s\n", (s->managerid ? "HTTP " : ""), s->username, ast_inet_ntoa(s->sin.sin_addr));
}
}
@@ -2508,7 +2525,7 @@
/* session is over, explain why and terminate */
if (s->authenticated) {
if (option_verbose > 1) {
- if (displayconnects)
+ if (manager_displayconnects(s))
ast_verbose(VERBOSE_PREFIX_2 "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
}
ast_log(LOG_EVENT, "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
@@ -2537,7 +2554,7 @@
if (s->sessiontimeout && (now > s->sessiontimeout) && !s->inuse) {
AST_LIST_REMOVE_CURRENT(&sessions, list);
ast_atomic_fetchadd_int(&num_sessions, -1);
- if (s->authenticated && (option_verbose > 1) && displayconnects) {
+ if (s->authenticated && (option_verbose > 1) && manager_displayconnects(s)) {
ast_verbose(VERBOSE_PREFIX_2 "HTTP Manager '%s' timed out from %s\n",
s->username, ast_inet_ntoa(s->sin.sin_addr));
}
@@ -3075,7 +3092,7 @@
if (process_message(s, &m)) {
if (s->authenticated) {
if (option_verbose > 1) {
- if (displayconnects)
+ if (manager_displayconnects(s))
ast_verbose(VERBOSE_PREFIX_2 "HTTP Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
}
ast_log(LOG_EVENT, "HTTP Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
@@ -3378,6 +3395,8 @@
/* Make sure we keep this user and don't destroy it during cleanup */
user->keep = 1;
+ /* Default displayconnect to [general] */
+ user->displayconnects = displayconnects;
var = ast_variable_browse(cfg, cat);
while (var) {
More information about the asterisk-commits
mailing list