Compare commits

..

No commits in common. "master" and "v15.1" have entirely different histories.

49 changed files with 206 additions and 326 deletions

View file

@ -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-24.04
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)

View file

@ -222,23 +222,17 @@ e11c452e2adec376e6fcaee9ff2ec4de4e943c35690229c9c67056c5eaed52a1 snapraid-14.9-
1ec0572359fb31f2827702d792db0bdf6a95161eb9e2a6deff2bdc7e1f5b794b snapraid-14.10-windows-x86.zip
6930d629c73b5307ec32277310ed13887b1bd051e30dc41c75b4752040032d1c snapraid-14.10-x86_64-1_am.txz
ceba44e15566386d923d6895ecab81f7437848b03a4cf9585c02d3636197ce19 snapraid-15.0.tar.gz
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
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
128b5b0f80a6a0911e77ed3b5d9d81529f5ea1d8fffbb5112e3af3467d80464a snapraid_14.0-1_amd64.deb
b9c41ae2e8edbc413abd3172b7ed2da2cba7fa0e631d0f47fc1dafccf7c6e92c snapraid_14.1-1_amd64.deb
e6456b926bb053d34645e31e5e3d8363e952c9869e873eb348abb1149598d331 snapraid_14.2-1_amd64.deb
@ -250,6 +244,5 @@ 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
fc875789267ec9b057d14780f04362cc32b3cb4191e707d6e0390f05ff346d46 snapraid_15.0rc2-1_amd64.deb
845091e7eeb2495fc3899dc6e8fab2c3fe7a5945f345c767a7603dab90e2cb84 snapraid_15.0-1_amd64.deb
974cd45fc8f44d5642b49bd9b30e81aca2bcd7689877f9fa73d1e58d3f1b5bda snapraid_15.1-1_amd64.deb
9c78f158347cc0340ed5c9877724bb4f3b5e5fb48b43332ee7e0e7b6a63642d9 snapraid_15.2-1_amd64.deb

13
HISTORY
View file

@ -1,19 +1,6 @@
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

View file

