diff --git a/authd/authd.c b/authd/authd.c index 1fa9f3c9..9b0e18d0 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -53,7 +53,7 @@ static void handle_stat(int parc, char *parv[]) { authd_stat_handler handler; - long lrid; + unsigned long long rid; if(parc < 3) { @@ -61,16 +61,16 @@ handle_stat(int parc, char *parv[]) return; } - if((lrid = strtol(parv[1], NULL, 16)) > UINT32_MAX) + if((rid = strtoull(parv[1], NULL, 16)) > UINT32_MAX) { - warn_opers(L_CRIT, "BUG: handle_stat got a rid that was too large: %lx", lrid); + warn_opers(L_CRIT, "BUG: handle_stat got a rid that was too large: %s", parv[1]); return; } if (!(handler = authd_stat_handlers[(unsigned char)parv[2][0]])) return; - handler((uint32_t)lrid, parv[2][0]); + handler((uint32_t)rid, parv[2][0]); } static void diff --git a/authd/provider.c b/authd/provider.c index 11991877..3b64c55a 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -280,10 +280,10 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port) { struct auth_client *auth; - long lcid = strtol(cid, NULL, 16); + unsigned long long lcid = strtoull(cid, NULL, 16); rb_dlink_node *ptr; - if(lcid >= UINT32_MAX) + if(lcid == 0 || lcid > UINT32_MAX) return; auth = rb_malloc(sizeof(struct auth_client)); @@ -293,7 +293,7 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ rb_dictionary_add(auth_clients, RB_UINT_TO_POINTER(auth->cid), auth); else { - warn_opers(L_CRIT, "provider: duplicate client added via start_auth: %x", auth->cid); + warn_opers(L_CRIT, "provider: duplicate client added via start_auth: %s", cid); exit(EX_PROVIDER_ERROR); } @@ -357,7 +357,7 @@ void handle_cancel_connection(int parc, char *parv[]) { struct auth_client *auth; - long lcid; + unsigned long long lcid; if(parc < 2) { @@ -365,9 +365,10 @@ handle_cancel_connection(int parc, char *parv[]) exit(EX_PROVIDER_ERROR); } - if((lcid = strtol(parv[1], NULL, 16)) > UINT32_MAX) + lcid = strtoull(parv[1], NULL, 16); + if(lcid == 0 || lcid > UINT32_MAX) { - warn_opers(L_CRIT, "provider: got a request to cancel a connection that can't exist: %lx", lcid); + warn_opers(L_CRIT, "provider: got a request to cancel a connection that can't exist: %s", parv[1]); exit(EX_PROVIDER_ERROR); } diff --git a/authd/provider.h b/authd/provider.h index 34a0b5c3..fc7d5fea 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -44,7 +44,7 @@ struct auth_client_data struct auth_client { - uint16_t cid; /* Client ID */ + uint32_t cid; /* Client ID */ char l_ip[HOSTIPLEN + 1]; /* Listener IP address */ uint16_t l_port; /* Listener port */