mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-21 07:26:29 -05:00
Compare commits
No commits in common. "master" and "v15.0" have entirely different histories.
12 changed files with 173 additions and 347 deletions
14
.github/workflows/build.yml
vendored
14
.github/workflows/build.yml
vendored
|
|
@ -20,16 +20,16 @@ jobs:
|
|||
- run: make all -j$(sysctl -n hw.ncpu)
|
||||
- run: make dist check
|
||||
build-linux:
|
||||
runs-on: ubuntu-26.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
linux-main-modules-zfs-$(uname -r) \
|
||||
linux-modules-extra-$(uname -r) \
|
||||
zfsutils-linux
|
||||
sudo modprobe zfs
|
||||
sudo zfs version
|
||||
zfs version
|
||||
- run: autoreconf -i
|
||||
- run: ./configure --enable-warning-as-error
|
||||
- run: make all -j$(nproc)
|
||||
|
|
@ -90,12 +90,12 @@ jobs:
|
|||
with:
|
||||
usesh: true
|
||||
prepare: |
|
||||
pkg install -y autoconf automake
|
||||
pkg install -y autoconf automake gmake
|
||||
run: |
|
||||
autoreconf -i
|
||||
./configure --enable-warning-as-error
|
||||
make all -j$(sysctl -n hw.ncpu)
|
||||
make dist check
|
||||
./configure --enable-warning-as-error MAKE=gmake
|
||||
gmake all -j$(sysctl -n hw.ncpu)
|
||||
gmake dist check
|
||||
build-musl:
|
||||
runs-on: ubuntu-latest
|
||||
container: alpine:latest
|
||||
|
|
|
|||
28
CHECKSUMS
28
CHECKSUMS
|
|
@ -221,24 +221,12 @@ e11c452e2adec376e6fcaee9ff2ec4de4e943c35690229c9c67056c5eaed52a1 snapraid-14.9-
|
|||
6e8892175bfe240ae7828d513342180a249511a2d5baf8c003ae8b2bb82e0f46 snapraid-14.10-windows-x64.zip
|
||||
1ec0572359fb31f2827702d792db0bdf6a95161eb9e2a6deff2bdc7e1f5b794b snapraid-14.10-windows-x86.zip
|
||||
6930d629c73b5307ec32277310ed13887b1bd051e30dc41c75b4752040032d1c snapraid-14.10-x86_64-1_am.txz
|
||||
ceba44e15566386d923d6895ecab81f7437848b03a4cf9585c02d3636197ce19 snapraid-15.0.tar.gz
|
||||
9d55d0308ce41beb29956b59f9d2e32d419c930118266d3e08b15f658119f4fb snapraid-15.0-1-x86_64.pkg.tar.zst
|
||||
ad66c0b4c016775c9a759adf2a5202bebb357d319b0063b9cf68befde9a67363 snapraid-15.0-1.x86_64.rpm
|
||||
704706c21b432719c4da8cd237c1f26327af89c86604dc339a38d63574004a22 snapraid-15.0-windows-x64.zip
|
||||
58b3ed90307e41b7a6e862d2dc070204c98b5c3ac24718e2fb9fe03e275bc2ce snapraid-15.0-windows-x86.zip
|
||||
9483df5a39a8b59c32433331ac92a4eef54dcff4722694a5bc5e89bcefb6b3b0 snapraid-15.0-x86_64-1_am.txz
|
||||
fb2d6a9cf9c8ea30c6962f4a48764dc9012fe61d6e23f40a8d959dadea02278b snapraid-15.1.tar.gz
|
||||
5e627e08caa8d7647fd40e5288b8d59846d1f3d65d586bae74a57cd99a23f497 snapraid-15.1-1-x86_64.pkg.tar.zst
|
||||
8922234dd566c876b17cbaadad6a22690d05240250455e504513906d933e16dd snapraid-15.1-1.x86_64.rpm
|
||||
64849f463986d0d80b948dbb07e9af6402bed230a9cf17dbd1110199aca56486 snapraid-15.1-windows-x64.zip
|
||||
f7be230f7849d89941a280dc8c2cc6e158844e0fe6f00adbb6aa9ac0f65322b8 snapraid-15.1-windows-x86.zip
|
||||
4dbd01ab2582a74fab4d7ee8f9b11966d4188fba9eedcd31fcc0a5588cd0c702 snapraid-15.1-x86_64-1_am.txz
|
||||
0740169f66c506c29846a5aef57d2b11ffe5c354c5bb0ba260f2b5f328f985c5 snapraid-15.2.tar.gz
|
||||
208a5d99c94889e2357f0211d716bababcfb8289907167220563f734fb936e96 snapraid-15.2-1-x86_64.pkg.tar.zst
|
||||
f1c37fa43beea8445858520a5cd514198d8c0c0ac5a5ab588adcd02e872ee681 snapraid-15.2-1.x86_64.rpm
|
||||
882334e5102b418ace0753f9335a99783fc784e149429c29911247b56f04e438 snapraid-15.2-windows-x64.zip
|
||||
942157645a532e2a280ca404625476c42591436f2292491b1faedb9d48efd07e snapraid-15.2-windows-x86.zip
|
||||
7bb455cb77586dd2d90f6868c66dd9cdf6774aa89c099f1026a851407ac7adac snapraid-15.2-x86_64-1_am.txz
|
||||
1e15cc11b26b02fbb54a679c0379161bf3c94aadfaf29081d876990d809a43f9 snapraid-15.0rc2.tar.gz
|
||||
a546944800a5001c3960715b97ba73cae219c854da1bb55dca16ce70fe06c6d6 snapraid-15.0rc2-1-x86_64.pkg.tar.zst
|
||||
1327c122a66f91e7780e77431a318907661e690a4aca7fa78f9d504e8dde9e06 snapraid-15.0rc2-1.x86_64.rpm
|
||||
092d1e91915e7644288805d1a91bd6f20ee0591d70157f5bb5980e26eaf82c1a snapraid-15.0rc2-windows-x64.zip
|
||||
2c010c4ea69f39d28f266d978d78e0b2c3a845ab47f847cb5a305fc242994691 snapraid-15.0rc2-windows-x86.zip
|
||||
7ada0dd95bad90895c3faaf627f99da02a4e31ac948d05f012efd2ab05a37d97 snapraid-15.0rc2-x86_64-1_am.txz
|
||||
128b5b0f80a6a0911e77ed3b5d9d81529f5ea1d8fffbb5112e3af3467d80464a snapraid_14.0-1_amd64.deb
|
||||
b9c41ae2e8edbc413abd3172b7ed2da2cba7fa0e631d0f47fc1dafccf7c6e92c snapraid_14.1-1_amd64.deb
|
||||
e6456b926bb053d34645e31e5e3d8363e952c9869e873eb348abb1149598d331 snapraid_14.2-1_amd64.deb
|
||||
|
|
@ -250,6 +238,4 @@ b71b556da4be6263a904fb8ac489933875467adbb920dd3911e54d87e9637ca3 snapraid_14.6-
|
|||
c0e00a25b9bce40ff74f5a55401c3bfedac1881fd99aaa90a692f5858d417f7d snapraid_14.8-1_amd64.deb
|
||||
09064689a64d965ac33ee89fb8b2cc14dfec0745f2b3b86a78f377fc353b7e07 snapraid_14.9-1_amd64.deb
|
||||
15f5fd9f639912c94daae9d75d3567b7a3fc0e18475880f972acd8d8e9e0992c snapraid_14.10-1_amd64.deb
|
||||
845091e7eeb2495fc3899dc6e8fab2c3fe7a5945f345c767a7603dab90e2cb84 snapraid_15.0-1_amd64.deb
|
||||
974cd45fc8f44d5642b49bd9b30e81aca2bcd7689877f9fa73d1e58d3f1b5bda snapraid_15.1-1_amd64.deb
|
||||
9c78f158347cc0340ed5c9877724bb4f3b5e5fb48b43332ee7e0e7b6a63642d9 snapraid_15.2-1_amd64.deb
|
||||
fc875789267ec9b057d14780f04362cc32b3cb4191e707d6e0390f05ff346d46 snapraid_15.0rc2-1_amd64.deb
|
||||
|
|
|
|||
32
HISTORY
32
HISTORY
|
|
@ -1,36 +1,8 @@
|
|||
SnapRAID HISTORY
|
||||
================
|
||||
|
||||
15.2 2026/11
|
||||
============
|
||||
* Avoid creating a redundant Windows Job Object when SnapRAID is
|
||||
already running inside an existing job (such as under SnapRAID
|
||||
Daemon). This prevents potential execution failures of child
|
||||
processes (such as smartctl) on systems where nested job objects are
|
||||
not supported.
|
||||
* Skip disks on network or virtual filesystems (such as NFS, CIFS,
|
||||
FUSE, or tmpfs) in device operations like 'up', 'down', 'smart',
|
||||
and 'probe' on Linux, instead of failing with an error. If no
|
||||
physical device remains, the operation completes successfully with
|
||||
an informational message.
|
||||
|
||||
15.1 2026/10
|
||||
============
|
||||
* Add synthetic device IDs on Linux, allowing SnapRAID Daemon to
|
||||
preserve history for devices without unique hardware IDs while
|
||||
they remain connected within the same boot.
|
||||
* Fix a failed internal inconsistency check when '--gui-touch-before'
|
||||
is used before the first sync when no content file exists yet.
|
||||
Also ensure that commands that can save the content file ('touch',
|
||||
'scrub', 'rehash', 'rewrite') fail with a clear error message if the
|
||||
array has not been synced yet. This fix is required by
|
||||
SnapRAID-Daemon.
|
||||
* Make test and doc variables in Makefile.am compatible with BSD make,
|
||||
allowing builds, tests, and documentation generation on BSD systems
|
||||
without requiring GNU make.
|
||||
|
||||
15.0 2026/10
|
||||
============
|
||||
15.0 (Work in Progress)
|
||||
=======================
|
||||
* Added support for automated filesystem snapshots to ensure data
|
||||
consistency and improve recovery reliability.
|
||||
When the 'snapshot' option is enabled, SnapRAID transparently manages
|
||||
|
|
|
|||
32
Makefile.am
32
Makefile.am
|
|
@ -228,28 +228,13 @@ dist-hook:
|
|||
|
||||
LANG_CODES = de es fr it ja ko pl pt ro ru sv uk zh
|
||||
|
||||
LIST_LANG_D = \
|
||||
doc/snapraid-de.d \
|
||||
doc/snapraid-es.d \
|
||||
doc/snapraid-fr.d \
|
||||
doc/snapraid-it.d \
|
||||
doc/snapraid-ja.d \
|
||||
doc/snapraid-ko.d \
|
||||
doc/snapraid-pl.d \
|
||||
doc/snapraid-pt.d \
|
||||
doc/snapraid-ro.d \
|
||||
doc/snapraid-ru.d \
|
||||
doc/snapraid-sv.d \
|
||||
doc/snapraid-uk.d \
|
||||
doc/snapraid-zh.d
|
||||
LIST_D = doc/snapraid.d doc/snapraid_log.d $(patsubst %, doc/snapraid-%.d, $(LANG_CODES))
|
||||
|
||||
LIST_D = doc/snapraid.d doc/snapraid_log.d $(LIST_LANG_D)
|
||||
LIST_MAN = doc/snapraid.1 doc/snapraid_log.1 $(patsubst %, doc/snapraid-%.1, $(LANG_CODES))
|
||||
|
||||
LIST_MAN = $(LIST_D:.d=.1)
|
||||
LIST_TXT = doc/snapraid.txt doc/snapraid_log.txt $(patsubst %, doc/snapraid-%.txt, $(LANG_CODES))
|
||||
|
||||
LIST_TXT = $(LIST_D:.d=.txt)
|
||||
|
||||
LIST_XML = $(LIST_D:.d=.xml)
|
||||
LIST_XML = doc/snapraid.xml doc/snapraid_log.xml $(patsubst %, doc/snapraid-%.xml, $(LANG_CODES))
|
||||
|
||||
EXTRA_DIST = \
|
||||
autogen.sh autover.sh valgrind.supp \
|
||||
|
|
@ -400,13 +385,8 @@ else # HAVE_POSIX
|
|||
CHECKCOUNT_DEFAULT = 500
|
||||
endif # HAVE_POSIX
|
||||
|
||||
CHECKCOUNT_0 = $(CHECKCOUNT_DEFAULT)
|
||||
CHECKCOUNT_1 = 500
|
||||
CHECKCOUNT = $(CHECKCOUNT_$(SHORTCHECK))
|
||||
|
||||
CHECKSIZE_0 = 4000
|
||||
CHECKSIZE_1 = 100
|
||||
CHECKSIZE = $(CHECKSIZE_$(SHORTCHECK))
|
||||
CHECKCOUNT = $(if $(filter 1,$(SHORTCHECK)),500,$(CHECKCOUNT_DEFAULT))
|
||||
CHECKSIZE = $(if $(filter 1,$(SHORTCHECK)),100,4000)
|
||||
|
||||
CONF = $(srcdir)/test/test-par6.conf
|
||||
THERMAL = $(srcdir)/test/test-par6-thermal.conf
|
||||
|
|
|
|||
10
TODO
10
TODO
|
|
@ -6,23 +6,19 @@ This is the list of TODO items for SnapRAID.
|
|||
16.x Releases
|
||||
=============
|
||||
|
||||
* Support a `[power_control: off]` tag in `smartctl` options to disable power
|
||||
management (`up` and `down`) on specific disks (e.g. for SAS drives that
|
||||
fail to wake up on write). Emit an attribute tag in probe for snapraid-daemon.
|
||||
|
||||
* Enable MuseAir and disable random seed
|
||||
* Use statx() instead of lstat() when scanning directories.
|
||||
|
||||
* Add a new 'restore' command, similar to 'fix', that recovers a whole disk
|
||||
using the same multithreaded approach as sync/scrub.
|
||||
|
||||
* Use statx() instead of lstat() when scanning directories.
|
||||
|
||||
* Integration with MergerFS ?
|
||||
|
||||
* Restore ownership and permissions, at least in Unix.
|
||||
|
||||
* Restore directory timestamps.
|
||||
|
||||
* Enable MuseAir and disable random seed
|
||||
|
||||
* Check Reliability Test. We can derive Failure probability from MBTF
|
||||
https://github.com/linuxhw/SMART
|
||||
https://github.com/linuxhw/EnterpriseDrive
|
||||
|
|
|
|||
|
|
@ -1237,16 +1237,13 @@ int state_device_force(struct snapraid_state* state, int operation, tommy_list*
|
|||
}
|
||||
}
|
||||
|
||||
/* distinguish skipped devices from unsupported device queries */
|
||||
if (ret == 0 && tommy_list_empty(&low)) {
|
||||
ret = -1;
|
||||
if (tommy_list_empty(&high)) {
|
||||
ret = -1;
|
||||
log_error(ESOFT, "No accessible devices selected for this operation.\n");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* not an error, the selected disks are on network or virtual filesystems without a block device to manage */
|
||||
msg_info("No physical devices found for the selected disks, nothing to do.\n");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (ret != 0) {
|
||||
|
|
|
|||
|
|
@ -1530,8 +1530,7 @@ int snapraid_main(int argc, char* argv[])
|
|||
if (state.opt.force_realloc)
|
||||
state_locate_mark_tail_blocks_for_resync(&state, opt.parity_tail);
|
||||
|
||||
/* skip touch itself until content is loaded and sync has initialized parity sizes */
|
||||
if (opt.gui_touch_before && state_is_write_ready(&state)) {
|
||||
if (opt.gui_touch_before) {
|
||||
ret = state_touch(&state);
|
||||
|
||||
/* save the new state if required */
|
||||
|
|
@ -1628,9 +1627,6 @@ int snapraid_main(int argc, char* argv[])
|
|||
} else if (operation == OPERATION_REHASH) {
|
||||
state_read(&state);
|
||||
|
||||
/* prevent saving content with uninitialized parity split sizes */
|
||||
state_require_write_ready(&state);
|
||||
|
||||
state_rehash(&state);
|
||||
|
||||
/*
|
||||
|
|
@ -1649,9 +1645,6 @@ int snapraid_main(int argc, char* argv[])
|
|||
} else if (operation == OPERATION_SCRUB) {
|
||||
state_read(&state);
|
||||
|
||||
/* prevent saving content with uninitialized parity split sizes */
|
||||
state_require_write_ready(&state);
|
||||
|
||||
/* refresh the size info before the content write */
|
||||
state_refresh(&state);
|
||||
|
||||
|
|
@ -1674,9 +1667,6 @@ int snapraid_main(int argc, char* argv[])
|
|||
} else if (operation == OPERATION_REWRITE) {
|
||||
state_read(&state);
|
||||
|
||||
/* prevent saving content with uninitialized parity split sizes */
|
||||
state_require_write_ready(&state);
|
||||
|
||||
/* intercept signals while operating */
|
||||
os_signal_init(app_signal_handler, app_signal_handler);
|
||||
|
||||
|
|
@ -1692,9 +1682,6 @@ int snapraid_main(int argc, char* argv[])
|
|||
} else if (operation == OPERATION_TOUCH) {
|
||||
state_read(&state);
|
||||
|
||||
/* prevent saving content with uninitialized parity split sizes */
|
||||
state_require_write_ready(&state);
|
||||
|
||||
memory();
|
||||
|
||||
ret = state_touch(&state);
|
||||
|
|
@ -1709,7 +1696,6 @@ int snapraid_main(int argc, char* argv[])
|
|||
*/
|
||||
os_signal_init(app_signal_handler, app_signal_handler);
|
||||
|
||||
/* save the new state if required */
|
||||
if (state.need_write)
|
||||
state_write(&state);
|
||||
} else if (operation == OPERATION_SPINUP) {
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ void state_init(struct snapraid_state* state)
|
|||
state->autosave = 0;
|
||||
state->need_write = 0;
|
||||
state->written = 0;
|
||||
state->checked_read = 0;
|
||||
state->block_size = 256 * KIBI; /* default 256 KiB */
|
||||
state->raid_mode = RAID_MODE_CAUCHY_RAID;
|
||||
state->file_mode = ADVISE_DEFAULT;
|
||||
|
|
@ -5422,37 +5423,9 @@ void state_read(struct snapraid_state* state)
|
|||
log_tag("content_info:read_unixtime:%" PRId64 "\n", (int64_t)st.st_mtime);
|
||||
}
|
||||
log_flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if all configured parity splits have persistent sizes.
|
||||
*/
|
||||
int state_is_write_ready(struct snapraid_state* state)
|
||||
{
|
||||
unsigned l, s;
|
||||
|
||||
for (l = 0; l < state->level; ++l) {
|
||||
for (s = 0; s < state->parity[l].split_mac; ++s) {
|
||||
if (state->parity[l].split_map[s].size == PARITY_SIZE_INVALID)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Require sync to initialize parity sizes before commands that can save content.
|
||||
* Check before modifying timestamps or metadata, as a later write could fail
|
||||
* even if the command has no blocks to process (e.g. a missing content replica).
|
||||
*/
|
||||
void state_require_write_ready(struct snapraid_state* state)
|
||||
{
|
||||
if (!state_is_write_ready(state)) {
|
||||
log_fatal(EUSER, "The array has not been synced yet, or its parity configuration has changed.\n");
|
||||
log_fatal(EUSER, "Run 'snapraid sync' before '%s'.\n", state->command);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/* mark that we read the content file, and it passed all the checks */
|
||||
state->checked_read = 1;
|
||||
}
|
||||
|
||||
struct state_verify_thread_context {
|
||||
|
|
@ -5963,6 +5936,7 @@ void state_write(struct snapraid_state* state)
|
|||
log_flush();
|
||||
|
||||
state->need_write = 0; /* no write needed anymore */
|
||||
state->checked_read = 0; /* what we wrote is not checked in read */
|
||||
state->written = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ struct snapraid_state {
|
|||
uint64_t autosave; /**< Autosave after the specified amount of data. 0 to disable. */
|
||||
int need_write; /**< If the state is changed. */
|
||||
int written; /**< If the state was written at least one time */
|
||||
int checked_read; /**< If the state was read and checked. */
|
||||
uint32_t block_size; /**< Block size in bytes. */
|
||||
unsigned raid_mode; /**< Raid mode to use. RAID_MODE_DEFAULT or RAID_MODE_ALTERNATE. */
|
||||
int file_mode; /**< File access mode. Combination of ADVISE_* flags. */
|
||||
|
|
@ -239,16 +240,6 @@ void state_probe(struct snapraid_state* state);
|
|||
*/
|
||||
void state_read(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Check if all configured parity splits have persistent sizes.
|
||||
*/
|
||||
int state_is_write_ready(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Require initialized parity split sizes before commands that can save content.
|
||||
*/
|
||||
void state_require_write_ready(struct snapraid_state* state);
|
||||
|
||||
/**
|
||||
* Count the number of unsynced parity positions using an event sweep across extents.
|
||||
* Counts positions in [blockmin, blockmax). The caller must ensure that the disk list,
|
||||
|
|
|
|||
|
|
@ -4375,16 +4375,6 @@ int devquery(tommy_list* high, tommy_list* low)
|
|||
struct dev_struct* dev = j->data;
|
||||
uint64_t access_stat;
|
||||
|
||||
/*
|
||||
* Major 0 is an anonymous superblock (NFS, CIFS, FUSE, tmpfs, overlay, ...)
|
||||
* not backed by a block device. Btrfs/Bcachefs/ZFS are already dereferenced
|
||||
* to their member devices, so what remains has no physical disk to manage.
|
||||
*/
|
||||
if (major(dev->device) == 0) {
|
||||
log_tag("device:%s:skip:%u:%u: no block device\n", esc_tag(devinfo->name), major(dev->device), minor(dev->device));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* retrieve access stat for the high level device */
|
||||
if (devstat(dev->device, &access_stat) == 0) {
|
||||
/* cumulate access stat in the first split */
|
||||
|
|
@ -4430,9 +4420,6 @@ int devquery(tommy_list* high, tommy_list* low)
|
|||
#else
|
||||
(void)high;
|
||||
(void)low;
|
||||
|
||||
/* device operations are unsupported in this platform */
|
||||
failed = 1;
|
||||
#endif
|
||||
|
||||
return failed ? -1 : degraded ? 1 : 0;
|
||||
|
|
@ -4460,7 +4447,6 @@ int devmap(void)
|
|||
{
|
||||
#if HAVE_LINUX_DEVICE
|
||||
char path[PATH_MAX];
|
||||
char boot_id[64];
|
||||
DIR* d = opendir("/sys/block");
|
||||
if (!d) {
|
||||
/* LCOV_EXCL_START */
|
||||
|
|
@ -4468,22 +4454,6 @@ int devmap(void)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* optional boot identity: failure must not affect hardware mappings */
|
||||
if (sysattr("/proc/sys/kernel/random/boot_id", boot_id, sizeof(boot_id)) != 0 || strlen(boot_id) != 36) {
|
||||
boot_id[0] = 0;
|
||||
} else {
|
||||
for (unsigned i = 0; i < 36; ++i) {
|
||||
if (i == 8 || i == 13 || i == 18 || i == 23) {
|
||||
if (boot_id[i] == '-')
|
||||
continue;
|
||||
} else if (hexval(boot_id[i]) >= 0) {
|
||||
continue;
|
||||
}
|
||||
boot_id[0] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct dirent* dd;
|
||||
while (1) {
|
||||
char buf[256];
|
||||
|
|
@ -4547,20 +4517,6 @@ int devmap(void)
|
|||
if (sysattr(path, buf, sizeof(buf)) == 0 && buf[0] != 0) {
|
||||
log_tag("map:/dev/%s:%s\n", dd->d_name, esc_tag(buf));
|
||||
}
|
||||
|
||||
/*
|
||||
* This identifies the kernel device instance within one boot, not
|
||||
* persistent hardware across reconnections. Missing attributes are optional.
|
||||
*/
|
||||
if (boot_id[0] != 0) {
|
||||
pathprint(path, sizeof(path), "/sys/block/%s/diskseq", dd->d_name);
|
||||
if (sysattr(path, buf, sizeof(buf)) == 0) {
|
||||
char* end;
|
||||
unsigned long long diskseq = strtonll(buf, &end, 10);
|
||||
if (buf[0] >= '0' && buf[0] <= '9' && diskseq != 0 && end != buf && *end == 0)
|
||||
log_tag("map:/dev/%s:linux-diskseq.%s.%llu\n", esc_tag(dd->d_name), esc_tag(boot_id), diskseq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
|
|
|
|||
144
os/mingw.c
144
os/mingw.c
|
|
@ -1192,8 +1192,8 @@ int windows_fsync(int fd)
|
|||
* So, we use now an extended error reporting.
|
||||
*/
|
||||
windows_errno(error);
|
||||
os_syslog(OS_LVL_ERROR, "unexpected Windows INVALID_HANDLE error in FlushFileBuffers()");
|
||||
os_syslog(OS_LVL_ERROR, "are you using ATA-over-Ethernet? Please report it.");
|
||||
os_syslog(OS_LVL_INFO, "unexpected Windows INVALID_HANDLE error in FlushFileBuffers()");
|
||||
os_syslog(OS_LVL_INFO, "are you using ATA-over-Ethernet? Please report it.");
|
||||
return -1;
|
||||
|
||||
case ERROR_ACCESS_DENIED :
|
||||
|
|
@ -1249,8 +1249,8 @@ static int windows_vsync(const wchar_t* volume)
|
|||
* So, we use now an extended error reporting.
|
||||
*/
|
||||
windows_errno(error);
|
||||
os_syslog(OS_LVL_ERROR, "unexpected Windows INVALID_HANDLE error in FlushFileBuffers()");
|
||||
os_syslog(OS_LVL_ERROR, "are you using ATA-over-Ethernet? Please report it.");
|
||||
os_syslog(OS_LVL_INFO, "unexpected Windows INVALID_HANDLE error in FlushFileBuffers()");
|
||||
os_syslog(OS_LVL_INFO, "are you using ATA-over-Ethernet? Please report it.");
|
||||
return -1;
|
||||
|
||||
case ERROR_ACCESS_DENIED :
|
||||
|
|
@ -3206,14 +3206,14 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
/* create a pipe for the child process's STDOUT */
|
||||
if (!CreatePipe(&stdout_read_handle, &stdout_write_handle, &sa, 0)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to create pipe for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create pipe for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ensure the reading handle to the pipe is not inherited */
|
||||
if (!SetHandleInformation(stdout_read_handle, HANDLE_FLAG_INHERIT, 0)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to set handle information for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to handle information for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(stdout_write_handle);
|
||||
CloseHandle(stdout_read_handle);
|
||||
return -1;
|
||||
|
|
@ -3222,7 +3222,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
out_f = _open_osfhandle((intptr_t)stdout_read_handle, O_RDONLY | O_BINARY);
|
||||
if (out_f == -1) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to open osfhandle for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to open osfhandle for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(stdout_write_handle);
|
||||
CloseHandle(stdout_read_handle);
|
||||
return -1;
|
||||
|
|
@ -3233,7 +3233,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
/* create a pipe for the child process's STDERR */
|
||||
if (!CreatePipe(&stderr_read_handle, &stderr_write_handle, &sa, 0)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to create pipe for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create pipe for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
if (has_out) {
|
||||
CloseHandle(stdout_write_handle);
|
||||
close(out_f);
|
||||
|
|
@ -3244,7 +3244,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
/* ensure the reading handle to the pipe is not inherited */
|
||||
if (!SetHandleInformation(stderr_read_handle, HANDLE_FLAG_INHERIT, 0)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to set handle information for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to handle information for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(stderr_write_handle);
|
||||
CloseHandle(stderr_read_handle);
|
||||
if (has_out) {
|
||||
|
|
@ -3257,7 +3257,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
err_f = _open_osfhandle((intptr_t)stderr_read_handle, O_RDONLY | O_BINARY);
|
||||
if (err_f == -1) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to open osfhandle for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to open osfhandle for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(stderr_write_handle);
|
||||
CloseHandle(stderr_read_handle);
|
||||
if (has_out) {
|
||||
|
|
@ -3272,7 +3272,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
HANDLE nul_handle = CreateFileW(L"NUL", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, OPEN_EXISTING, 0, NULL);
|
||||
if (nul_handle == INVALID_HANDLE_VALUE) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to open NUL for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to open NUL for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
if (has_out) {
|
||||
CloseHandle(stdout_write_handle);
|
||||
close(out_f);
|
||||
|
|
@ -3302,7 +3302,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
}
|
||||
pos = argcat(cmd_buffer, COMMAND_LINE_MAX, pos, conv);
|
||||
if (pos < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "command too long for spawn");
|
||||
os_syslog(OS_LVL_INFO, "command to long for spawn");
|
||||
CloseHandle(nul_handle);
|
||||
if (has_out) {
|
||||
CloseHandle(stdout_write_handle);
|
||||
|
|
@ -3322,7 +3322,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
if (process_startup_init(&startup, nul_handle,
|
||||
has_out ? stdout_write_handle : nul_handle,
|
||||
has_err ? stderr_write_handle : nul_handle) != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to create handle list for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create handle list for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(nul_handle);
|
||||
if (has_out) {
|
||||
CloseHandle(stdout_write_handle);
|
||||
|
|
@ -3374,7 +3374,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
|
||||
/* validate that the requested user is actually a supported Service Account before attempting logon */
|
||||
if (_stricmp(run_as_user, "LocalService") != 0 && _stricmp(run_as_user, "NetworkService") != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "only supported users are LocalService and NetworkService");
|
||||
os_syslog(OS_LVL_INFO, "only supported users are LocalService and NetworkService");
|
||||
pid_unpublish(pid_slot, 0);
|
||||
process_startup_done(&startup);
|
||||
CloseHandle(nul_handle);
|
||||
|
|
@ -3392,7 +3392,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
const wchar_t* wuser = _stricmp(run_as_user, "LocalService") == 0 ? L"LocalService" : L"NetworkService";
|
||||
if (!LogonUserW(wuser, L"NT AUTHORITY", NULL, LOGON32_LOGON_SERVICE, LOGON32_PROVIDER_DEFAULT, &h_token)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to logon user %s, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to logon user %s, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
process_startup_done(&startup);
|
||||
CloseHandle(nul_handle);
|
||||
|
|
@ -3411,7 +3411,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
LPVOID env = NULL;
|
||||
if (!CreateEnvironmentBlock(&env, h_token, FALSE)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to get user %s environment, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to get user %s environment, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
CloseHandle(h_token);
|
||||
process_startup_done(&startup);
|
||||
|
|
@ -3447,7 +3447,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
process_startup_done(&startup);
|
||||
if (!ret) {
|
||||
windows_errno(create_error);
|
||||
os_syslog(OS_LVL_ERROR, "failed to create process '%s' for spawn, errno=%s(%d)", argv[0], strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create process '%s' for spawn, errno=%s(%d)", argv[0], strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
CloseHandle(nul_handle);
|
||||
if (has_out) {
|
||||
|
|
@ -3471,7 +3471,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
if (os_job_handle != 0) {
|
||||
if (!AssignProcessToJobObject(os_job_handle, pi.hProcess)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to assign process to job object, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to assign process to job object, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
CloseHandle(pi.hThread);
|
||||
|
|
@ -3491,7 +3491,7 @@ pid_t os_spawn(char** argv, int* stdout_read_int, int* stderr_read_int, const ch
|
|||
/* resume the primary thread now that the process is assigned to the job object */
|
||||
if (ResumeThread(pi.hThread) == (DWORD)-1) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to resume thread for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to resume thread for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
CloseHandle(pi.hThread);
|
||||
|
|
@ -3696,14 +3696,14 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
/* create pipe for child's STDIN */
|
||||
if (!CreatePipe(&stdin_read_handle, &stdin_write_handle, &sa, 0)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to create pipe for command, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create pipe for command, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ensure the parent's write end is NOT inherited */
|
||||
if (!SetHandleInformation(stdin_write_handle, HANDLE_FLAG_INHERIT, 0)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to set handle information for command, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to handle information for spawn, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(stdin_read_handle);
|
||||
CloseHandle(stdin_write_handle);
|
||||
return -1;
|
||||
|
|
@ -3720,7 +3720,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
NULL);
|
||||
if (nul == INVALID_HANDLE_VALUE) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to create nul device, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create nul device, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(stdin_read_handle);
|
||||
CloseHandle(stdin_write_handle);
|
||||
return -1;
|
||||
|
|
@ -3728,7 +3728,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
if (process_startup_init(&startup, stdin_read_handle, nul, nul) != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to create handle list for command, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create handle list for command, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(stdin_read_handle);
|
||||
CloseHandle(stdin_write_handle);
|
||||
CloseHandle(nul);
|
||||
|
|
@ -3777,7 +3777,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
* Service Account before attempting logon.
|
||||
*/
|
||||
if (_stricmp(run_as_user, "LocalService") != 0 && _stricmp(run_as_user, "NetworkService") != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "only supported users are LocalService and NetworkService");
|
||||
os_syslog(OS_LVL_INFO, "only supported users are LocalService and NetworkService");
|
||||
pid_unpublish(pid_slot, 0);
|
||||
process_startup_done(&startup);
|
||||
CloseHandle(stdin_read_handle);
|
||||
|
|
@ -3789,7 +3789,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
const wchar_t* wuser = _stricmp(run_as_user, "LocalService") == 0 ? L"LocalService" : L"NetworkService";
|
||||
if (!LogonUserW(wuser, L"NT AUTHORITY", NULL, LOGON32_LOGON_SERVICE, LOGON32_PROVIDER_DEFAULT, &h_token)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to logon user %s, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to logon user %s, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
process_startup_done(&startup);
|
||||
CloseHandle(stdin_read_handle);
|
||||
|
|
@ -3804,7 +3804,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
LPVOID env = NULL;
|
||||
if (!CreateEnvironmentBlock(&env, h_token, FALSE)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to get user %s environment, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to get user %s environment, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
process_startup_done(&startup);
|
||||
CloseHandle(stdin_read_handle);
|
||||
|
|
@ -3834,7 +3834,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
process_startup_done(&startup);
|
||||
if (!ret) {
|
||||
windows_errno(create_error);
|
||||
os_syslog(OS_LVL_ERROR, "failed to create process '%s' for command, errno=%s(%d)", command, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create process '%s' for command, errno=%s(%d)", command, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
CloseHandle(stdin_read_handle);
|
||||
CloseHandle(stdin_write_handle);
|
||||
|
|
@ -3852,7 +3852,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
if (os_job_handle != 0) {
|
||||
if (!AssignProcessToJobObject(os_job_handle, pi.hProcess)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to assign command process to job object, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to assign command process to job object, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
CloseHandle(pi.hThread);
|
||||
|
|
@ -3865,7 +3865,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
/* resume the primary thread now that the process is assigned to the job object */
|
||||
if (ResumeThread(pi.hThread) == (DWORD)-1) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to resume thread for command, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to resume thread for command, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
CloseHandle(pi.hThread);
|
||||
|
|
@ -3888,7 +3888,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
if (error == ERROR_BROKEN_PIPE || error == ERROR_NO_DATA)
|
||||
break; /* child closed stdin early */
|
||||
windows_errno(error);
|
||||
os_syslog(OS_LVL_ERROR, "failed to write stdin to command %s, errno=%s(%d)", command, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to write stdin to command %s, errno=%s(%d)", command, strerror(errno), errno);
|
||||
break;
|
||||
}
|
||||
written += count;
|
||||
|
|
@ -3914,7 +3914,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
int64_t execution_time = stop - start;
|
||||
|
||||
if (timed_out) {
|
||||
os_syslog(OS_LVL_ERROR, "command %s timeout after %" PRId64 " seconds", command, execution_time);
|
||||
os_syslog(OS_LVL_INFO, "command %s timeout after %" PRId64 " seconds", command, execution_time);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -3926,16 +3926,16 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
if (exit_code == 0)
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds with success", command, execution_time);
|
||||
else
|
||||
os_syslog(OS_LVL_ERROR, "command %s terminated in %" PRId64 " seconds with exit code %d", command, execution_time, exit_code);
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds with exit code %d", command, execution_time, exit_code);
|
||||
return exit_code;
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
/* child died from a signal */
|
||||
int sig = WTERMSIG(status);
|
||||
os_syslog(OS_LVL_ERROR, "command %s terminated in %" PRId64 " seconds with signal %s(%d)", command, execution_time, os_signal_name(sig), sig);
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds with signal %s(%d)", command, execution_time, os_signal_name(sig), sig);
|
||||
return 128 + sig;
|
||||
} else {
|
||||
/* in Windows it can happen */
|
||||
os_syslog(OS_LVL_ERROR, "command %s terminated in %" PRId64 " seconds for unknown reason, status=0x%08x", command, execution_time, (unsigned)status);
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds for unknown reason, status=0x%08x", command, execution_time, (unsigned)status);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -4094,7 +4094,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
|
||||
/* resolve the script path to prevent symlink attacks */
|
||||
if (!realpath(script_path, resolved_path)) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to resolve script, path=%s, errno=%s(%d)", script_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to resolve script, path=%s, errno=%s(%d)", script_path, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -4120,9 +4120,9 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
pos = scriptcat(cmd_buffer, COMMAND_LINE_MAX, pos, conv);
|
||||
if (pos < 0) {
|
||||
if (errno == EINVAL)
|
||||
os_syslog(OS_LVL_ERROR, "unsupported embedded double quote in script path");
|
||||
os_syslog(OS_LVL_INFO, "unsupported embedded double quote in script path");
|
||||
else
|
||||
os_syslog(OS_LVL_ERROR, "command too long for script");
|
||||
os_syslog(OS_LVL_INFO, "command to long for script");
|
||||
return -1;
|
||||
}
|
||||
for (int i = 1; argv[i]; ++i) {
|
||||
|
|
@ -4131,15 +4131,15 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
pos = scriptcat(cmd_buffer, COMMAND_LINE_MAX, pos, conv);
|
||||
if (pos < 0) {
|
||||
if (errno == EINVAL)
|
||||
os_syslog(OS_LVL_ERROR, "unsupported embedded double quote in script argument");
|
||||
os_syslog(OS_LVL_INFO, "unsupported embedded double quote in script argument");
|
||||
else
|
||||
os_syslog(OS_LVL_ERROR, "command too long for script");
|
||||
os_syslog(OS_LVL_INFO, "command to long for script");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
pos = fixcat(cmd_buffer, COMMAND_LINE_MAX, pos, L" \"");
|
||||
if (pos < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "command too long for script");
|
||||
os_syslog(OS_LVL_INFO, "command to long for script");
|
||||
return -1;
|
||||
}
|
||||
cmd_buffer[pos] = 0;
|
||||
|
|
@ -4167,14 +4167,14 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
base_env = GetEnvironmentStringsW();
|
||||
if (!base_env) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to get environment strings, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to get environment strings, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
return -1;
|
||||
}
|
||||
combined_env = env_combine(base_env, envp);
|
||||
FreeEnvironmentStringsW(base_env);
|
||||
if (!combined_env) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to combine environment strings, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to combine environment strings, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -4205,7 +4205,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
* Service Account before attempting logon.
|
||||
*/
|
||||
if (_stricmp(run_as_user, "LocalService") != 0 && _stricmp(run_as_user, "NetworkService") != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "only supported users are LocalService and NetworkService");
|
||||
os_syslog(OS_LVL_INFO, "only supported users are LocalService and NetworkService");
|
||||
pid_unpublish(pid_slot, 0);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -4213,7 +4213,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
const wchar_t* wuser = _stricmp(run_as_user, "LocalService") == 0 ? L"LocalService" : L"NetworkService";
|
||||
if (!LogonUserW(wuser, L"NT AUTHORITY", NULL, LOGON32_LOGON_SERVICE, LOGON32_PROVIDER_DEFAULT, &h_token)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to logon user %s, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to logon user %s, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -4224,7 +4224,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
LPVOID env = NULL;
|
||||
if (!CreateEnvironmentBlock(&env, h_token, FALSE)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to get user %s environment, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to get user %s environment, errno=%s(%d)", run_as_user, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
CloseHandle(h_token);
|
||||
return -1;
|
||||
|
|
@ -4234,7 +4234,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
if (envp != NULL) {
|
||||
combined_env = env_combine((const WCHAR*)env, envp);
|
||||
if (!combined_env) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to combine environment strings, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to combine environment strings, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
DestroyEnvironmentBlock(env);
|
||||
CloseHandle(h_token);
|
||||
|
|
@ -4261,7 +4261,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
}
|
||||
if (!ret) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to create process '%s' for script, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create process '%s' for script, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -4270,7 +4270,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
if (os_job_handle != 0) {
|
||||
if (!AssignProcessToJobObject(os_job_handle, pi.hProcess)) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to assign script process to job object, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to assign script process to job object, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
CloseHandle(pi.hThread);
|
||||
|
|
@ -4282,7 +4282,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
/* resume the primary thread now that the process is assigned to the job object */
|
||||
if (ResumeThread(pi.hThread) == (DWORD)-1) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_ERROR, "failed to resume thread for script, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to resume thread for script, errno=%s(%d)", strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
TerminateProcess(pi.hProcess, 1);
|
||||
CloseHandle(pi.hThread);
|
||||
|
|
@ -4309,7 +4309,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
int64_t execution_time = stop - start;
|
||||
|
||||
if (timed_out) {
|
||||
os_syslog(OS_LVL_ERROR, "script %s timeout after %" PRId64 " seconds", resolved_path, execution_time);
|
||||
os_syslog(OS_LVL_INFO, "script %s timeout after %" PRId64 " seconds", resolved_path, execution_time);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -4321,16 +4321,16 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
if (exit_code == 0)
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds with success", resolved_path, execution_time);
|
||||
else
|
||||
os_syslog(OS_LVL_ERROR, "script %s terminated in %" PRId64 " seconds with exit code %d", resolved_path, execution_time, exit_code);
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds with exit code %d", resolved_path, execution_time, exit_code);
|
||||
return exit_code;
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
/* child died from a signal */
|
||||
int sig = WTERMSIG(status);
|
||||
os_syslog(OS_LVL_ERROR, "script %s terminated in %" PRId64 " seconds with signal %s(%d)", resolved_path, execution_time, os_signal_name(sig), sig);
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds with signal %s(%d)", resolved_path, execution_time, os_signal_name(sig), sig);
|
||||
return 128 + sig;
|
||||
} else {
|
||||
/* in Windows it can happen */
|
||||
os_syslog(OS_LVL_ERROR, "script %s terminated in %" PRId64 " seconds for unknown reason, status=0x%08x", resolved_path, execution_time, (unsigned)status);
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds for unknown reason, status=0x%08x", resolved_path, execution_time, (unsigned)status);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -4661,33 +4661,21 @@ void os_init(unsigned opt)
|
|||
os_exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip creating a separate job object if already running inside one
|
||||
* (e.g. spawned by snapraid-daemon, a service, or Task Scheduler).
|
||||
* Child processes automatically inherit the parent's job object, and
|
||||
* attempting to assign them to a second independent job object would
|
||||
* fail with ERROR_ACCESS_DENIED.
|
||||
*/
|
||||
BOOL in_job = 0;
|
||||
if (IsProcessInJob(GetCurrentProcess(), 0, &in_job) && in_job) {
|
||||
os_job_handle = 0;
|
||||
} else {
|
||||
/* initialize job object to terminate child processes if daemon dies */
|
||||
os_job_handle = CreateJobObjectW(0, 0);
|
||||
if (os_job_handle != 0) {
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info;
|
||||
ZeroMemory(&info, sizeof(info));
|
||||
info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||
if (!SetInformationJobObject(os_job_handle, JobObjectExtendedLimitInformation, &info, sizeof(info))) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_WARNING, "failed to configure job object, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(os_job_handle);
|
||||
os_job_handle = 0;
|
||||
}
|
||||
} else {
|
||||
/* initialize job object to terminate child processes if daemon dies */
|
||||
os_job_handle = CreateJobObjectW(0, 0);
|
||||
if (os_job_handle != 0) {
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info;
|
||||
ZeroMemory(&info, sizeof(info));
|
||||
info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||
if (!SetInformationJobObject(os_job_handle, JobObjectExtendedLimitInformation, &info, sizeof(info))) {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_WARNING, "failed to create job object, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_WARNING, "failed to configure job object, errno=%s(%d)", strerror(errno), errno);
|
||||
CloseHandle(os_job_handle);
|
||||
os_job_handle = 0;
|
||||
}
|
||||
} else {
|
||||
windows_errno(GetLastError());
|
||||
os_syslog(OS_LVL_WARNING, "failed to create job object, errno=%s(%d)", strerror(errno), errno);
|
||||
}
|
||||
|
||||
/* check for Wine presence */
|
||||
|
|
|
|||
148
os/unix.c
148
os/unix.c
|
|
@ -461,24 +461,24 @@ static int verify_shebang_interpreter(int fd, const char* script_path)
|
|||
|
||||
bytes_read = pread(fd, shebang, sizeof(shebang) - 1, 0); /* reserve space for the terminating 0 */
|
||||
if (bytes_read < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to read script shebang, path=%s, errno=%s(%d)", script_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to read script shebang, path=%s, errno=%s(%d)", script_path, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
if (bytes_read < 4) {
|
||||
os_syslog(OS_LVL_ERROR, "script %s is too small or missing a shebang", script_path);
|
||||
os_syslog(OS_LVL_INFO, "script %s is too small or missing a shebang", script_path);
|
||||
return -1;
|
||||
}
|
||||
shebang[bytes_read] = 0;
|
||||
|
||||
/* check for shebang */
|
||||
if (shebang[0] != '#' || shebang[1] != '!') {
|
||||
os_syslog(OS_LVL_ERROR, "script %s is missing shebang (#!)", script_path);
|
||||
os_syslog(OS_LVL_INFO, "script %s is missing shebang (#!)", script_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char* end_of_line = strchr(shebang, '\n');
|
||||
if (!end_of_line || end_of_line - shebang > 128) {
|
||||
os_syslog(OS_LVL_ERROR, "script %s has invalid or overlong shebang (#!), exceeds 126 characters", script_path);
|
||||
os_syslog(OS_LVL_INFO, "script %s has invalid or overlong shebang (#!), exceeds 126 characters", script_path);
|
||||
return -1;
|
||||
}
|
||||
*end_of_line = 0;
|
||||
|
|
@ -489,7 +489,7 @@ static int verify_shebang_interpreter(int fd, const char* script_path)
|
|||
++interpreter;
|
||||
|
||||
if (*interpreter == 0) {
|
||||
os_syslog(OS_LVL_ERROR, "script %s has empty shebang", script_path);
|
||||
os_syslog(OS_LVL_INFO, "script %s has empty shebang", script_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -510,49 +510,49 @@ static int verify_shebang_interpreter(int fd, const char* script_path)
|
|||
}
|
||||
|
||||
if (!found) {
|
||||
os_syslog(OS_LVL_ERROR, "script %s uses disallowed interpreter %s", script_path, interpreter);
|
||||
os_syslog(OS_LVL_INFO, "script %s uses disallowed interpreter %s", script_path, interpreter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* verify interpreter exists and is safe */
|
||||
if (stat(interpreter, &st) != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "interpreter %s does not exist, errno=%s(%d)", interpreter, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "interpreter %s does not exist, errno=%s(%d)", interpreter, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* interpreter must be a regular file */
|
||||
if (!S_ISREG(st.st_mode)) {
|
||||
os_syslog(OS_LVL_ERROR, "interpreter %s must be a regular file", interpreter);
|
||||
os_syslog(OS_LVL_INFO, "interpreter %s must be a regular file", interpreter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* interpreter must be owned by root */
|
||||
if (st.st_uid != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "interpreter %s not owned by root", interpreter);
|
||||
os_syslog(OS_LVL_INFO, "interpreter %s not owned by root", interpreter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* interpreter must be not world-writable */
|
||||
if (st.st_mode & S_IWOTH) {
|
||||
os_syslog(OS_LVL_ERROR, "interpreter %s is world-writable", interpreter);
|
||||
os_syslog(OS_LVL_INFO, "interpreter %s is world-writable", interpreter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* interpreter must be not group-writable (unless group is root) */
|
||||
if ((st.st_mode & S_IWGRP) && st.st_gid != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "interpreter %s is group-writable by non-root group", interpreter);
|
||||
os_syslog(OS_LVL_INFO, "interpreter %s is group-writable by non-root group", interpreter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* interpreter must be executable */
|
||||
if (!(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||
os_syslog(OS_LVL_ERROR, "interpreter %s is not executable", interpreter);
|
||||
os_syslog(OS_LVL_INFO, "interpreter %s is not executable", interpreter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* interpreter must be not setuid / setgid */
|
||||
if (st.st_mode & (S_ISUID | S_ISGID)) {
|
||||
os_syslog(OS_LVL_ERROR, "file %s has setuid/setgid bits set", interpreter);
|
||||
os_syslog(OS_LVL_INFO, "file %s has setuid/setgid bits set", interpreter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -595,7 +595,7 @@ static int verify_shebang_interpreter(int fd, const char* script_path)
|
|||
*
|
||||
* Returns an open file descriptor (>= 0) on success. The caller is
|
||||
* responsible for closing it. Returns -1 on any verification failure;
|
||||
* the specific reason is emitted via os_syslog(OS_LVL_ERROR, ...).
|
||||
* the specific reason is emitted via os_syslog(OS_LVL_INFO, ...).
|
||||
*/
|
||||
static int verify_executable(const char* exec_path, char* resolved_path, int is_script)
|
||||
{
|
||||
|
|
@ -610,29 +610,29 @@ static int verify_executable(const char* exec_path, char* resolved_path, int is_
|
|||
|
||||
/* verify path is absolute */
|
||||
if (exec_path[0] != '/') {
|
||||
os_syslog(OS_LVL_ERROR, "path %s must be absolute", exec_path);
|
||||
os_syslog(OS_LVL_INFO, "path %s must be absolute", exec_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* resolve the path to prevent symlink attacks */
|
||||
if (!realpath(exec_path, resolved_path)) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to resolve %s, errno=%s(%d)", exec_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to resolve %s, errno=%s(%d)", exec_path, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char* last_slash = strrchr(resolved_path, '/');
|
||||
if (last_slash == 0) {
|
||||
os_syslog(OS_LVL_ERROR, "relative execution of %s not allowed", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "relative execution of %s not allowed", resolved_path);
|
||||
return -1;
|
||||
}
|
||||
if (last_slash == resolved_path) {
|
||||
os_syslog(OS_LVL_ERROR, "root dir execution of %s not allowed", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "root dir execution of %s not allowed", resolved_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* exec_name = last_slash + 1;
|
||||
if (exec_name[0] == 0) {
|
||||
os_syslog(OS_LVL_ERROR, "no executable name in %s", exec_path);
|
||||
os_syslog(OS_LVL_INFO, "no executable name in %s", exec_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -643,33 +643,33 @@ static int verify_executable(const char* exec_path, char* resolved_path, int is_
|
|||
|
||||
int dir_fd = open(dir_path, O_PATH | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
|
||||
if (dir_fd < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to open directory %s, errno=%s(%d)", dir_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to open directory %s, errno=%s(%d)", dir_path, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fstat(dir_fd, &st) != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to stat directory %s, errno=%s(%d)", dir_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to stat directory %s, errno=%s(%d)", dir_path, strerror(errno), errno);
|
||||
close(dir_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* directory must be owned by root or the daemon's real user */
|
||||
if (st.st_uid != process_uid && st.st_uid != process_euid && st.st_uid != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "directory %s owner must match the daemon owner or be root", dir_path);
|
||||
os_syslog(OS_LVL_INFO, "directory %s owner must match the daemon owner or be root", dir_path);
|
||||
close(dir_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* directory must be not group-writable unless group matches daemon */
|
||||
if ((st.st_mode & S_IWGRP) && st.st_gid != process_gid && st.st_gid != process_egid && st.st_gid != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "directory %s must be not group-writable unless group matches daemon owner or root", dir_path);
|
||||
os_syslog(OS_LVL_INFO, "directory %s must be not group-writable unless group matches daemon owner or root", dir_path);
|
||||
close(dir_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* directory must be not world-writable */
|
||||
if (st.st_mode & S_IWOTH) {
|
||||
os_syslog(OS_LVL_ERROR, "directory %s must be not world-writable", dir_path);
|
||||
os_syslog(OS_LVL_INFO, "directory %s must be not world-writable", dir_path);
|
||||
close(dir_fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -689,7 +689,7 @@ static int verify_executable(const char* exec_path, char* resolved_path, int is_
|
|||
|
||||
int fd = openat(dir_fd, exec_name, flags);
|
||||
if (fd < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to open %s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to open %s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
close(dir_fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -698,14 +698,14 @@ static int verify_executable(const char* exec_path, char* resolved_path, int is_
|
|||
|
||||
/* get the file handle (TOCTOU Protection) */
|
||||
if (fstat(fd, &st) == -1) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to stat %s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to stat %s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ensure it's a regular file */
|
||||
if (!S_ISREG(st.st_mode)) {
|
||||
os_syslog(OS_LVL_ERROR, "file %s is not a regular file", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "file %s is not a regular file", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -714,7 +714,7 @@ static int verify_executable(const char* exec_path, char* resolved_path, int is_
|
|||
if (!is_script) {
|
||||
char magic[2];
|
||||
if (read(fd, magic, 2) == 2 && magic[0] == '#' && magic[1] == '!') {
|
||||
os_syslog(OS_LVL_ERROR, "file %s is a script, which is not supported", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "file %s is a script, which is not supported", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -725,35 +725,35 @@ static int verify_executable(const char* exec_path, char* resolved_path, int is_
|
|||
|
||||
/* ensure it has execute permissions */
|
||||
if (!(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||
os_syslog(OS_LVL_ERROR, "file %s is not an executable", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "file %s is not an executable", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* must be owned by root or the daemon's real user */
|
||||
if (st.st_uid != process_uid && st.st_uid != process_euid && st.st_uid != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "file %s owner must match the daemon owner or be root", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "file %s owner must match the daemon owner or be root", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* must be not group-writable unless group matches daemon */
|
||||
if ((st.st_mode & S_IWGRP) && st.st_gid != process_gid && st.st_gid != process_egid && st.st_gid != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "file %s must be not group-writable unless group matches daemon owner or root", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "file %s must be not group-writable unless group matches daemon owner or root", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* must be not world-writable */
|
||||
if (st.st_mode & S_IWOTH) {
|
||||
os_syslog(OS_LVL_ERROR, "file %s must be not world-writable", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "file %s must be not world-writable", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* must be not setuid / setgid */
|
||||
if (st.st_mode & (S_ISUID | S_ISGID)) {
|
||||
os_syslog(OS_LVL_ERROR, "file %s has setuid/setgid bits set", resolved_path);
|
||||
os_syslog(OS_LVL_INFO, "file %s has setuid/setgid bits set", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -765,13 +765,13 @@ int os_validate_exec_input(const char* str)
|
|||
{
|
||||
/* reject paths trying to go up levels */
|
||||
if (strstr(str, "..") != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "invalid argument %s for execution", str);
|
||||
os_syslog(OS_LVL_INFO, "invalid argument %s for execution", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* reject inputs starting with '-' to prevent Flag Injection */
|
||||
if (str[0] == '-') {
|
||||
os_syslog(OS_LVL_ERROR, "invalid argument %s for execution", str);
|
||||
os_syslog(OS_LVL_INFO, "invalid argument %s for execution", str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -810,7 +810,7 @@ static int os_user_lookup(const char* run_as_user, struct os_user* user)
|
|||
char pw_buf[PASSWD_MAX];
|
||||
int err = getpwnam_r(run_as_user, &pw, pw_buf, sizeof(pw_buf), &pw_res);
|
||||
if (err != 0 || !pw_res) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to get user info for %s, errno=%s(%d)", run_as_user, strerror(err ? err : ENOENT), err ? err : ENOENT);
|
||||
os_syslog(OS_LVL_INFO, "failed to get user info for %s, errno=%s(%d)", run_as_user, strerror(err ? err : ENOENT), err ? err : ENOENT);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -822,7 +822,7 @@ static int os_user_lookup(const char* run_as_user, struct os_user* user)
|
|||
int ngroups = sizeof(groups_buf) / sizeof(groups_buf[0]);
|
||||
|
||||
if (getgrouplist(pw.pw_name, (os_group_t)pw.pw_gid, groups_buf, &ngroups) < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to get group list for %s, exceeds maximum of %d groups", run_as_user, GROUPS_MAX);
|
||||
os_syslog(OS_LVL_INFO, "failed to get group list for %s, exceeds maximum of %d groups", run_as_user, GROUPS_MAX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1198,7 +1198,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to fork script=%s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to fork script=%s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
close(fd);
|
||||
return -1;
|
||||
|
|
@ -1323,7 +1323,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
}
|
||||
|
||||
if (ret == -1) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to wait for script, path=%s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to wait for script, path=%s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1331,7 +1331,7 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
int64_t execution_time = stop - start;
|
||||
|
||||
if (timed_out) {
|
||||
os_syslog(OS_LVL_ERROR, "script %s timeout after %" PRId64 " seconds", resolved_path, execution_time);
|
||||
os_syslog(OS_LVL_INFO, "script %s timeout after %" PRId64 " seconds", resolved_path, execution_time);
|
||||
|
||||
return 128 + SIGALRM;
|
||||
}
|
||||
|
|
@ -1344,17 +1344,17 @@ int os_script(char** argv, char** envp, const char* run_as_user, uint64_t timeou
|
|||
if (exit_code == 0)
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds with success", resolved_path, execution_time);
|
||||
else
|
||||
os_syslog(OS_LVL_ERROR, "script %s terminated in %" PRId64 " seconds with exit code %d", resolved_path, execution_time, exit_code);
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds with exit code %d", resolved_path, execution_time, exit_code);
|
||||
return exit_code;
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
/* child died from a signal */
|
||||
int sig = WTERMSIG(status);
|
||||
|
||||
os_syslog(OS_LVL_ERROR, "script %s terminated in %" PRId64 " seconds with signal %s(%d)", resolved_path, execution_time, os_signal_name(sig), sig);
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds with signal %s(%d)", resolved_path, execution_time, os_signal_name(sig), sig);
|
||||
return 128 + sig;
|
||||
} else {
|
||||
/* in Linux it should never happen */
|
||||
os_syslog(OS_LVL_ERROR, "script %s terminated in %" PRId64 " seconds for unknown reason, status=%d", resolved_path, execution_time, status);
|
||||
os_syslog(OS_LVL_INFO, "script %s terminated in %" PRId64 " seconds for unknown reason, status=%d", resolved_path, execution_time, status);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1373,14 +1373,14 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
/* create pipe only if we have text to send */
|
||||
if (stdin_text != 0) {
|
||||
if (pipe_cloexec(pipe_fds) < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to create input pipe, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to create input pipe, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int flags = fcntl(pipe_fds[1], F_GETFL);
|
||||
|
||||
if (flags < 0 || fcntl(pipe_fds[1], F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to make input pipe non-blocking, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to make input pipe non-blocking, errno=%s(%d)", strerror(errno), errno);
|
||||
close(pipe_fds[0]);
|
||||
close(pipe_fds[1]);
|
||||
return -1;
|
||||
|
|
@ -1411,7 +1411,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to fork command=%s, errno=%s(%d)", command, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to fork command=%s, errno=%s(%d)", command, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
if (pipe_fds[0] != -1) {
|
||||
close(pipe_fds[0]);
|
||||
|
|
@ -1509,7 +1509,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
pid_unpublish(pid_slot, pid);
|
||||
|
||||
if (input_error != 0)
|
||||
os_syslog(OS_LVL_ERROR, "failed to write stdin to command %s, errno=%s(%d)", command, strerror(input_error), input_error);
|
||||
os_syslog(OS_LVL_INFO, "failed to write stdin to command %s, errno=%s(%d)", command, strerror(input_error), input_error);
|
||||
|
||||
if (ret != -1) {
|
||||
do {
|
||||
|
|
@ -1518,7 +1518,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
}
|
||||
|
||||
if (ret == -1) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to wait for command, command=%s, errno=%s(%d)", command, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to wait for command, command=%s, errno=%s(%d)", command, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1526,7 +1526,7 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
int64_t execution_time = stop - start;
|
||||
|
||||
if (timed_out) {
|
||||
os_syslog(OS_LVL_ERROR, "command %s timeout after %" PRId64 " seconds", command, execution_time);
|
||||
os_syslog(OS_LVL_INFO, "command %s timeout after %" PRId64 " seconds", command, execution_time);
|
||||
return 128 + SIGALRM;
|
||||
}
|
||||
|
||||
|
|
@ -1538,16 +1538,16 @@ int os_command(const char* command, const char* run_as_user, const char* stdin_t
|
|||
if (exit_code == 0)
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds with success", command, execution_time);
|
||||
else
|
||||
os_syslog(OS_LVL_ERROR, "command %s terminated in %" PRId64 " seconds with exit code %d", command, execution_time, exit_code);
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds with exit code %d", command, execution_time, exit_code);
|
||||
return exit_code;
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
/* child died from a signal */
|
||||
int sig = WTERMSIG(status);
|
||||
os_syslog(OS_LVL_ERROR, "command %s terminated in %" PRId64 " seconds with signal %s(%d)", command, execution_time, os_signal_name(sig), sig);
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds with signal %s(%d)", command, execution_time, os_signal_name(sig), sig);
|
||||
return 128 + sig;
|
||||
} else {
|
||||
/* in Linux it should never happen */
|
||||
os_syslog(OS_LVL_ERROR, "command %s terminated in %" PRId64 " seconds for unknown reason, status=%d", command, execution_time, status);
|
||||
os_syslog(OS_LVL_INFO, "command %s terminated in %" PRId64 " seconds for unknown reason, status=%d", command, execution_time, status);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1584,7 +1584,7 @@ pid_t os_spawn(char** argv, int* stdout_read_fd, int* stderr_read_fd, const char
|
|||
|
||||
if (has_out) {
|
||||
if (pipe_cloexec(out_pipe) < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to open output pipe, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to open output pipe, errno=%s(%d)", strerror(errno), errno);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1592,7 +1592,7 @@ pid_t os_spawn(char** argv, int* stdout_read_fd, int* stderr_read_fd, const char
|
|||
|
||||
if (has_err) {
|
||||
if (pipe_cloexec(err_pipe) < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to open error pipe, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to open error pipe, errno=%s(%d)", strerror(errno), errno);
|
||||
if (has_out) {
|
||||
close(out_pipe[0]);
|
||||
close(out_pipe[1]);
|
||||
|
|
@ -1634,7 +1634,7 @@ pid_t os_spawn(char** argv, int* stdout_read_fd, int* stderr_read_fd, const char
|
|||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to fork path=%s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to fork path=%s, errno=%s(%d)", resolved_path, strerror(errno), errno);
|
||||
pid_unpublish(pid_slot, 0);
|
||||
if (has_out) {
|
||||
close(out_pipe[0]);
|
||||
|
|
@ -1819,7 +1819,7 @@ pid_t os_wait(pid_t pid, int* status, pid_t* pid_slot)
|
|||
} while (ret == -1 && errno == EINTR);
|
||||
|
||||
if (ret == -1) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to wait, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to wait, errno=%s(%d)", strerror(errno), errno);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -1996,7 +1996,7 @@ int os_privileges_drop(void)
|
|||
/* find the unprivileged user "nobody" */
|
||||
struct passwd* pw = getpwnam("nobody");
|
||||
if (!pw) {
|
||||
os_syslog(OS_LVL_ERROR, "unprivileged user 'nobody' not found");
|
||||
os_syslog(OS_LVL_INFO, "unprivileged user 'nobody' not found");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -2010,7 +2010,7 @@ int os_privileges_drop(void)
|
|||
*/
|
||||
privileged_group_count = getgroups(0, 0);
|
||||
if (privileged_group_count < 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to get supplementary group count, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to get supplementary group count, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -2022,12 +2022,12 @@ int os_privileges_drop(void)
|
|||
}
|
||||
|
||||
if (getgroups(privileged_group_count, privileged_groups) != privileged_group_count) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to get supplementary groups, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to get supplementary groups, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setgroups(0, 0) != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -2035,14 +2035,14 @@ int os_privileges_drop(void)
|
|||
}
|
||||
|
||||
if (setegid(unpriv_gid) != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
gid_dropped = 1;
|
||||
|
||||
if (seteuid(unpriv_uid) != 0) {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -2072,7 +2072,7 @@ void os_privileges_acquire(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to acquire privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to acquire privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2083,7 +2083,7 @@ void os_privileges_acquire(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to acquire group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to acquire group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2094,7 +2094,7 @@ void os_privileges_acquire(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to acquire supplementary group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to acquire supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2105,7 +2105,7 @@ void os_privileges_acquire(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to acquire privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to acquire privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2116,7 +2116,7 @@ void os_privileges_acquire(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to acquire group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to acquire group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2127,7 +2127,7 @@ void os_privileges_acquire(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to acquire supplementary group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to acquire supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to acquire supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2147,7 +2147,7 @@ void os_privileges_release(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to release supplementary group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2158,7 +2158,7 @@ void os_privileges_release(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to release group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2170,7 +2170,7 @@ void os_privileges_release(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to release privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2181,7 +2181,7 @@ void os_privileges_release(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to release supplementary group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release supplementary group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2192,7 +2192,7 @@ void os_privileges_release(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to release group privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release group privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -2204,7 +2204,7 @@ void os_privileges_release(void)
|
|||
if (errno == EPERM) {
|
||||
os_syslog(OS_LVL_INFO, "permission denied to release privileges, continuing with active privileges");
|
||||
} else {
|
||||
os_syslog(OS_LVL_ERROR, "failed to release privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_syslog(OS_LVL_INFO, "failed to release privileges, errno=%s(%d)", strerror(errno), errno);
|
||||
os_abort();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue