From: Alan T. DeKok Date: Sun, 29 Apr 2012 13:22:17 +0000 (+0200) Subject: Added "hup" trigger. X-Git-Tag: release_3_0_0_beta0~213 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9146f8fcae26b9ce13823bfe81ea2e4891e58358;p=thirdparty%2Ffreeradius-server.git Added "hup" trigger. It is sent when this module (and only this module) is sent a HUP via "radmin" --- diff --git a/mibs/FREERADIUS-NOTIFICATION-MIB.txt b/mibs/FREERADIUS-NOTIFICATION-MIB.txt index 888d44ad836..3c8213460d4 100644 --- a/mibs/FREERADIUS-NOTIFICATION-MIB.txt +++ b/mibs/FREERADIUS-NOTIFICATION-MIB.txt @@ -92,6 +92,13 @@ serverModuleConnectionFail NOTIFICATION-TYPE DESCRIPTION "Notification that the module has failed to open a new connection" ::= { serverModuleGeneric 4 } +serverModuleHup NOTIFICATION-TYPE + OBJECTS { radiusdModuleName, + radiusdModuleInstance } + STATUS current + DESCRIPTION "Notification that the module has been HUP'd via radmin" + ::= { serverModuleGeneric 5 } + homeServer OBJECT IDENTIFIER ::= { freeRadiusNotificationMib 3 } -- diff --git a/raddb/trigger.conf b/raddb/trigger.conf index 12b9639811e..54746343946 100644 --- a/raddb/trigger.conf +++ b/raddb/trigger.conf @@ -177,6 +177,18 @@ trigger { # module. You can have module-specific triggers, by placing a # "trigger" subsection in the module configuration. modules { + # The files module + files { + # Common arguments + args = "radiusdModuleName s ldap' radiusdModuleInstance s ''" + + # The module has been HUP'd via radmin + hup = "${snmptrap}::serverModuleHup ${args}" + + # Note that "hup" can be used for every module + # which can be HUP'd via radmin + } + # The LDAP module ldap { # Common arguments @@ -224,6 +236,7 @@ trigger { # home_server.zombie # home_server_pool.fallback # home_server_pool.normal +# modules.*.hup # modules.ldap.fail # modules.sql.close # modules.sql.fail diff --git a/src/main/command.c b/src/main/command.c index 34b1ac031f5..19485fdbec2 100644 --- a/src/main/command.c +++ b/src/main/command.c @@ -297,6 +297,7 @@ static int command_hup(rad_listen_t *listener, int argc, char *argv[]) { CONF_SECTION *cs; module_instance_t *mi; + char buffer[256]; if (argc == 0) { radius_signal_self(RADIUS_SIGNAL_SELF_HUP); @@ -323,6 +324,9 @@ static int command_hup(rad_listen_t *listener, int argc, char *argv[]) return 0; } + snprintf(buffer, sizeof(buffer), "modules.%s.hup", argv[0]); + exec_trigger(NULL, mi->cs, buffer); + return 1; /* success */ }