Commit Graph

436 Commits

Author SHA1 Message Date
Lennart Poettering
2181a7f558 bus: implement server mode, and anonymous authentication 2013-03-30 15:21:55 +01:00
Lennart Poettering
a3de5ae1d7 prioq: consider a NULL prioq empty 2013-03-30 15:21:55 +01:00
Lennart Poettering
830f01f0bc unit: no need to export variables if we can avoid it 2013-03-30 15:21:54 +01:00
Lennart Poettering
f04c0bd6ed utmp: make gcc shut up, we need to pass an int here, not size_t 2013-03-29 15:47:18 +01:00
Zbigniew Jędrzejewski-Szmek
8333c77edf Always use errno > 0 to help gcc
gcc thinks that errno might be negative, and functions could return
something positive on error (-errno). Should not matter in practice,
but makes an -O4 build much quieter.
2013-03-29 10:12:41 -04:00
Zbigniew Jędrzejewski-Szmek
76877b46b6 tests: add some silly tests for path-util.c 2013-03-28 23:45:59 -04:00
Zbigniew Jędrzejewski-Szmek
844ec79b3c catalog: open up catalog internals
In order to write tests for the catalog functions, they
are made non-static and start taking a 'database' parameter,
which is the name of a file with the preprocessed catalog
entries.

This makes it possible to make test-catalog part of the
normal test suite, since it now only operates on files
in /tmp.

Some more tests are added.
2013-03-28 23:45:59 -04:00
Zbigniew Jędrzejewski-Szmek
2688887653 utmp-wtmp: don't try to read past end of string
systemd-199/src/shared/utmp-wtmp.c:228: buffer_size_warning: Calling
strncpy with a maximum size argument of 32 bytes on destination array
"store.ut_line" of size 32 bytes might leave the destination string
unterminated.

