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.
Moved connection-private.h from src/include/frontend/ to src/frontend/.
This header is not meant to be used anyway else, so don't lead people into
temptation.
This header is not meant to be used anyway else, so don't lead people into
temptation.
Moved sysdb and sysdbd sources to src/tools/.
Also, moved all purely private headers to that directory as well.
Renamed some files for greater consistency.
Also, moved all purely private headers to that directory as well.
Renamed some files for greater consistency.
.gitignore: Ignore ar-lib.
sysdb: Use a string buffer and simple (stupid) ';' EO-query checks.
Use a different prompt (similar to psql) when inside a query.
Use a different prompt (similar to psql) when inside a query.
configure: Fixed some automake warnings.
doc/Makefile: Use SUFFIXES rather than GNU-specific %-style rules.
strbuf_test: Added tests for sdb_strbuf_clear().
strbuf_test: Added a couple of tests operating on a zero-size buffer.
This is mostly about checking that this does not crash.
This is mostly about checking that this does not crash.
strbuf utils: Added sdb_strbuf_clear().
sysdb: Free memory allocated by readline().
sysdb: Don't warn about missing history file when loading history.
sysdb: Check for and use libedit/libreadline for command input.
dbi utils: Don't keep invalid object address after closing DBI connections.
frontend: Remove stale UNIX sockets before trying to bind().
client: Report client socket errors using error utils.
sysdb: Exit, if the current user could not be determined.
Merged branch 'master' of git://git.tokkee.org/sysdb.
sysdb: Use error utilities.
error utils: Make the logger callback configurable.
Don't depend on the plugin module anymore. Rather, add sdb_error_set_logger()
which may be used to set a callback to be used for all logging. Default to
printing to stderr.
sysdbd now uses that to register sdb_plugin_log as logger callback.
Don't depend on the plugin module anymore. Rather, add sdb_error_set_logger()
which may be used to set a callback to be used for all logging. Default to
printing to stderr.
sysdbd now uses that to register sdb_plugin_log as logger callback.
Moved core/error to utils/error.
Later, we'll use the module from the daemon and client.
Later, we'll use the module from the daemon and client.
sysdb: Connect to the server and issue a STARTUP command.
The current username is sent along with the STARTUP command.
The current username is sent along with the STARTUP command.
sysdbd: Send SIGINT to backend thread when shutting down.
This will interrupt the sleep call and make the thread shut down faster.
This will interrupt the sleep call and make the thread shut down faster.
proto utils: Fixed offset check in get_int().
Let sdb_client_connect() send a username to the server.
… using a STARTUP message.
… using a STARTUP message.
frontend: Split connection status constants into a separate header.
This will allow the client to use it as well.
This will allow the client to use it as well.
store_test: Fixed golden data for tojson() test.