Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rlm_always: xlat for setting module status and rcode via unlang (#3396)
Parity with: radmin -e 'set module status db_status {alive,dead,notfound,...}'
- Loading branch information
1 parent
26ca6af
commit 25142b0
Showing
6 changed files
with
201 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
always my_reject { | ||
rcode = reject | ||
} | ||
} | ||
|
||
always db_status { | ||
rcode = ok | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# | ||
# Set status to "notfound". xlat should expand to previous status, "alive" | ||
# | ||
if ("%{db_status:notfound}" != "alive") { | ||
update reply { | ||
Filter-Id += "failed" | ||
} | ||
} | ||
|
||
|
||
# | ||
# Verify that the status was changed | ||
# | ||
db_status | ||
if (!notfound) { | ||
update reply { | ||
Filter-Id += "failed" | ||
} | ||
} | ||
|
||
|
||
# | ||
# Fetch status using xlat without setting the status | ||
# | ||
if ("%{db_status:}" != "notfound") { | ||
update reply { | ||
Filter-Id += "failed" | ||
} | ||
} | ||
|
||
|
||
# | ||
# Verify that the status did not change | ||
# | ||
db_status | ||
if (notfound) { | ||
update reply { | ||
Filter-Id += "success" | ||
} | ||
} | ||
|
||
update control { | ||
Cleartext-Password := "hello" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# Set the module status to dead, call it and check that it fails | ||
# | ||
%{db_status:dead} | ||
|
||
db_status { | ||
fail = 1 | ||
} | ||
|
||
if (fail) { | ||
update reply { | ||
Filter-Id := "success" | ||
} | ||
} | ||
|
||
update control { | ||
Cleartext-Password := "hello" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Fail a module... | ||
# | ||
%{db_status:dead} | ||
db_status { | ||
fail = 1 | ||
} | ||
if (!fail) { | ||
update reply { | ||
Filter-Id += "failed" | ||
} | ||
} | ||
|
||
|
||
# | ||
# ... Now revive it | ||
# | ||
%{db_status:alive} | ||
db_status | ||
if (ok) { | ||
update reply { | ||
Filter-Id += "success" | ||
} | ||
} | ||
|
||
update control { | ||
Cleartext-Password := "hello" | ||
} |