The destination string is unterminated on purpose, but we must
remember that.
2013-03-28 23:24:55 -04:00
Václav Pavlín
f36a783ca7 shared: free dt (temporary dir name) on fail
[zj: modified to not to try to rmdir() dir we haven't created.]
2013-03-27 12:01:44 -04:00
Zbigniew Jędrzejewski-Szmek
49e5de64e2 tests: skip bus test if bus cannot be opened
To make the result more visible, special return value
is used to tell automake that the test was skipped. While
at it, use the same return value in other skipped tests.
2013-03-26 23:50:44 -04:00
Zbigniew Jędrzejewski-Szmek
3baed19327 Simplify the meaning of %s
The rules governing %s where just too complicated. First of
all, looking at $SHELL is dangerous. For systemd --system,
it usually wouldn't be set. But it could be set if the admin
first started a debug shell, let's say /sbin/sash, and then
launched systemd from it. This shouldn't influence how daemons
are started later on, so is better ignored. Similar reasoning
holds for session mode. Some shells set $SHELL, while other
set it only when it wasn't set previously (e.g. zsh). This
results in fragility that is better avoided by ignoring $SHELL
totally.

With $SHELL out of the way, simplify things by saying that
%s==/bin/sh for root, and the configured shell otherwise.
get_shell() is the only caller, so it can be inlined.

Fixes one issue seen with 'make check'.
2013-03-26 23:49:44 -04:00
Lennart Poettering
2fd9ae2e9b bus: implement 'unixexec:' protocol 2013-03-25 02:33:35 +01:00
Lennart Poettering
2c93b4efec bus: implement support for FD passing 2013-03-25 02:33:34 +01:00
Lennart Poettering
4589f5bb0a conf-parser: when we parse a string list, always fill in something
Some code really wants to know whether there was a string list parsed,
so don't take the shortcut here, and always allocate a string list, even
if it is an empty one.

https://bugs.freedesktop.org/show_bug.cgi?id=62558
2013-03-23 04:32:43 +01:00
Colin Walters
a5a5ade34c dbus: Do send out "replies" to signals
Some parts of systemd (at least the DBus activation codepath) "reply"
to signals, which of course have the no-reply flag set.  We will be
defensive here and still send out a reply if we're passed a signal.

Regression introduced by: c6a818c820

Reported-by: Mantas Mikulėnas <grawity@gmail.com>
Tested-by: Mantas Mikulėnas <grawity@gmail.com>
2013-03-22 23:37:11 +01:00
Zbigniew Jędrzejewski-Szmek
48deb058b6 util: workaround two gcc warnings
gcc does not know that errno cannot be negative, and warns
about unitialized variables later on. Kill the warnings by
returning -errno only after checking that errno is positive.
2013-03-22 15:40:37 -04:00
Zbigniew Jędrzejewski-Szmek
478c82693c build-sys: move acl searching code into libsystemd-acl
This loop over acls is a bit too much to keep inside
of another loop.
2013-03-22 15:31:45 -04:00
Lennart Poettering
aa3c5cf8ee util: be more picky when validating hostnames
No longer allow dots at the beginning or end of host names, Or double
dots.

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1152187/comments/14
2013-03-22 17:59:49 +01:00
Lennart Poettering
4468addca6 journalctl: give a nice hint about group membership based on ACLs of /var/log/journal
If we notice that we unprivileged and not in any of the groups which
have access to /var/log/journal, print a nice message about which groups
do.

This checks and prints all groups that are in the default ACL for
/var/log/journal, which is not necessarily correct for all journal
files, but pretty close.
2013-03-22 17:44:19 +01:00
Zbigniew Jędrzejewski-Szmek
742af54adc efivars: fix return code
Was returning 1 on read error.
2013-03-21 22:39:24 -04:00
Lennart Poettering
e3017af973 bus: implement full method call timeout logic 2013-03-21 22:53:29 +01:00
Lennart Poettering
30bdd69525 shared: add simple priority queue implementation 2013-03-21 02:54:47 +01:00
Zbigniew Jędrzejewski-Szmek
4750fade13 Remove some unused variables 2013-03-20 19:16:01 -04:00
Lennart Poettering
9a17484d98 bus: implement demarshaller 2013-03-20 23:00:09 +01:00
Lennart Poettering
66e35261ef util: add hexmem() and strextend() calls 2013-03-20 23:00:09 +01:00
Lennart Poettering
a9c55a882f macro: add CHAR_TO_STR macro to make a one character string from a char 2013-03-20 22:58:40 +01:00
Lennart Poettering
907809fc6a macro: don't redefine CLAMP if it is already defined by glib or some other library 2013-03-20 22:58:40 +01:00
Zbigniew Jędrzejewski-Szmek
d34cd37490 Make PrivateTmp dirs also inaccessible from the outside
Currently, PrivateTmp=yes means that the service cannot see the /tmp
shared by rest of the system and is isolated from other services using
PrivateTmp, but users can access and modify /tmp as seen by the
service.

Move the private /tmp and /var/tmp directories into a 0077-mode
directory. This way unpriviledged users on the system cannot see (or
modify) /tmp as seen by the service.
2013-03-20 14:08:41 -04:00
Zbigniew Jędrzejewski-Szmek
763c7aa288 journal,shared: add _cleanup_journal_close_ 2013-03-18 19:49:30 -04:00
Michal Sekletar
c17ec25e4d core: reuse the same /tmp, /var/tmp and inaccessible dir
All Execs within the service, will get mounted the same
/tmp and /var/tmp directories, if service is configured with
PrivateTmp=yes. Temporary directories are cleaned up by service
itself in addition to systemd-tmpfiles. Directory which is mounted
as inaccessible is created at runtime in /run/systemd.
2013-03-15 22:56:40 -04:00
Lennart Poettering
961e452692 strv: fix STRV_FOREACH_PAIR macro definition 2013-03-15 16:49:07 +01:00
Zbigniew Jędrzejewski-Szmek
1c17cbed55 fileio: use _cleanup_ 2013-03-13 22:50:04 -04:00
Zbigniew Jędrzejewski-Szmek
886a64fe69 logs-show: export logic to add matches for units
After that functions which add matches, show_journal_by_unit
and show_journal_by_user_unit, become nearly identical, so
I merged them into one function.
2013-03-13 19:53:29 -04:00
Michal Schmidt
6282c859bd util, manager: and mempset() and use it
Just like mempcpy() is almost identical to memcpy() except the useful
return value, so is the relation of mempset() to memset().
2013-03-13 14:14:13 +01:00
Kay Sievers
bc6f2e7c62 bootctl: print secure boot flags 2013-03-10 22:48:27 +01:00
Michal Schmidt
f620dff8dd util: fix printing of welcome message
Commit 984a2be4 failed to adjust this caller of status_printf().
2013-03-08 10:59:15 +01:00
Michal Schmidt
a740c14c59 shared: inline trivial auto-cleanup functions 2013-03-08 10:09:31 +01:00
Michal Schmidt
5f1be48b26 shared: remove pointless checks in auto-cleanup functions
The argument given to the __attribute__((cleanup)) functions is the
address of the variable that's going out of scope. It cannot be NULL.
The "if (!s)" check in set_freep() is pointless.

Perhaps "if (!*s)" was intented. But that's pointless too, because
set_free()/set_free_free() are OK to call with a NULL argument (just
like free()).

Setting "*s = NULL" is pointless, because the variable that s points
to is about to go out of scope.

The same holds for strv_freep().
2013-03-08 10:09:31 +01:00
Lennart Poettering
b47ef6a085 pager: add -M to $LESS to make the bottom line nicer 2013-03-07 21:43:28 +01:00
Lennart Poettering
a4c41bf3fa pager: always override LESS
https://bugzilla.redhat.com/show_bug.cgi?id=868383

Primary reason to do this is to ensure "-e" works as intended, and is
not ignored because the user set his own LESS variable.
2013-03-07 21:28:09 +01:00
Harald Hoyer
1b12a7b589 pager: introduce "jump to end" option
$ journalctl -be

is what you want :)

