aboutsummaryrefslogtreecommitdiff
path: root/src/psycstore/plugin_psycstore_postgres.c
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2016-10-18 10:36:46 +0000
committerDaniel Golle <daniel@makrotopia.org>2016-10-18 10:36:46 +0000
commit562504f9c0e8571fefd6c3dd2c398e6ccffa0027 (patch)
tree0a0ae4d7d0091e5390f53369e3ca8135dfa8b06e /src/psycstore/plugin_psycstore_postgres.c
parentb3edc375977fd6c85b83c1413ea7d0816aacd91a (diff)
psycstore: postgres: introduce LENGTH check for pub_key field
Diffstat (limited to 'src/psycstore/plugin_psycstore_postgres.c')
-rw-r--r--src/psycstore/plugin_psycstore_postgres.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/psycstore/plugin_psycstore_postgres.c b/src/psycstore/plugin_psycstore_postgres.c
index 9240d33348..c6d274a78c 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")) ||