frontend: Added very simple single-quoted string support.
No escape sequences whatsoever are supported so far but except for that any
single-quoted strings which do not contain single quotes, can be used.
FETCH now supports host names specified as strings as well.
No escape sequences whatsoever are supported so far but except for that any
single-quoted strings which do not contain single quotes, can be used.
FETCH now supports host names specified as strings as well.
frontend: Free dynamically allocated memory in the parser.
frontend: Added FETCH support to the connection handler.
The wire format is: <CONNECTION_FETCH>;<len>;<host>
The wire format is: <CONNECTION_FETCH>;<len>;<host>
parser_test: Check the node's command type.
frontend: Added 'FETCH <name>' query command.
For now, <name> may only be a simple identifier.
For now, <name> may only be a simple identifier.
object: Added sdb_object_create_dT() macro.
This may be used to create a simple dynamic object of a specified type.
Dynamic type means that it uses a destructor.
This may be used to create a simple dynamic object of a specified type.
Dynamic type means that it uses a destructor.
object: Let create_simple() accept an optional destructor.
This is still simple but it allows for some more dynamic.
This is still simple but it allows for some more dynamic.
frontend: Let the parser not accept other grammars in default mode.
utils llist: Let llist_get() increment the reference count.
This feels more consistent.
This feels more consistent.
frontend parser: Added support for parsing single expressions.
The parser has been extended to support different modes. In SDB_PARSE_EXPR
mode, a single expression will be accepted as a start condition. The new
function sdb_fe_parse_matcher() uses this to parse expressions.
For now, this implements only the basic framework. Any identifier will be
parsed as a simple name matcher expression.
The parser has been extended to support different modes. In SDB_PARSE_EXPR
mode, a single expression will be accepted as a start condition. The new
function sdb_fe_parse_matcher() uses this to parse expressions.
For now, this implements only the basic framework. Any identifier will be
parsed as a simple name matcher expression.
t/cibuild.sh: Use ./configure --enable-standards.
configure: Don't use -pedantic.
Else, GCC will complain about "ISO C forbids conversion of object pointer to
function pointer type", even for casting function points to or from void
pointers. This is allowed by POSIX, though, and required, for example, for
dlsym() to work.
Else, GCC will complain about "ISO C forbids conversion of object pointer to
function pointer type", even for casting function points to or from void
pointers. This is allowed by POSIX, though, and required, for example, for
dlsym() to work.
configure: Make "standards" and "hardening" flags part of STRICT_CFLAGS.
Most importantly, don't assign them to CFLAGS which might be overwritten when
running make, thus leaving out the flags which were originally requested to be
used.
Most importantly, don't assign them to CFLAGS which might be overwritten when
running make, thus leaving out the flags which were originally requested to be
used.
configure: Disable -Wsign-conversion.
It may cause problems in expanded macros from libc.
It may cause problems in expanded macros from libc.
configure: Request X/Open 7 (XSI) compliance.
This is required for strndup().
This is required for strndup().
configure: Include _BSD_SOURCE in standards related defines.
Else, GNU libc does not define strcasecmp() even though it conforms to
POSIX.1-2001.
Else, GNU libc does not define strcasecmp() even though it conforms to
POSIX.1-2001.
Removed semicolon from SDB_PLUGIN_MAGIC definition.
Rather, the semicolon is added when using the define.
Rather, the semicolon is added when using the define.
Fixed (pedantic) void-pointer to function-pointer cast warnings.
Include config.h in source files.
Else, we don't get any definitions required for enforcing standard compliance.
Else, we don't get any definitions required for enforcing standard compliance.
frontend: Fixed two typing issues.
frontend, liboconfig: Added missing prototypes for yylex/yyparse.
store_lookup_test: Continue loop after fail().
The compiler does not know that fail aborts the test program and clang
(correctly) complains that the variable ('m' in this case) might be used
uninitialized afterwards.
The compiler does not know that fail aborts the test program and clang
(correctly) complains that the variable ('m' in this case) might be used
uninitialized afterwards.
t/coverage.sh: Fall-back to lcov without --no-external.
Old versions of lcov don't support that flag. Simply try to fall back in case
the first run fails.
Old versions of lcov don't support that flag. Simply try to fall back in case
the first run fails.
store_lookup: Made logical operators public.
Added tests for store lookup functions.
store: Added public functions to create and execute matchers.
The matcher types are now based on sdb_object_t to ease memory management in
case a matcher is used in multiple places. Constructors for each matcher type
are now available and the top-level matching function has been made public.
The matcher types are now based on sdb_object_t to ease memory management in
case a matcher is used in multiple places. Constructors for each matcher type
are now available and the top-level matching function has been made public.
t/coverage.sh: Use version-gen.sh to determine the current version.
… rather than guessing ;-) D'oh!
… rather than guessing ;-) D'oh!
t/coverage.sh: Don't git reset but test the current, possibly dirty, code.
Instead, only get back files which are not included in the tarball.
Instead, only get back files which are not included in the tarball.
store_lookup: Fix matching of services with empty attr matcher.
store: Require name matchers to match string *and* regex if specified.
store: Fixed data format error detection.
store_test: Clear the test after running the test-case.
This removes any cross-dependencies between multiple checks.
This removes any cross-dependencies between multiple checks.
store: Added sdb_store_clear().
This function clears the entire store removing all entries. It's mostly
useful for testing, I suppose.
This function clears the entire store removing all entries. It's mostly
useful for testing, I suppose.
store: Added a frame-work for object lookups.
store_lookup currently provides low-level functionality for matching store
objects based on their various attributes.
store_lookup currently provides low-level functionality for matching store
objects based on their various attributes.
data: Let sdb_data_format() different quoting styles.
data_test: Compare return values of format() and strlen().
This is to check that sdb_data_strlen() reports sane numbers.
This is to check that sdb_data_strlen() reports sane numbers.
data: Let sdb_data_format() return the number of bytes written.
date_test: Added some simple overflow tests.
data: Let sdb_data_format output to a character array.
This is more universally usable.
This is more universally usable.
data: Added sdb_data_strlen.
This function provides a worst-case estimate of the number of bytes required
to format a datum as a string.
This function provides a worst-case estimate of the number of bytes required
to format a datum as a string.
data_test: Print type of datum in case of a test failure.
data_test: Use a table-driven test.
data: Escape \ and " in strings when formatting them.
data: Correctly format NULL values.
store: Split private type definitions into a new header store-private.h.
store: Serialize attribute values using sdb_data_format().
store: Removed sdb_ prefix from private lookup function.
data: Double quote formatted date-times.
JSON does not support time values, thus, we need to treat this is a string.
JSON does not support time values, thus, we need to treat this is a string.
data: Format binary bytes as \xXX rather than \XX.
data: Improve serialization of binary data.
Instead of calling strbuf_append() for each byte, precompute the string in a
simple for-loop and then append the result to the buffer. This basically
inlines a formatter specific to this use-case and, thus, should be must
faster.
Instead of calling strbuf_append() for each byte, precompute the string in a
simple for-loop and then append the result to the buffer. This basically
inlines a formatter specific to this use-case and, thus, should be must
faster.
frontend: Don't send debug logs to the client (for now).
Later, this should be configurable by the client at runtime.
Later, this should be configurable by the client at runtime.
frontend: Send connection-related log messages to the client.
This is done by registering a logging callback which will send all messages
originating from a thread currently handling a connection to the respective
client. For this, the connection object is stored in a thread-specific data
segment.
This is done by registering a logging callback which will send all messages
originating from a thread currently handling a connection to the respective
client. For this, the connection object is stored in a thread-specific data
segment.
sysdb: Handle EOF from the server.
client: Correctly handle EOF in sdb_client_connect().
client: Added an EOF flag to the client object.
In a lot of cases, a client is passed through a couple of functions in order
to handle I/O. Adding the flag will make it easier to access the information
in the right location without having to worry about 0 return codes (which mean
different things in some cases anyway, e.g. in sdb_client_recv() which returns
zero if an empty message (header only) has been received).
In a lot of cases, a client is passed through a couple of functions in order
to handle I/O. Adding the flag will make it easier to access the information
in the right location without having to worry about 0 return codes (which mean
different things in some cases anyway, e.g. in sdb_client_recv() which returns
zero if an empty message (header only) has been received).
frontend/connection: Require authentication before allowing any commands.
frontend/session: Store authenticated user information.
Also, for now, reject access in case no username is provided.
Also, for now, reject access in case no username is provided.
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.