AmendHub

jcs

/

subtext

/

amendments

/

140

db: Add max_login_seconds to be shorter than max_idle_minutes


jcs made amendment 140 5 months ago
--- db.c Thu Jun 9 10:13:04 2022 +++ db.c Sun Jun 12 21:06:03 2022 @@ -50,6 +50,9 @@ struct struct_field config_fields[] = { { "Max Idle Minutes", CONFIG_TYPE_SHORT, offsetof(struct config, max_idle_minutes), 1, USHRT_MAX }, + { "Max Login Seconds", CONFIG_TYPE_SHORT, + offsetof(struct config, max_login_seconds), + 1, USHRT_MAX }, { "Timezone (Abbrev)", CONFIG_TYPE_STRING, offsetof(struct config, timezone), 1, member_size(struct config, timezone) }, @@ -301,6 +304,17 @@ db_migrate(struct db *tdb, short is_new) bile_write(tdb->bile, DB_CONFIG_RTYPE, 1, &new_config, sizeof(new_config)); break; + } + case 3: { + /* 3->4, added max_login_seconds */ + struct config new_config = { 0 }; + + bile_read(tdb->bile, DB_CONFIG_RTYPE, 1, (char *)&new_config, + sizeof(new_config)); + new_config.max_login_seconds = 30; + + bile_write(tdb->bile, DB_CONFIG_RTYPE, 1, &new_config, + sizeof(new_config)); } } --- db.h Tue Jun 7 22:07:07 2022 +++ db.h Sun Jun 12 21:05:26 2022 @@ -23,7 +23,7 @@ #define DB_TYPE 'STDB' -#define DB_CUR_VERS 3 +#define DB_CUR_VERS 4 #define DB_TRUE 0x100 #define DB_FALSE 0x000 @@ -69,6 +69,7 @@ struct config { short max_idle_minutes; char timezone[8]; short open_signup; + short max_login_seconds; }; extern struct struct_field config_fields[];