Fossil SCM

Exempt admin and setup users from the load_control() restriction.

stephan 2022-04-14 17:12 load-control-rework
Commit 57cdf4f2b9c69e0859516f7791e8ef288d0089b94f6e7bd8d4b583dbe4c66cdb
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -51,10 +51,15 @@
5151
** is too high.
5252
*/
5353
void load_control(void){
5454
double mxLoad = atof(db_get("max-loadavg", 0));
5555
if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
56
+
57
+ login_check_credentials();
58
+ if(g.perm.Admin || g.perm.Setup){
59
+ return;
60
+ }
5661
5762
style_set_current_feature("test");
5863
style_header("Server Overload");
5964
@ <h2>The server load is currently too high.
6065
@ Please try again later.</h2>
6166
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -51,10 +51,15 @@
51 ** is too high.
52 */
53 void load_control(void){
54 double mxLoad = atof(db_get("max-loadavg", 0));
55 if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
 
 
 
 
 
56
57 style_set_current_feature("test");
58 style_header("Server Overload");
59 @ <h2>The server load is currently too high.
60 @ Please try again later.</h2>
61
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -51,10 +51,15 @@
51 ** is too high.
52 */
53 void load_control(void){
54 double mxLoad = atof(db_get("max-loadavg", 0));
55 if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
56
57 login_check_credentials();
58 if(g.perm.Admin || g.perm.Setup){
59 return;
60 }
61
62 style_set_current_feature("test");
63 style_header("Server Overload");
64 @ <h2>The server load is currently too high.
65 @ Please try again later.</h2>
66
--- src/login.c
+++ src/login.c
@@ -985,10 +985,11 @@
985985
** g.userUid Database USER.UID value. Might be -1 for "nobody"
986986
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
987987
** g.perm Permissions granted to this user
988988
** g.anon Permissions that would be available to anonymous
989989
** g.isHuman True if the user is human, not a spider or robot
990
+** g.perm Populated based on user account's capabilities
990991
**
991992
*/
992993
void login_check_credentials(void){
993994
int uid = 0; /* User id */
994995
const char *zCookie; /* Text of the login cookie */
995996
--- src/login.c
+++ src/login.c
@@ -985,10 +985,11 @@
985 ** g.userUid Database USER.UID value. Might be -1 for "nobody"
986 ** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
987 ** g.perm Permissions granted to this user
988 ** g.anon Permissions that would be available to anonymous
989 ** g.isHuman True if the user is human, not a spider or robot
 
990 **
991 */
992 void login_check_credentials(void){
993 int uid = 0; /* User id */
994 const char *zCookie; /* Text of the login cookie */
995
--- src/login.c
+++ src/login.c
@@ -985,10 +985,11 @@
985 ** g.userUid Database USER.UID value. Might be -1 for "nobody"
986 ** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
987 ** g.perm Permissions granted to this user
988 ** g.anon Permissions that would be available to anonymous
989 ** g.isHuman True if the user is human, not a spider or robot
990 ** g.perm Populated based on user account's capabilities
991 **
992 */
993 void login_check_credentials(void){
994 int uid = 0; /* User id */
995 const char *zCookie; /* Text of the login cookie */
996

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button