Age | Commit message (Collapse) | Author |
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
since openrc-pam now sets XDG_RUNTIME_DIR in case it's unset, we can
expect it to exist.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
creates all the directories in a give path. only the last directory in
the path return -1 to EEXIST. any other error is always returned.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
this simplifies the allocation of path string. also fixes some memory
leaks from the ealier commit
also changes the log path for users to XDG_CACHE_HOME, default
~/.cache/openrc
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Also add ~/.local/share/openrc for data files (like logs)
This is done to help avoid name conflictions for anything else that
might create/user files in .config/
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Using ${HOME} works when the user runs any librc program from the shell,
but trying to invoke them from pam or similar, the variable is not set.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Modifies many functions where filesystem paths were hardcoded. In
non-user-services mode, they still are. In user-services mode, they are
allocated, since XDG_ dirs are to be set via environment variables.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
Those functions allocates and set up the environment for user services.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
This conflicts with linux-headers which uses __unused for some padding members
on ppc64le at least.
Closes: https://github.com/OpenRC/openrc/issues/622
|
|
|
|
From scan-build w/ clang-16.0.0_pre20230107:
```
../src/librc/librc.c:759:14: warning: Potential leak of memory pointed to by 'init' [unix.Malloc]
return false;
^~~~~
```
|
|
|
|
Both 'pkg' and 'local' are referenced within list,
so we can't free them yet.
Signed-off-by: Sam James <sam@gentoo.org>
|
|
'services' is still referenced by the list
which gets returned. We can't free it.
Thanks to GCC 11's -fanalyzer.
Signed-off-by: Sam James <sam@gentoo.org>
|
|
Signed-off-by: Sam James <sam@gentoo.org>
|
|
Seen on running rc-status.
```
=================================================================
==14636==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 72 byte(s) in 3 object(s) allocated from:
#0 0x7f443412dcb7 in __interceptor_malloc /usr/src/debug/sys-devel/gcc-11.2.1_p20220312/gcc-11-20220312/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7f443400c727 in xmalloc ../src/includes/helpers.h:64
#2 0x7f443400d1f4 in rc_stringlist_add ../src/librc/librc-stringlist.c:32
#3 0x7f4433fecc34 in get_runlevel_chain ../src/librc/librc.c:390
#4 0x7f4433fedc00 in rc_runlevel_stacks ../src/librc/librc.c:519
#5 0x7f4433ff1d8e in rc_services_in_runlevel_stacked ../src/librc/librc.c:976
#6 0x55be0e8f9517 in main ../src/rc/rc-status.c:407
#7 0x7f44334736cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
```
Signed-off-by: Sam James <sam@gentoo.org>
|
|
There are no semantic changes in this commit.
Suggested-by: Mike Frysinger <vapier@gentoo.org>
See: https://github.com/OpenRC/openrc/pull/435#pullrequestreview-727035394
|
|
This makes the URIs shorter and dynamic: whatever the default branch
the repo uses will be used.
|
|
The existing copyright notices in the file headers cover these vars.
|
|
This function should return false if the runlevel is an empty string.
X-Gentoo-Bug: 803536
X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536
Closes: https://github.com/OpenRC/openrc/pull/431
|
|
This fixes #313.
|
|
I am removing this on the advice of a member of the Gentoo toolchain
team. It was explained to me that this doesn't offer any significant
benefits to OpenRC.
If anyone ffeels differently, please open a pull request reverting
this and adding an explanation of what it does and how to know which
functions to mark hidden in the future.
This fixes #301.
|
|
This fixes #226.
|
|
readlink(3) does not nul-terminate the result it sticks
into the supplied buffer. Consequently, the code
rc = readlink(path, buf, sizeof(buf));
does not necessarily produce a C string.
The code in rc_find_pid() produces some C strings this way
and passes them to strlen() and strcmp(), which can lead
to an out-of-bounds read.
In this case, since the code already takes care to
zero-initialize the buffers before passing them
to readlink(3), only allow sizeof(buf)-1 bytes to
be returned.
(While fixing this issue, I fixed two other locations that
used the same problematic pattern.)
This fixes #270.
|
|
Use errno != EACCES to fix false-positive for non-root users
with grsecurity kernels.
Fixes: 37e29442721a ("librc: Add check for crashed state")
This fixes #237
|
|
In rc_service_state,, call rc_service_daemons_crashed to check for
a crashed daemon if the service is started.
|
|
|
|
This allows the equivalent of "unsetting" a value for a service.
|
|
X-Gentoo-Bug: 604666
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604666
|
|
This fixes #109.
X-Gentoo-Bug: 558700
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=558700
|
|
The original auto detection of Docker containers assumed the presence of
a container environment variable. However, Docker-1.12 does not
implement this, and I'm not sure which versions of docker implemented
it.
The new test is for the presence of a file named .dockerenv in the
root directory.
|
|
This probably isn't needed, but it mimics old behavior.
|
|
|
|
This fixes an issue where librc code was calling code that only existed
in the rc binary.
This reverts commits 8addd79 and 9f6e056
This fixes #75.
|
|
In the past, OpenRC was a hybrid of a centralized and file-scope
license/copyright structure.
I followed the instructions from the Software Freedom Law Center [1] to
convert to a Centralized structure where possible, for easier future
maintenance.
[1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
|
|
|
|
|
|
These functions were never meant to be used outside of OpenRC, and they
were added when we thought we were going to do away with the automatic
detection of subsystems. Since the autodetection is not going away, we
can combine these functions into rc_sys.
|
|
If a service has the same name as the runlevel it is in, openrc will
crash on changing to such runlevel. It goes in a recursive madness and
eventually gets a SEGV while in snprintf (don't know why).
This fixes two errors:
1. ls_dir stats files not with full path -> stat always returns != 0
2. ls_dir adds files to list if stat failed
This fixes #53.
X-Gentoo-Bug: 537304
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=537304
|
|
This adds support for running OpenRC in a container created by
the systemd-nspawn utility.
This fixes #52.
X-Gentoo-Bug: 548058
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548058
|
|
We are bundling this to allow building on musl-based systems since musl
does not include <sys/queue.h>.
|
|
The rc_runlevel_exists function was attempting to treat "." and ".." as
valid runlevels; however, this should not be allowed.
X-Gentoo-Bug: 488710
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=488710
|
|
We should first check if we are within bounds and then read rather than
the opposite.
This makes valgrind happy.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
Patch was provided by Max Hacking <max.gentoo.bugzilla@hacking.co.uk>
and slightly fixed by Alexander Vershilov <qnikst@gentoo.org> and
William Hubbs <williamh@gentoo.org>.
Fixes:
1). Rebase to newest OpenRC version.
2). Remove code style fixes. Port to currect code style.
3). Fix rc_runlevel_stack instead of introducing new function.
4). Make get_runlevel_chain a private function.
X-Gentoo-Bug: 467368
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=467368
|
|
The /proc/1/environ contains various \0 terminated strings. The current
code will only work when the search string is in the first of those.
To fix this we look for strings in entire buffer.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
We now have a team member who is interested in OpenRC on prefix, so I am
bringing it back to the main tree.
|