From: Daniel Golle Date: Tue, 18 Oct 2016 10:36:46 +0000 (+0000) Subject: psycstore: postgres: introduce LENGTH check for pub_key field X-Git-Tag: initial-import-from-subversion-38251~84 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=562504f9c0e8571fefd6c3dd2c398e6ccffa0027;p=oweals%2Fgnunet.git psycstore: postgres: introduce LENGTH check for pub_key field --- diff --git a/src/psycstore/plugin_psycstore_postgres.c b/src/psycstore/plugin_psycstore_postgres.c index 9240d3334..c6d274a78 100644 --- a/src/psycstore/plugin_psycstore_postgres.c +++ b/src/psycstore/plugin_psycstore_postgres.c @@ -100,7 +100,7 @@ database_setup (struct Plugin *plugin) GNUNET_POSTGRES_exec(plugin->dbh, "CREATE TABLE IF NOT EXISTS channels (\n" " id SERIAL,\n" - " pub_key BYTEA,\n" + " pub_key BYTEA NOT NULL CHECK (LENGTH(pub_key)=32),\n" " max_state_message_id BIGINT,\n" " state_hash_message_id BIGINT,\n" " PRIMARY KEY(id)\n" @@ -121,7 +121,7 @@ database_setup (struct Plugin *plugin) GNUNET_POSTGRES_exec(plugin->dbh, "CREATE TABLE IF NOT EXISTS slaves (\n" " id SERIAL,\n" - " pub_key BYTEA,\n" + " pub_key BYTEA NOT NULL CHECK (LENGTH(pub_key)=32),\n" " PRIMARY KEY(id)\n" ")" "WITH OIDS")) ||