Commit Graph

2136 Commits

Author SHA1 Message Date
Andrew Bettison
21991726ae Add logging tests, add "log" command
Refactor log.c ready for log file rotation
2013-04-02 17:01:48 +10:30
Andrew Bettison
2d09ec545e Improve configuration dump to log
Refactor much of the new code in log.c

Add new functions: cf_load_strict() and cf_reload_strict() for use by the
server, which does not want to overwrite its in-memory config at all if there
is any defect in the config file.  However, commands always want to overwrite
the default in-memory config, even with a defective config file, so that
logging has a chance to succeed.

Added `log_format.dump_config` boolean config option
2013-03-29 00:22:08 +10:30
Andrew Bettison
bcfd032223 Replace logDebugFlags() with logCurrentConfig() 2013-03-27 17:23:31 +10:30
Andrew Bettison
95b0c028f2 Log to file, Android and stderr simultaneously
Indepent configuration of show_pid, show_time and log level for each
destination

Update test scripts for new config options

Include xprintf.c in MDP client source files (now used by log.c)
2013-03-27 16:17:38 +10:30
Andrew Bettison
a50594971c Fix comment in strbuf.h 2013-03-26 18:24:13 +10:30
Andrew Bettison
d3d6fa4547 Add log format config options for file and stderr
Upgrade configuration schema macros to allow optional "default label"
argument to SUB_STRUCT and VALUE_SUB_STRUCT elements.

New STRUCT_DEFAULT section declares alternative STRUCT default values
with a label.
2013-03-26 16:11:31 +10:30
Andrew Bettison
a88234ce9d Add optional filter args to 'help' command 2013-03-25 12:05:26 +10:30
Andrew Bettison
28a77abc18 Add XPRINT strbuf adapter 2013-03-25 12:02:48 +10:30
Andrew Bettison
74adb2038a Document 'config dump' command
Re-order the documentation sections and add more explanation
of how an invalid config file is handled.
2013-03-20 20:44:12 -07:00
Andrew Bettison
300ec986f1 Fix warnings from gcc 4.6.3 2013-03-18 16:48:15 +10:30
Andrew Bettison
7d312f51fb Fix broken Android build 2013-03-18 15:35:37 +10:30
Andrew Bettison
1cfedb19e4 Fix broken 'make directory_service' 2013-03-18 15:35:13 +10:30
Andrew Bettison
a5d3c16928 Move 'serverMode' flag from server.c to log.c
Because log.c and conf.c now depend on serverMode
2013-03-18 15:34:33 +10:30
Andrew Bettison
edd245fa81 Fix version_string.sh for older Git versions 2013-03-18 14:31:19 +10:30
gardners
3a0a4df216 add place-holder tests for adding channel labels to Rhizome. #58 2013-03-18 13:27:15 +10:30
Andrew Bettison
5dd6a53615 Fix 'rhizomeops' tests
Rename duplicate AddNoAuthor test to AddNoAuthorEncrypted

Fix broken AddNoAuthor test

Add new AddInvalidAuthor test
2013-03-15 15:58:17 +10:30
Andrew Bettison
da2c523bd6 Improve logging: version, date/time and debug flags
Also quieten start-up log messages for invoked commands, to reduce chatter
2013-03-12 19:18:30 +10:30
Andrew Bettison
b17f5a6f63 Servald version string from git describe 2013-03-12 14:03:33 +10:30
Andrew Bettison
1d1f7a37a4 Fix Solaris SIGBUS bug in MDP ping
Also fixed non-portable (endian dependent) code
2013-03-07 14:54:40 +10:30
Andrew Bettison
b7185a294f Fix keyring SEGV bug
Sometimes, when adding a PIN to a keyring (eg, when opening a keyring
file), a SEGV would be caused while trying to validate the MAC for an
entry which apparently had zero keypair entries.

Changed some keyring struct 'int' fields to 'unsigned int', to ensure
that comparison logic behaves as expected.

Refactored some keyring code for more clarity and code maintenance
safety.

