DDL for blacklist_keys
authorVolker Birk <vb@pep-project.org>
Sun, 21 Feb 2016 21:17:31 +0100
changeset 45659be449d1aca
parent 455 154302d31d05
child 457 7802147af797
DDL for blacklist_keys
src/pEpEngine.c
src/pEp_internal.h
     1.1 --- a/src/pEpEngine.c	Sun Feb 21 12:37:36 2016 +0100
     1.2 +++ b/src/pEpEngine.c	Sun Feb 21 21:17:31 2016 +0100
     1.3 @@ -20,6 +20,7 @@
     1.4      static const char *sql_least_trust;
     1.5      static const char *sql_mark_as_compromized;
     1.6      static const char *sql_crashdump;
     1.7 +    static const char *sql_blacklist_keys;
     1.8  
     1.9      bool in_first = false;
    1.10  
    1.11 @@ -94,66 +95,70 @@
    1.12      if (in_first) {
    1.13          int_result = sqlite3_exec(
    1.14              _session->db,
    1.15 -                "create table if not exists version_info ("
    1.16 -                "	id integer primary key,"
    1.17 -                "	timestamp integer default (datetime('now')) ,"
    1.18 -                "	version text,"
    1.19 -                "	comment text"
    1.20 -                ");"
    1.21 -                "create table if not exists log ("
    1.22 -                "	timestamp integer default (datetime('now')) ,"
    1.23 -                "	title text not null,"
    1.24 -                "	entity text not null,"
    1.25 -                "	description text,"
    1.26 -                "	comment text"
    1.27 -                ");"
    1.28 -                "create index if not exists log_timestamp on log ("
    1.29 -                "	timestamp"
    1.30 -                ");"
    1.31 -                "create table if not exists pgp_keypair ("
    1.32 -                "	fpr text primary key,"
    1.33 -                "	public_id text unique,"
    1.34 -                "   private_id text,"
    1.35 -                "	created integer,"
    1.36 -                "	expires integer,"
    1.37 -                "	comment text"
    1.38 -                ");"
    1.39 -                "create index if not exists pgp_keypair_expires on pgp_keypair ("
    1.40 -                "	expires"
    1.41 -                ");"
    1.42 -                "create table if not exists person ("
    1.43 -                "	id text primary key,"
    1.44 -                "	username text not null,"
    1.45 -                "	main_key_id text"
    1.46 -                "		references pgp_keypair (fpr)"
    1.47 -                "		on delete set null,"
    1.48 -                "   lang text,"
    1.49 -                "	comment text"
    1.50 -                ");"
    1.51 -                "create table if not exists identity ("
    1.52 -                "	address text primary key,"
    1.53 -                "	user_id text"
    1.54 -                "		references person (id)"
    1.55 -                "		on delete cascade,"
    1.56 -                "	main_key_id text"
    1.57 -                "		references pgp_keypair (fpr)"
    1.58 -                "		on delete set null,"
    1.59 -                "	comment text"
    1.60 -                ");"
    1.61 -                "create table if not exists trust ("
    1.62 -                "   user_id text not null"
    1.63 -                "       references person (id)"
    1.64 -                "		on delete cascade,"
    1.65 -                "   pgp_keypair_fpr text not null"
    1.66 -                "       references pgp_keypair (fpr)"
    1.67 -                "       on delete cascade,"
    1.68 -                "   comm_type integer not null,"
    1.69 -                "	comment text"
    1.70 -                ");"
    1.71 -                "create unique index if not exists trust_index on trust ("
    1.72 -                "   user_id,"
    1.73 -                "   pgp_keypair_fpr"
    1.74 -                ");",
    1.75 +                "create table if not exists version_info (\n"
    1.76 +                "   id integer primary key,\n"
    1.77 +                "   timestamp integer default (datetime('now')) ,\n"
    1.78 +                "   version text,\n"
    1.79 +                "   comment text\n"
    1.80 +                ");\n"
    1.81 +                "create table if not exists log (\n"
    1.82 +                "   timestamp integer default (datetime('now')) ,\n"
    1.83 +                "   title text not null,\n"
    1.84 +                "   entity text not null,\n"
    1.85 +                "   description text,\n"
    1.86 +                "   comment text\n"
    1.87 +                ");\n"
    1.88 +                "create index if not exists log_timestamp on log (\n"
    1.89 +                "   timestamp\n"
    1.90 +                ");\n"
    1.91 +                "create table if not exists pgp_keypair (\n"
    1.92 +                "   fpr text primary key,\n"
    1.93 +                "   public_id text unique,\n"
    1.94 +                "   private_id text,\n"
    1.95 +                "   created integer,\n"
    1.96 +                "   expires integer,\n"
    1.97 +                "   comment text\n"
    1.98 +                ");\n"
    1.99 +                "create index if not exists pgp_keypair_expires on pgp_keypair (\n"
   1.100 +                "   expires\n"
   1.101 +                ");\n"
   1.102 +                "create table if not exists person (\n"
   1.103 +                "   id text primary key,\n"
   1.104 +                "   username text not null,\n"
   1.105 +                "   main_key_id text\n"
   1.106 +                "       references pgp_keypair (fpr)\n"
   1.107 +                "       on delete set null,\n"
   1.108 +                "   lang text,\n"
   1.109 +                "   comment text\n"
   1.110 +                ");\n"
   1.111 +                "create table if not exists identity (\n"
   1.112 +                "   address text primary key,\n"
   1.113 +                "   user_id text\n"
   1.114 +                "       references person (id)\n"
   1.115 +                "       on delete cascade,\n"
   1.116 +                "   main_key_id text\n"
   1.117 +                "       references pgp_keypair (fpr)\n"
   1.118 +                "       on delete set null,\n"
   1.119 +                "   comment text\n"
   1.120 +                ");\n"
   1.121 +                "create table if not exists trust (\n"
   1.122 +                "   user_id text not null\n"
   1.123 +                "       references person (id)\n"
   1.124 +                "       on delete cascade,\n"
   1.125 +                "   pgp_keypair_fpr text not null\n"
   1.126 +                "       references pgp_keypair (fpr)\n"
   1.127 +                "       on delete cascade,\n"
   1.128 +                "   comm_type integer not null,\n"
   1.129 +                "   comment text\n"
   1.130 +                ");\n"
   1.131 +                "create unique index if not exists trust_index on trust (\n"
   1.132 +                "   user_id,\n"
   1.133 +                "   pgp_keypair_fpr\n"
   1.134 +                ");\n"
   1.135 +                "create table if not exists blacklist_keys (\n"
   1.136 +                "   fpr text primary key\n"
   1.137 +                ");\n"
   1.138 +                ,
   1.139              NULL,
   1.140              NULL,
   1.141              NULL
     2.1 --- a/src/pEp_internal.h	Sun Feb 21 12:37:36 2016 +0100
     2.2 +++ b/src/pEp_internal.h	Sun Feb 21 21:17:31 2016 +0100
     2.3 @@ -97,6 +97,7 @@
     2.4      sqlite3_stmt *mark_compromized;
     2.5      sqlite3_stmt *reset_trust;
     2.6      sqlite3_stmt *crashdump;
     2.7 +    sqlite3_stmt *blacklist_keys;
     2.8  
     2.9      examine_identity_t examine_identity;
    2.10      void *examine_management;