Fossil SCM
Exempt admin and setup users from the load_control() restriction.
Commit
57cdf4f2b9c69e0859516f7791e8ef288d0089b94f6e7bd8d4b583dbe4c66cdb
Parent
1cc86c16a2214c5…
2 files changed
+5
+1
+5
| --- src/loadctrl.c | ||
| +++ src/loadctrl.c | ||
| @@ -51,10 +51,15 @@ | ||
| 51 | 51 | ** is too high. |
| 52 | 52 | */ |
| 53 | 53 | void load_control(void){ |
| 54 | 54 | double mxLoad = atof(db_get("max-loadavg", 0)); |
| 55 | 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 | + } | |
| 56 | 61 | |
| 57 | 62 | style_set_current_feature("test"); |
| 58 | 63 | style_header("Server Overload"); |
| 59 | 64 | @ <h2>The server load is currently too high. |
| 60 | 65 | @ Please try again later.</h2> |
| 61 | 66 |
| --- 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 |
+1
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -985,10 +985,11 @@ | ||
| 985 | 985 | ** g.userUid Database USER.UID value. Might be -1 for "nobody" |
| 986 | 986 | ** g.zLogin Database USER.LOGIN value. NULL for user "nobody" |
| 987 | 987 | ** g.perm Permissions granted to this user |
| 988 | 988 | ** g.anon Permissions that would be available to anonymous |
| 989 | 989 | ** g.isHuman True if the user is human, not a spider or robot |
| 990 | +** g.perm Populated based on user account's capabilities | |
| 990 | 991 | ** |
| 991 | 992 | */ |
| 992 | 993 | void login_check_credentials(void){ |
| 993 | 994 | int uid = 0; /* User id */ |
| 994 | 995 | const char *zCookie; /* Text of the login cookie */ |
| 995 | 996 |
| --- 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 |