https://bugzilla.redhat.com/show_bug.cgi?id=867841
2013-03-07 21:16:04 +01:00
Jan Janssen
650001c6f7 util: Fix grammar in comment 2013-03-07 16:06:43 +01:00
Lennart Poettering
b1b8e81694 virt: check for /sys/hypervisor/type for detecting xen PV
https://bugs.freedesktop.org/show_bug.cgi?id=61491
2013-03-07 16:03:12 +01:00
Lennart Poettering
d47c78be4a util: properly escape corner cases in bus_path_escape(), too
This follows the suggestions from:

http://lists.freedesktop.org/archives/systemd-devel/2013-March/009363.html
2013-03-05 20:05:46 +01:00
Michal Schmidt
076a24adf4 job: print the "OK" status messages in normal green
The "OK" status messages should not draw attention to themselves.
It's better if they're not printed in bright/bold. Leave that
to errors and warnings.

Use a plain inconspicuous enterprisey green.
2013-03-02 17:56:32 +01:00
Lennart Poettering
242c4e1cc4 path-lookup: downgrade again the messages where we log for units
This partially reverts 7ad94c716d.

After that commit commands such as "systemctl enable" and friends
printed the search path information multiple times in its output, which
is ugly.

If we want the search paths to be printed at a higher log level, then we
should do this in PID 1 only, i.e. split the printing out of the normal
path lookup logic and invoke that explicitly from PID 1 but not in the
auxiliary tools.
2013-03-01 14:07:20 +01:00
Lukas Nykryn
82910f1358 pager: add K to less environment
Using less as a pager sometimes breaks terminal when output
is interrupted by ctrl-c.

Reproducer: run 'sudo journalctl' ctrl-c.

Thanks mbriza@redhat.com for the solution.
2013-03-01 13:51:43 +01:00
Zbigniew Jędrzejewski-Szmek
2ca0435be9 systemd-activate: add a socket-activation test tool 2013-02-27 22:10:14 -05:00
Michal Schmidt
03b717a3c4 core/manager: print status messages about running jobs
Sometimes the boot gets stuck until a timeout hits. The usual timeouts
are on the order of minutes, so users may lose patience.

Print animated status messages telling the names of units with running
jobs to make it easy to see what systemd is waiting for.

The animation looks cooler with a shorter interval, but 1 s is OK and
should not be too hard on slow serial console users.
2013-02-28 02:24:02 +01:00
Michal Schmidt
21baf21ae5 util: split resolving of /dev/console into a new function 2013-02-28 02:23:53 +01:00