Added TODO comment about keyring file format non-back-compatibility.
2013-03-07 14:27:33 +10:30
Andrew Bettison
4ea748c5e2 Remove unwanted DEBUG statement 2013-03-06 16:00:48 +10:30
Andrew Bettison
bc7c58ee3c Improve keyring test case 2013-03-06 15:29:27 +10:30
Andrew Bettison
1d5b57443b Some keyring refactoring and improvements 2013-03-06 15:28:57 +10:30
Andrew Bettison
91f11dc72a Improve more keyring error messages 2013-03-06 14:57:23 +10:30
Andrew Bettison
287701f128 Improve keyring error messages 2013-03-06 14:43:52 +10:30
Andrew Bettison
03f38d2031 Improve keyring debugging 2013-03-06 14:15:27 +10:30
Andrew Bettison
705f414a4d Fix SEGV bug in keyring_enter_pin()
The public and private key length fields were stored as 'int' not
'unsigned', so arithmetic for checking buffer overrun was not correct.
2013-03-06 14:02:33 +10:30
Andrew Bettison
226fcf3754 Improve test framework: fix some minor awk bugs 2013-03-06 13:08:10 +10:30
Andrew Bettison
157fe3f1d6 Fix Solaris SEGV bug: null pointer passed to sprintf() 2013-03-06 12:56:41 +10:30
Andrew Bettison
25e5acc68c Fix quoting typos 2013-03-05 17:19:23 -08:00
Andrew Bettison
6f3c2b99c9 Improve test framework: Solaris bug
The 'includeTests' function failed if /bin/bash was not available or not
the same as the Bash used to run the top test script.  This failed on
Solaris, where /usr/bin/bash is too old, and a privately-built Bash must
be used to run the test scripts.
2013-03-06 11:45:12 +10:30
Andrew Bettison
fdd3623352 Update INSTALL instructions
Instructions for Solaris

Use tests/all script to run all tests

Correct spelling of Erik's last name
2013-03-06 11:43:44 +10:30
Andrew Bettison
c9f9ef5ed4 New config type: bool_t (char)
Replace 'int_boolean' and 'char_boolean' representations with 'boolean'.

Clean up spacing and column alignment in conf_schema.h
2013-03-05 12:35:30 +10:30
Jeremy Lakeman
4cdd3da77f Add config option to disable fetching via rhizome 2013-03-05 10:56:20 +10:30
Andrew Bettison
8771d6181b Merge branch 'naf2-logging' into 'development' 2013-03-01 17:32:57 +10:30
Andrew Bettison
54ce857cff Improve config schema declaration
Remove array key SORTED flag; all arrays are now sorted by key

Use representation's comparison function for sorting arrays, not
a schema-supplied comparison function.
2013-03-01 15:27:28 +10:30
Andrew Bettison
2ac35bfdf7 Remove unconditional DEBUG logging 2013-02-28 17:57:25 +10:30
Jeremy Lakeman
2c687e9b35 Ensure a randomly generated phone number is valid, Fixes #55 2013-02-28 16:39:00 +10:30
Jeremy Lakeman
9e2eb1aea4 Add keyring test for implicitly created identity 2013-02-28 16:27:53 +10:30
Andrew Bettison
ae787339ec Improve "config dump" command
All STRUCT cf_fmt_config_xxx() functions omit invalid values, silently
if the invalid value is the default, otherwise with a non-CFOK return
value.

The "config dump --full" option includes all options with valid values,
otherwise omits options having default values.
2013-02-28 15:18:48 +10:30
Andrew Bettison
5939aa9edc Add config cf_cmp_ functions 2013-02-27 18:11:18 +10:30
Andrew Bettison
133c34325f Fix wrong declaration of strnchr() 2013-02-27 18:10:39 +10:30
Andrew Bettison
be479dafe9 Add uint64_scaled_to_str() function in str.c 2013-02-27 16:35:11 +10:30
Andrew Bettison
4648f5096a Fix some config schema declarations
Replace 'int' representation with 'uint32_nonneg', so that default value
of -1 is out of reach of parser.
2013-02-27 16:30:23 +10:30
Andrew Bettison
a583cb7a0f Fix bugs in interface pattern list parsing
Treat empty pattern list as invalid.

Fix bug in legacy interface parser: was not handling asterisk wildcards
'*' properly.
2013-02-27 16:28:03 +10:30
Andrew Bettison
46eeacb823 Improve new "config dump" command
No more SEGV.  Omits invalid (default) values.  Logs unconditional DEBUG
output, to be removed before merging into development.  Still missing
cf_cmp_ functions to prune out default values.

Improved config Object Model iterator logic to barf on internal NULL
nodes.
2013-02-27 16:26:07 +10:30
Andrew Bettison
14b859616e Add strnchr() to str.c 2013-02-27 15:58:32 +10:30
Jeremy Lakeman
ee95e47d1f Add rhizome export commands that don't try to decrypt file contents
export [bundle/manifest/file]
extract [bundle/file]

"dump file" has been replaced with "export file".
2013-02-27 11:39:23 +10:30
Andrew Bettison
6eb08ae805 Add new "config dump" command - not working yet
Add cf_fmt_xxx() functions for converting configuration structs into a
config object model tree.
2013-02-26 18:09:08 +10:30
Andrew Bettison
aeeef0e972 Add uint64_scaled_to_str() function in str.c 2013-02-26 12:59:40 +10:30