Commit Graph

1744 Commits

Author SHA1 Message Date
Chrissie Caulfield
c4c4ca8464 Merge pull request #180 from jnpkrn/example-simplelog-stdout
example: simplelog supports -o (for stdout sink)
2016-02-18 14:58:38 +00:00
Chrissie Caulfield
6137f654e3 Merge pull request #178 from jnpkrn/format-annotations
build: avoid too keen -Wmissing-format-attribute warning
2016-02-18 11:37:56 +00:00
Chrissie Caulfield
3b7b50dead Merge pull request #183 from jnpkrn/doc-fix-overview
Doc: fix overview
2016-02-18 11:14:50 +00:00
Jan Pokorný
7b10be7401
CI: restore travis notifications, IRC this time around
While quarterback [dash] devel [at] lists [dot] fedorahosted [dot] org,
original notification target and development ML seems long gone (without
archives preserved!), let's use #clusterlabs-dev at freenode IRC
network.  This is in-line with the purpose of the channel and it's what
clufter, crmsh and hawk seem to be currently using.
2016-02-18 12:06:28 +01:00
Jan Pokorný
fa73c21ae4
CI: enable recently added syslog-tests in .travis.yml 2016-02-18 11:32:55 +01:00
Jan Pokorný
0fc2757546
CI: .travis.yml cosmetics 2016-02-18 11:32:40 +01:00
Jan Pokorný
642f74de61
Feature: allow changing the identifier for syslog (+tests)
Original "qb_log_ctl" interface had to be extended for passing read-only
strings (new parameter), resulting in new "qb_log_ctl2" function, which
is what qb_log_ctl calls into with the new parameter set to NULL.
This ensures backward compatibility.

A new QB_LOG_CONF_IDENT configuration directive for the mentioned
interface is added with a goal to set new internal identifier
that is, notably, used for syslog sink.  This allows for switching
the identification without a need to reinitialize logging subsystem,
akin to changing target logging facility.

Also a brand new concept of testing syslog sink in particular is
introduced (finally).  During initial trial&error stage, it used
LD_PRELOAD hack but it seems that libtool is sophisticated enough
that no such extra intervention is needed and the desired symbol
resolution Just Works (tm).  However, the technique is highly
non-portable (there is even a warning about that from libtool,
which is partially on purpose as the _syslog_override.so should
rather be explicit it is by no mean a regular library) and hence
the syslog tests have to be enabled with explicit

    ./configure --enable-syslog-tests

rather than possibly break on untested platforms (far too many).
The concept can be extended upon, but initially, just the new
feature is being tested.

Post-review: thanks Chrissie for a suggestion how to deal with
extract-arg-and-forget in a less intrusive way (no defines).
2016-02-18 11:30:14 +01:00
Jan Pokorný
837108b02a
qblog.h: fix typos and make stylistic enhancements 2016-02-16 18:10:10 +01:00
Jan Pokorný
78d5d1686a
qblog.h: unify descriptions before the code examples
- use semicolons at the end of the description
- use commas when there can be an issue with parsing a long sentence
  (and wrap such text at 79 characters if applicable)
2016-02-16 18:08:46 +01:00
Jan Pokorný
7a290093d0
log: convert few more instances to use enum qb_log_target_slot 2016-02-16 18:08:13 +01:00
Jan Pokorný
2198893c3e
log: refactor static target slots state initialization
It doesn't matter that also syslog is disabled first, as it will get
enabled few lines later on (uniformity + simplicity > optimization +
complexity).
2016-02-16 18:07:45 +01:00
Jan Pokorný
807c7dc34a
log: better (fixed) documentation for funcs returning "slot" index
Also add missing "stdout" to the enumerations of the static ones.
2016-02-16 18:06:52 +01:00
Jan Pokorný
fdbb80a87b
doc: IPC overview: fix typos 2016-02-16 17:49:01 +01:00
Jan Pokorný
3ef3ae434f
doc: main overview: fix style + reword per spec file 2016-02-16 17:48:35 +01:00
Jan Pokorný
4ccca4bda9
log: convert log target defined values into enum values
Also use the new enum qb_log_target_slot type in for-loops together
with a proper substitute for the literal "0" initializer.

