From 9877b82a12f4e81cbda5236a5905bc32b214ee90 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 26 Oct 2009 22:35:31 +0100 Subject: [PATCH] Don't assert on "user not found" --- src/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.c b/src/main.c index d1f1943..d6cf48c 100644 --- a/src/main.c +++ b/src/main.c @@ -310,6 +310,12 @@ static int get_data_for_uid(char *uid, struct ykc_stats *stats) r = -1; goto free_mem; } + if (PQntuples(res) == 0) { + syslog(LOG_INFO, "uid %s not found in database", uid); + /* XXX Better handling */ + r = -1; + goto free_mem; + } assert(PQgetlength(res, 0, PQfnumber(res, "secret_key")) == YUBIKEY_KEY_SIZE); stats->secret_key = ysc_memdup( PQgetvalue(res, 0, PQfnumber(res, "secret_key")), -- 2.39.5