Commit Graph

2548 Commits

Author SHA1 Message Date
Andrew Bettison
1c96164b62 Issue #11: uint16_t instead of unsigned short for URI port number 2013-10-08 09:56:54 +10:30
Andrew Bettison
7a8d750a0e Issue #11: uint16_t instead of short for TCP port number 2013-10-07 23:37:37 +10:30
Andrew Bettison
ffafae86b1 Issue #11: replace long long with int64_t 2013-10-07 05:54:46 +10:30
Andrew Bettison
1c8e01af9d urandombytes() size_t instead of unsigned long long 2013-10-07 04:47:23 +10:30
Andrew Bettison
5d7ea6e6f5 Improve logic and logging in server_pid() 2013-10-07 04:47:23 +10:30
Andrew Bettison
55edc74482 Fix intermittent 'rhizomeops' test failure 2013-10-07 04:47:14 +10:30
Andrew Bettison
8970c4ece7 Improved debug to help diagnose MDP failures on Android 2013-10-07 04:47:13 +10:30
Andrew Bettison
6fadb73f1f Improve version_string.sh: detect changes in submodules 2013-10-07 04:47:13 +10:30
Andrew Bettison
3758b038ab Merge branch 'sqlbind' into 'development'
Issue #69: Fixed SQL injection vulnerabilities (for good?) by replacing
sprintf(3)-style SQL statement composition with a varargs parameter
binding syntax.

Introduced rhizome_bid_t type and used it everywhere instead of unsigned
char [RHIZOME_MANIFEST_ID_BYTES].  Bundle IDs are now stored and passed
around internally almost entirely in binary form.
2013-10-04 11:59:03 +09:30
Andrew Bettison
7b427d48ee A few more uses of rhizome_bid_t
Now the TEXT_TOUPPER SQL bind action is only used for filehash hex
strings; all Bundle ID parameters are bound using RHIZOME_BID_T.
2013-10-04 04:50:37 +09:30
Andrew Bettison
e3f64516d5 Add config option 'debug.rhizome_bind' 2013-10-04 03:46:52 +09:30
Andrew Bettison
f5e7db089c Fix bugs revealed by test failures
Introduced by the recent change to rhizome_bid_t everywhere
2013-10-04 03:12:52 +09:30
Andrew Bettison
c3a4ab1f25 Fix two Rhizome Direct test cases 2013-10-04 03:11:54 +09:30
Jeremy Lakeman
0861dfdd94 Fix rhizome sync with larger numbers of existing bundles 2013-10-03 18:24:39 +02:00
Andrew Bettison
ab31420faf rhizome_bid_t
Consistent type for internal binary representation of Rhizome Bundle ID
(aka Manifest ID)
2013-10-03 23:16:45 +09:30
Andrew Bettison
d18e48868d Issue #69: transient text SQL binding 2013-10-03 23:16:02 +09:30
Andrew Bettison
41e18e587d Issue #69: replace sqlite3_bind_xxx() calls
Use the new sqlite_bind() and sqlite_prepare_bind() calls instead.

Add cmp_sid_t() function, use it instead of memcmp().

Use alloca_tohex_sid_t() in preference to alloca_tohex_sid() when the
argument is a sid_t.
2013-10-03 16:44:06 +09:30
Andrew Bettison
7e3a552011 Issue #69: refactor all Rhizome SQL queries to use binding
Remove all uses of sprintf(3) and its ilk to form SQL query commands.
Use the new sqlite_bind() and sqlite_prepare_bind() functions instead.
2013-10-03 15:15:30 +09:30
Andrew Bettison
41c862ea30 Fix 'rhizomeops' test case
Was broken by 919455608f
2013-10-03 15:13:28 +09:30
Andrew Bettison
8f7d600216 Issue #69: continue work on multi-bind varargs
Revise sqlite_prepare() macro et al and underlying functions to use bind
varargs instead of sprintf(3)-style varargs.

Convert all SQL function calls in rhizome_database.c
2013-10-03 01:16:10 +09:30
Andrew Bettison
772e1bf9d6 Issue #69: start writing SQLite multi-bind function 2013-10-02 18:19:20 +09:30
Andrew Bettison
06d7620314 Add "rhizome add file" --force-new option
Overrides the default behaviour of de-duplicating added manifests

New 'rhizomeops' test case: AddForceDuplicate
2013-09-30 16:48:18 +09:30
Andrew Bettison
2868cf0adf Improve Rhizome test functions
Options to allow manifest name to be given explicitly to override the
conventional "<filename>.manifest"
2013-09-30 16:39:58 +09:30
Andrew Bettison
919455608f Rename 'rhizomeops' test case
AddDuplicate -> AddDeDuplicate
2013-09-30 16:34:17 +09:30
Andrew Bettison
162108dd18 Fix duplicate payload logic
rhizome_finish_write() was treating a duplicate file hash as an error,
instead of dealing with it sensibly
2013-09-30 16:32:08 +09:30
Andrew Bettison
01216f06c2 Refactor rhizome_cleanup()
Compute time horizons once only, not once per query

