diff options
author | David Barksdale <amatus@amat.us> | 2017-02-20 13:08:08 -0600 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2017-02-20 13:11:19 -0600 |
commit | fe4f6e8cedfa8d0a57b0247727fc4849d38c2f3a (patch) | |
tree | cbcbc99a93ec8f466426190a340cc46f54d2641e /src/datastore/plugin_datastore_sqlite.c | |
parent | f553963d649374a75cc5a6e57df39d83565eb913 (diff) | |
download | gnunet-fe4f6e8cedfa8d0a57b0247727fc4849d38c2f3a.tar.gz gnunet-fe4f6e8cedfa8d0a57b0247727fc4849d38c2f3a.zip |
Restrict update to positive priority deltas
This is only ever called with positive values and the mysql and postgres
plugins were not handling negative values correctly anyway.
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 18a3aa4ac..028117d26 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -291,6 +291,12 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
291 | sq_prepare (plugin->dbh, | 291 | sq_prepare (plugin->dbh, |
292 | "SELECT 1 FROM sqlite_master WHERE tbl_name = 'gn090'", | 292 | "SELECT 1 FROM sqlite_master WHERE tbl_name = 'gn090'", |
293 | &stmt)); | 293 | &stmt)); |
294 | |||
295 | /* FIXME: SQLite does not have unsigned integers! This is ok for the type column because | ||
296 | * we only test equality on it and can cast it to/from uint32_t. For repl, prio, and anonLevel | ||
297 | * we do math or inequality tests, so we can't handle the entire range of uint32_t. | ||
298 | * This will also cause problems for expiration times after 294247-01-10-04:00:54 UTC. | ||
299 | */ | ||
294 | if ((sqlite3_step (stmt) == SQLITE_DONE) && | 300 | if ((sqlite3_step (stmt) == SQLITE_DONE) && |
295 | (sqlite3_exec | 301 | (sqlite3_exec |
296 | (plugin->dbh, | 302 | (plugin->dbh, |
@@ -593,9 +599,7 @@ sqlite_plugin_put (void *cls, | |||
593 | * @param cls the plugin context (state for this module) | 599 | * @param cls the plugin context (state for this module) |
594 | * @param uid unique identifier of the datum | 600 | * @param uid unique identifier of the datum |
595 | * @param delta by how much should the priority | 601 | * @param delta by how much should the priority |
596 | * change? If priority + delta < 0 the | 602 | * change? |
597 | * priority should be set to 0 (never go | ||
598 | * negative). | ||
599 | * @param expire new expiration time should be the | 603 | * @param expire new expiration time should be the |
600 | * MAX of any existing expiration time and | 604 | * MAX of any existing expiration time and |
601 | * this value | 605 | * this value |
@@ -605,7 +609,7 @@ sqlite_plugin_put (void *cls, | |||
605 | static void | 609 | static void |
606 | sqlite_plugin_update (void *cls, | 610 | sqlite_plugin_update (void *cls, |
607 | uint64_t uid, | 611 | uint64_t uid, |
608 | int delta, | 612 | uint32_t delta, |
609 | struct GNUNET_TIME_Absolute expire, | 613 | struct GNUNET_TIME_Absolute expire, |
610 | PluginUpdateCont cont, | 614 | PluginUpdateCont cont, |
611 | void *cont_cls) | 615 | void *cont_cls) |