There could be more places that might be type-substituted for this enum
(and hence possibly catch more of an incorrect usage if the compiler
or checker has some notion of enum type narrowing), but leave it as
a possible enhancement for now.
2016-02-16 14:49:02 +01:00
Jan Pokorný
e74214b79b
log: defined value as an index-pointer after static slots
Amongst other uses, this allows for better (fixed) documentation
regarding how many additional logging targets the user can define.
2016-02-16 14:48:06 +01:00
Jan Pokorný
6e6791113f
example: simplelog supports -o (for stdout sink) 2016-02-15 16:52:11 +01:00
David Shane Holden
33794cce5a ipc: return -errno when getsockopt/setsockopt fail 2016-02-14 16:44:17 -05:00
David Shane Holden
4978104ae4 ipc: set socket buffer size used by ipcs service 2016-02-14 16:29:11 -05:00
David Shane Holden
e788d618ee ipc: set socket receive buffer
Set the sockets receive buffer size to match the send buffer.  On
FreeBSD without this calls to sendto() will result in an ENOBUFS error
if the message is larger than net.local.dgram.recvspace sysctl.
2016-02-14 06:31:45 -05:00
Jan Pokorný
4f6c235470
build: avoid too keen -Wmissing-format-attribute warning
Grouped with pre-existing -Wsuggest-attribute=format treatment.
2016-02-12 23:33:13 +01:00
Chrissie Caulfield
242a07ebc2 Merge pull request #175 from jnpkrn/format-annotations
Format annotations
2016-02-04 09:16:55 +00:00
Chrissie Caulfield
386a6e9fdd Merge pull request #174 from jnpkrn/spec-cleanup
Spec cleanup
2016-02-04 09:16:31 +00:00
Jan Pokorný
4fd4e5e71b
spec cleanup: drop redundant %{buildroot} cleaning
References:
http://pkgs.fedoraproject.org/cgit/rpms/redhat-rpm-config.git/commit/?id=159a65f
(~2010)
2016-02-03 15:44:40 +01:00
Jan Pokorný
4037a3684d
spec cleanup: summary should not end with a dot
References:
https://fedoraproject.org/wiki/Common_Rpmlint_issues#summary-ended-with-dot
https://en.opensuse.org/openSUSE:Specfile_guidelines#Summary

+ it's an internal inconsistency with Summary for -devel package
2016-02-03 15:44:04 +01:00
Jan Pokorný
736e2c8153
includes: format __attribute__ func. annotations in qblog.h
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2016-02-03 15:40:36 +01:00
Jan Pokorný
ea35cfaa61
build: avoid too keen -Wsuggest-attribute=format warning
With gcc 5.3.1 20151207:
> log.c: In function 'cs_format':
> log.c:182:2: warning: function might be possible candidate for
>              'gnu_printf' format attribute [-Wsuggest-attribute=format]
>   len = vsnprintf(str, QB_LOG_MAX_LEN, cs->format, ap_copy);
>   ^

We certainly don't want to disable that warning globally so make use of
diagnostic pragmas for GCC instead in one instance that we cannot
annotate properly.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2016-02-03 15:40:11 +01:00
Jan Pokorný
b7108edaff
spec cleanup: get rid of redundant %clean section
References:
http://rpm.org/gitweb?p=rpm.git;a=commit;h=3fc5824 (~2009)
2016-02-03 09:59:33 +01:00
Jan Pokorný
11a5cea3a6
spec cleanup: remove ignored BuildRoot tag
References:
http://rpm.org/gitweb?p=rpm.git;a=commit;h=6c06519 (~2008)
2016-02-03 09:59:05 +01:00
Jan Pokorný
018fbfa5f2
spec cleanup: get rid of redundant defattr
References (first one is a direct trigger):
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/KEO7AX3JXR2TY6OVL4M7HDISZ6YIJNKU/#2UFET77NHMJTG4NA2ECRVH2KO3W56ZWD
http://rpm.org/gitweb?p=rpm.git;a=commit;h=47ea5da (~2004)
2016-02-03 09:58:38 +01:00
Chrissie Caulfield
8b2450edb0 Merge pull request #173 from dpejesh/socket
ipc: set gid on unix sockets
2016-02-01 16:00:12 +00:00
David Shane Holden
4f131253fc update: per kgaillot review
* remove pid/euid from qb_ipcc_connection
* use proper #elif defines
* return NULL instead of 0 for pointers
* return -ENOMEM when malloc fails
* remove redundant if check
* use -1 for uid to chown()
2016-01-25 21:27:29 -05:00
David Shane Holden
8668d051c5 ipc: set gid on unix sockets
When creating a unix socket it's default gid is that of the parent
directory.  If the SOCKETDIR is owned by root:wheel with 1777 mode
some of the pacemaker daemons end up unable to communicate with one
another due to having insufficient permissions on the sockets.