Factor query that deletes orphan FILEBLOBS rows into its own function
2013-09-30 16:20:50 +09:30
Andrew Bettison
99a0d36812 Improve Rhizome debugging
Log the integer result of an int64 query
2013-09-30 16:16:44 +09:30
Andrew Bettison
c91ea7f8ac Make some Rhizome db functions static 2013-09-30 16:15:59 +09:30
Andrew Bettison
a04fc263f9 Improve comments on Rhizome db functions 2013-09-30 16:15:01 +09:30
Andrew Bettison
394870502d Fix "rhizome hash file" command for nil files
Now returns an empty result for zero-length file or zero-length file name

Test framework only invokes on non-zero-length files
2013-09-30 16:11:35 +09:30
Andrew Bettison
ae5ae2d394 Cosmetic changes to whitespace
Make it easier to edit in Vim
2013-09-30 16:06:23 +09:30
Andrew Bettison
5e164607aa Expand output of rhizome add and import
Rename 'secret:' field to '.secret:' (non-manifest-fields start with '.'
using the same convention as rhizome list)

Add '.author' and 'BK' fields to "rhizome add"

Add 'BK' field to "rhizome import"

Fix 'rhizomeops' tests to assert no 'author' and 'BK' output fields from
"rhizome add" with no author

Fiz testdefs.sh and testdefs_rhizome.sh to support new output fields
2013-09-27 22:34:22 +09:30
Andrew Bettison
ef5622f84a Fix bugs in new local socket naming code
Socket names (both file and abstract) were being truncated by two bytes
2013-09-25 16:56:06 +09:30
Andrew Bettison
c0aa4796a1 Remove MDP and Monitor socket names from config
Now they are fixed names under the instance path: "mdp.socket" and
"monitor.socket".
2013-09-25 16:56:06 +09:30
Jeremy Lakeman
ba3f77e67c Rename external payloads instead of linking and unlinking 2013-09-25 15:51:54 +09:30
Jeremy Lakeman
dab07dd4dc Remove monitor.socket & mdp.socket from tests 2013-09-24 16:27:34 +09:30
Romain Vimont (®om)
954a8a01a4 Use one MDP socket per binding instead of a single global socket. 2013-09-24 16:09:44 +09:30
Jeremy Lakeman
4838a529bd Don't busy wait while testing for MDP failover 2013-09-24 15:15:32 +09:30
Jeremy Lakeman
b38b4720cc Add html stats for http connection and mdp transfer counts 2013-09-24 14:34:51 +09:30
Jeremy Lakeman
5383b5e3be Fix signature verification cache 2013-09-24 14:34:51 +09:30
Jeremy Lakeman
9885280334 Squelch warning on success 2013-09-24 14:34:51 +09:30
Jeremy Lakeman
79bdb5f993 Add more html debugging for rhizome sync and fetch queues 2013-09-24 14:34:51 +09:30
Jeremy Lakeman
931ca60554 Refactor and simplify http server
- Define a function per page that is responsible for parsing requests
- Define a "generator" callback function for filling the buffer for a response
- Remove features that have never been used
- Remove functions that are no longer used
2013-09-24 14:34:50 +09:30
Andrew Bettison
c7eb5776f9 Fix version_string.sh script
Fix logic for appending dirty suffix to synthetic version string
(only used when no tags present, ie "git describe" fails).
2013-09-24 10:46:20 +09:30
Andrew Bettison
2e211a62d5 Fix version_string.sh: dirty suffix on untracked files
Don't use the git describe --dirty option to append the suffix
because it only considers changes in tracked files as dirt.  If
the script wants to consider untracked files as dirt then this
will not do.
2013-09-23 17:38:23 +09:30
Jeremy Lakeman
08b44e96ed Improve html debug statistics
- shift radio rssi onto interace structure
- track packets sent received
- create html output for interface stats
- create html output for link state routing stats
2013-09-23 11:31:38 +09:30
Jeremy Lakeman
ae25091fab Remove duplicate variable to ensure manifest is freed 2013-09-20 16:49:36 +09:30
Jeremy Lakeman
57577abca6 Merge branch 'mavlink' into development 2013-09-20 14:58:29 +09:30
Jeremy Lakeman
80c1da28b0 Send and track mavlink sequence number 2013-09-20 14:41:50 +09:30
Jeremy Lakeman
e3a5e8c353 Use heartbeat packets to control serial buffering
- Improve simulation of fakeradio
- Backtrack on partial RS errors in case of truncation / heartbeat insertion
2013-09-20 14:41:50 +09:30