commit 95ef3f8a77725d7ef0d173b0c0da5e8089ba0645 from: Stefan Sperling via: Thomas Adam date: Fri Dec 30 14:58:04 2022 UTC fix gotd authentication timeout The authentication timeout was accidentally overriden by the request timeout. Fix this and set both timeouts in the same place for clarity. ok op@ commit - c669c4892eacfb82355f0fa66bcafe84a600040e commit + 95ef3f8a77725d7ef0d173b0c0da5e8089ba0645 blob - 063629cca40ebe02f4733b7efe3abcfafcfa8705 blob + 5e2400783e338df5abf9a5f86a071d7494a5438b --- gotd/gotd.c +++ gotd/gotd.c @@ -94,6 +94,7 @@ static struct gotd_clients gotd_clients[GOTD_CLIENT_TA static SIPHASH_KEY clients_hash_key; volatile int client_cnt; static struct timeval timeout = { 3600, 0 }; +static struct timeval auth_timeout = { 5, 0 }; static struct gotd gotd; void gotd_sighdlr(int sig, short event, void *arg); @@ -1199,7 +1200,10 @@ gotd_request(int fd, short events, void *arg) disconnect_on_error(client, err); } else { gotd_imsg_event_add(&client->iev); - evtimer_add(&client->tmo, &timeout); + if (client->state == GOTD_STATE_EXPECT_LIST_REFS) + evtimer_add(&client->tmo, &auth_timeout); + else + evtimer_add(&client->tmo, &timeout); } } @@ -2305,7 +2309,6 @@ start_auth_child(struct gotd_client *client, int requi { struct gotd_child_proc *proc; struct gotd_imsg_auth iauth; - struct timeval auth_timeout = { 5, 0 }; memset(&iauth, 0, sizeof(iauth)); @@ -2347,7 +2350,6 @@ start_auth_child(struct gotd_client *client, int requi client->auth = proc; client->required_auth = required_auth; - evtimer_add(&client->tmo, &auth_timeout); return NULL; }