This can be fixed by setting the client sockets gid to the primary
group of the server socket owner it's attempting to connect to.  And,
on the server side by setting the gid to the already captured gid
stored in the connection info.  This ensures that regardless of who
owns the socket directory, as long as the applications have r/w
access to it they should work.
2016-01-23 10:32:42 -05:00
David Shane Holden
267160634d lib: store server peer credentials in qb_ipcc_connection 2016-01-22 19:42:28 -05:00
David Shane Holden
888ef2e721 lib: add init_ipc_auth_data() to initialize ipc_auth_data 2016-01-22 19:30:13 -05:00
David Shane Holden
7c4185a72a lib: split peer credential loopup into it's own method 2016-01-22 19:22:20 -05:00
Christine Caulfield
2dd75dee24 build: Correctly generate spec file's date
LC_ALL=C was outside of the shell environment so the date
was incorrect in the spec file if the system default language was not
C or English.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-01-19 13:46:07 +00:00
Chrissie Caulfield
09cba8c92c Merge pull request #171 from dpejesh/socket
minor socket/mmap fixes
2016-01-19 11:35:15 +00:00
David Shane Holden
dfa7874154 lib: create mmap files in socket directory
Currently the mmap files are created in LOCALSTATEDIR/run on non-Linux
platforms which can be problematic with pacemaker since it spawns processes
as the hacluster user, which by default doesn't have write permissions to
it.  Using --with-socket-dir partially fixes the problem by allowing the
unix sockets to reside somewhere else but not the mmap files and this
patch puts them in the same directory.
2016-01-18 19:02:08 -05:00
David Shane Holden
29b2c44fb6 ipc: set file permissions on created sockets
When using sockets for IPC the file permissions default to whatever
the umask is.  This isn't a problem on Linux since it uses abstract
namespace sockets which don't have any permissions, but on other
platforms this causes problems with pacemaker which spawns processes
under the hacluster user and ends up failing to connect.
2016-01-18 18:31:49 -05:00
chrissie-c
a1011c5f18 Merge pull request #170 from dkopecek/master
Add missing Makefile rule for generating the auto_check_header_qbconf…
2016-01-14 16:44:17 +00:00
Daniel Kopecek
80834ea1cb Add missing Makefile rule for generating the auto_check_header_qbconfig.c file
Resolves issue #158

Addressing:
make[2]: Entering directory `/home/dkopecek/Projects/github/usbguard/src/ThirdParty/libqb/_build/tests'
...
  GEN      auto_check_header_qbarray.c
  CC       auto_check_header_qbarray.o
  CCLD     auto_check_header_qbarray
make[2]: *** No rule to make target `auto_check_header_qbconfig.c', needed by `auto_check_header_qbconfig.o'.  Stop.
make[2]: Leaving directory `/home/dkopecek/Projects/github/usbguard/src/ThirdParty/libqb/_build/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dkopecek/Projects/github/usbguard/src/ThirdParty/libqb/_build'
make: *** [all] Error 2
2016-01-14 16:37:26 +01:00
Christine Caulfield
9b61a2c672 lib: update library version for new release
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-01-12 11:10:18 +00:00
chrissie-c
ea0345428e Merge pull request #164 from kgaillot/fixes
Improvements to build process
2016-01-11 15:31:43 +00:00
Christine Caulfield
0f62ddb76f includes: Fix format string
The format strings for QB_HDB_D_FORMAT & QB_HDB_X_FORMAT had no spaces
between "%" and PRIx64. This is allowed, but technically incorrect and
breaks C++11

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2016-01-08 11:25:02 +00:00
chrissie-c
3245d7ad1d Merge pull request #167 from gao-yan/ipc-fd-memory-leaks
Fix: ipc: Prevent fd and memory leaks in handle_new_connection()
2016-01-08 09:30:41 +00:00
chrissie-c
32f782d4c7 Merge pull request #169 from rubenk/remove-unused-define
configure.ac: remove an unused DEFINE
2015-12-17 11:37:43 +00:00
chrissie-c
6b79ae01f1 Merge pull request #168 from rubenk/point-at-the-correct-license-file
The license is in COPYING, not LICENSE
2015-12-17 10:32:29 +00:00
Ruben Kerkhof
f15407b9e2 configure.ac: remove an unused DEFINE 2015-12-16 20:07:23 +01:00
Ruben Kerkhof
e0137ddbb9 The license is in COPYING, not LICENSE 2015-12-16 19:28:20 +01:00