mirror of
https://github.com/znc/znc.git
synced 2026-05-06 13:32:36 +02:00
Add "AuthOnlyViaModule" global/user setting
Setting AuthOnlyViaModule on a user causes CheckPass to never return true, causing all authentication attempts using the configured password to fail, both on IRC connections and for webadmin. This is useful in situations where an external module (cyrusauth, certauth, imapauth) handles authentication. Setting the global AuthOnlyViaModule option causes similar behavior across every user. If AuthOnlyViaModule is set to true globally, it cannot be overridden per-user. Close #1474 Close #331
This commit is contained in:
committed by
Alexey Sokolov
parent
3d874f6fe4
commit
42939c998f
@@ -108,6 +108,7 @@ class CAdminMod : public CModule {
|
||||
{"Admin", boolean},
|
||||
{"AppendTimestamp", boolean},
|
||||
{"PrependTimestamp", boolean},
|
||||
{"AuthOnlyViaModule", boolean},
|
||||
{"TimestampFormat", str},
|
||||
{"DCCBindHost", str},
|
||||
{"StatusPrefix", str},
|
||||
@@ -273,6 +274,9 @@ class CAdminMod : public CModule {
|
||||
else if (sVar == "prependtimestamp")
|
||||
PutModule("PrependTimestamp = " +
|
||||
CString(pUser->GetTimestampPrepend()));
|
||||
else if (sVar == "authonlyviamodule")
|
||||
PutModule("AuthOnlyViaModule = " +
|
||||
CString(pUser->AuthOnlyViaModule()));
|
||||
else if (sVar == "timestampformat")
|
||||
PutModule("TimestampFormat = " + pUser->GetTimestampFormat());
|
||||
else if (sVar == "dccbindhost")
|
||||
@@ -442,6 +446,14 @@ class CAdminMod : public CModule {
|
||||
bool b = sValue.ToBool();
|
||||
pUser->SetTimestampAppend(b);
|
||||
PutModule("AppendTimestamp = " + CString(b));
|
||||
} else if (sVar == "authonlyviamodule") {
|
||||
if (GetUser()->IsAdmin()) {
|
||||
bool b = sValue.ToBool();
|
||||
pUser->SetAuthOnlyViaModule(b);
|
||||
PutModule("AuthOnlyViaModule = " + CString(b));
|
||||
} else {
|
||||
PutModule(t_s("Access denied!"));
|
||||
}
|
||||
} else if (sVar == "timestampformat") {
|
||||
pUser->SetTimestampFormat(sValue);
|
||||
PutModule("TimestampFormat = " + sValue);
|
||||
|
||||
Reference in New Issue
Block a user