]> err.no Git - yubikey-server-c/commitdiff
Don't assert on "user not found"
authorTollef Fog Heen <tfheen@err.no>
Mon, 26 Oct 2009 21:35:31 +0000 (22:35 +0100)
committerTollef Fog Heen <tfheen@err.no>
Mon, 26 Oct 2009 21:35:31 +0000 (22:35 +0100)
src/main.c

index d1f194333ab05b332bdc4f614b14ccd151f0e650..d6cf48c25db549eee7728e4cf4a75798e9e9b0c4 100644 (file)
@@ -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")),