llist_test: Added simple tests for _search() and _remove().
Updated copyright information.
sysdb: Hide implementation details in the "input" module.
… and added some overview documentation about how the "input" module works and
interacts with the other subsystems.
… and added some overview documentation about how the "input" module works and
interacts with the other subsystems.
sysdb: Use the asynchronous readline interface; handle asynch server replies.
For this, setup the terminal in non-canonical, raw mode in order to be able to
handle each single character input. This allows to handle user input and
asynchronous server replies at the same time but without the need to give up
sequential operation (no threads are required for the asynchronous operation).
Instead, select() is used to do the input multiplexing allowing to easily
handle different output.
For this, setup the terminal in non-canonical, raw mode in order to be able to
handle each single character input. This allows to handle user input and
asynchronous server replies at the same time but without the need to give up
sequential operation (no threads are required for the asynchronous operation).
Instead, select() is used to do the input multiplexing allowing to easily
handle different output.
sysdb: Split sdb_command_exec() into two functions.
Separate the handling of the server's reply to make it reusable by other parts
of the code.
Separate the handling of the server's reply to make it reusable by other parts
of the code.
Merged branch 'master' of git://git.tokkee.org/sysdb.
core/data: Added sdb_data_format() function.
This function creates a string representation of a datum using a default
format.
This function creates a string representation of a datum using a default
format.
core/data.h: Removed obsolete comment.
store: Added support for different data-types for attributes.
An attribute value is now stored as sdb_data_t, supporting all data-types
which are supported by that type.
JSON-serialization does not fully support that yet, though.
An attribute value is now stored as sdb_data_t, supporting all data-types
which are supported by that type.
JSON-serialization does not fully support that yet, though.
utils dbi: Use sdb_data_free_datum().
data: Added helper functions to copy and free data.
dbi_test: Mocked required dbi*_copy_idx() functions.
core/data: Make string and binary data not constant.
This will allow for more flexibility. However, it also requires to create a
copy of data queried using libdbi.
This will allow for more flexibility. However, it also requires to create a
copy of data queried using libdbi.
configure, src/Makefile: Sort plugins alphabetically.
configure: Report an error when encountering invalid settings.
client, sysdb: Improved error reporting.
sysdb: Store a global input handler object in the input module.
… rather than in the scanner. All input related code should be in the input
module.
… rather than in the scanner. All input related code should be in the input
module.
frontend: Added missing 'break' in switch statement.
This bug caused a LIST command to be executed after each QUERY.
D'oh!
This bug caused a LIST command to be executed after each QUERY.
D'oh!
client: Added sdb_client_sockfd() function.
This function returns the file-descriptor associated with the client's network
socket.
This function returns the file-descriptor associated with the client's network
socket.
frontend: Free parser-allocated memory after handling a command.
Merged branch 'master' of git://git.tokkee.org/sysdb.
sysdb: Do not add duplicate entries to the history.
.travis.yml: Exclude AddressSanitizer runs with GCC.
Travis-CI's GCC does not support the address sanitizer options.
Travis-CI's GCC does not support the address sanitizer options.
t/cibuild.sh, .travis.yml: Do an AddressSanitizer run as well.
Passing additional build flags as CICFLAGS and CILDFLAGS.
Passing additional build flags as CICFLAGS and CILDFLAGS.
Fixed memory errors identified by LLVM's AddressSanitizer.
Test performed as:
./configure CC=clang \
CFLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" \
LDFLAGS=-fsanitize=address
make clean all test
See also http://clang.llvm.org/docs/AddressSanitizer.html
Test performed as:
./configure CC=clang \
CFLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" \
LDFLAGS=-fsanitize=address
make clean all test
See also http://clang.llvm.org/docs/AddressSanitizer.html
object_test: Removed 'obj->ref_cnt == 0' checks.
They generate unnecessary noise in LLVM's AddressSanitizer runs.
They generate unnecessary noise in LLVM's AddressSanitizer runs.
sysdb: Added a query to the history after executing it.
Mimic zsh's histignorespace option and ignore commands when the first
character is a space.
Mimic zsh's histignorespace option and ignore commands when the first
character is a space.
sysdbd.conf(5), sysdbd.conf: Documented the 'Listen' option.
And added a sample configuration.
And added a sample configuration.
sysdb: Only strip newlines from the command buffer.
Keep whitespace in order to keep the users formatting and keep semicolons to
ensure correct parsing (avoid possible future ambiquity).
Keep whitespace in order to keep the users formatting and keep semicolons to
ensure correct parsing (avoid possible future ambiquity).
unixsock utils: Retry reading from socket if the call was interrupted.
Merged branch 'master' of git://git.tokkee.org/sysdb.
sysdb: Implemented input scanner and simple command handling.
Reused the frontend parser lexer to identify single queries (terminated by
semicolon). No other parsing of the command is done by the client to make the
frontend the ultimate truth in regard to the parser (including simple stuff
like comments).
The query is then sent to the daemon and the reply will be printed to the
standard output channel.
Reused the frontend parser lexer to identify single queries (terminated by
semicolon). No other parsing of the command is done by the client to make the
frontend the ultimate truth in regard to the parser (including simple stuff
like comments).
The query is then sent to the daemon and the reply will be printed to the
standard output channel.
configure: Fixed --with-readline=libreadline checks.
.travis.yml, t/cibuild.sh: Test builds with libedit and libreadline.
Using an env variable for this purpose, thus, making both options show up in
the Travis build matrix.
Using an env variable for this purpose, thus, making both options show up in
the Travis build matrix.
Added t/cibuild.sh and use that in the Travis configuration.
This allows for some more flexiblity.
This allows for some more flexiblity.
sysdb: Append newlines to lines read from readline().
Else, whitespace will be missing in multi-line commands.
Else, whitespace will be missing in multi-line commands.
parser_test: Test partial query parsing.
frontend: Implemented the CONNECTION_QUERY command.
This command expects a string representation of the to be executed command as
the command body. The frontend will then parse the string and execute the
first command. Other commands are (currently?) ignored to make injection
attacks harder.
This command expects a string representation of the to be executed command as
the command body. The frontend will then parse the string and execute the
first command. Other commands are (currently?) ignored to make injection
attacks harder.
frontend parser: Added 'len' parameter to sdb_fe_parse().
When greater than (or equal to) zero, this parameter let's the parser parse a
substring of the specified query. This makes it easier to pass in a command
stored in a connection's input string buffer.
When greater than (or equal to) zero, this parameter let's the parser parse a
substring of the specified query. This makes it easier to pass in a command
stored in a connection's input string buffer.
frontend: Added simple implementation of sdb_fe_exec().
This function executes the return value of sdb_fe_parse().
This function executes the return value of sdb_fe_parse().
store: Added sdb_store_get_host().
… querying a host by it's name.
… querying a host by it's name.
t/coverage.sh: Reset files not part of the tarball.
This way, files like .gitignore and .travis.yml, which are not part of a
release, are reset and will not cause a "dirty" version.
This way, files like .gitignore and .travis.yml, which are not part of a
release, are reset and will not cause a "dirty" version.
store_test: Test various serialization flags.
store: Added flags to JSON functions indicating information to leave out.
This may be used to leave out services or attributes from the serialized
object. For this purpose, the serialization function has been simplified to
handle attributes and services mostly alike.
This may be used to leave out services or attributes from the serialized
object. For this purpose, the serialization function has been simplified to
handle attributes and services mostly alike.
store: Introduced sdb_store_host_tojson() to serialize a single host.
store: Moved object type attribute to the base object.
utils llist: Added TODO note about iterator improvements.
store: Exported the store base object type as opaque type.
Renamed from store_obj_t to sdb_store_base_t to avoid a name-clash with
sdb_store_obj_t.
Renamed from store_obj_t to sdb_store_base_t to avoid a name-clash with
sdb_store_obj_t.
parser_test: Free memory returned by sdb_fe_parse().
dbi_test: Make tests support CK_FORK=no.
… by resetting state as needed.
… by resetting state as needed.
frontend: Let sdb_fe_parse() return a list of parsed node objects.
Each parse-tree node object represents a single command.
Each parse-tree node object represents a single command.
utils llist: Added sdb_llist_get().
object: Added sdb_object_create_simple().
This function creates a "simple" object without custom initialization and
destructor.
This function creates a "simple" object without custom initialization and
destructor.
utils llist: Added sdb_llist_len().
Declare sdb_fe_yyparse() in parser.h.
Apparently, older versions of bison do not include the function prototype in
the generated header file. Double-declarations don't hurt (as long as they
match).
Apparently, older versions of bison do not include the function prototype in
the generated header file. Double-declarations don't hurt (as long as they
match).
src/Makefile: Let libsysdb depend on parser.h.
src/Makefile: Tell automake that grammar.h is auto-built.
frontend: Added flex/bison based parser skeleton.
For now, this implements a mostly empty parser and helper functions to parse
strings (rather than open files). The parser accepts the "LIST" command and
ignores SQL and C style comments.
For now, this implements a mostly empty parser and helper functions to parse
strings (rather than open files). The parser accepts the "LIST" command and
ignores SQL and C style comments.
frontend/query: Fixed typo.
src/Makefile: Use LTLIBRARIES for libsysdb_scanner.
sysdb/scanner.l: Enabled 8bit, nodefault, and warn options.
store: Don't look up services from hierarchical hosts.
We don't have any concept of service inheritance (yet?).
Also, I'm not sure if this would ever make sense in general. This might be a
query option, though.
We don't have any concept of service inheritance (yet?).
Also, I'm not sure if this would ever make sense in general. This might be a
query option, though.
Fixed some issues identified by static code analysis.
The following issues were identified and fixed:
* Allocator sizeof operand mismatch in dbi utils.
* Dead increment in tools/sysdb/input.
* Memory leak (and leaving behind invalid memory) in tools/sysdbd/configfile.
* Out-of-bound array access in core/plugin (the original report by the clang
analyzer was wrong but pointed to a location affected by a related
problem).
* Stack address stored into global variable in liboconfig.
Thanks to cppcheck and the clang analyzer!
The following issues were identified and fixed:
* Allocator sizeof operand mismatch in dbi utils.
* Dead increment in tools/sysdb/input.
* Memory leak (and leaving behind invalid memory) in tools/sysdbd/configfile.
* Out-of-bound array access in core/plugin (the original report by the clang
analyzer was wrong but pointed to a location affected by a related
problem).
* Stack address stored into global variable in liboconfig.
Thanks to cppcheck and the clang analyzer!
Moved coverage.sh to the t/ subdirectory.
Makefile: Added coverage.sh to a dist tarball.
coverage.sh: Added a helper script to generate HTML coverage reports.
The script uses lcov and creates a clean copy of the source code in a
temporary directory using 'make dist'.
The script uses lcov and creates a clean copy of the source code in a
temporary directory using 'make dist'.
t/Makefile: Pass gcov flags to tests as well.
Else, some tests might not compile correctly.
Else, some tests might not compile correctly.
.gitignore: Ignore test-driver.
This file is created by newer autotools when running ‘make check’.
This file is created by newer autotools when running ‘make check’.
src/Makefile: Include sysdb.h.in file in a distribution.
src/Makefile: Added a rule to create ‘../version’.
Makefile: Fixed generation of the ‘version’ file.
src/Makefile: Fixed path to connection-private.h.
t/Makefile: Use top_srcdir rather than top_builddir.
This allows running tests out-of-tree.
This allows running tests out-of-tree.
Make everything buildable out-of-tree.
Updated README.
Added missing dependencies, links to dependency upstream homepages, and some
notes about testing.
Added missing dependencies, links to dependency upstream homepages, and some
notes about testing.
Let the config parser accept unquoted IPv6 addresses.
The parser supports raw IPv6 addresses, optional address and port (as
[<addr>]:<port>), and embedded IPv4 addresses.
Based on "Common Patterns" found in the flex manual.
The parser supports raw IPv6 addresses, optional address and port (as
[<addr>]:<port>), and embedded IPv4 addresses.
Based on "Common Patterns" found in the flex manual.
src/Makefile: Fixed an automake warning.
Added "lib" suffix to library name.
Added "lib" suffix to library name.
configure: Re-enabled coverage support for GCC.
D'oh!
D'oh!
configure: Do stricter GCC checking.
$GCC might be true for clang as well but clang does not support gcov coverage
testing.
$GCC might be true for clang as well but clang does not support gcov coverage
testing.
configure: Do not enable gcov unless the compiler is GCC.
Others are not known (to me) to work.
Others are not known (to me) to work.
.travis.yml: Use --enable-gcov which will fix clang builds.
build system: Added --enable-gcov configure option.
.travis.yml: Use verbose coveralls output.
This is to see what's going on in the logs.
This is to see what's going on in the logs.
.travis.yml: Collect and upload coverage information to coveralls.io.
Use -Wno-sign-conversion on Travis.
GNU libc, as used on the current test machines, would else provoke an error in
the expansion of FD_SET.
GNU libc, as used on the current test machines, would else provoke an error in
the expansion of FD_SET.
proto utils: Fixed invalid conversion of return value.
Thanks to Travis CI for finding this!
Thanks to Travis CI for finding this!
Added a travis-ci.org project specification.
sysdb: Use the flex scanner generator for reading input.
The idea is to implement a minimalistic parser which understands all valid
input and which is used to determine if an input line is part of an existing
command or a command on its own. This information will then be used to update
the prompt (and possibly to determine other information as well).
The scanner's YY_INPUT "method" is overwritten in order to use readline and
custom buffering for user input.
The idea is to implement a minimalistic parser which understands all valid
input and which is used to determine if an input line is part of an existing
command or a command on its own. This information will then be used to update
the prompt (and possibly to determine other information as well).
The scanner's YY_INPUT "method" is overwritten in order to use readline and
custom buffering for user input.
Merged branch 'master' of git://git.tokkee.org/sysdb.
plugin: Record all loaded plugins and use that for improved error messages.
frontend: Make the number of handler threads configurable.
The number is passed to listen_and_serve() as part of sdb_fe_loop_t.
The number is passed to listen_and_serve() as part of sdb_fe_loop_t.
frontend: Return an error if no handler threads could be created.
frontend: Implemented simplified error handling when creating threads.
There's hardly any reasonable error condition that might happen, so this
rather simplied approach should be sufficient.
There's hardly any reasonable error condition that might happen, so this
rather simplied approach should be sufficient.
client: Let sdb_client_recv() use sdb_proto_select().
proto utils: Added sdb_proto_select().
This is a simple wrapper around select(2) to be used in cases where we only
care about a single file-descriptor being ready for a particular operation.
This is a simple wrapper around select(2) to be used in cases where we only
care about a single file-descriptor being ready for a particular operation.
frontend/sock_test: Try to connect to the server socket.
This verifies that the socket is actually usable.
Also, it fixes a race condition in the test. The UNIX socket file is already
created when adding the listener. Thus, the previous synchronization between
the main thread and the socket handler thread did not work in most cases.
This verifies that the socket is actually usable.
Also, it fixes a race condition in the test. The UNIX socket file is already
created when adding the listener. Thus, the previous synchronization between
the main thread and the socket handler thread did not work in most cases.
frontend: Clean up UNIX sockets when closing a listener.
frontend: Let listen_and_serve() return early if do_loop == 0.
That is, do not (re-)open any sockets.
That is, do not (re-)open any sockets.
frontend/sock_test: Added initial tests for frontend code.
.gitignore: Ignore sysdb / sysdbd only as src/sysdb / src/sysdbd.