@ -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) {

View file

@ -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;

View file

@ -583,10 +583,8 @@ verloren!
.PP
KEINE PANIK! Sie werden in der Lage sein, sie wiederherzustellen!
.PP
Bevor Sie irgendetwas anderes tun, vermeiden Sie jegliche Änderungen an Ihrem
Festplatten\-Array, da das Ändern oder Löschen von Daten auf den verbleibenden
Festplatten eine Wiederherstellung unmöglich machen kann.
Deaktivieren Sie alle Remote\-Verbindungen
Das erste, was Sie tun müssen, ist, weitere Änderungen an Ihrem
Festplatten\-Array zu vermeiden. Deaktivieren Sie alle Remote\-Verbindungen
dazu und alle geplanten Prozesse, einschließlich geplanter SnapRAID\-nächtlicher
\`sync\`\- oder \`scrub\`\-Läufe.
.PP

View file

@ -334,10 +334,8 @@ Erste Schritte (Getting Started)
KEINE PANIK! Sie werden in der Lage sein, sie wiederherzustellen!
Bevor Sie irgendetwas anderes tun, vermeiden Sie jegliche Änderungen an Ihrem
Festplatten-Array, da das Ändern oder Löschen von Daten auf den verbleibenden
Festplatten eine Wiederherstellung unmöglich machen kann.
Deaktivieren Sie alle Remote-Verbindungen
Das erste, was Sie tun müssen, ist, weitere Änderungen an Ihrem
Festplatten-Array zu vermeiden. Deaktivieren Sie alle Remote-Verbindungen
dazu und alle geplanten Prozesse, einschließlich geplanter SnapRAID-nächtlicher
`sync`- oder `scrub`-Läufe.

View file

@ -355,10 +355,8 @@ verloren!
KEINE PANIK! Sie werden in der Lage sein, sie wiederherzustellen!
Bevor Sie irgendetwas anderes tun, vermeiden Sie jegliche Änderungen an Ihrem
Festplatten-Array, da das Ändern oder Löschen von Daten auf den verbleibenden
Festplatten eine Wiederherstellung unmöglich machen kann.
Deaktivieren Sie alle Remote-Verbindungen
Das erste, was Sie tun müssen, ist, weitere Änderungen an Ihrem
Festplatten-Array zu vermeiden. Deaktivieren Sie alle Remote-Verbindungen
dazu und alle geplanten Prozesse, einschließlich geplanter SnapRAID-nächtlicher
`sync`- oder `scrub`-Läufe.

View file

@ -570,9 +570,7 @@ Ha sucedido lo peor, ¡y ha perdido uno o más discos!
.PP
¡NO ENTRE EN PÁNICO! ¡Podrá recuperarlos!
.PP
Antes de hacer cualquier otra cosa, evite realizar cualquier cambio en su
array de discos, ya que modificar o eliminar datos en los discos restantes
puede hacer imposible la recuperación.
Lo primero que debe hacer es evitar más cambios en su array de discos.
Deshabilite cualquier conexión remota a él y cualquier proceso
programado, incluida cualquier sincronización o depuración nocturna
programada de SnapRAID.

View file

@ -321,9 +321,7 @@ Primeros pasos (Getting Started)
¡NO ENTRE EN PÁNICO! ¡Podrá recuperarlos!
Antes de hacer cualquier otra cosa, evite realizar cualquier cambio en su
array de discos, ya que modificar o eliminar datos en los discos restantes
puede hacer imposible la recuperación.
Lo primero que debe hacer es evitar más cambios en su array de discos.
Deshabilite cualquier conexión remota a él y cualquier proceso
programado, incluida cualquier sincronización o depuración nocturna
programada de SnapRAID.

View file

@ -342,9 +342,7 @@ Ha sucedido lo peor, ¡y ha perdido uno o más discos!
¡NO ENTRE EN PÁNICO! ¡Podrá recuperarlos!
Antes de hacer cualquier otra cosa, evite realizar cualquier cambio en su
array de discos, ya que modificar o eliminar datos en los discos restantes
puede hacer imposible la recuperación.
Lo primero que debe hacer es evitar más cambios en su array de discos.
Deshabilite cualquier conexión remota a él y cualquier proceso
programado, incluida cualquier sincronización o depuración nocturna
programada de SnapRAID.

View file

@ -582,10 +582,8 @@ Le pire est arrivé, et vous avez perdu un ou plusieurs disques !
.PP
NE PANIQUEZ PAS ! Vous pourrez les récupérer !
.PP
Avant toute autre chose, évitez d\'apporter la moindre modification
à votre baie de disques, car modifier ou supprimer des données sur
les disques restants peut rendre la récupération impossible.
Désactivez toute connexion à distance
La première chose à faire est d\'éviter d\'autres modifications
sur votre baie de disques. Désactivez toute connexion à distance
et tout processus planifié, y compris toute synchronisation ou
nettoyage SnapRAID nocturne planifié.
.PP

View file

@ -333,10 +333,8 @@ Démarrer (Getting Started)
NE PANIQUEZ PAS ! Vous pourrez les récupérer !
Avant toute autre chose, évitez d'apporter la moindre modification
à votre baie de disques, car modifier ou supprimer des données sur
les disques restants peut rendre la récupération impossible.
Désactivez toute connexion à distance
La première chose à faire est d'éviter d'autres modifications
sur votre baie de disques. Désactivez toute connexion à distance
et tout processus planifié, y compris toute synchronisation ou
nettoyage SnapRAID nocturne planifié.

View file

@ -354,10 +354,8 @@ Le pire est arrivé, et vous avez perdu un ou plusieurs disques !
NE PANIQUEZ PAS ! Vous pourrez les récupérer !
Avant toute autre chose, évitez d'apporter la moindre modification
à votre baie de disques, car modifier ou supprimer des données sur
les disques restants peut rendre la récupération impossible.
Désactivez toute connexion à distance
La première chose à faire est d'éviter d'autres modifications
sur votre baie de disques. Désactivez toute connexion à distance
et tout processus planifié, y compris toute synchronisation ou
nettoyage SnapRAID nocturne planifié.

View file

@ -572,9 +572,7 @@ snapraid fix \-m
.PP
NON FARSI PRENDERE DAL PANICO! Sarà possibile recuperarli!
.PP
Prima di fare qualsiasi altra cosa, evitare di apportare qualsiasi modifica
all\'array di dischi, poiché modificare o cancellare dati sui dischi rimanenti
potrebbe rendere impossibile il recupero.
La prima cosa da fare è evitare ulteriori modifiche all\'array di dischi.
Disabilitare qualsiasi connessione remota ad esso e qualsiasi processo
pianificato, incluso qualsiasi sync o scrub notturno pianificato di SnapRAID.
.PP

View file

@ -323,9 +323,7 @@ Primi passi (Getting Started)
NON FARSI PRENDERE DAL PANICO! Sarà possibile recuperarli!
Prima di fare qualsiasi altra cosa, evitare di apportare qualsiasi modifica
all'array di dischi, poiché modificare o cancellare dati sui dischi rimanenti
potrebbe rendere impossibile il recupero.
La prima cosa da fare è evitare ulteriori modifiche all'array di dischi.
Disabilitare qualsiasi connessione remota ad esso e qualsiasi processo
pianificato, incluso qualsiasi sync o scrub notturno pianificato di SnapRAID.

View file

@ -344,9 +344,7 @@ O per recuperare tutti i file eliminati su tutte le unità con:
NON FARSI PRENDERE DAL PANICO! Sarà possibile recuperarli!
Prima di fare qualsiasi altra cosa, evitare di apportare qualsiasi modifica
all'array di dischi, poiché modificare o cancellare dati sui dischi rimanenti
potrebbe rendere impossibile il recupero.
La prima cosa da fare è evitare ulteriori modifiche all'array di dischi.
Disabilitare qualsiasi connessione remota ad esso e qualsiasi processo
pianificato, incluso qualsiasi sync o scrub notturno pianificato di SnapRAID.

View file

@ -545,8 +545,7 @@ snapraid fix \-m
.PP
**パニックにならないでください!** 復旧できます!
.PP
何よりもまず、ディスクアレイへの**変更を一切行わないでください**。
残りのディスク上のデータを変更または削除すると、復旧が不可能になる可能性があります。
最初に行うべきことは、ディスクアレイへの**さらなる変更を避ける**ことです。
リモート接続、およびスケジュールされたSnapRAIDの夜間 \`sync\` や \`scrub\` を含む、
すべてのスケジュールされたプロセスを無効にしてください。
.PP

View file

@ -296,8 +296,7 @@ Name{number}
**パニックにならないでください!** 復旧できます!
何よりもまず、ディスクアレイへの**変更を一切行わないでください**。
残りのディスク上のデータを変更または削除すると、復旧が不可能になる可能性があります。
最初に行うべきことは、ディスクアレイへの**さらなる変更を避ける**ことです。
リモート接続、およびスケジュールされたSnapRAIDの夜間 `sync` や `scrub` を含む、
すべてのスケジュールされたプロセスを無効にしてください。

View file

@ -317,8 +317,7 @@ SnapRAIDはRAIDシステムよりもバックアッププログラムのよう
**パニックにならないでください!** 復旧できます!
何よりもまず、ディスクアレイへの**変更を一切行わないでください**。
残りのディスク上のデータを変更または削除すると、復旧が不可能になる可能性があります。
最初に行うべきことは、ディスクアレイへの**さらなる変更を避ける**ことです。
リモート接続、およびスケジュールされたSnapRAIDの夜間 `sync` や `scrub` を含む、
すべてのスケジュールされたプロセスを無効にしてください。

View file

@ -554,8 +554,7 @@ snapraid fix \-m
.PP
**당황하지 마십시오!** 복구할 수 있습니다!
.PP
다른 작업을 하기 전에 디스크 어레이를 일절 변경하지 마십시오. 남은 디스크의
데이터를 수정하거나 삭제하면 복구가 불가능해질 수 있습니다.
가장 먼저 해야 할 일은 디스크 어레이에 대한 추가 변경을 피하는 것입니다.
모든 원격 연결과 SnapRAID 야간 동기화 또는 스크럽을 포함한 모든 예약된
프로세스를 비활성화하십시오.
.PP

View file

@ -305,8 +305,7 @@ Name{number}
**당황하지 마십시오!** 복구할 수 있습니다!
다른 작업을 하기 전에 디스크 어레이를 일절 변경하지 마십시오. 남은 디스크의
데이터를 수정하거나 삭제하면 복구가 불가능해질 수 있습니다.
가장 먼저 해야 할 일은 디스크 어레이에 대한 추가 변경을 피하는 것입니다.
모든 원격 연결과 SnapRAID 야간 동기화 또는 스크럽을 포함한 모든 예약된
프로세스를 비활성화하십시오.

View file

@ -326,8 +326,7 @@ SnapRAID는 RAID 시스템보다는 백업 프로그램처럼 작동하며,
**당황하지 마십시오!** 복구할 수 있습니다!
다른 작업을 하기 전에 디스크 어레이를 일절 변경하지 마십시오. 남은 디스크의
데이터를 수정하거나 삭제하면 복구가 불가능해질 수 있습니다.
가장 먼저 해야 할 일은 디스크 어레이에 대한 추가 변경을 피하는 것입니다.
모든 원격 연결과 SnapRAID 야간 동기화 또는 스크럽을 포함한 모든 예약된
프로세스를 비활성화하십시오.

View file

@ -559,9 +559,7 @@ Najgorsze się wydarzyło i straciłeś jeden lub więcej dysków!
.PP
NIE PANIKUJ! Będziesz w stanie je odzyskać!
.PP
Zanim zrobisz cokolwiek innego, unikaj wprowadzania jakichkolwiek zmian w Twojej
macierzy dysków, ponieważ modyfikowanie lub usuwanie danych na pozostałych
dyskach może uniemożliwić odzyskanie.
Pierwszą rzeczą, którą musisz zrobić, to unikać dalszych zmian w Twojej macierzy dysków.
Wyłącz wszelkie zdalne połączenia z nią i wszelkie zaplanowane procesy, w tym
jakąkolwiek zaplanowaną nocną synchronizację lub scrub SnapRAID.
.PP

View file

@ -310,9 +310,7 @@ Pierwsze kroki (Getting Started)
NIE PANIKUJ! Będziesz w stanie je odzyskać!
Zanim zrobisz cokolwiek innego, unikaj wprowadzania jakichkolwiek zmian w Twojej
macierzy dysków, ponieważ modyfikowanie lub usuwanie danych na pozostałych
dyskach może uniemożliwić odzyskanie.
Pierwszą rzeczą, którą musisz zrobić, to unikać dalszych zmian w Twojej macierzy dysków.
Wyłącz wszelkie zdalne połączenia z nią i wszelkie zaplanowane procesy, w tym
jakąkolwiek zaplanowaną nocną synchronizację lub scrub SnapRAID.

View file

@ -331,9 +331,7 @@ Najgorsze się wydarzyło i straciłeś jeden lub więcej dysków!
NIE PANIKUJ! Będziesz w stanie je odzyskać!
Zanim zrobisz cokolwiek innego, unikaj wprowadzania jakichkolwiek zmian w Twojej
macierzy dysków, ponieważ modyfikowanie lub usuwanie danych na pozostałych
dyskach może uniemożliwić odzyskanie.
Pierwszą rzeczą, którą musisz zrobić, to unikać dalszych zmian w Twojej macierzy dysków.
Wyłącz wszelkie zdalne połączenia z nią i wszelkie zaplanowane procesy, w tym
jakąkolwiek zaplanowaną nocną synchronizację lub scrub SnapRAID.

View file

@ -563,10 +563,8 @@ O pior aconteceu e você perdeu um ou mais discos!
.PP
NÃO ENTRE EM PÂNICO! Você será capaz de recuperá\-los!
.PP
Antes de fazer qualquer outra coisa, evite fazer qualquer alteração em seu
array de discos, pois modificar ou excluir dados nos discos restantes pode
tornar a recuperação impossível.
Desabilite quaisquer conexões remotas a ele e quaisquer
A primeira coisa que você deve fazer é evitar mais alterações em seu array
de discos. Desabilite quaisquer conexões remotas a ele e quaisquer
processos agendados, incluindo qualquer sincronização noturna ou scrub
agendado do SnapRAID.
.PP

View file

@ -314,10 +314,8 @@ Primeiros Passos (Getting Started)
NÃO ENTRE EM PÂNICO! Você será capaz de recuperá-los!
Antes de fazer qualquer outra coisa, evite fazer qualquer alteração em seu
array de discos, pois modificar ou excluir dados nos discos restantes pode
tornar a recuperação impossível.
Desabilite quaisquer conexões remotas a ele e quaisquer
A primeira coisa que você deve fazer é evitar mais alterações em seu array
de discos. Desabilite quaisquer conexões remotas a ele e quaisquer
processos agendados, incluindo qualquer sincronização noturna ou scrub
agendado do SnapRAID.

View file

@ -335,10 +335,8 @@ O pior aconteceu e você perdeu um ou mais discos!
NÃO ENTRE EM PÂNICO! Você será capaz de recuperá-los!
Antes de fazer qualquer outra coisa, evite fazer qualquer alteração em seu
array de discos, pois modificar ou excluir dados nos discos restantes pode
tornar a recuperação impossível.
Desabilite quaisquer conexões remotas a ele e quaisquer
A primeira coisa que você deve fazer é evitar mais alterações em seu array
de discos. Desabilite quaisquer conexões remotas a ele e quaisquer
processos agendados, incluindo qualquer sincronização noturna ou scrub
agendado do SnapRAID.

View file

@ -556,9 +556,7 @@ Cel mai rău s\-a întâmplat și ați pierdut unul sau mai multe discuri!
.PP
NU INTRAȚI ÎN PANICĂ! Veți putea să le recuperați!
.PP
Înainte de a face orice altceva, evitați să efectuați orice modificare la matricea
dvs. de discuri, deoarece modificarea sau ștergerea datelor de pe discurile
rămase poate face recuperarea imposibilă.
Primul lucru pe care trebuie să\-l faceți este să evitați modificările ulterioare la matricea dvs. de discuri.
Dezactivați orice conexiuni la distanță la aceasta și orice procese programate, inclusiv
orice sincronizare sau verificare SnapRAID programată pe timp de noapte.
.PP

View file

@ -307,9 +307,7 @@ Noțiuni de Bază (Getting Started)
NU INTRAȚI ÎN PANICĂ! Veți putea să le recuperați!
Înainte de a face orice altceva, evitați să efectuați orice modificare la matricea
dvs. de discuri, deoarece modificarea sau ștergerea datelor de pe discurile
rămase poate face recuperarea imposibilă.
Primul lucru pe care trebuie să-l faceți este să evitați modificările ulterioare la matricea dvs. de discuri.
Dezactivați orice conexiuni la distanță la aceasta și orice procese programate, inclusiv
orice sincronizare sau verificare SnapRAID programată pe timp de noapte.

View file

@ -328,9 +328,7 @@ Cel mai rău s-a întâmplat și ați pierdut unul sau mai multe discuri!
NU INTRAȚI ÎN PANICĂ! Veți putea să le recuperați!
Înainte de a face orice altceva, evitați să efectuați orice modificare la matricea
dvs. de discuri, deoarece modificarea sau ștergerea datelor de pe discurile
rămase poate face recuperarea imposibilă.
Primul lucru pe care trebuie să-l faceți este să evitați modificările ulterioare la matricea dvs. de discuri.
Dezactivați orice conexiuni la distanță la aceasta și orice procese programate, inclusiv
orice sincronizare sau verificare SnapRAID programată pe timp de noapte.

View file

@ -558,9 +558,7 @@ snapraid fix \-m
.PP
НЕ ПАНИКУЙТЕ! Вы сможете их восстановить!
.PP
Прежде чем делать что\-либо ещё, избегайте любых изменений в вашем дисковом
массиве, так как изменение или удаление данных на оставшихся дисках может
сделать восстановление невозможным.
Первое, что вы должны сделать, это избегать дальнейших изменений в вашем дисковом массиве.
Отключите любые удаленные подключения к нему и любые запланированные процессы,
включая любое запланированное ночное sync или scrub SnapRAID.
.PP

View file

@ -309,9 +309,7 @@ Name{number}
НЕ ПАНИКУЙТЕ! Вы сможете их восстановить!
Прежде чем делать что-либо ещё, избегайте любых изменений в вашем дисковом
массиве, так как изменение или удаление данных на оставшихся дисках может
сделать восстановление невозможным.
Первое, что вы должны сделать, это избегать дальнейших изменений в вашем дисковом массиве.
Отключите любые удаленные подключения к нему и любые запланированные процессы,
включая любое запланированное ночное sync или scrub SnapRAID.

View file

@ -330,9 +330,7 @@ SnapRAID функционирует скорее как программа ре
НЕ ПАНИКУЙТЕ! Вы сможете их восстановить!
Прежде чем делать что-либо ещё, избегайте любых изменений в вашем дисковом
массиве, так как изменение или удаление данных на оставшихся дисках может
сделать восстановление невозможным.
Первое, что вы должны сделать, это избегать дальнейших изменений в вашем дисковом массиве.
Отключите любые удаленные подключения к нему и любые запланированные процессы,
включая любое запланированное ночное sync или scrub SnapRAID.

View file

@ -558,9 +558,7 @@ Det värsta har hänt, och du har förlorat en eller flera diskar!
.PP
FÅ INTE PANIK! Du kommer att kunna återställa dem!
.PP
Innan du gör något annat, undvik att göra några ändringar i din disk\-array,
eftersom ändring eller borttagning av data på de återstående diskarna kan
göra återställning omöjlig.
Det första du måste göra är att undvika ytterligare ändringar i din disk\-array.
Inaktivera alla fjärranslutningar till den och alla schemalagda processer, inklusive
alla schemalagda SnapRAID nattliga sync\- eller scrub\-körningar.
.PP

View file

@ -309,9 +309,7 @@ Kom igång (Getting Started)
FÅ INTE PANIK! Du kommer att kunna återställa dem!
Innan du gör något annat, undvik att göra några ändringar i din disk-array,
eftersom ändring eller borttagning av data på de återstående diskarna kan
göra återställning omöjlig.
Det första du måste göra är att undvika ytterligare ändringar i din disk-array.
Inaktivera alla fjärranslutningar till den och alla schemalagda processer, inklusive
alla schemalagda SnapRAID nattliga sync- eller scrub-körningar.

View file

@ -330,9 +330,7 @@ Det värsta har hänt, och du har förlorat en eller flera diskar!
FÅ INTE PANIK! Du kommer att kunna återställa dem!
Innan du gör något annat, undvik att göra några ändringar i din disk-array,
eftersom ändring eller borttagning av data på de återstående diskarna kan
göra återställning omöjlig.
Det första du måste göra är att undvika ytterligare ändringar i din disk-array.
Inaktivera alla fjärranslutningar till den och alla schemalagda processer, inklusive
alla schemalagda SnapRAID nattliga sync- eller scrub-körningar.

View file

@ -585,10 +585,8 @@ snapraid fix \-m
.PP
НЕ ПАНІКУЙТЕ! Ви зможете їх відновити!
.PP
Перш ніж робити будь\-що інше, уникайте будь\-яких змін у
вашому дисковому масиві, оскільки зміна або видалення
даних на решті дисків може унеможливити відновлення.
Вимкніть будь\-які віддалені
Перше, що ви повинні зробити, це уникнути подальших змін у
вашому дисковому масиві. Вимкніть будь\-які віддалені
підключення до нього та будь\-які заплановані процеси,
включаючи будь\-яку заплановану нічну синхронізацію або
скрабування SnapRAID.

View file

@ -336,10 +336,8 @@ Name{number}
НЕ ПАНІКУЙТЕ! Ви зможете їх відновити!
Перш ніж робити будь-що інше, уникайте будь-яких змін у
вашому дисковому масиві, оскільки зміна або видалення
даних на решті дисків може унеможливити відновлення.
Вимкніть будь-які віддалені
Перше, що ви повинні зробити, це уникнути подальших змін у
вашому дисковому масиві. Вимкніть будь-які віддалені
підключення до нього та будь-які заплановані процеси,
включаючи будь-яку заплановану нічну синхронізацію або
скрабування SnapRAID.

View file

@ -357,10 +357,8 @@ SnapRAID функціонує більше як програма резервн
НЕ ПАНІКУЙТЕ! Ви зможете їх відновити!
Перш ніж робити будь-що інше, уникайте будь-яких змін у
вашому дисковому масиві, оскільки зміна або видалення
даних на решті дисків може унеможливити відновлення.
Вимкніть будь-які віддалені
Перше, що ви повинні зробити, це уникнути подальших змін у
вашому дисковому масиві. Вимкніть будь-які віддалені
підключення до нього та будь-які заплановані процеси,
включаючи будь-яку заплановану нічну синхронізацію або
скрабування SnapRAID.

View file

@ -520,8 +520,7 @@ snapraid fix \-m
.PP
**不要惊慌!** 您将能够恢复它们!
.PP
在执行任何其他操作之前,请避免对磁盘阵列进行任何更改,
因为修改或删除剩余磁盘上的数据可能会导致无法恢复。
您必须做的第一件事是避免对磁盘阵列进行进一步的更改。
禁用对其的任何远程连接以及任何计划的进程,包括任何计划的 SnapRAID
夜间同步或 scrub。
.PP

View file

@ -271,8 +271,7 @@ Name{number}
**不要惊慌!** 您将能够恢复它们!
在执行任何其他操作之前,请避免对磁盘阵列进行任何更改,
因为修改或删除剩余磁盘上的数据可能会导致无法恢复。
您必须做的第一件事是避免对磁盘阵列进行进一步的更改。
禁用对其的任何远程连接以及任何计划的进程,包括任何计划的 SnapRAID
夜间同步或 scrub。

View file

@ -292,8 +292,7 @@ SnapRAID 的功能更像一个备份程序而不是 RAID 系统,
**不要惊慌!** 您将能够恢复它们!
在执行任何其他操作之前,请避免对磁盘阵列进行任何更改,
因为修改或删除剩余磁盘上的数据可能会导致无法恢复。
您必须做的第一件事是避免对磁盘阵列进行进一步的更改。
禁用对其的任何远程连接以及任何计划的进程,包括任何计划的 SnapRAID
夜间同步或 scrub。

View file

@ -559,8 +559,7 @@ The worst has happened, and you have lost one or more disks!
.PP
DO NOT PANIC! You will be able to recover them!
.PP
Before doing anything else, avoid making any changes to your disk array, as
modifying or deleting data on the remaining disks may make recovery impossible.
The first thing you must do is avoid further changes to your disk array.
Disable any remote connections to it and any scheduled processes, including
any scheduled SnapRAID nightly sync or scrub.
.PP

View file

@ -310,8 +310,7 @@ Getting Started
DO NOT PANIC! You will be able to recover them!
Before doing anything else, avoid making any changes to your disk array, as
modifying or deleting data on the remaining disks may make recovery impossible.
The first thing you must do is avoid further changes to your disk array.
Disable any remote connections to it and any scheduled processes, including
any scheduled SnapRAID nightly sync or scrub.

View file

@ -331,8 +331,7 @@ The worst has happened, and you have lost one or more disks!
DO NOT PANIC! You will be able to recover them!
Before doing anything else, avoid making any changes to your disk array, as
modifying or deleting data on the remaining disks may make recovery impossible.
The first thing you must do is avoid further changes to your disk array.
Disable any remote connections to it and any scheduled processes, including
any scheduled SnapRAID nightly sync or scrub.

View file

@ -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
View file

@ -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();
}
}