Compare commits
162 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
238aa92948 | ||
|
|
faeab50e71 | ||
|
|
6cbec2d0aa | ||
|
|
f606314f0c | ||
|
|
1d281273b1 | ||
|
|
dab764d019 | ||
|
|
f6f8bcd2a5 | ||
|
|
e9ae247cb1 | ||
|
|
4b3dde0b11 | ||
|
|
68bf7189e0 | ||
|
|
ef79a4d8c8 | ||
|
|
25337787e7 | ||
|
|
c68ec38e3f | ||
|
|
6448da507e | ||
|
|
c6c8130db4 | ||
|
|
477c8e6f42 | ||
|
|
ce185b2b48 | ||
|
|
87d5a54ba0 | ||
|
|
8f093ea93a | ||
|
|
4c641c1f2a | ||
|
|
ae38d3a87f | ||
|
|
44917600b6 | ||
|
|
c5090d91a1 | ||
|
|
e32b4a9a81 | ||
|
|
0fe4128ee6 | ||
|
|
af76c25f77 | ||
|
|
caad9b987c | ||
|
|
b5aba2624b | ||
|
|
f397e32638 | ||
|
|
18b8095a8d | ||
|
|
3f7a72e967 | ||
|
|
fb96d3f84d | ||
|
|
3ec32f9975 | ||
|
|
62d99ee3fc | ||
|
|
ad4ab16559 | ||
|
|
1bf5868e33 | ||
|
|
f1a922f3b3 | ||
|
|
274e786be9 | ||
|
|
6688f1c1eb | ||
|
|
1f84142915 | ||
|
|
f4d5705e4a | ||
|
|
f4cf8fe51c | ||
|
|
a83533d97d | ||
|
|
b372b8a3be | ||
|
|
3b89b71680 | ||
|
|
0c7ded471f | ||
|
|
0b51cde162 | ||
|
|
23baa40d9d | ||
|
|
3e183c2f5a | ||
|
|
29309f5913 | ||
|
|
48ceff86de | ||
|
|
45d6746219 | ||
|
|
edf5ea7974 | ||
|
|
b62d02f38f | ||
|
|
0593b330d8 | ||
|
|
58b6e97a9e | ||
|
|
edca359022 | ||
|
|
5a7ed86fba | ||
|
|
9cdb5251b6 | ||
|
|
3c1e5fcf16 | ||
|
|
3732cf72d6 | ||
|
|
a026154c6f | ||
|
|
a43d0b95c4 | ||
|
|
e9bf727253 | ||
|
|
57cd14f194 | ||
|
|
4f393a5f9f | ||
|
|
b7bbf1beb8 | ||
|
|
d2da05aa1b | ||
|
|
c9015a7e58 | ||
|
|
3a091d5def | ||
|
|
5f88f2cca7 | ||
|
|
2f30d235c2 | ||
|
|
10b2e1e7c5 | ||
|
|
b3ce696f36 | ||
|
|
212d20c80e | ||
|
|
1882c66bda | ||
|
|
8abe637468 | ||
|
|
db90ccc199 | ||
|
|
726abe8a32 | ||
|
|
8e0fe8a9a3 | ||
|
|
fbe54952f0 | ||
|
|
9a780cf22b | ||
|
|
f1f1678e13 | ||
|
|
e101219ad7 | ||
|
|
fd5945e533 | ||
|
|
1b96f6a9b3 | ||
|
|
f19a8044c3 | ||
|
|
2c9b3f8459 | ||
|
|
5538ecd7cc | ||
|
|
c643845100 | ||
|
|
3d392c6e05 | ||
|
|
80d419124e | ||
|
|
602d280aa3 | ||
|
|
ccb09d9f5f | ||
|
|
2e1da29fc1 | ||
|
|
4504a1a4bf | ||
|
|
98e10715ff | ||
|
|
eefaf55b1b | ||
|
|
f741643d75 | ||
|
|
88bd05020c | ||
|
|
20a39fbbab | ||
|
|
9e788adf56 | ||
|
|
5450f9a904 | ||
|
|
79e28694ef | ||
|
|
39eea79d8d | ||
|
|
98f943f2a5 | ||
|
|
51e77b9a96 | ||
|
|
7a799ebb2c | ||
|
|
b2bc1f6927 | ||
|
|
a8166a86ed | ||
|
|
debea9b761 | ||
|
|
7909308285 | ||
|
|
a74114fe34 | ||
|
|
119cee142e | ||
|
|
946eb84182 | ||
|
|
45bba0e190 | ||
|
|
f84b8530c5 | ||
|
|
eccf1c569c | ||
|
|
7ad96661ef | ||
|
|
8736e4a37e | ||
|
|
e8a2cfa7dc | ||
|
|
f06a1d8b00 | ||
|
|
b4472167c2 | ||
|
|
d22f1c18cc | ||
|
|
dcca8653a5 | ||
|
|
5575995541 | ||
|
|
6f266a30ff | ||
|
|
8f134c0bea | ||
|
|
44126d85ee | ||
|
|
2a41a72b8c | ||
|
|
45d2e6dff0 | ||
|
|
4e1afcd662 | ||
|
|
e668c7e725 | ||
|
|
9e5a852ee0 | ||
|
|
80b52a597f | ||
|
|
d355cb2b16 | ||
|
|
4ce27b5e60 | ||
|
|
62449968fa | ||
|
|
b7e12ec04e | ||
|
|
047bfc47c6 | ||
|
|
913e16ce20 | ||
|
|
3e602b58a2 | ||
|
|
6b341b1e90 | ||
|
|
e751bc67eb | ||
|
|
92bd73c657 | ||
|
|
2b0bdef6f9 | ||
|
|
9750fd6819 | ||
|
|
e1b1d187f4 | ||
|
|
7052a0a2dd | ||
|
|
962c820fba | ||
|
|
363eab25f0 | ||
|
|
4758641b1d | ||
|
|
f5a7404c7a | ||
|
|
618bafc238 | ||
|
|
355ad6a9e0 | ||
|
|
d59a090933 | ||
|
|
0e6fe5e728 | ||
|
|
f93cf255d4 | ||
|
|
6761cf2d7e | ||
|
|
79157cbad8 | ||
|
|
b8c67c320c | ||
|
|
e0d66b4be1 |
32
.builds/alpine-edge.yml
Normal file
32
.builds/alpine-edge.yml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
image: alpine/latest
|
||||||
|
# apk add --update alpine-sdk
|
||||||
|
packages:
|
||||||
|
- cmd:setcap
|
||||||
|
- autoconf
|
||||||
|
- automake
|
||||||
|
- byacc
|
||||||
|
- expect
|
||||||
|
- gettext
|
||||||
|
- gettext-dev
|
||||||
|
- gettext-lang
|
||||||
|
- libcap-dev
|
||||||
|
- libtool
|
||||||
|
- linux-pam-dev
|
||||||
|
- sed
|
||||||
|
sources:
|
||||||
|
- https://github.com/shadow-maint/shadow
|
||||||
|
tasks:
|
||||||
|
- build: |
|
||||||
|
cd shadow
|
||||||
|
./autogen.sh --without-selinux --disable-man --disable-nls
|
||||||
|
grep ENABLE_ config.status
|
||||||
|
- tasks: |
|
||||||
|
cd shadow
|
||||||
|
cat /proc/self/uid_map
|
||||||
|
cat /proc/self/status
|
||||||
|
make
|
||||||
|
make DESTDIR=/tmp/shadow-inst install
|
||||||
|
sudo make install
|
||||||
|
#TODO - fix up the tests. Let's merge what's here now as it
|
||||||
|
#at least tests build.
|
||||||
|
#(cd tests; sudo ./run_some || { cat testsuite.log; false; })
|
||||||
31
.builds/fedora.yml
Normal file
31
.builds/fedora.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
image: fedora/latest
|
||||||
|
packages:
|
||||||
|
- autoconf
|
||||||
|
- automake
|
||||||
|
- byacc
|
||||||
|
- expect
|
||||||
|
- findutils
|
||||||
|
- gettext
|
||||||
|
- gettext-devel
|
||||||
|
- git
|
||||||
|
- libselinux-devel
|
||||||
|
- libsemanage-devel
|
||||||
|
- libtool
|
||||||
|
- libxslt
|
||||||
|
sources:
|
||||||
|
- https://github.com/shadow-maint/shadow
|
||||||
|
tasks:
|
||||||
|
- build: |
|
||||||
|
cd shadow
|
||||||
|
./autogen.sh --with-selinux --enable-man
|
||||||
|
grep ENABLE_ config.status
|
||||||
|
- tasks: |
|
||||||
|
cd shadow
|
||||||
|
cat /proc/self/uid_map
|
||||||
|
cat /proc/self/status
|
||||||
|
make
|
||||||
|
make DESTDIR=/tmp/shadow-inst install
|
||||||
|
sudo make install
|
||||||
|
#TODO - fix up the tests. Let's merge what's here now as it
|
||||||
|
#at least tests build.
|
||||||
|
#(cd tests; sudo ./run_some || { cat testsuite.log; false; })
|
||||||
26
.builds/ubuntu-focal.yml
Normal file
26
.builds/ubuntu-focal.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
image: ubuntu/focal
|
||||||
|
packages:
|
||||||
|
- automake
|
||||||
|
- autopoint
|
||||||
|
- xsltproc
|
||||||
|
- libselinux1-dev
|
||||||
|
- gettext
|
||||||
|
- expect
|
||||||
|
- byacc
|
||||||
|
- libtool
|
||||||
|
sources:
|
||||||
|
- https://github.com/shadow-maint/shadow
|
||||||
|
tasks:
|
||||||
|
- build: |
|
||||||
|
cd shadow
|
||||||
|
./autogen.sh --without-selinux --disable-man
|
||||||
|
grep ENABLE_ config.status
|
||||||
|
- tasks: |
|
||||||
|
cd shadow
|
||||||
|
cat /proc/self/uid_map
|
||||||
|
cat /proc/self/status
|
||||||
|
systemd-detect-virt
|
||||||
|
make
|
||||||
|
make DESTDIR=/tmp/shadow-inst install
|
||||||
|
sudo make install
|
||||||
|
(cd tests; sudo ./run_some || { cat testsuite.log; false; })
|
||||||
26
.builds/ubuntu-jammy.yml
Normal file
26
.builds/ubuntu-jammy.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
image: ubuntu/22.04
|
||||||
|
packages:
|
||||||
|
- automake
|
||||||
|
- autopoint
|
||||||
|
- xsltproc
|
||||||
|
- libselinux1-dev
|
||||||
|
- gettext
|
||||||
|
- expect
|
||||||
|
- byacc
|
||||||
|
- libtool
|
||||||
|
sources:
|
||||||
|
- https://github.com/shadow-maint/shadow
|
||||||
|
tasks:
|
||||||
|
- build: |
|
||||||
|
cd shadow
|
||||||
|
./autogen.sh --without-selinux --enable-man
|
||||||
|
grep ENABLE_ config.status
|
||||||
|
- tasks: |
|
||||||
|
cat /proc/self/uid_map
|
||||||
|
cat /proc/self/status
|
||||||
|
systemd-detect-virt
|
||||||
|
cd shadow
|
||||||
|
make
|
||||||
|
make DESTDIR=/tmp/shadow-inst install
|
||||||
|
sudo make install
|
||||||
|
(cd tests; sudo ./run_some || { cat testsuite.log; false; })
|
||||||
12
.github/actions/install-dependencies/action.yml
vendored
Normal file
12
.github/actions/install-dependencies/action.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
name: 'Install dependencies'
|
||||||
|
description: 'Install dependencies to build shadow-utils'
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y ubuntu-dev-tools
|
||||||
|
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get -y build-dep shadow
|
||||||
43
.github/workflows/main.yml
vendored
43
.github/workflows/main.yml
vendored
@@ -1,43 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: debug
|
|
||||||
run: |
|
|
||||||
id
|
|
||||||
which bash
|
|
||||||
whoami
|
|
||||||
env
|
|
||||||
ps -ef
|
|
||||||
pwd
|
|
||||||
cat /proc/self/uid_map
|
|
||||||
cat /proc/self/status
|
|
||||||
systemd-detect-virt
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get -y install automake autopoint xsltproc gettext expect byacc libtool
|
|
||||||
- name: configure
|
|
||||||
run: |
|
|
||||||
./autogen.sh --without-selinux --disable-man
|
|
||||||
grep ENABLE_ config.status
|
|
||||||
- run: make
|
|
||||||
- run: make install DESTDIR=${HOME}/rootfs
|
|
||||||
- run: sudo make install
|
|
||||||
- run: |
|
|
||||||
cd tests
|
|
||||||
sudo ./run_some
|
|
||||||
cat testsuite.log
|
|
||||||
38
.github/workflows/static-code-analysis.yml
vendored
Normal file
38
.github/workflows/static-code-analysis.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: "Static code analysis"
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
schedule:
|
||||||
|
# Everyday at midnight
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
jobs:
|
||||||
|
codeql:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
id: dependencies
|
||||||
|
uses: ./.github/actions/install-dependencies
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: cpp
|
||||||
|
queries: +security-and-quality
|
||||||
|
|
||||||
|
- name: Configure shadow-utils
|
||||||
|
run: ./autogen.sh --without-selinux --disable-man
|
||||||
|
|
||||||
|
- name: Build shadow-utils
|
||||||
|
run: |
|
||||||
|
PROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
|
||||||
|
make -j$PROCESSORS
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
164
AUTHORS.md
164
AUTHORS.md
@@ -3,87 +3,87 @@ reports and various comments. This list may be incomplete, I received
|
|||||||
a lot of mail...
|
a lot of mail...
|
||||||
|
|
||||||
# Maintainers
|
# Maintainers
|
||||||
Tomasz Kłoczko <kloczek@pld.org.pl> (2000-2007)
|
* Tomasz Kłoczko <kloczek@pld.org.pl> (2000-2007)
|
||||||
Nicolas François <nicolas.francois@centraliens.net> (2007-2014)
|
* Nicolas François <nicolas.francois@centraliens.net> (2007-2014)
|
||||||
Serge E. Hallyn <serge@hallyn.com> (2014-now)
|
* Serge E. Hallyn <serge@hallyn.com> (2014-now)
|
||||||
Christian Brauner <christian@brauner.io> (2019-now)
|
* Christian Brauner <christian@brauner.io> (2019-now)
|
||||||
|
* Iker Pedrosa <ipedrosa@redhat.com> (2022-now)
|
||||||
|
|
||||||
# Authors and contributors
|
# Authors and contributors
|
||||||
Adam Rudnicki <adam@v-lo.krakow.pl>
|
* Adam Rudnicki <adam@v-lo.krakow.pl>
|
||||||
Alan Curry <pacman@tardis.mars.net>
|
* Alan Curry <pacman@tardis.mars.net>
|
||||||
Aleksa Sarai <cyphar@cyphar.com>
|
* Aleksa Sarai <cyphar@cyphar.com>
|
||||||
Alexander O. Yuriev <alex@bach.cis.temple.edu>
|
* Alexander O. Yuriev <alex@bach.cis.temple.edu>
|
||||||
Algis Rudys <arudys@rice.edu>
|
* Algis Rudys <arudys@rice.edu>
|
||||||
Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
* Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
Andy Zaugg <andy.zaugg@gmail.com>
|
* Andy Zaugg <andy.zaugg@gmail.com>
|
||||||
Aniello Del Sorbo <anidel@edu-gw.dia.unisa.it>
|
* Aniello Del Sorbo <anidel@edu-gw.dia.unisa.it>
|
||||||
Anton Gluck <gluc@midway.uchicago.edu>
|
* Anton Gluck <gluc@midway.uchicago.edu>
|
||||||
Arkadiusz Miskiewicz <misiek@pld.org.pl>
|
* Arkadiusz Miskiewicz <misiek@pld.org.pl>
|
||||||
Ben Collins <bcollins@debian.org>
|
* Ben Collins <bcollins@debian.org>
|
||||||
Brian R. Gaeke <brg@dgate.org>
|
* Brian R. Gaeke <brg@dgate.org>
|
||||||
Calle Karlsson <ckn@kash.se>
|
* Calle Karlsson <ckn@kash.se>
|
||||||
Chip Rosenthal <chip@unicom.com>
|
* Chip Rosenthal <chip@unicom.com>
|
||||||
Chris Evans <lady0110@sable.ox.ac.uk>
|
* Chris Evans <lady0110@sable.ox.ac.uk>
|
||||||
Chris Lamb <chris@chris-lamb.co.uk>
|
* Chris Lamb <chris@chris-lamb.co.uk>
|
||||||
Cristian Gafton <gafton@sorosis.ro>
|
* Cristian Gafton <gafton@sorosis.ro>
|
||||||
Dan Walsh <dwalsh@redhat.com>
|
* Dan Walsh <dwalsh@redhat.com>
|
||||||
Darcy Boese <possum@chardonnay.niagara.com>
|
* Darcy Boese <possum@chardonnay.niagara.com>
|
||||||
Dave Hagewood <admin@arrowweb.com>
|
* Dave Hagewood <admin@arrowweb.com>
|
||||||
David A. Holland <dholland@hcs.harvard.edu>
|
* David A. Holland <dholland@hcs.harvard.edu>
|
||||||
David Frey <David.Frey@lugs.ch>
|
* David Frey <David.Frey@lugs.ch>
|
||||||
Ed Carp <ecarp@netcom.com>
|
* Ed Carp <ecarp@netcom.com>
|
||||||
Ed Neville <ed@s5h.net>
|
* Ed Neville <ed@s5h.net>
|
||||||
Eric W. Biederman" <ebiederm@xmission.com>
|
* Eric W. Biederman" <ebiederm@xmission.com>
|
||||||
Floody <flood@evcom.net>
|
* Floody <flood@evcom.net>
|
||||||
Frank Denis <j@4u.net>
|
* Frank Denis <j@4u.net>
|
||||||
George Kraft IV <gk4@us.ibm.com>
|
* George Kraft IV <gk4@us.ibm.com>
|
||||||
Greg Mortensen <loki@world.std.com>
|
* Greg Mortensen <loki@world.std.com>
|
||||||
Guido van Rooij
|
* Guido van Rooij
|
||||||
Guy Maor <maor@debian.org>
|
* Guy Maor <maor@debian.org>
|
||||||
Hrvoje Dogan <hdogan@bjesomar.srce.hr>
|
* Hrvoje Dogan <hdogan@bjesomar.srce.hr>
|
||||||
Iker Pedrosa <ipedrosa@redhat.com>
|
* Jakub Hrozek <jhrozek@redhat.com>
|
||||||
Jakub Hrozek <jhrozek@redhat.com>
|
* Janos Farkas <chexum@bankinf.banki.hu>
|
||||||
Janos Farkas <chexum@bankinf.banki.hu>
|
* Jason Franklin <jason.franklin@quoininc.com>
|
||||||
Jason Franklin <jason.franklin@quoininc.com>
|
* Jay Soffian <jay@lw.net>
|
||||||
Jay Soffian <jay@lw.net>
|
* Jesse Thilo <Jesse.Thilo@pobox.com>
|
||||||
Jesse Thilo <Jesse.Thilo@pobox.com>
|
* Joey Hess <joey@kite.ml.org>
|
||||||
Joey Hess <joey@kite.ml.org>
|
* John Adelsberger <jja@umr.edu>
|
||||||
John Adelsberger <jja@umr.edu>
|
* Jonathan Hankins <jhankins@mailserv.homewood.k12.al.us>
|
||||||
Jonathan Hankins <jhankins@mailserv.homewood.k12.al.us>
|
* Jon Lewis <jlewis@lewis.org>
|
||||||
Jon Lewis <jlewis@lewis.org>
|
* Joshua Cowan <jcowan@hermit.reslife.okstate.edu>
|
||||||
Joshua Cowan <jcowan@hermit.reslife.okstate.edu>
|
* Judd Bourgeois <shagboy@bluesky.net>
|
||||||
Judd Bourgeois <shagboy@bluesky.net>
|
* Juergen Heinzl <unicorn@noris.net>
|
||||||
Juergen Heinzl <unicorn@noris.net>
|
* Juha Virtanen <jiivee@iki.fi>
|
||||||
Juha Virtanen <jiivee@iki.fi>
|
* Julian Pidancet <julian.pidancet@gmail.com>
|
||||||
Julian Pidancet <julian.pidancet@gmail.com>
|
* Julianne Frances Haugh <julie78787@gmail.com>
|
||||||
Julianne Frances Haugh <julie78787@gmail.com>
|
* Leonard N. Zubkoff <lnz@dandelion.com>
|
||||||
Leonard N. Zubkoff <lnz@dandelion.com>
|
* Luca Berra <bluca@www.polimi.it>
|
||||||
Luca Berra <bluca@www.polimi.it>
|
* Lukáš Kuklínek <lkukline@redhat.com>
|
||||||
Lukáš Kuklínek <lkukline@redhat.com>
|
* Lutz Schwalowsky <schwalow@mineralogie.uni-hamburg.de>
|
||||||
Lutz Schwalowsky <schwalow@mineralogie.uni-hamburg.de>
|
* Marc Ewing <marc@redhat.com>
|
||||||
Marc Ewing <marc@redhat.com>
|
* Martin Bene <mb@sime.com>
|
||||||
Martin Bene <mb@sime.com>
|
* Martin Mares <mj@gts.cz>
|
||||||
Martin Mares <mj@gts.cz>
|
* Michael Meskes <meskes@topsystem.de>
|
||||||
Michael Meskes <meskes@topsystem.de>
|
* Michael Talbot-Wilson <mike@calypso.bns.com.au>
|
||||||
Michael Talbot-Wilson <mike@calypso.bns.com.au>
|
* Michael Vetter <jubalh@iodoru.org>
|
||||||
Michael Vetter <jubalh@iodoru.org>
|
* Mike Frysinger <vapier@gentoo.org>
|
||||||
Mike Frysinger <vapier@gentoo.org>
|
* Mike Pakovic <mpakovic@users.southeast.net>
|
||||||
Mike Pakovic <mpakovic@users.southeast.net>
|
* Nicolas François <nicolas.francois@centraliens.net>
|
||||||
Nicolas François <nicolas.francois@centraliens.net>
|
* Nikos Mavroyanopoulos <nmav@i-net.paiko.gr>
|
||||||
Nikos Mavroyanopoulos <nmav@i-net.paiko.gr>
|
* Pavel Machek <pavel@bug.ucw.cz>
|
||||||
Pavel Machek <pavel@bug.ucw.cz>
|
* Peter Vrabec <pvrabec@redhat.com>
|
||||||
Peter Vrabec <pvrabec@redhat.com>
|
* Phillip Street
|
||||||
Phillip Street
|
* Rafał Maszkowski <rzm@icm.edu.pl>
|
||||||
Rafał Maszkowski <rzm@icm.edu.pl>
|
* Rani Chouha <ranibey@smartec.com>
|
||||||
Rani Chouha <ranibey@smartec.com>
|
* Sami Kerola <kerolasa@rocketmail.com>
|
||||||
Sami Kerola <kerolasa@rocketmail.com>
|
* Scott Garman <scott.a.garman@intel.com>
|
||||||
Scott Garman <scott.a.garman@intel.com>
|
* Sebastian Rick Rijkers <srrijkers@gmail.com>
|
||||||
Sebastian Rick Rijkers <srrijkers@gmail.com>
|
* Seraphim Mellos <mellos@ceid.upatras.gr>
|
||||||
Seraphim Mellos <mellos@ceid.upatras.gr>
|
* Shane Watts <shane@nexus.mlckew.edu.au>
|
||||||
Shane Watts <shane@nexus.mlckew.edu.au>
|
* Steve M. Robbins <steve@nyongwa.montreal.qc.ca>
|
||||||
Steve M. Robbins <steve@nyongwa.montreal.qc.ca>
|
* Thorsten Kukuk <kukuk@suse.de>
|
||||||
Thorsten Kukuk <kukuk@suse.de>
|
* Tim Hockin <thockin@eagle.ais.net>
|
||||||
Tim Hockin <thockin@eagle.ais.net>
|
* Timo Karjalainen <timok@iki.fi>
|
||||||
Timo Karjalainen <timok@iki.fi>
|
* Ulisses Alonso Camaro <ulisses@pusa.eleinf.uv.es>
|
||||||
Ulisses Alonso Camaro <ulisses@pusa.eleinf.uv.es>
|
* Werner Fink <werner@suse.de>
|
||||||
Werner Fink <werner@suse.de>
|
|
||||||
|
|||||||
143
COPYING
143
COPYING
@@ -1,118 +1,41 @@
|
|||||||
NOTE:
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
This license has been obsoleted by the change to the BSD-style copyright.
|
|
||||||
You may continue to use this license if you wish, but you are under no
|
|
||||||
obligation to do so.
|
|
||||||
|
|
||||||
(*
|
All files under this project either
|
||||||
This document is freely plagiarised from the 'Artistic Licence',
|
|
||||||
distributed as part of the Perl v4.0 kit by Larry Wall, which is
|
|
||||||
available from most major archive sites. I stole it from CrackLib.
|
|
||||||
|
|
||||||
$Id$
|
1. fall under the BSD 3 clause license (by default).
|
||||||
*)
|
|
||||||
|
|
||||||
This documents purpose is to state the conditions under which this
|
2. carry an SPDX header declaring what license applies.
|
||||||
Package (See definition below) viz: "Shadow", the Shadow Password Suite
|
|
||||||
which is held by Julianne Frances Haugh, may be copied, such that the
|
|
||||||
copyright holder maintains some semblance of artistic control over the
|
|
||||||
development of the package, while giving the users of the package the
|
|
||||||
right to use and distribute the Package in a more-or-less customary
|
|
||||||
fashion, plus the right to make reasonable modifications.
|
|
||||||
|
|
||||||
So there.
|
or
|
||||||
|
|
||||||
***************************************************************************
|
3. list a full custom license
|
||||||
|
|
||||||
Definitions:
|
This software is originally
|
||||||
|
|
||||||
|
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
||||||
|
|
||||||
A "Package" refers to the collection of files distributed by the
|
* All rights reserved.
|
||||||
Copyright Holder, and derivatives of that collection of files created
|
*
|
||||||
through textual modification, or segments thereof.
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
"Standard Version" refers to such a Package if it has not been modified,
|
* are met:
|
||||||
or has been modified in accordance with the wishes of the Copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
Holder.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
"Copyright Holder" is whoever is named in the copyright or copyrights
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
for the package.
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the copyright holders or contributors may not be used to
|
||||||
"You" is you, if you're thinking about copying or distributing this
|
* endorse or promote products derived from this software without
|
||||||
Package.
|
* specific prior written permission.
|
||||||
|
*
|
||||||
"Reasonable copying fee" is whatever you can justify on the basis of
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
media cost, duplication charges, time of people involved, and so on.
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
(You will not be required to justify it to the Copyright Holder, but
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
only to the computing community at large as a market that must bear the
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
fee.)
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
"Freely Available" means that no fee is charged for the item itself,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
though there may be fees involved in handling the item. It also means
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
that recipients of the item may redistribute it under the same
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
conditions they received it.
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
1. You may make and give away verbatim copies of the source form of the
|
|
||||||
Standard Version of this Package without restriction, provided that you
|
|
||||||
duplicate all of the original copyright notices and associated
|
|
||||||
disclaimers.
|
|
||||||
|
|
||||||
2. You may apply bug fixes, portability fixes and other modifications
|
|
||||||
derived from the Public Domain or from the Copyright Holder. A Package
|
|
||||||
modified in such a way shall still be considered the Standard Version.
|
|
||||||
|
|
||||||
3. You may otherwise modify your copy of this Package in any way,
|
|
||||||
provided that you insert a prominent notice in each changed file stating
|
|
||||||
how and when AND WHY you changed that file, and provided that you do at
|
|
||||||
least ONE of the following:
|
|
||||||
|
|
||||||
a) place your modifications in the Public Domain or otherwise make them
|
|
||||||
Freely Available, such as by posting said modifications to Usenet or an
|
|
||||||
equivalent medium, or placing the modifications on a major archive site
|
|
||||||
such as uunet.uu.net, or by allowing the Copyright Holder to include
|
|
||||||
your modifications in the Standard Version of the Package.
|
|
||||||
|
|
||||||
b) use the modified Package only within your corporation or organization.
|
|
||||||
|
|
||||||
c) rename any non-standard executables so the names do not conflict with
|
|
||||||
standard executables, which must also be provided, and provide separate
|
|
||||||
documentation for each non-standard executable that clearly documents
|
|
||||||
how it differs from the Standard Version.
|
|
||||||
|
|
||||||
d) make other distribution arrangements with the Copyright Holder.
|
|
||||||
|
|
||||||
4. You may distribute the programs of this Package in object code or
|
|
||||||
executable form, provided that you do at least ONE of the following:
|
|
||||||
|
|
||||||
a) distribute a Standard Version of the executables and library files,
|
|
||||||
together with instructions (in the manual page or equivalent) on where
|
|
||||||
to get the Standard Version.
|
|
||||||
|
|
||||||
b) accompany the distribution with the machine-readable source of the
|
|
||||||
Package with your modifications.
|
|
||||||
|
|
||||||
c) accompany any non-standard executables with their corresponding
|
|
||||||
Standard Version executables, giving the non-standard executables
|
|
||||||
non-standard names, and clearly documenting the differences in manual
|
|
||||||
pages (or equivalent), together with instructions on where to get the
|
|
||||||
Standard Version.
|
|
||||||
|
|
||||||
d) make other distribution arrangements with the Copyright Holder.
|
|
||||||
|
|
||||||
5. You may charge a reasonable copying fee for any distribution of this
|
|
||||||
Package. You may charge any fee you choose for support of this Package.
|
|
||||||
YOU MAY NOT CHARGE A FEE FOR THIS PACKAGE ITSELF. However, you may
|
|
||||||
distribute this Package in aggregate with other (possibly commercial)
|
|
||||||
programs as part of a larger (possibly commercial) software distribution
|
|
||||||
provided that YOU DO NOT ADVERTISE this package as a product of your
|
|
||||||
own.
|
|
||||||
|
|
||||||
6. The name of the Copyright Holder may not be used to endorse or
|
|
||||||
promote products derived from this software without specific prior
|
|
||||||
written permission.
|
|
||||||
|
|
||||||
7. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
||||||
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
The End
|
|
||||||
|
|||||||
86
ChangeLog
86
ChangeLog
@@ -1,3 +1,89 @@
|
|||||||
|
2022-08-15 Serge Hallyn <serge@hallyn.com>
|
||||||
|
|
||||||
|
* Address CVE-2013-4235 (TOCTTOU when copying directories)
|
||||||
|
(Christian Göttsche)
|
||||||
|
|
||||||
|
2022-08-15 Serge Hallyn <serge@hallyn.com>
|
||||||
|
|
||||||
|
* Fix uk manpages
|
||||||
|
|
||||||
|
2022-08-08 Serge Hallyn <serge@hallyn.com>
|
||||||
|
|
||||||
|
* Add absolute path hint to --root (Celeste Liu)
|
||||||
|
* Various cleanups (Christian Göttsche)
|
||||||
|
* Fix Ubuntu release used in CI tests (Jeremy Whiting)
|
||||||
|
* add -F options to useradd (and tests) (Masatake YAMATO)
|
||||||
|
* useradd manpage updates (Masatake YAMATO and Alexander Zhang))
|
||||||
|
* Check for ownerid (not just username) in subid ranges (Iker Pedrosa)
|
||||||
|
|
||||||
|
2022-07-04 Serge Hallyn <serge@hallyn.com>
|
||||||
|
|
||||||
|
* Declare file local functions static (Christian Göttsche)
|
||||||
|
* Use strict prototypes (Christian Göttsche)
|
||||||
|
* Do not drop const qualifier for Basename (Christian Göttsche)
|
||||||
|
* Constify various pointers (Christian Göttsche)
|
||||||
|
* Don't return uninitialized memory (Christian Göttsche)
|
||||||
|
* Don't let compiler optimize away memory cleaning (Christian Göttsche)
|
||||||
|
* Remove many obsolete compatibility checks and defines (Alejandro Colomar)
|
||||||
|
* Modify ID range check in useradd (Iker Pedrosa)
|
||||||
|
* Use "extern "C"" to make libsubid easier to use from C++ (Alois Wohlschlager)
|
||||||
|
* French translation updates (bubu)
|
||||||
|
* Fix s/with-pam/with-libpam/ (serge)
|
||||||
|
* Spanish translation updates (Fernando)
|
||||||
|
* French translation fixes (Balint Reczey)
|
||||||
|
* Default max group name length to 32 (Jami Kettunen)
|
||||||
|
* Fix PAM service files without-selinux (Ali Riza KESKIN)
|
||||||
|
* Improve manpages (Markus Hiereth)
|
||||||
|
- groupadd, useradd, usermod
|
||||||
|
- groups and id
|
||||||
|
- pwck
|
||||||
|
* Add fedora to CI builds (Iker Pedrosa)
|
||||||
|
* Fix condition under which pw_dir check happens (Ed Neville)
|
||||||
|
* logoutd: switch to strncat (Steve Grubb)
|
||||||
|
* AUTHORS: improve markdown output (Iker Pedrosa)
|
||||||
|
* Handle ERANGE errors correctly (Niko)
|
||||||
|
* Check for fopen NULL return (juyin)
|
||||||
|
* Split get_salt() into its own fn juyin)
|
||||||
|
* Get salt before chroot to ensure /dev/urandom. (juyin)
|
||||||
|
* Chpasswd code cleanup (juyin)
|
||||||
|
* Work around git safe.directory enforcement (serge)
|
||||||
|
* Alphabetize order in usermod help (Matheus Marques)
|
||||||
|
* Erase password copy on error branches (Christian Göttsche)
|
||||||
|
* Suggest using --badname if needed (Iker Pedrosa)
|
||||||
|
* Update translation files (Iker Pedrosa)
|
||||||
|
* Correct badnames option to badname (Iker Pedrosa)
|
||||||
|
* configure: replace obsolete autoconf macros (Christian Göttsche)
|
||||||
|
* tests: replace egrep with grep -E (Sam James)
|
||||||
|
* Update Ukrainian translations (Yuri Chornoivan)
|
||||||
|
* Cleanups (Iker Pedrosa)
|
||||||
|
- Remove redeclared variable
|
||||||
|
- Remove commented out code and FIXMEs
|
||||||
|
- Add header guards
|
||||||
|
- Initialize local variables
|
||||||
|
* CI updates (Iker Pedrosa)
|
||||||
|
- Create github workflow to install dependencies
|
||||||
|
- Enable CodeQL
|
||||||
|
- Update actions version
|
||||||
|
* libmisc: use /dev/urandom as fallback if other methods fail (Xi Ruoyao)
|
||||||
|
|
||||||
|
|
||||||
|
2022-01-02 Serge Hallyn <serge@hallyn.com>
|
||||||
|
|
||||||
|
* build: include lib/shadowlog_internal.h in dist tarballs (Sam James)
|
||||||
|
|
||||||
|
2022-01-02 Serge Hallyn <serge@hallyn.com>
|
||||||
|
|
||||||
|
* Handle possible TOCTTOU issues in usermod/userdel (edneville)
|
||||||
|
* (CVE-2013-4235)
|
||||||
|
* Use O_NOFOLLOW when copying file
|
||||||
|
* Kill all user tasks in userdel
|
||||||
|
* Fix useradd -D segfault (Xi Ruoyao)
|
||||||
|
* Clean up obsolete libc feature-check ifdefs (Alejandro Colomar)
|
||||||
|
* Fix -fno-common build breaks due to duplicate Prog declarations
|
||||||
|
(Adam Sampson)
|
||||||
|
* Have single date_to_str definition (Alejandro Colomar)
|
||||||
|
* Fix libsubid SONAME version (Sam James)
|
||||||
|
|
||||||
2021-12-19 Serge Hallyn <serge@hallyn.com>
|
2021-12-19 Serge Hallyn <serge@hallyn.com>
|
||||||
|
|
||||||
Note: From this release forward, su from this package should be
|
Note: From this release forward, su from this package should be
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ AC_DEFUN([JH_PATH_XML_CATALOG],
|
|||||||
[
|
[
|
||||||
# check for the presence of the XML catalog
|
# check for the presence of the XML catalog
|
||||||
AC_ARG_WITH([xml-catalog],
|
AC_ARG_WITH([xml-catalog],
|
||||||
AC_HELP_STRING([--with-xml-catalog=CATALOG],
|
AS_HELP_STRING([--with-xml-catalog=CATALOG],
|
||||||
[path to xml catalog to use]),,
|
[path to xml catalog to use]),,
|
||||||
[with_xml_catalog=/etc/xml/catalog])
|
[with_xml_catalog=/etc/xml/catalog])
|
||||||
jh_found_xmlcatalog=true
|
jh_found_xmlcatalog=true
|
||||||
|
|||||||
95
configure.ac
95
configure.ac
@@ -4,7 +4,7 @@ m4_define([libsubid_abi_major], 4)
|
|||||||
m4_define([libsubid_abi_minor], 0)
|
m4_define([libsubid_abi_minor], 0)
|
||||||
m4_define([libsubid_abi_micro], 0)
|
m4_define([libsubid_abi_micro], 0)
|
||||||
m4_define([libsubid_abi], [libsubid_abi_major.libsubid_abi_minor.libsubid_abi_micro])
|
m4_define([libsubid_abi], [libsubid_abi_major.libsubid_abi_minor.libsubid_abi_micro])
|
||||||
AC_INIT([shadow], [4.10], [pkg-shadow-devel@lists.alioth.debian.org], [],
|
AC_INIT([shadow], [4.12.2], [pkg-shadow-devel@lists.alioth.debian.org], [],
|
||||||
[https://github.com/shadow-maint/shadow])
|
[https://github.com/shadow-maint/shadow])
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
|
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
|
||||||
AC_CONFIG_MACRO_DIRS([m4])
|
AC_CONFIG_MACRO_DIRS([m4])
|
||||||
@@ -20,26 +20,22 @@ dnl Some hacks...
|
|||||||
test "$prefix" = "NONE" && prefix="/usr"
|
test "$prefix" = "NONE" && prefix="/usr"
|
||||||
test "$prefix" = "/usr" && exec_prefix=""
|
test "$prefix" = "/usr" && exec_prefix=""
|
||||||
|
|
||||||
AC_GNU_SOURCE
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
|
||||||
AM_ENABLE_STATIC
|
AC_ENABLE_STATIC
|
||||||
AM_ENABLE_SHARED
|
AC_ENABLE_SHARED
|
||||||
|
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_ISC_POSIX
|
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AM_PROG_LIBTOOL
|
LT_INIT
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_DIRENT
|
|
||||||
AC_HEADER_STDC
|
|
||||||
AC_HEADER_SYS_WAIT
|
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
|
|
||||||
AC_CHECK_HEADERS(crypt.h errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
|
AC_CHECK_HEADERS(crypt.h errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
|
||||||
@@ -51,27 +47,19 @@ AC_CHECK_HEADERS(crypt.h errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
|
|||||||
dnl shadow now uses the libc's shadow implementation
|
dnl shadow now uses the libc's shadow implementation
|
||||||
AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
|
AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
|
||||||
|
|
||||||
AC_CHECK_FUNCS(arc4random_buf l64a fchmod fchown fsync futimes getgroups \
|
AC_CHECK_FUNCS(arc4random_buf l64a fchmod fchown fsync futimes \
|
||||||
gethostname getentropy getrandom getspnam gettimeofday getusershell \
|
getentropy getrandom getspnam getusershell \
|
||||||
getutent initgroups lchown lckpwdf lstat lutimes memcpy memset \
|
getutent initgroups lckpwdf lutimes \
|
||||||
setgroups sigaction strchr updwtmp updwtmpx innetgr getpwnam_r \
|
setgroups updwtmp updwtmpx innetgr getpwnam_r \
|
||||||
getpwuid_r getgrnam_r getgrgid_r getspnam_r getaddrinfo ruserok \
|
getpwuid_r getgrnam_r getgrgid_r getspnam_r \
|
||||||
dlopen)
|
memset_s explicit_bzero)
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
|
||||||
AC_TYPE_UID_T
|
|
||||||
AC_TYPE_OFF_T
|
|
||||||
AC_TYPE_PID_T
|
|
||||||
AC_TYPE_MODE_T
|
|
||||||
AC_HEADER_STAT
|
|
||||||
AC_CHECK_MEMBERS([struct stat.st_rdev])
|
|
||||||
AC_CHECK_MEMBERS([struct stat.st_atim])
|
AC_CHECK_MEMBERS([struct stat.st_atim])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_atimensec])
|
AC_CHECK_MEMBERS([struct stat.st_atimensec])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_mtim])
|
AC_CHECK_MEMBERS([struct stat.st_mtim])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_mtimensec])
|
AC_CHECK_MEMBERS([struct stat.st_mtimensec])
|
||||||
AC_HEADER_TIME
|
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
|
|
||||||
AC_CHECK_MEMBERS([struct utmp.ut_type,
|
AC_CHECK_MEMBERS([struct utmp.ut_type,
|
||||||
@@ -113,9 +101,7 @@ fi
|
|||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_TYPE_GETGROUPS
|
AC_TYPE_GETGROUPS
|
||||||
AC_TYPE_SIGNAL
|
|
||||||
AC_FUNC_UTIME_NULL
|
AC_FUNC_UTIME_NULL
|
||||||
AC_FUNC_STRFTIME
|
|
||||||
AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
|
AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
|
||||||
AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
|
AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
|
||||||
AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
|
AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
|
||||||
@@ -212,7 +198,7 @@ if test "$ac_cv_func_ruserok" = "yes"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(shadowgrp,
|
AC_ARG_ENABLE(shadowgrp,
|
||||||
[AC_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
|
[AS_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
yes) enable_shadowgrp="yes" ;;
|
yes) enable_shadowgrp="yes" ;;
|
||||||
no) enable_shadowgrp="no" ;;
|
no) enable_shadowgrp="no" ;;
|
||||||
@@ -222,15 +208,15 @@ AC_ARG_ENABLE(shadowgrp,
|
|||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_ENABLE(man,
|
AC_ARG_ENABLE(man,
|
||||||
[AC_HELP_STRING([--enable-man],
|
[AS_HELP_STRING([--enable-man],
|
||||||
[regenerate roff man pages from Docbook @<:@default=no@:>@])],
|
[regenerate roff man pages from Docbook @<:@default=no@:>@])],
|
||||||
[enable_man="${enableval}"],
|
[enable_man="${enableval}"],
|
||||||
[enable_man="no"]
|
[enable_man="no"]
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_ENABLE(account-tools-setuid,
|
AC_ARG_ENABLE(account-tools-setuid,
|
||||||
[AC_HELP_STRING([--enable-account-tools-setuid],
|
[AS_HELP_STRING([--enable-account-tools-setuid],
|
||||||
[Install the user and group management tools setuid and authenticate the callers. This requires --with-pam.])],
|
[Install the user and group management tools setuid and authenticate the callers. This requires --with-libpam.])],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
yes) enable_acct_tools_setuid="yes" ;;
|
yes) enable_acct_tools_setuid="yes" ;;
|
||||||
no) enable_acct_tools_setuid="no" ;;
|
no) enable_acct_tools_setuid="no" ;;
|
||||||
@@ -241,7 +227,7 @@ AC_ARG_ENABLE(account-tools-setuid,
|
|||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_ENABLE(utmpx,
|
AC_ARG_ENABLE(utmpx,
|
||||||
[AC_HELP_STRING([--enable-utmpx],
|
[AS_HELP_STRING([--enable-utmpx],
|
||||||
[enable loggin in utmpx / wtmpx @<:@default=no@:>@])],
|
[enable loggin in utmpx / wtmpx @<:@default=no@:>@])],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
yes) enable_utmpx="yes" ;;
|
yes) enable_utmpx="yes" ;;
|
||||||
@@ -252,65 +238,65 @@ AC_ARG_ENABLE(utmpx,
|
|||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_ENABLE(subordinate-ids,
|
AC_ARG_ENABLE(subordinate-ids,
|
||||||
[AC_HELP_STRING([--enable-subordinate-ids],
|
[AS_HELP_STRING([--enable-subordinate-ids],
|
||||||
[support subordinate ids @<:@default=yes@:>@])],
|
[support subordinate ids @<:@default=yes@:>@])],
|
||||||
[enable_subids="${enableval}"],
|
[enable_subids="${enableval}"],
|
||||||
[enable_subids="maybe"]
|
[enable_subids="maybe"]
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_ARG_WITH(audit,
|
AC_ARG_WITH(audit,
|
||||||
[AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
|
[AS_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
|
||||||
[with_audit=$withval], [with_audit=maybe])
|
[with_audit=$withval], [with_audit=maybe])
|
||||||
AC_ARG_WITH(libpam,
|
AC_ARG_WITH(libpam,
|
||||||
[AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
|
[AS_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
|
||||||
[with_libpam=$withval], [with_libpam=maybe])
|
[with_libpam=$withval], [with_libpam=maybe])
|
||||||
AC_ARG_WITH(btrfs,
|
AC_ARG_WITH(btrfs,
|
||||||
[AC_HELP_STRING([--with-btrfs], [add BtrFS support @<:@default=yes if found@:>@])],
|
[AS_HELP_STRING([--with-btrfs], [add BtrFS support @<:@default=yes if found@:>@])],
|
||||||
[with_btrfs=$withval], [with_btrfs=maybe])
|
[with_btrfs=$withval], [with_btrfs=maybe])
|
||||||
AC_ARG_WITH(selinux,
|
AC_ARG_WITH(selinux,
|
||||||
[AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=yes if found@:>@])],
|
[AS_HELP_STRING([--with-selinux], [use SELinux support @<:@default=yes if found@:>@])],
|
||||||
[with_selinux=$withval], [with_selinux=maybe])
|
[with_selinux=$withval], [with_selinux=maybe])
|
||||||
AC_ARG_WITH(acl,
|
AC_ARG_WITH(acl,
|
||||||
[AC_HELP_STRING([--with-acl], [use ACL support @<:@default=yes if found@:>@])],
|
[AS_HELP_STRING([--with-acl], [use ACL support @<:@default=yes if found@:>@])],
|
||||||
[with_acl=$withval], [with_acl=maybe])
|
[with_acl=$withval], [with_acl=maybe])
|
||||||
AC_ARG_WITH(attr,
|
AC_ARG_WITH(attr,
|
||||||
[AC_HELP_STRING([--with-attr], [use Extended Attribute support @<:@default=yes if found@:>@])],
|
[AS_HELP_STRING([--with-attr], [use Extended Attribute support @<:@default=yes if found@:>@])],
|
||||||
[with_attr=$withval], [with_attr=maybe])
|
[with_attr=$withval], [with_attr=maybe])
|
||||||
AC_ARG_WITH(skey,
|
AC_ARG_WITH(skey,
|
||||||
[AC_HELP_STRING([--with-skey], [use S/Key support @<:@default=no@:>@])],
|
[AS_HELP_STRING([--with-skey], [use S/Key support @<:@default=no@:>@])],
|
||||||
[with_skey=$withval], [with_skey=no])
|
[with_skey=$withval], [with_skey=no])
|
||||||
AC_ARG_WITH(tcb,
|
AC_ARG_WITH(tcb,
|
||||||
[AC_HELP_STRING([--with-tcb], [use tcb support (incomplete) @<:@default=yes if found@:>@])],
|
[AS_HELP_STRING([--with-tcb], [use tcb support (incomplete) @<:@default=yes if found@:>@])],
|
||||||
[with_tcb=$withval], [with_tcb=maybe])
|
[with_tcb=$withval], [with_tcb=maybe])
|
||||||
AC_ARG_WITH(libcrack,
|
AC_ARG_WITH(libcrack,
|
||||||
[AC_HELP_STRING([--with-libcrack], [use libcrack @<:@default=no@:>@])],
|
[AS_HELP_STRING([--with-libcrack], [use libcrack @<:@default=no@:>@])],
|
||||||
[with_libcrack=$withval], [with_libcrack=no])
|
[with_libcrack=$withval], [with_libcrack=no])
|
||||||
AC_ARG_WITH(sha-crypt,
|
AC_ARG_WITH(sha-crypt,
|
||||||
[AC_HELP_STRING([--with-sha-crypt], [allow the SHA256 and SHA512 password encryption algorithms @<:@default=yes@:>@])],
|
[AS_HELP_STRING([--with-sha-crypt], [allow the SHA256 and SHA512 password encryption algorithms @<:@default=yes@:>@])],
|
||||||
[with_sha_crypt=$withval], [with_sha_crypt=yes])
|
[with_sha_crypt=$withval], [with_sha_crypt=yes])
|
||||||
AC_ARG_WITH(bcrypt,
|
AC_ARG_WITH(bcrypt,
|
||||||
[AC_HELP_STRING([--with-bcrypt], [allow the bcrypt password encryption algorithm @<:@default=no@:>@])],
|
[AS_HELP_STRING([--with-bcrypt], [allow the bcrypt password encryption algorithm @<:@default=no@:>@])],
|
||||||
[with_bcrypt=$withval], [with_bcrypt=no])
|
[with_bcrypt=$withval], [with_bcrypt=no])
|
||||||
AC_ARG_WITH(yescrypt,
|
AC_ARG_WITH(yescrypt,
|
||||||
[AC_HELP_STRING([--with-yescrypt], [allow the yescrypt password encryption algorithm @<:@default=no@:>@])],
|
[AS_HELP_STRING([--with-yescrypt], [allow the yescrypt password encryption algorithm @<:@default=no@:>@])],
|
||||||
[with_yescrypt=$withval], [with_yescrypt=no])
|
[with_yescrypt=$withval], [with_yescrypt=no])
|
||||||
AC_ARG_WITH(nscd,
|
AC_ARG_WITH(nscd,
|
||||||
[AC_HELP_STRING([--with-nscd], [enable support for nscd @<:@default=yes@:>@])],
|
[AS_HELP_STRING([--with-nscd], [enable support for nscd @<:@default=yes@:>@])],
|
||||||
[with_nscd=$withval], [with_nscd=yes])
|
[with_nscd=$withval], [with_nscd=yes])
|
||||||
AC_ARG_WITH(sssd,
|
AC_ARG_WITH(sssd,
|
||||||
[AC_HELP_STRING([--with-sssd], [enable support for flushing sssd caches @<:@default=yes@:>@])],
|
[AS_HELP_STRING([--with-sssd], [enable support for flushing sssd caches @<:@default=yes@:>@])],
|
||||||
[with_sssd=$withval], [with_sssd=yes])
|
[with_sssd=$withval], [with_sssd=yes])
|
||||||
AC_ARG_WITH(group-name-max-length,
|
AC_ARG_WITH(group-name-max-length,
|
||||||
[AC_HELP_STRING([--with-group-name-max-length], [set max group name length @<:@default=16@:>@])],
|
[AS_HELP_STRING([--with-group-name-max-length], [set max group name length @<:@default=32@:>@])],
|
||||||
[with_group_name_max_length=$withval], [with_group_name_max_length=yes])
|
[with_group_name_max_length=$withval], [with_group_name_max_length=yes])
|
||||||
AC_ARG_WITH(su,
|
AC_ARG_WITH(su,
|
||||||
[AC_HELP_STRING([--with-su], [build and install su program and man page @<:@default=yes@:>@])],
|
[AS_HELP_STRING([--with-su], [build and install su program and man page @<:@default=yes@:>@])],
|
||||||
[with_su=$withval], [with_su=yes])
|
[with_su=$withval], [with_su=yes])
|
||||||
|
|
||||||
if test "$with_group_name_max_length" = "no" ; then
|
if test "$with_group_name_max_length" = "no" ; then
|
||||||
with_group_name_max_length=0
|
with_group_name_max_length=0
|
||||||
elif test "$with_group_name_max_length" = "yes" ; then
|
elif test "$with_group_name_max_length" = "yes" ; then
|
||||||
with_group_name_max_length=16
|
with_group_name_max_length=32
|
||||||
fi
|
fi
|
||||||
AC_DEFINE_UNQUOTED(GROUP_NAME_MAX_LENGTH, $with_group_name_max_length, [max group name length])
|
AC_DEFINE_UNQUOTED(GROUP_NAME_MAX_LENGTH, $with_group_name_max_length, [max group name length])
|
||||||
AC_SUBST(GROUP_NAME_MAX_LENGTH)
|
AC_SUBST(GROUP_NAME_MAX_LENGTH)
|
||||||
@@ -321,8 +307,6 @@ if test "$with_sha_crypt" = "yes"; then
|
|||||||
AC_DEFINE(USE_SHA_CRYPT, 1, [Define to allow the SHA256 and SHA512 password encryption algorithms])
|
AC_DEFINE(USE_SHA_CRYPT, 1, [Define to allow the SHA256 and SHA512 password encryption algorithms])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(ENABLE_SHARED, test "x$enable_shared" = "xyes")
|
|
||||||
|
|
||||||
AM_CONDITIONAL(USE_BCRYPT, test "x$with_bcrypt" = "xyes")
|
AM_CONDITIONAL(USE_BCRYPT, test "x$with_bcrypt" = "xyes")
|
||||||
if test "$with_bcrypt" = "yes"; then
|
if test "$with_bcrypt" = "yes"; then
|
||||||
AC_DEFINE(USE_BCRYPT, 1, [Define to allow the bcrypt password encryption algorithm])
|
AC_DEFINE(USE_BCRYPT, 1, [Define to allow the bcrypt password encryption algorithm])
|
||||||
@@ -672,7 +656,7 @@ AM_CONDITIONAL(ACCT_TOOLS_SETUID, test "x$enable_acct_tools_setuid" = "xyes")
|
|||||||
|
|
||||||
|
|
||||||
AC_ARG_WITH(fcaps,
|
AC_ARG_WITH(fcaps,
|
||||||
[AC_HELP_STRING([--with-fcaps], [use file capabilities instead of suid binaries for newuidmap/newgidmap @<:@default=no@:>@])],
|
[AS_HELP_STRING([--with-fcaps], [use file capabilities instead of suid binaries for newuidmap/newgidmap @<:@default=no@:>@])],
|
||||||
[with_fcaps=$withval], [with_fcaps=no])
|
[with_fcaps=$withval], [with_fcaps=no])
|
||||||
AM_CONDITIONAL(FCAPS, test "x$with_fcaps" = "xyes")
|
AM_CONDITIONAL(FCAPS, test "x$with_fcaps" = "xyes")
|
||||||
|
|
||||||
@@ -690,12 +674,12 @@ if test "$with_skey" = "yes"; then
|
|||||||
AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
|
AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
|
||||||
[AC_MSG_ERROR([liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])])
|
[AC_MSG_ERROR([liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])])
|
||||||
AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
|
AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
|
||||||
AC_TRY_COMPILE([
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <skey.h>
|
#include <skey.h>
|
||||||
],[
|
]], [[
|
||||||
skeychallenge((void*)0, (void*)0, (void*)0, 0);
|
skeychallenge((void*)0, (void*)0, (void*)0, 0);
|
||||||
],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])])
|
]])],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])],[])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$enable_utmpx" = "yes"; then
|
if test "$enable_utmpx" = "yes"; then
|
||||||
@@ -709,7 +693,7 @@ fi
|
|||||||
|
|
||||||
AC_DEFINE_UNQUOTED(SHELL, ["$SHELL"], [The default shell.])
|
AC_DEFINE_UNQUOTED(SHELL, ["$SHELL"], [The default shell.])
|
||||||
|
|
||||||
AM_GNU_GETTEXT_VERSION(0.16)
|
AM_GNU_GETTEXT_VERSION([0.19])
|
||||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||||
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
|
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
|
||||||
|
|
||||||
@@ -736,6 +720,7 @@ AC_CONFIG_FILES([
|
|||||||
man/ru/Makefile
|
man/ru/Makefile
|
||||||
man/sv/Makefile
|
man/sv/Makefile
|
||||||
man/tr/Makefile
|
man/tr/Makefile
|
||||||
|
man/uk/Makefile
|
||||||
man/zh_CN/Makefile
|
man/zh_CN/Makefile
|
||||||
man/zh_TW/Makefile
|
man/zh_TW/Makefile
|
||||||
libmisc/Makefile
|
libmisc/Makefile
|
||||||
|
|||||||
@@ -1,34 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# Copyright (c) 1996 Brian R. Gaeke
|
# SPDX-FileCopyrightText: 1996 Brian R. Gaeke
|
||||||
# All rights reserved.
|
# SPDX-License-Identifier: BSD-4-Clause
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# 3. All advertising materials mentioning features or use of this software
|
|
||||||
# must display the following acknowledgement:
|
|
||||||
# This product includes software developed by Brian R. Gaeke.
|
|
||||||
# 4. The name of the author, Brian R. Gaeke, may not be used to endorse
|
|
||||||
# or promote products derived from this software without specific
|
|
||||||
# prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY BRIAN R. GAEKE ``AS IS'' AND ANY EXPRESS
|
|
||||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
# DISCLAIMED. IN NO EVENT SHALL BRIAN R. GAEKE BE LIABLE FOR ANY DIRECT,
|
|
||||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
||||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
#
|
||||||
# Additionally:
|
# Additionally:
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -76,36 +76,9 @@ else
|
|||||||
$echo 'x -' extracting 'Makefile' '(text)'
|
$echo 'x -' extracting 'Makefile' '(text)'
|
||||||
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
|
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
|
||||||
/*
|
/*
|
||||||
# Copyright 2000, International Business Machines, Inc.
|
# SPDX-FileCopyrightText: 2000, International Business Machines, Inc.
|
||||||
# All rights reserved.
|
# SPDX-FileCopyrightText: 2000, George Kraft IV, gk4@us.ibm.com
|
||||||
#
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
# original author: George Kraft IV, gk4@us.ibm.com
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# 3. Neither the name of International Business Machines, Inc., nor the
|
|
||||||
# names of its contributors may be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY INTERNATIONAL BUSINESS MACHINES, INC. AND
|
|
||||||
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
|
||||||
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
# INTERNATIONAL BUSINESS MACHINES, INC. OR CONTRIBUTORS BE LIABLE
|
|
||||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
# SUCH DAMAGE.
|
|
||||||
#
|
#
|
||||||
X
|
X
|
||||||
all: groupmems
|
all: groupmems
|
||||||
@@ -143,36 +116,9 @@ else
|
|||||||
$echo 'x -' extracting 'groupmems.c' '(text)'
|
$echo 'x -' extracting 'groupmems.c' '(text)'
|
||||||
sed 's/^X//' << 'SHAR_EOF' > 'groupmems.c' &&
|
sed 's/^X//' << 'SHAR_EOF' > 'groupmems.c' &&
|
||||||
/*
|
/*
|
||||||
X * Copyright 2000, International Business Machines, Inc.
|
X * SPDX-FileCopyrightText: 2000, International Business Machines, Inc.
|
||||||
X * All rights reserved.
|
X * SPDX-FileCopyrightText: 2000, George Kraft IV, gk4@us.ibm.com
|
||||||
X *
|
X * SPDX-License-Identifier: BSD-3-Clause
|
||||||
X * original author: George Kraft IV, gk4@us.ibm.com
|
|
||||||
X *
|
|
||||||
X * Redistribution and use in source and binary forms, with or without
|
|
||||||
X * modification, are permitted provided that the following conditions
|
|
||||||
X * are met:
|
|
||||||
X *
|
|
||||||
X * 1. Redistributions of source code must retain the above copyright
|
|
||||||
X * notice, this list of conditions and the following disclaimer.
|
|
||||||
X * 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
X * notice, this list of conditions and the following disclaimer in the
|
|
||||||
X * documentation and/or other materials provided with the distribution.
|
|
||||||
X * 3. Neither the name of International Business Machines, Inc., nor the
|
|
||||||
X * names of its contributors may be used to endorse or promote products
|
|
||||||
X * derived from this software without specific prior written permission.
|
|
||||||
X *
|
|
||||||
X * THIS SOFTWARE IS PROVIDED BY INTERNATIONAL BUSINESS MACHINES, INC. AND
|
|
||||||
X * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
|
||||||
X * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
X * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
X * INTERNATIONAL BUSINESS MACHINES, INC. OR CONTRIBUTORS BE LIABLE
|
|
||||||
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
X * SUCH DAMAGE.
|
|
||||||
X */
|
X */
|
||||||
/*
|
/*
|
||||||
**
|
**
|
||||||
@@ -436,36 +382,9 @@ else
|
|||||||
$echo 'x -' extracting 'groupmems.8' '(text)'
|
$echo 'x -' extracting 'groupmems.8' '(text)'
|
||||||
sed 's/^X//' << 'SHAR_EOF' > 'groupmems.8' &&
|
sed 's/^X//' << 'SHAR_EOF' > 'groupmems.8' &&
|
||||||
X.\"
|
X.\"
|
||||||
X.\" Copyright 2000, International Business Machines, Inc.
|
X.\" SPDX-FileCopyrightText: 2000, International Business Machines, Inc.
|
||||||
X.\" All rights reserved.
|
X.\" SPDX-FileCopyrightText: 2000, George Kraft IV, gk4@us.ibm.com
|
||||||
X.\"
|
X.\" SPDX-License-Identifier: BSD-3-Clause
|
||||||
X.\" original author: George Kraft IV, gk4@us.ibm.com
|
|
||||||
X.\"
|
|
||||||
X.\" Redistribution and use in source and binary forms, with or without
|
|
||||||
X.\" modification, are permitted provided that the following conditions
|
|
||||||
X.\" are met:
|
|
||||||
X.\"
|
|
||||||
X.\" 1. Redistributions of source code must retain the above copyright
|
|
||||||
X.\" notice, this list of conditions and the following disclaimer.
|
|
||||||
X.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
X.\" notice, this list of conditions and the following disclaimer in the
|
|
||||||
X.\" documentation and/or other materials provided with the distribution.
|
|
||||||
X.\" 3. Neither the name of International Business Machines, Inc., nor the
|
|
||||||
X.\" names of its contributors may be used to endorse or promote products
|
|
||||||
X.\" derived from this software without specific prior written permission.
|
|
||||||
X.\"
|
|
||||||
X.\" THIS SOFTWARE IS PROVIDED BY INTERNATIONAL BUSINESS MACHINES, INC. AND
|
|
||||||
X.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
|
||||||
X.\" BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
X.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
X.\" INTERNATIONAL BUSINESS MACHINES, INC. OR CONTRIBUTORS BE LIABLE
|
|
||||||
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
X.\" SUCH DAMAGE.
|
|
||||||
X.\"
|
X.\"
|
||||||
X.\" $Id$
|
X.\" $Id$
|
||||||
X.\"
|
X.\"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ auth include system-auth
|
|||||||
account required pam_nologin.so
|
account required pam_nologin.so
|
||||||
account include system-auth
|
account include system-auth
|
||||||
password include system-auth
|
password include system-auth
|
||||||
session required pam_selinux.so close
|
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
|
||||||
session include system-auth
|
session include system-auth
|
||||||
session required pam_loginuid.so
|
session required pam_loginuid.so
|
||||||
session optional pam_console.so
|
session optional pam_console.so
|
||||||
session required pam_selinux.so open
|
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ auth required pam_wheel.so use_uid
|
|||||||
auth include system-auth
|
auth include system-auth
|
||||||
account include system-auth
|
account include system-auth
|
||||||
password include system-auth
|
password include system-auth
|
||||||
session required pam_selinux.so close
|
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
|
||||||
session include system-auth
|
session include system-auth
|
||||||
session required pam_selinux.so open multiple
|
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
|
||||||
session optional pam_xauth.so
|
session optional pam_xauth.so
|
||||||
|
|||||||
28
etc/shadow-maint/userdel-pre.d/01-kill_user_procs.sh
Executable file
28
etc/shadow-maint/userdel-pre.d/01-kill_user_procs.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
|
||||||
|
# Check user exists, and if so, send sigkill to processes that the user owns
|
||||||
|
|
||||||
|
RUNNING=`ps -eo user | grep -Fx "$SUBJECT" | wc -l`
|
||||||
|
|
||||||
|
# if the user does not exist, RUNNING will be 0
|
||||||
|
|
||||||
|
if [ "${RUNNING}x" = "0x" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
ls -1 /proc | while IFS= read -r PROC; do
|
||||||
|
echo "$PROC" | grep -E '^[0-9]+$' >/dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [ -d "/proc/${PROC}" ]; then
|
||||||
|
USR=`stat -c "%U" /proc/${PROC}`
|
||||||
|
if [ "${USR}" = "${SUBJECT}" ]; then
|
||||||
|
echo "Killing ${SUBJECT} owned ${PROC}"
|
||||||
|
kill -9 "${PROC}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
@@ -36,6 +36,9 @@ libshadow_la_SOURCES = \
|
|||||||
nss.c \
|
nss.c \
|
||||||
nscd.c \
|
nscd.c \
|
||||||
nscd.h \
|
nscd.h \
|
||||||
|
shadowlog.c \
|
||||||
|
shadowlog.h \
|
||||||
|
shadowlog_internal.h \
|
||||||
sssd.c \
|
sssd.c \
|
||||||
sssd.h \
|
sssd.h \
|
||||||
pam_defs.h \
|
pam_defs.h \
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2001, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2001, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2011, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2011, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -51,6 +28,7 @@
|
|||||||
#endif /* WITH_TCB */
|
#endif /* WITH_TCB */
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "commonio.h"
|
#include "commonio.h"
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static int lrename (const char *, const char *);
|
static int lrename (const char *, const char *);
|
||||||
@@ -87,7 +65,6 @@ int lrename (const char *old, const char *new)
|
|||||||
int res;
|
int res;
|
||||||
char *r = NULL;
|
char *r = NULL;
|
||||||
|
|
||||||
#if defined(S_ISLNK)
|
|
||||||
#ifndef __GLIBC__
|
#ifndef __GLIBC__
|
||||||
char resolved_path[PATH_MAX];
|
char resolved_path[PATH_MAX];
|
||||||
#endif /* !__GLIBC__ */
|
#endif /* !__GLIBC__ */
|
||||||
@@ -104,7 +81,6 @@ int lrename (const char *old, const char *new)
|
|||||||
new = r;
|
new = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* S_ISLNK */
|
|
||||||
|
|
||||||
res = rename (old, new);
|
res = rename (old, new);
|
||||||
|
|
||||||
@@ -146,7 +122,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: %s: %s\n",
|
"%s: %s: %s\n",
|
||||||
Prog, file, strerror (errno));
|
shadow_progname, file, strerror (errno));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -158,7 +134,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: %s file write error: %s\n",
|
"%s: %s file write error: %s\n",
|
||||||
Prog, file, strerror (errno));
|
shadow_progname, file, strerror (errno));
|
||||||
}
|
}
|
||||||
(void) close (fd);
|
(void) close (fd);
|
||||||
unlink (file);
|
unlink (file);
|
||||||
@@ -168,7 +144,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: %s file sync error: %s\n",
|
"%s: %s file sync error: %s\n",
|
||||||
Prog, file, strerror (errno));
|
shadow_progname, file, strerror (errno));
|
||||||
}
|
}
|
||||||
(void) close (fd);
|
(void) close (fd);
|
||||||
unlink (file);
|
unlink (file);
|
||||||
@@ -181,7 +157,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if ((0==retval) && log) {
|
if ((0==retval) && log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: %s: lock file already used\n",
|
"%s: %s: lock file already used\n",
|
||||||
Prog, file);
|
shadow_progname, file);
|
||||||
}
|
}
|
||||||
unlink (file);
|
unlink (file);
|
||||||
return retval;
|
return retval;
|
||||||
@@ -192,7 +168,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: %s: %s\n",
|
"%s: %s: %s\n",
|
||||||
Prog, lock, strerror (errno));
|
shadow_progname, lock, strerror (errno));
|
||||||
}
|
}
|
||||||
unlink (file);
|
unlink (file);
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@@ -204,7 +180,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: existing lock file %s without a PID\n",
|
"%s: existing lock file %s without a PID\n",
|
||||||
Prog, lock);
|
shadow_progname, lock);
|
||||||
}
|
}
|
||||||
unlink (file);
|
unlink (file);
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@@ -215,7 +191,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: existing lock file %s with an invalid PID '%s'\n",
|
"%s: existing lock file %s with an invalid PID '%s'\n",
|
||||||
Prog, lock, buf);
|
shadow_progname, lock, buf);
|
||||||
}
|
}
|
||||||
unlink (file);
|
unlink (file);
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@@ -225,7 +201,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: lock %s already used by PID %lu\n",
|
"%s: lock %s already used by PID %lu\n",
|
||||||
Prog, lock, (unsigned long) pid);
|
shadow_progname, lock, (unsigned long) pid);
|
||||||
}
|
}
|
||||||
unlink (file);
|
unlink (file);
|
||||||
errno = EEXIST;
|
errno = EEXIST;
|
||||||
@@ -235,7 +211,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: cannot get lock %s: %s\n",
|
"%s: cannot get lock %s: %s\n",
|
||||||
Prog, lock, strerror (errno));
|
shadow_progname, lock, strerror (errno));
|
||||||
}
|
}
|
||||||
unlink (file);
|
unlink (file);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -247,13 +223,13 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
if ((0==retval) && log) {
|
if ((0==retval) && log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: %s: lock file already used\n",
|
"%s: %s: lock file already used\n",
|
||||||
Prog, file);
|
shadow_progname, file);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: cannot get lock %s: %s\n",
|
"%s: cannot get lock %s: %s\n",
|
||||||
Prog, lock, strerror (errno));
|
shadow_progname, lock, strerror (errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,7 +424,7 @@ int commonio_lock (struct commonio_db *db)
|
|||||||
if (geteuid () != 0) {
|
if (geteuid () != 0) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
"%s: Permission denied.\n",
|
"%s: Permission denied.\n",
|
||||||
Prog);
|
shadow_progname);
|
||||||
}
|
}
|
||||||
return 0; /* failure */
|
return 0; /* failure */
|
||||||
}
|
}
|
||||||
@@ -483,7 +459,7 @@ int commonio_lock (struct commonio_db *db)
|
|||||||
/* no unnecessary retries on "permission denied" errors */
|
/* no unnecessary retries on "permission denied" errors */
|
||||||
if (geteuid () != 0) {
|
if (geteuid () != 0) {
|
||||||
(void) fprintf (shadow_logfd, "%s: Permission denied.\n",
|
(void) fprintf (shadow_logfd, "%s: Permission denied.\n",
|
||||||
Prog);
|
shadow_progname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2010, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
101
lib/defines.h
101
lib/defines.h
@@ -22,8 +22,6 @@ typedef unsigned char _Bool;
|
|||||||
# define __bool_true_false_are_defined 1
|
# define __bool_true_false_are_defined 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
|
||||||
|
|
||||||
/* Take care of NLS matters. */
|
/* Take care of NLS matters. */
|
||||||
#ifdef S_SPLINT_S
|
#ifdef S_SPLINT_S
|
||||||
extern char *setlocale(int categories, const char *locale);
|
extern char *setlocale(int categories, const char *locale);
|
||||||
@@ -61,20 +59,8 @@ extern char * textdomain (const char * domainname);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if STDC_HEADERS
|
#include <stdlib.h>
|
||||||
# include <stdlib.h>
|
#include <string.h>
|
||||||
# include <string.h>
|
|
||||||
#else /* not STDC_HEADERS */
|
|
||||||
# ifndef HAVE_STRCHR
|
|
||||||
# define strchr index
|
|
||||||
# define strrchr rindex
|
|
||||||
# endif
|
|
||||||
char *strchr (), *strrchr (), *strtok ();
|
|
||||||
|
|
||||||
# ifndef HAVE_MEMCPY
|
|
||||||
# define memcpy(d, s, n) bcopy((s), (d), (n))
|
|
||||||
# endif
|
|
||||||
#endif /* not STDC_HEADERS */
|
|
||||||
|
|
||||||
#if HAVE_ERRNO_H
|
#if HAVE_ERRNO_H
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
@@ -82,15 +68,7 @@ char *strchr (), *strrchr (), *strtok ();
|
|||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#if HAVE_SYS_WAIT_H
|
#include <sys/wait.h>
|
||||||
# include <sys/wait.h>
|
|
||||||
#endif
|
|
||||||
#ifndef WEXITSTATUS
|
|
||||||
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
|
|
||||||
#endif
|
|
||||||
#ifndef WIFEXITED
|
|
||||||
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_UNISTD_H
|
#if HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
@@ -104,39 +82,26 @@ char *strchr (), *strrchr (), *strtok ();
|
|||||||
# include <crypt.h>
|
# include <crypt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIME_WITH_SYS_TIME
|
#include <sys/time.h>
|
||||||
# include <sys/time.h>
|
#include <time.h>
|
||||||
# include <time.h>
|
|
||||||
#else /* not TIME_WITH_SYS_TIME */
|
#ifdef HAVE_MEMSET_S
|
||||||
# if HAVE_SYS_TIME_H
|
# define memzero(ptr, size) memset_s((ptr), 0, (size))
|
||||||
# include <sys/time.h>
|
#elif defined HAVE_EXPLICIT_BZERO /* !HAVE_MEMSET_S */
|
||||||
# else
|
# define memzero(ptr, size) explicit_bzero((ptr), (size))
|
||||||
# include <time.h>
|
#else /* !HAVE_MEMSET_S && HAVE_EXPLICIT_BZERO */
|
||||||
# endif
|
static inline void memzero(void *ptr, size_t size)
|
||||||
#endif /* not TIME_WITH_SYS_TIME */
|
{
|
||||||
|
volatile unsigned char * volatile p = ptr;
|
||||||
|
while (size--) {
|
||||||
|
*p++ = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* !HAVE_MEMSET_S && !HAVE_EXPLICIT_BZERO */
|
||||||
|
|
||||||
#ifdef HAVE_MEMSET
|
|
||||||
# define memzero(ptr, size) memset((void *)(ptr), 0, (size))
|
|
||||||
#else
|
|
||||||
# define memzero(ptr, size) bzero((char *)(ptr), (size))
|
|
||||||
#endif
|
|
||||||
#define strzero(s) memzero(s, strlen(s)) /* warning: evaluates twice */
|
#define strzero(s) memzero(s, strlen(s)) /* warning: evaluates twice */
|
||||||
|
|
||||||
#ifdef HAVE_DIRENT_H /* DIR_SYSV */
|
#include <dirent.h>
|
||||||
# include <dirent.h>
|
|
||||||
# define DIRECT dirent
|
|
||||||
#else
|
|
||||||
# ifdef HAVE_SYS_NDIR_H /* DIR_XENIX */
|
|
||||||
# include <sys/ndir.h>
|
|
||||||
# endif
|
|
||||||
# ifdef HAVE_SYS_DIR_H /* DIR_??? */
|
|
||||||
# include <sys/dir.h>
|
|
||||||
# endif
|
|
||||||
# ifdef HAVE_NDIR_H /* DIR_BSD */
|
|
||||||
# include <ndir.h>
|
|
||||||
# endif
|
|
||||||
# define DIRECT direct
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Possible cases:
|
* Possible cases:
|
||||||
@@ -240,30 +205,6 @@ char *strchr (), *strrchr (), *strtok ();
|
|||||||
# define SEEK_END 2
|
# define SEEK_END 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STAT_MACROS_BROKEN
|
|
||||||
# define S_ISDIR(x) ((x) & S_IFMT) == S_IFDIR)
|
|
||||||
# define S_ISREG(x) ((x) & S_IFMT) == S_IFREG)
|
|
||||||
# ifdef S_IFLNK
|
|
||||||
# define S_ISLNK(x) ((x) & S_IFMT) == S_IFLNK)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef S_ISLNK
|
|
||||||
#define S_ISLNK(x) (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_LCHOWN
|
|
||||||
#define LCHOWN lchown
|
|
||||||
#else
|
|
||||||
#define LCHOWN chown
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_LSTAT
|
|
||||||
#define LSTAT lstat
|
|
||||||
#else
|
|
||||||
#define LSTAT stat
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAVE_TERMIOS_H
|
#if HAVE_TERMIOS_H
|
||||||
# include <termios.h>
|
# include <termios.h>
|
||||||
# define STTY(fd, termio) tcsetattr(fd, TCSANOW, termio)
|
# define STTY(fd, termio) tcsetattr(fd, TCSANOW, termio)
|
||||||
@@ -363,8 +304,10 @@ extern char *strerror ();
|
|||||||
/* To be used for verified unused parameters */
|
/* To be used for verified unused parameters */
|
||||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||||
# define unused __attribute__((unused))
|
# define unused __attribute__((unused))
|
||||||
|
# define format_attr(type, index, check) __attribute__((format (type, index, check)))
|
||||||
#else
|
#else
|
||||||
# define unused
|
# define unused
|
||||||
|
# define format_attr(type, index, check)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ! Arguments evaluated twice ! */
|
/* ! Arguments evaluated twice ! */
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1993, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1993, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2010, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -39,6 +16,7 @@
|
|||||||
|
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
/*@exposed@*//*@null@*/char *pw_encrypt (const char *clear, const char *salt)
|
/*@exposed@*//*@null@*/char *pw_encrypt (const char *clear, const char *salt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 - 2006, Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
33
lib/fields.c
33
lib/fields.c
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 , Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 , Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 , Nicolas François
|
* SPDX-FileCopyrightText: 2007 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
33
lib/fputsx.c
33
lib/fputsx.c
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1999, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 , Nicolas François
|
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 , Nicolas François
|
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 , Nicolas François
|
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
35
lib/getdef.c
35
lib/getdef.c
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2002 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2002 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2008, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2008, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -44,6 +21,7 @@
|
|||||||
#include <libeconf.h>
|
#include <libeconf.h>
|
||||||
#endif
|
#endif
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
/*
|
/*
|
||||||
* A configuration item definition.
|
* A configuration item definition.
|
||||||
*/
|
*/
|
||||||
@@ -367,7 +345,6 @@ unsigned long getdef_ulong (const char *item, unsigned long dflt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (getulong (d->value, &val) == 0) {
|
if (getulong (d->value, &val) == 0) {
|
||||||
/* FIXME: we should have a getulong */
|
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("configuration error - cannot parse %s value: '%s'"),
|
_("configuration error - cannot parse %s value: '%s'"),
|
||||||
item, d->value);
|
item, d->value);
|
||||||
|
|||||||
33
lib/getdef.h
33
lib/getdef.h
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2002 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2002 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
#ifndef _GETDEF_H
|
#ifndef _GETDEF_H
|
||||||
#define _GETDEF_H
|
#define _GETDEF_H
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2010, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2013, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2013, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1988 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1988 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
31
lib/lockpw.c
31
lib/lockpw.c
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1992 , Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1992 , Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "nscd.h"
|
#include "nscd.h"
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
#define MSG_NSCD_FLUSH_CACHE_FAILED "%s: Failed to flush the nscd cache.\n"
|
#define MSG_NSCD_FLUSH_CACHE_FAILED "%s: Failed to flush the nscd cache.\n"
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ int nscd_flush_cache (const char *service)
|
|||||||
|
|
||||||
if (run_command (cmd, spawnedArgs, spawnedEnv, &status) != 0) {
|
if (run_command (cmd, spawnedArgs, spawnedEnv, &status) != 0) {
|
||||||
/* run_command writes its own more detailed message. */
|
/* run_command writes its own more detailed message. */
|
||||||
(void) fprintf (shadow_logfd, _(MSG_NSCD_FLUSH_CACHE_FAILED), Prog);
|
(void) fprintf (shadow_logfd, _(MSG_NSCD_FLUSH_CACHE_FAILED), shadow_progname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ int nscd_flush_cache (const char *service)
|
|||||||
if (!WIFEXITED (status)) {
|
if (!WIFEXITED (status)) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (shadow_logfd,
|
||||||
_("%s: nscd did not terminate normally (signal %d)\n"),
|
_("%s: nscd did not terminate normally (signal %d)\n"),
|
||||||
Prog, WTERMSIG (status));
|
shadow_progname, WTERMSIG (status));
|
||||||
return -1;
|
return -1;
|
||||||
} else if (code == E_CMD_NOTFOUND) {
|
} else if (code == E_CMD_NOTFOUND) {
|
||||||
/* nscd is not installed, or it is installed but uses an
|
/* nscd is not installed, or it is installed but uses an
|
||||||
@@ -44,8 +45,8 @@ int nscd_flush_cache (const char *service)
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (code != 0) {
|
} else if (code != 0) {
|
||||||
(void) fprintf (shadow_logfd, _("%s: nscd exited with status %d\n"),
|
(void) fprintf (shadow_logfd, _("%s: nscd exited with status %d\n"),
|
||||||
Prog, code);
|
shadow_progname, code);
|
||||||
(void) fprintf (shadow_logfd, _(MSG_NSCD_FLUSH_CACHE_FAILED), Prog);
|
(void) fprintf (shadow_logfd, _(MSG_NSCD_FLUSH_CACHE_FAILED), shadow_progname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "../libsubid/subid.h"
|
#include "../libsubid/subid.h"
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
#define NSSWITCH "/etc/nsswitch.conf"
|
#define NSSWITCH "/etc/nsswitch.conf"
|
||||||
|
|
||||||
@@ -28,7 +30,7 @@ bool nss_is_initialized() {
|
|||||||
return atomic_load(&nss_init_completed);
|
return atomic_load(&nss_init_completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nss_exit() {
|
static void nss_exit(void) {
|
||||||
if (nss_is_initialized() && subid_nss) {
|
if (nss_is_initialized() && subid_nss) {
|
||||||
dlclose(subid_nss->handle);
|
dlclose(subid_nss->handle);
|
||||||
free(subid_nss);
|
free(subid_nss);
|
||||||
@@ -37,10 +39,11 @@ void nss_exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// nsswitch_path is an argument only to support testing.
|
// nsswitch_path is an argument only to support testing.
|
||||||
void nss_init(char *nsswitch_path) {
|
void nss_init(const char *nsswitch_path) {
|
||||||
FILE *nssfp = NULL;
|
FILE *nssfp = NULL;
|
||||||
char *line = NULL, *p, *token, *saveptr;
|
char *line = NULL, *p, *token, *saveptr;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
FILE *shadow_logfd = log_get_logfd();
|
||||||
|
|
||||||
if (atomic_flag_test_and_set(&nss_init_started)) {
|
if (atomic_flag_test_and_set(&nss_init_started)) {
|
||||||
// Another thread has started nss_init, wait for it to complete
|
// Another thread has started nss_init, wait for it to complete
|
||||||
@@ -56,7 +59,7 @@ void nss_init(char *nsswitch_path) {
|
|||||||
// subid: files
|
// subid: files
|
||||||
nssfp = fopen(nsswitch_path, "r");
|
nssfp = fopen(nsswitch_path, "r");
|
||||||
if (!nssfp) {
|
if (!nssfp) {
|
||||||
fprintf(shadow_logfd, "Failed opening %s: %m", nsswitch_path);
|
fprintf(shadow_logfd, "Failed opening %s: %m\n", nsswitch_path);
|
||||||
atomic_store(&nss_init_completed, true);
|
atomic_store(&nss_init_completed, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 , Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1999 , Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
33
lib/port.c
33
lib/port.c
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
31
lib/port.h
31
lib/port.h
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1991, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1991, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2010, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -59,9 +36,6 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "commonio.h"
|
#include "commonio.h"
|
||||||
|
|
||||||
extern /*@observer@*/ const char *Prog; /* Program name showed in error messages */
|
|
||||||
extern FILE *shadow_logfd; /* file descripter to which error messages are printed */
|
|
||||||
|
|
||||||
/* addgrps.c */
|
/* addgrps.c */
|
||||||
#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
|
#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
|
||||||
extern int add_groups (const char *);
|
extern int add_groups (const char *);
|
||||||
@@ -134,6 +108,9 @@ extern int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
|
|
||||||
|
/* date_to_str.c */
|
||||||
|
extern void date_to_str (size_t size, char buf[size], long date);
|
||||||
|
|
||||||
/* encrypt.c */
|
/* encrypt.c */
|
||||||
extern /*@exposed@*//*@null@*/char *pw_encrypt (const char *, const char *);
|
extern /*@exposed@*//*@null@*/char *pw_encrypt (const char *, const char *);
|
||||||
|
|
||||||
@@ -182,12 +159,12 @@ extern int getlong (const char *numstr, /*@out@*/long int *result);
|
|||||||
extern int get_pid (const char *pidstr, pid_t *pid);
|
extern int get_pid (const char *pidstr, pid_t *pid);
|
||||||
|
|
||||||
/* getrange */
|
/* getrange */
|
||||||
extern int getrange (char *range,
|
extern int getrange (const char *range,
|
||||||
unsigned long *min, bool *has_min,
|
unsigned long *min, bool *has_min,
|
||||||
unsigned long *max, bool *has_max);
|
unsigned long *max, bool *has_max);
|
||||||
|
|
||||||
/* gettime.c */
|
/* gettime.c */
|
||||||
extern time_t gettime ();
|
extern time_t gettime (void);
|
||||||
|
|
||||||
/* get_uid.c */
|
/* get_uid.c */
|
||||||
extern int get_uid (const char *uidstr, uid_t *uid);
|
extern int get_uid (const char *uidstr, uid_t *uid);
|
||||||
@@ -265,8 +242,8 @@ extern /*@null@*//*@only@*/struct passwd *get_my_pwent (void);
|
|||||||
|
|
||||||
/* nss.c */
|
/* nss.c */
|
||||||
#include <libsubid/subid.h>
|
#include <libsubid/subid.h>
|
||||||
extern void nss_init(char *nsswitch_path);
|
extern void nss_init(const char *nsswitch_path);
|
||||||
extern bool nss_is_initialized();
|
extern bool nss_is_initialized(void);
|
||||||
|
|
||||||
struct subid_nss_ops {
|
struct subid_nss_ops {
|
||||||
/*
|
/*
|
||||||
@@ -316,7 +293,7 @@ struct subid_nss_ops {
|
|||||||
void *handle;
|
void *handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct subid_nss_ops *get_subid_nss_handle();
|
extern struct subid_nss_ops *get_subid_nss_handle(void);
|
||||||
|
|
||||||
|
|
||||||
/* pam_pass_non_interactive.c */
|
/* pam_pass_non_interactive.c */
|
||||||
@@ -347,12 +324,12 @@ extern struct passwd *prefix_getpwuid(uid_t uid);
|
|||||||
extern struct passwd *prefix_getpwnam(const char* name);
|
extern struct passwd *prefix_getpwnam(const char* name);
|
||||||
extern struct spwd *prefix_getspnam(const char* name);
|
extern struct spwd *prefix_getspnam(const char* name);
|
||||||
extern struct group *prefix_getgr_nam_gid(const char *grname);
|
extern struct group *prefix_getgr_nam_gid(const char *grname);
|
||||||
extern void prefix_setpwent();
|
extern void prefix_setpwent(void);
|
||||||
extern struct passwd* prefix_getpwent();
|
extern struct passwd* prefix_getpwent(void);
|
||||||
extern void prefix_endpwent();
|
extern void prefix_endpwent(void);
|
||||||
extern void prefix_setgrent();
|
extern void prefix_setgrent(void);
|
||||||
extern struct group* prefix_getgrent();
|
extern struct group* prefix_getgrent(void);
|
||||||
extern void prefix_endgrent();
|
extern void prefix_endgrent(void);
|
||||||
|
|
||||||
/* pwd2spwd.c */
|
/* pwd2spwd.c */
|
||||||
#ifndef USE_PAM
|
#ifndef USE_PAM
|
||||||
@@ -503,7 +480,7 @@ extern int setutmpx (struct utmpx *utx);
|
|||||||
extern bool valid (const char *, const struct passwd *);
|
extern bool valid (const char *, const struct passwd *);
|
||||||
|
|
||||||
/* xmalloc.c */
|
/* xmalloc.c */
|
||||||
extern /*@maynotreturn@*/ /*@only@*//*@out@*//*@notnull@*/char *xmalloc (size_t size)
|
extern /*@maynotreturn@*/ /*@only@*//*@out@*//*@notnull@*/void *xmalloc (size_t size)
|
||||||
/*@ensures MaxSet(result) == (size - 1); @*/;
|
/*@ensures MaxSet(result) == (size - 1); @*/;
|
||||||
extern /*@maynotreturn@*/ /*@only@*//*@notnull@*/char *xstrdup (const char *);
|
extern /*@maynotreturn@*/ /*@only@*//*@notnull@*/char *xstrdup (const char *);
|
||||||
extern void xfree(void *ap);
|
extern void xfree(void *ap);
|
||||||
|
|||||||
33
lib/pwauth.c
33
lib/pwauth.c
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1992 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1992 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
38
lib/pwauth.h
38
lib/pwauth.h
@@ -1,39 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1992 - 1993, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1992 - 1993, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2009 , Nicolas François
|
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _PWAUTH_H
|
||||||
|
#define _PWAUTH_H
|
||||||
|
|
||||||
#ifndef USE_PAM
|
#ifndef USE_PAM
|
||||||
int pw_auth (const char *cipher,
|
int pw_auth (const char *cipher,
|
||||||
const char *user,
|
const char *user,
|
||||||
@@ -64,3 +44,5 @@ int pw_auth (const char *cipher,
|
|||||||
#define PW_RLOGIN 202
|
#define PW_RLOGIN 202
|
||||||
#define PW_FTP 203
|
#define PW_FTP 203
|
||||||
#define PW_REXEC 204
|
#define PW_REXEC 204
|
||||||
|
|
||||||
|
#endif /* _PWAUTH_H */
|
||||||
|
|||||||
35
lib/pwio.c
35
lib/pwio.c
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
35
lib/pwio.h
35
lib/pwio.h
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Michał Moskal
|
* SPDX-FileCopyrightText: 2005 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
35
lib/pwmem.c
35
lib/pwmem.c
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2013, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2013, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -8,8 +8,10 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <lib/prototypes.h>
|
#include <lib/prototypes.h>
|
||||||
|
#include "run_part.h"
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
int run_part (char *script_path, char *name, char *action)
|
int run_part (char *script_path, const char *name, const char *action)
|
||||||
{
|
{
|
||||||
int pid;
|
int pid;
|
||||||
int wait_status;
|
int wait_status;
|
||||||
@@ -38,15 +40,15 @@ int run_part (char *script_path, char *name, char *action)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int run_parts (char *directory, char *name, char *action)
|
int run_parts (const char *directory, const char *name, const char *action)
|
||||||
{
|
{
|
||||||
struct dirent **namelist;
|
struct dirent **namelist;
|
||||||
int scanlist;
|
int scanlist;
|
||||||
int n;
|
int n;
|
||||||
int execute_result;
|
int execute_result = 0;
|
||||||
|
|
||||||
scanlist = scandir (directory, &namelist, 0, alphasort);
|
scanlist = scandir (directory, &namelist, 0, alphasort);
|
||||||
if (scanlist<0) {
|
if (scanlist<=0) {
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,7 @@
|
|||||||
int run_part (char *script_path, char *name, char *action);
|
#ifndef _RUN_PART_H
|
||||||
int run_parts (char *directory, char *name, char *action);
|
#define _RUN_PART_H
|
||||||
|
|
||||||
|
int run_part (char *script_path, const char *name, const char *action);
|
||||||
|
int run_parts (const char *directory, const char *name, const char *action);
|
||||||
|
|
||||||
|
#endif /* _RUN_PART_H */
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 , Peter Vrabec <pvrabec@redhat.com>
|
* SPDX-FileCopyrightText: 2011 , Peter Vrabec <pvrabec@redhat.com>
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -38,6 +15,8 @@
|
|||||||
#include <selinux/label.h>
|
#include <selinux/label.h>
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
static bool selinux_checked = false;
|
static bool selinux_checked = false;
|
||||||
static bool selinux_enabled;
|
static bool selinux_enabled;
|
||||||
static /*@null@*/struct selabel_handle *selabel_hnd = NULL;
|
static /*@null@*/struct selabel_handle *selabel_hnd = NULL;
|
||||||
@@ -130,7 +109,7 @@ int reset_selinux_file_context (void)
|
|||||||
/*
|
/*
|
||||||
* Log callback for libselinux internal error reporting.
|
* Log callback for libselinux internal error reporting.
|
||||||
*/
|
*/
|
||||||
__attribute__((__format__ (printf, 2, 3)))
|
format_attr(printf, 2, 3)
|
||||||
static int selinux_log_cb (int type, const char *fmt, ...) {
|
static int selinux_log_cb (int type, const char *fmt, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *buf;
|
char *buf;
|
||||||
@@ -214,7 +193,7 @@ int check_selinux_permit (const char *perm_name)
|
|||||||
if (getprevcon_raw (&user_context_raw) != 0) {
|
if (getprevcon_raw (&user_context_raw) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: can not get previous SELinux process context: %s\n"),
|
_("%s: can not get previous SELinux process context: %s\n"),
|
||||||
Prog, strerror (errno));
|
shadow_progname, strerror (errno));
|
||||||
SYSLOG ((LOG_WARN,
|
SYSLOG ((LOG_WARN,
|
||||||
"can not get previous SELinux process context: %s",
|
"can not get previous SELinux process context: %s",
|
||||||
strerror (errno)));
|
strerror (errno)));
|
||||||
|
|||||||
@@ -1,31 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010 , Jakub Hrozek <jhrozek@redhat.com>
|
* SPDX-FileCopyrightText: 2010 , Jakub Hrozek <jhrozek@redhat.com>
|
||||||
* Copyright (c) 2011 , Peter Vrabec <pvrabec@redhat.com>
|
* SPDX-FileCopyrightText: 2011 , Peter Vrabec <pvrabec@redhat.com>
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -43,12 +20,14 @@
|
|||||||
#include <semanage/semanage.h>
|
#include <semanage/semanage.h>
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
#ifndef DEFAULT_SERANGE
|
#ifndef DEFAULT_SERANGE
|
||||||
#define DEFAULT_SERANGE "s0"
|
#define DEFAULT_SERANGE "s0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
format_attr(printf, 3, 4)
|
||||||
static void semanage_error_callback (unused void *varg,
|
static void semanage_error_callback (unused void *varg,
|
||||||
semanage_handle_t *handle,
|
semanage_handle_t *handle,
|
||||||
const char *fmt, ...)
|
const char *fmt, ...)
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -58,8 +35,8 @@ struct passwd *sgetpwent (const char *buf)
|
|||||||
{
|
{
|
||||||
static struct passwd pwent;
|
static struct passwd pwent;
|
||||||
static char pwdbuf[1024];
|
static char pwdbuf[1024];
|
||||||
register int i;
|
int i;
|
||||||
register char *cp;
|
char *cp;
|
||||||
char *fields[NFIELDS];
|
char *fields[NFIELDS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2009 , Nicolas François
|
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -194,8 +171,7 @@ struct spwd *sgetspent (const char *string)
|
|||||||
|
|
||||||
if (fields[8][0] == '\0') {
|
if (fields[8][0] == '\0') {
|
||||||
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
|
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
|
||||||
} else if (getlong (fields[8], &spwd.sp_flag) == 0) {
|
} else if (getulong (fields[8], &spwd.sp_flag) == 0) {
|
||||||
/* FIXME: add a getulong function */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2013, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2013, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
36
lib/shadow.c
36
lib/shadow.c
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2009 , Nicolas François
|
* SPDX-FileCopyrightText: 2009 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -328,8 +305,7 @@ static struct spwd *my_sgetspent (const char *string)
|
|||||||
if (fields[8][0] == '\0') {
|
if (fields[8][0] == '\0') {
|
||||||
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
|
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
|
||||||
} else {
|
} else {
|
||||||
if (getlong (fields[8], &spwd.sp_flag) == 0) {
|
if (getulong (fields[8], &spwd.sp_flag) == 0) {
|
||||||
/* FIXME: add a getulong function */
|
|
||||||
#ifdef USE_NIS
|
#ifdef USE_NIS
|
||||||
if (nis_used) {
|
if (nis_used) {
|
||||||
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
|
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
31
lib/shadowlog.c
Normal file
31
lib/shadowlog.c
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
|
#include "lib/shadowlog_internal.h"
|
||||||
|
|
||||||
|
const char *shadow_progname = "libshadow";
|
||||||
|
FILE *shadow_logfd = NULL;
|
||||||
|
|
||||||
|
void log_set_progname(const char *progname)
|
||||||
|
{
|
||||||
|
shadow_progname = progname;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *log_get_progname(void)
|
||||||
|
{
|
||||||
|
return shadow_progname;
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_set_logfd(FILE *fd)
|
||||||
|
{
|
||||||
|
if (NULL != fd)
|
||||||
|
shadow_logfd = fd;
|
||||||
|
else
|
||||||
|
shadow_logfd = stderr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *log_get_logfd(void)
|
||||||
|
{
|
||||||
|
if (shadow_logfd != NULL)
|
||||||
|
return shadow_logfd;
|
||||||
|
return stderr;
|
||||||
|
}
|
||||||
40
lib/shadowlog.h
Normal file
40
lib/shadowlog.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021 , Serge Hallyn
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the copyright holders or contributors may not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
#ifndef _LOG_H
|
||||||
|
#define _LOG_H
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern void log_set_progname(const char *);
|
||||||
|
extern const char *log_get_progname(void);
|
||||||
|
extern void log_set_logfd(FILE *fd);
|
||||||
|
extern FILE *log_get_logfd(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
7
lib/shadowlog_internal.h
Normal file
7
lib/shadowlog_internal.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef _SHADOWLOG_INTERNAL_H
|
||||||
|
#define _SHADOWLOG_INTERNAL_H
|
||||||
|
|
||||||
|
extern const char *shadow_progname; /* Program name showed in error messages */
|
||||||
|
extern FILE *shadow_logfd; /* file descripter to which error messages are printed */
|
||||||
|
|
||||||
|
#endif /* _SHADOWLOG_INTERNAL_H */
|
||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 , Michał Moskal
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2013, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2013, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
35
lib/spawn.c
35
lib/spawn.c
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 , Jonathan Nieder
|
* SPDX-FileCopyrightText: 2011 , Jonathan Nieder
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -38,6 +15,8 @@
|
|||||||
#include "exitcodes.h"
|
#include "exitcodes.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
int run_command (const char *cmd, const char *argv[],
|
int run_command (const char *cmd, const char *argv[],
|
||||||
/*@null@*/const char *envp[], /*@out@*/int *status)
|
/*@null@*/const char *envp[], /*@out@*/int *status)
|
||||||
{
|
{
|
||||||
@@ -58,11 +37,11 @@ int run_command (const char *cmd, const char *argv[],
|
|||||||
exit (E_CMD_NOTFOUND);
|
exit (E_CMD_NOTFOUND);
|
||||||
}
|
}
|
||||||
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
|
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
|
||||||
Prog, cmd, strerror (errno));
|
shadow_progname, cmd, strerror (errno));
|
||||||
exit (E_CMD_NOEXEC);
|
exit (E_CMD_NOEXEC);
|
||||||
} else if ((pid_t)-1 == pid) {
|
} else if ((pid_t)-1 == pid) {
|
||||||
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
|
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
|
||||||
Prog, cmd, strerror (errno));
|
shadow_progname, cmd, strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +54,7 @@ int run_command (const char *cmd, const char *argv[],
|
|||||||
|
|
||||||
if ((pid_t)-1 == wpid) {
|
if ((pid_t)-1 == wpid) {
|
||||||
fprintf (shadow_logfd, "%s: waitpid (status: %d): %s\n",
|
fprintf (shadow_logfd, "%s: waitpid (status: %d): %s\n",
|
||||||
Prog, *status, strerror (errno));
|
shadow_progname, *status, strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
lib/sssd.c
10
lib/sssd.c
@@ -11,6 +11,8 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "sssd.h"
|
#include "sssd.h"
|
||||||
|
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
#define MSG_SSSD_FLUSH_CACHE_FAILED "%s: Failed to flush the sssd cache."
|
#define MSG_SSSD_FLUSH_CACHE_FAILED "%s: Failed to flush the sssd cache."
|
||||||
|
|
||||||
int sssd_flush_cache (int dbflags)
|
int sssd_flush_cache (int dbflags)
|
||||||
@@ -46,22 +48,22 @@ int sssd_flush_cache (int dbflags)
|
|||||||
free(sss_cache_args);
|
free(sss_cache_args);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
/* run_command writes its own more detailed message. */
|
/* run_command writes its own more detailed message. */
|
||||||
SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, Prog));
|
SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, shadow_progname));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = WEXITSTATUS (status);
|
code = WEXITSTATUS (status);
|
||||||
if (!WIFEXITED (status)) {
|
if (!WIFEXITED (status)) {
|
||||||
SYSLOG ((LOG_WARN, "%s: sss_cache did not terminate normally (signal %d)",
|
SYSLOG ((LOG_WARN, "%s: sss_cache did not terminate normally (signal %d)",
|
||||||
Prog, WTERMSIG (status)));
|
shadow_progname, WTERMSIG (status)));
|
||||||
return -1;
|
return -1;
|
||||||
} else if (code == E_CMD_NOTFOUND) {
|
} else if (code == E_CMD_NOTFOUND) {
|
||||||
/* sss_cache is not installed, or it is installed but uses an
|
/* sss_cache is not installed, or it is installed but uses an
|
||||||
interpreter that is missing. Probably the former. */
|
interpreter that is missing. Probably the former. */
|
||||||
return 0;
|
return 0;
|
||||||
} else if (code != 0) {
|
} else if (code != 0) {
|
||||||
SYSLOG ((LOG_WARN, "%s: sss_cache exited with status %d", Prog, code));
|
SYSLOG ((LOG_WARN, "%s: sss_cache exited with status %d", shadow_progname, code));
|
||||||
SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, Prog));
|
SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, shadow_progname));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012 - Eric Biederman
|
* SPDX-FileCopyrightText: 2012 - Eric Biederman
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#define ID_SIZE 31
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* subordinate_dup: create a duplicate range
|
* subordinate_dup: create a duplicate range
|
||||||
*
|
*
|
||||||
@@ -155,7 +157,7 @@ static struct commonio_ops subordinate_ops = {
|
|||||||
*
|
*
|
||||||
* Returns true if @owner owns any subuid ranges, false otherwise.
|
* Returns true if @owner owns any subuid ranges, false otherwise.
|
||||||
*/
|
*/
|
||||||
static const bool range_exists(struct commonio_db *db, const char *owner)
|
static bool range_exists(struct commonio_db *db, const char *owner)
|
||||||
{
|
{
|
||||||
const struct subordinate_range *range;
|
const struct subordinate_range *range;
|
||||||
commonio_rewind(db);
|
commonio_rewind(db);
|
||||||
@@ -745,6 +747,40 @@ gid_t sub_gid_find_free_range(gid_t min, gid_t max, unsigned long count)
|
|||||||
return start == ULONG_MAX ? (gid_t) -1 : start;
|
return start == ULONG_MAX ? (gid_t) -1 : start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool get_owner_id(const char *owner, enum subid_type id_type, char *id)
|
||||||
|
{
|
||||||
|
struct passwd *pw;
|
||||||
|
struct group *gr;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
switch (id_type) {
|
||||||
|
case ID_TYPE_UID:
|
||||||
|
pw = getpwnam(owner);
|
||||||
|
if (pw == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ret = snprintf(id, ID_SIZE, "%u", pw->pw_uid);
|
||||||
|
if (ret < 0 || ret >= ID_SIZE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ID_TYPE_GID:
|
||||||
|
gr = getgrnam(owner);
|
||||||
|
if (gr == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ret = snprintf(id, ID_SIZE, "%u", gr->gr_gid);
|
||||||
|
if (ret < 0 || ret >= ID_SIZE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int list_owner_ranges(const char *owner, enum subid_type id_type, struct subordinate_range ***ranges)
|
* int list_owner_ranges(const char *owner, enum subid_type id_type, struct subordinate_range ***ranges)
|
||||||
*
|
*
|
||||||
@@ -770,6 +806,8 @@ int list_owner_ranges(const char *owner, enum subid_type id_type, struct subid_r
|
|||||||
enum subid_status status;
|
enum subid_status status;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
struct subid_nss_ops *h;
|
struct subid_nss_ops *h;
|
||||||
|
char id[ID_SIZE];
|
||||||
|
bool have_owner_id;
|
||||||
|
|
||||||
*in_ranges = NULL;
|
*in_ranges = NULL;
|
||||||
|
|
||||||
@@ -798,6 +836,8 @@ int list_owner_ranges(const char *owner, enum subid_type id_type, struct subid_r
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
have_owner_id = get_owner_id(owner, id_type, id);
|
||||||
|
|
||||||
commonio_rewind(db);
|
commonio_rewind(db);
|
||||||
while ((range = commonio_next(db)) != NULL) {
|
while ((range = commonio_next(db)) != NULL) {
|
||||||
if (0 == strcmp(range->owner, owner)) {
|
if (0 == strcmp(range->owner, owner)) {
|
||||||
@@ -808,6 +848,16 @@ int list_owner_ranges(const char *owner, enum subid_type id_type, struct subid_r
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Let's also compare with the ID
|
||||||
|
if (have_owner_id == true && 0 == strcmp(range->owner, id)) {
|
||||||
|
if (!append_range(&ranges, range, count++)) {
|
||||||
|
free(ranges);
|
||||||
|
ranges = NULL;
|
||||||
|
count = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|||||||
@@ -1,21 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Rafal Wojtczuk, Solar Designer
|
* SPDX-FileCopyrightText: 2001 Rafal Wojtczuk, Solar Designer
|
||||||
* All rights reserved.
|
* SPDX-License-Identifier: 0BSD
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
@@ -38,6 +23,8 @@
|
|||||||
#include "shadowio.h"
|
#include "shadowio.h"
|
||||||
#include "tcbfuncs.h"
|
#include "tcbfuncs.h"
|
||||||
|
|
||||||
|
#include "shadowlog_internal.h"
|
||||||
|
|
||||||
#define SHADOWTCB_HASH_BY 1000
|
#define SHADOWTCB_HASH_BY 1000
|
||||||
#define SHADOWTCB_LOCK_SUFFIX ".lock"
|
#define SHADOWTCB_LOCK_SUFFIX ".lock"
|
||||||
|
|
||||||
@@ -72,7 +59,7 @@ shadowtcb_status shadowtcb_gain_priv (void)
|
|||||||
* to exit soon.
|
* to exit soon.
|
||||||
*/
|
*/
|
||||||
#define OUT_OF_MEMORY do { \
|
#define OUT_OF_MEMORY do { \
|
||||||
fprintf (shadow_logfd, _("%s: out of memory\n"), Prog); \
|
fprintf (shadow_logfd, _("%s: out of memory\n"), shadow_progname); \
|
||||||
(void) fflush (shadow_logfd); \
|
(void) fflush (shadow_logfd); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
@@ -118,7 +105,7 @@ static /*@null@*/ char *shadowtcb_path_rel_existing (const char *name)
|
|||||||
if (lstat (path, &st) != 0) {
|
if (lstat (path, &st) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot stat %s: %s\n"),
|
_("%s: Cannot stat %s: %s\n"),
|
||||||
Prog, path, strerror (errno));
|
shadow_progname, path, strerror (errno));
|
||||||
free (path);
|
free (path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -134,7 +121,7 @@ static /*@null@*/ char *shadowtcb_path_rel_existing (const char *name)
|
|||||||
if (!S_ISLNK (st.st_mode)) {
|
if (!S_ISLNK (st.st_mode)) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: %s is neither a directory, nor a symlink.\n"),
|
_("%s: %s is neither a directory, nor a symlink.\n"),
|
||||||
Prog, path);
|
shadow_progname, path);
|
||||||
free (path);
|
free (path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -142,7 +129,7 @@ static /*@null@*/ char *shadowtcb_path_rel_existing (const char *name)
|
|||||||
if (-1 == ret) {
|
if (-1 == ret) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot read symbolic link %s: %s\n"),
|
_("%s: Cannot read symbolic link %s: %s\n"),
|
||||||
Prog, path, strerror (errno));
|
shadow_progname, path, strerror (errno));
|
||||||
free (path);
|
free (path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -151,7 +138,7 @@ static /*@null@*/ char *shadowtcb_path_rel_existing (const char *name)
|
|||||||
link[sizeof(link) - 1] = '\0';
|
link[sizeof(link) - 1] = '\0';
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Suspiciously long symlink: %s\n"),
|
_("%s: Suspiciously long symlink: %s\n"),
|
||||||
Prog, link);
|
shadow_progname, link);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
link[(size_t)ret] = '\0';
|
link[(size_t)ret] = '\0';
|
||||||
@@ -209,7 +196,7 @@ static shadowtcb_status mkdir_leading (const char *name, uid_t uid)
|
|||||||
if (stat (TCB_DIR, &st) != 0) {
|
if (stat (TCB_DIR, &st) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot stat %s: %s\n"),
|
_("%s: Cannot stat %s: %s\n"),
|
||||||
Prog, TCB_DIR, strerror (errno));
|
shadow_progname, TCB_DIR, strerror (errno));
|
||||||
goto out_free_path;
|
goto out_free_path;
|
||||||
}
|
}
|
||||||
while ((ind = strchr (ptr, '/'))) {
|
while ((ind = strchr (ptr, '/'))) {
|
||||||
@@ -221,19 +208,19 @@ static shadowtcb_status mkdir_leading (const char *name, uid_t uid)
|
|||||||
if ((mkdir (dir, 0700) != 0) && (errno != EEXIST)) {
|
if ((mkdir (dir, 0700) != 0) && (errno != EEXIST)) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot create directory %s: %s\n"),
|
_("%s: Cannot create directory %s: %s\n"),
|
||||||
Prog, dir, strerror (errno));
|
shadow_progname, dir, strerror (errno));
|
||||||
goto out_free_dir;
|
goto out_free_dir;
|
||||||
}
|
}
|
||||||
if (chown (dir, 0, st.st_gid) != 0) {
|
if (chown (dir, 0, st.st_gid) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change owner of %s: %s\n"),
|
_("%s: Cannot change owner of %s: %s\n"),
|
||||||
Prog, dir, strerror (errno));
|
shadow_progname, dir, strerror (errno));
|
||||||
goto out_free_dir;
|
goto out_free_dir;
|
||||||
}
|
}
|
||||||
if (chmod (dir, 0711) != 0) {
|
if (chmod (dir, 0711) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change mode of %s: %s\n"),
|
_("%s: Cannot change mode of %s: %s\n"),
|
||||||
Prog, dir, strerror (errno));
|
shadow_progname, dir, strerror (errno));
|
||||||
goto out_free_dir;
|
goto out_free_dir;
|
||||||
}
|
}
|
||||||
free (dir);
|
free (dir);
|
||||||
@@ -263,7 +250,7 @@ static shadowtcb_status unlink_suffs (const char *user)
|
|||||||
if ((unlink (tmp) != 0) && (errno != ENOENT)) {
|
if ((unlink (tmp) != 0) && (errno != ENOENT)) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: unlink: %s: %s\n"),
|
_("%s: unlink: %s: %s\n"),
|
||||||
Prog, tmp, strerror (errno));
|
shadow_progname, tmp, strerror (errno));
|
||||||
free (tmp);
|
free (tmp);
|
||||||
return SHADOWTCB_FAILURE;
|
return SHADOWTCB_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -288,7 +275,7 @@ static shadowtcb_status rmdir_leading (char *path)
|
|||||||
if (errno != ENOTEMPTY) {
|
if (errno != ENOTEMPTY) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot remove directory %s: %s\n"),
|
_("%s: Cannot remove directory %s: %s\n"),
|
||||||
Prog, dir, strerror (errno));
|
shadow_progname, dir, strerror (errno));
|
||||||
ret = SHADOWTCB_FAILURE;
|
ret = SHADOWTCB_FAILURE;
|
||||||
}
|
}
|
||||||
free (dir);
|
free (dir);
|
||||||
@@ -317,7 +304,7 @@ static shadowtcb_status move_dir (const char *user_newname, uid_t user_newid)
|
|||||||
if (stat (olddir, &oldmode) != 0) {
|
if (stat (olddir, &oldmode) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot stat %s: %s\n"),
|
_("%s: Cannot stat %s: %s\n"),
|
||||||
Prog, olddir, strerror (errno));
|
shadow_progname, olddir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
old_uid = oldmode.st_uid;
|
old_uid = oldmode.st_uid;
|
||||||
@@ -344,7 +331,7 @@ static shadowtcb_status move_dir (const char *user_newname, uid_t user_newid)
|
|||||||
if (rename (real_old_dir, real_new_dir) != 0) {
|
if (rename (real_old_dir, real_new_dir) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot rename %s to %s: %s\n"),
|
_("%s: Cannot rename %s to %s: %s\n"),
|
||||||
Prog, real_old_dir, real_new_dir, strerror (errno));
|
shadow_progname, real_old_dir, real_new_dir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (rmdir_leading (real_old_dir_rel) == SHADOWTCB_FAILURE) {
|
if (rmdir_leading (real_old_dir_rel) == SHADOWTCB_FAILURE) {
|
||||||
@@ -353,7 +340,7 @@ static shadowtcb_status move_dir (const char *user_newname, uid_t user_newid)
|
|||||||
if ((unlink (olddir) != 0) && (errno != ENOENT)) {
|
if ((unlink (olddir) != 0) && (errno != ENOENT)) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot remove %s: %s\n"),
|
_("%s: Cannot remove %s: %s\n"),
|
||||||
Prog, olddir, strerror (errno));
|
shadow_progname, olddir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (asprintf (&newdir, TCB_DIR "/%s", user_newname) == -1) {
|
if (asprintf (&newdir, TCB_DIR "/%s", user_newname) == -1) {
|
||||||
@@ -367,7 +354,7 @@ static shadowtcb_status move_dir (const char *user_newname, uid_t user_newid)
|
|||||||
&& (symlink (real_new_dir_rel, newdir) != 0)) {
|
&& (symlink (real_new_dir_rel, newdir) != 0)) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot create symbolic link %s: %s\n"),
|
_("%s: Cannot create symbolic link %s: %s\n"),
|
||||||
Prog, real_new_dir_rel, strerror (errno));
|
shadow_progname, real_new_dir_rel, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
ret = SHADOWTCB_SUCCESS;
|
ret = SHADOWTCB_SUCCESS;
|
||||||
@@ -466,31 +453,31 @@ shadowtcb_status shadowtcb_move (/*@NULL@*/const char *user_newname, uid_t user_
|
|||||||
if (stat (tcbdir, &dirmode) != 0) {
|
if (stat (tcbdir, &dirmode) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot stat %s: %s\n"),
|
_("%s: Cannot stat %s: %s\n"),
|
||||||
Prog, tcbdir, strerror (errno));
|
shadow_progname, tcbdir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chown (tcbdir, 0, 0) != 0) {
|
if (chown (tcbdir, 0, 0) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change owners of %s: %s\n"),
|
_("%s: Cannot change owners of %s: %s\n"),
|
||||||
Prog, tcbdir, strerror (errno));
|
shadow_progname, tcbdir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chmod (tcbdir, 0700) != 0) {
|
if (chmod (tcbdir, 0700) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change mode of %s: %s\n"),
|
_("%s: Cannot change mode of %s: %s\n"),
|
||||||
Prog, tcbdir, strerror (errno));
|
shadow_progname, tcbdir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (lstat (shadow, &filemode) != 0) {
|
if (lstat (shadow, &filemode) != 0) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot lstat %s: %s\n"),
|
_("%s: Cannot lstat %s: %s\n"),
|
||||||
Prog, shadow, strerror (errno));
|
shadow_progname, shadow, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Warning, user %s has no tcb shadow file.\n"),
|
_("%s: Warning, user %s has no tcb shadow file.\n"),
|
||||||
Prog, user_newname);
|
shadow_progname, user_newname);
|
||||||
} else {
|
} else {
|
||||||
if (!S_ISREG (filemode.st_mode) ||
|
if (!S_ISREG (filemode.st_mode) ||
|
||||||
filemode.st_nlink != 1) {
|
filemode.st_nlink != 1) {
|
||||||
@@ -498,19 +485,19 @@ shadowtcb_status shadowtcb_move (/*@NULL@*/const char *user_newname, uid_t user_
|
|||||||
_("%s: Emergency: %s's tcb shadow is not a "
|
_("%s: Emergency: %s's tcb shadow is not a "
|
||||||
"regular file with st_nlink=1.\n"
|
"regular file with st_nlink=1.\n"
|
||||||
"The account is left locked.\n"),
|
"The account is left locked.\n"),
|
||||||
Prog, user_newname);
|
shadow_progname, user_newname);
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chown (shadow, user_newid, filemode.st_gid) != 0) {
|
if (chown (shadow, user_newid, filemode.st_gid) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change owner of %s: %s\n"),
|
_("%s: Cannot change owner of %s: %s\n"),
|
||||||
Prog, shadow, strerror (errno));
|
shadow_progname, shadow, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chmod (shadow, filemode.st_mode & 07777) != 0) {
|
if (chmod (shadow, filemode.st_mode & 07777) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change mode of %s: %s\n"),
|
_("%s: Cannot change mode of %s: %s\n"),
|
||||||
Prog, shadow, strerror (errno));
|
shadow_progname, shadow, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -520,13 +507,13 @@ shadowtcb_status shadowtcb_move (/*@NULL@*/const char *user_newname, uid_t user_
|
|||||||
if (chown (tcbdir, user_newid, dirmode.st_gid) != 0) {
|
if (chown (tcbdir, user_newid, dirmode.st_gid) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change owner of %s: %s\n"),
|
_("%s: Cannot change owner of %s: %s\n"),
|
||||||
Prog, tcbdir, strerror (errno));
|
shadow_progname, tcbdir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chmod (tcbdir, dirmode.st_mode & 07777) != 0) {
|
if (chmod (tcbdir, dirmode.st_mode & 07777) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change mode of %s: %s\n"),
|
_("%s: Cannot change mode of %s: %s\n"),
|
||||||
Prog, tcbdir, strerror (errno));
|
shadow_progname, tcbdir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
ret = SHADOWTCB_SUCCESS;
|
ret = SHADOWTCB_SUCCESS;
|
||||||
@@ -551,7 +538,7 @@ shadowtcb_status shadowtcb_create (const char *name, uid_t uid)
|
|||||||
if (stat (TCB_DIR, &tcbdir_stat) != 0) {
|
if (stat (TCB_DIR, &tcbdir_stat) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot stat %s: %s\n"),
|
_("%s: Cannot stat %s: %s\n"),
|
||||||
Prog, TCB_DIR, strerror (errno));
|
shadow_progname, TCB_DIR, strerror (errno));
|
||||||
return SHADOWTCB_FAILURE;
|
return SHADOWTCB_FAILURE;
|
||||||
}
|
}
|
||||||
shadowgid = tcbdir_stat.st_gid;
|
shadowgid = tcbdir_stat.st_gid;
|
||||||
@@ -571,39 +558,39 @@ shadowtcb_status shadowtcb_create (const char *name, uid_t uid)
|
|||||||
if (mkdir (dir, 0700) != 0) {
|
if (mkdir (dir, 0700) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: mkdir: %s: %s\n"),
|
_("%s: mkdir: %s: %s\n"),
|
||||||
Prog, dir, strerror (errno));
|
shadow_progname, dir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
fd = open (shadow, O_RDWR | O_CREAT | O_TRUNC, 0600);
|
fd = open (shadow, O_RDWR | O_CREAT | O_TRUNC, 0600);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot open %s: %s\n"),
|
_("%s: Cannot open %s: %s\n"),
|
||||||
Prog, shadow, strerror (errno));
|
shadow_progname, shadow, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
close (fd);
|
close (fd);
|
||||||
if (chown (shadow, 0, authgid) != 0) {
|
if (chown (shadow, 0, authgid) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change owner of %s: %s\n"),
|
_("%s: Cannot change owner of %s: %s\n"),
|
||||||
Prog, shadow, strerror (errno));
|
shadow_progname, shadow, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chmod (shadow, (mode_t) ((authgid == shadowgid) ? 0600 : 0640)) != 0) {
|
if (chmod (shadow, (mode_t) ((authgid == shadowgid) ? 0600 : 0640)) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change mode of %s: %s\n"),
|
_("%s: Cannot change mode of %s: %s\n"),
|
||||||
Prog, shadow, strerror (errno));
|
shadow_progname, shadow, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chown (dir, 0, authgid) != 0) {
|
if (chown (dir, 0, authgid) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change owner of %s: %s\n"),
|
_("%s: Cannot change owner of %s: %s\n"),
|
||||||
Prog, dir, strerror (errno));
|
shadow_progname, dir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if (chmod (dir, (mode_t) ((authgid == shadowgid) ? 02700 : 02710)) != 0) {
|
if (chmod (dir, (mode_t) ((authgid == shadowgid) ? 02700 : 02710)) != 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("%s: Cannot change mode of %s: %s\n"),
|
_("%s: Cannot change mode of %s: %s\n"),
|
||||||
Prog, dir, strerror (errno));
|
shadow_progname, dir, strerror (errno));
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
if ( (shadowtcb_set_user (name) == SHADOWTCB_FAILURE)
|
if ( (shadowtcb_set_user (name) == SHADOWTCB_FAILURE)
|
||||||
|
|||||||
31
lib/utent.c
31
lib/utent.c
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1993 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1993 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ libmisc_la_SOURCES = \
|
|||||||
cleanup_user.c \
|
cleanup_user.c \
|
||||||
console.c \
|
console.c \
|
||||||
copydir.c \
|
copydir.c \
|
||||||
|
date_to_str.c \
|
||||||
entry.c \
|
entry.c \
|
||||||
env.c \
|
env.c \
|
||||||
failure.c \
|
failure.c \
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -40,6 +17,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
#ident "$Id$"
|
#ident "$Id$"
|
||||||
|
|
||||||
@@ -58,6 +36,7 @@ int add_groups (const char *list)
|
|||||||
char *token;
|
char *token;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int ret;
|
int ret;
|
||||||
|
FILE *shadow_logfd = log_get_logfd();
|
||||||
|
|
||||||
if (strlen (list) >= sizeof (buf)) {
|
if (strlen (list) >= sizeof (buf)) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2001 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005 , Red Hat, Inc.
|
* SPDX-FileCopyrightText: 2005 , Red Hat, Inc.
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -45,6 +22,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
int audit_fd;
|
int audit_fd;
|
||||||
|
|
||||||
void audit_help_open (void)
|
void audit_help_open (void)
|
||||||
@@ -59,7 +37,7 @@ void audit_help_open (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void) fputs (_("Cannot open audit interface - aborting.\n"),
|
(void) fputs (_("Cannot open audit interface - aborting.\n"),
|
||||||
shadow_logfd);
|
log_get_logfd());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ static bool path_exists(const char *p)
|
|||||||
|
|
||||||
static const char *btrfs_cmd(void)
|
static const char *btrfs_cmd(void)
|
||||||
{
|
{
|
||||||
const char *btrfs_paths[] = {"/sbin/btrfs",
|
const char *const btrfs_paths[] = {"/sbin/btrfs",
|
||||||
"/bin/btrfs", "/usr/sbin/btrfs", "/usr/bin/btrfs", NULL};
|
"/bin/btrfs", "/usr/sbin/btrfs", "/usr/bin/btrfs", NULL};
|
||||||
const char *p;
|
const char *p;
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2001 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2005 - 2008, Nicolas François
|
* SPDX-FileCopyrightText: 2005 - 2008, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1997 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1997 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1992 - 1993, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1992 - 1993, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2010 - , Nicolas François
|
* SPDX-FileCopyrightText: 2010 - , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -40,6 +17,112 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
static int chown_tree_at (int at_fd,
|
||||||
|
const char *path,
|
||||||
|
uid_t old_uid,
|
||||||
|
uid_t new_uid,
|
||||||
|
gid_t old_gid,
|
||||||
|
gid_t new_gid)
|
||||||
|
{
|
||||||
|
DIR *dir;
|
||||||
|
const struct dirent *ent;
|
||||||
|
struct stat dir_sb;
|
||||||
|
int dir_fd, rc = 0;
|
||||||
|
|
||||||
|
dir_fd = openat (at_fd, path, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
|
if (dir_fd < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = fdopendir (dir_fd);
|
||||||
|
if (!dir) {
|
||||||
|
(void) close (dir_fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open the directory and read each entry. Every entry is tested
|
||||||
|
* to see if it is a directory, and if so this routine is called
|
||||||
|
* recursively. If not, it is checked to see if an ownership
|
||||||
|
* shall be changed.
|
||||||
|
*/
|
||||||
|
while ((ent = readdir (dir))) {
|
||||||
|
uid_t tmpuid = (uid_t) -1;
|
||||||
|
gid_t tmpgid = (gid_t) -1;
|
||||||
|
struct stat ent_sb;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Skip the "." and ".." entries
|
||||||
|
*/
|
||||||
|
if ( (strcmp (ent->d_name, ".") == 0)
|
||||||
|
|| (strcmp (ent->d_name, "..") == 0)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = fstatat (dirfd(dir), ent->d_name, &ent_sb, AT_SYMLINK_NOFOLLOW);
|
||||||
|
if (rc < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (S_ISDIR (ent_sb.st_mode)) {
|
||||||
|
/*
|
||||||
|
* Do the entire subdirectory.
|
||||||
|
*/
|
||||||
|
rc = chown_tree_at (dirfd(dir), ent->d_name, old_uid, new_uid, old_gid, new_gid);
|
||||||
|
if (0 != rc) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* By default, the IDs are not changed (-1).
|
||||||
|
*
|
||||||
|
* If the file is not owned by the user, the owner is not
|
||||||
|
* changed.
|
||||||
|
*
|
||||||
|
* If the file is not group-owned by the group, the
|
||||||
|
* group-owner is not changed.
|
||||||
|
*/
|
||||||
|
if (((uid_t) -1 == old_uid) || (ent_sb.st_uid == old_uid)) {
|
||||||
|
tmpuid = new_uid;
|
||||||
|
}
|
||||||
|
if (((gid_t) -1 == old_gid) || (ent_sb.st_gid == old_gid)) {
|
||||||
|
tmpgid = new_gid;
|
||||||
|
}
|
||||||
|
if (((uid_t) -1 != tmpuid) || ((gid_t) -1 != tmpgid)) {
|
||||||
|
rc = fchownat (dirfd(dir), ent->d_name, tmpuid, tmpgid, AT_SYMLINK_NOFOLLOW);
|
||||||
|
if (0 != rc) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now do the root of the tree
|
||||||
|
*/
|
||||||
|
if ((0 == rc) && (fstat (dirfd(dir), &dir_sb) == 0)) {
|
||||||
|
uid_t tmpuid = (uid_t) -1;
|
||||||
|
gid_t tmpgid = (gid_t) -1;
|
||||||
|
if (((uid_t) -1 == old_uid) || (dir_sb.st_uid == old_uid)) {
|
||||||
|
tmpuid = new_uid;
|
||||||
|
}
|
||||||
|
if (((gid_t) -1 == old_gid) || (dir_sb.st_gid == old_gid)) {
|
||||||
|
tmpgid = new_gid;
|
||||||
|
}
|
||||||
|
if (((uid_t) -1 != tmpuid) || ((gid_t) -1 != tmpgid)) {
|
||||||
|
rc = fchown (dirfd(dir), tmpuid, tmpgid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rc = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void) closedir (dir);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* chown_tree - change ownership of files in a directory tree
|
* chown_tree - change ownership of files in a directory tree
|
||||||
*
|
*
|
||||||
@@ -59,143 +142,5 @@ int chown_tree (const char *root,
|
|||||||
gid_t old_gid,
|
gid_t old_gid,
|
||||||
gid_t new_gid)
|
gid_t new_gid)
|
||||||
{
|
{
|
||||||
char *new_name;
|
return chown_tree_at (AT_FDCWD, root, old_uid, new_uid, old_gid, new_gid);
|
||||||
size_t new_name_len;
|
|
||||||
int rc = 0;
|
|
||||||
struct DIRECT *ent;
|
|
||||||
struct stat sb;
|
|
||||||
DIR *dir;
|
|
||||||
|
|
||||||
new_name = malloc (1024);
|
|
||||||
if (NULL == new_name) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
new_name_len = 1024;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Make certain the directory exists. This routine is called
|
|
||||||
* directly by the invoker, or recursively.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (access (root, F_OK) != 0) {
|
|
||||||
free (new_name);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Open the directory and read each entry. Every entry is tested
|
|
||||||
* to see if it is a directory, and if so this routine is called
|
|
||||||
* recursively. If not, it is checked to see if an ownership
|
|
||||||
* shall be changed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
dir = opendir (root);
|
|
||||||
if (NULL == dir) {
|
|
||||||
free (new_name);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((ent = readdir (dir))) {
|
|
||||||
size_t ent_name_len;
|
|
||||||
uid_t tmpuid = (uid_t) -1;
|
|
||||||
gid_t tmpgid = (gid_t) -1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Skip the "." and ".." entries
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( (strcmp (ent->d_name, ".") == 0)
|
|
||||||
|| (strcmp (ent->d_name, "..") == 0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Make the filename for both the source and the
|
|
||||||
* destination files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ent_name_len = strlen (root) + strlen (ent->d_name) + 2;
|
|
||||||
if (ent_name_len > new_name_len) {
|
|
||||||
/*@only@*/char *tmp = realloc (new_name, ent_name_len);
|
|
||||||
if (NULL == tmp) {
|
|
||||||
rc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
new_name = tmp;
|
|
||||||
new_name_len = ent_name_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) snprintf (new_name, new_name_len, "%s/%s", root, ent->d_name);
|
|
||||||
|
|
||||||
/* Don't follow symbolic links! */
|
|
||||||
if (LSTAT (new_name, &sb) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (S_ISDIR (sb.st_mode) && !S_ISLNK (sb.st_mode)) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Do the entire subdirectory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
rc = chown_tree (new_name, old_uid, new_uid,
|
|
||||||
old_gid, new_gid);
|
|
||||||
if (0 != rc) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef HAVE_LCHOWN
|
|
||||||
/* don't use chown (follows symbolic links!) */
|
|
||||||
if (S_ISLNK (sb.st_mode)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* By default, the IDs are not changed (-1).
|
|
||||||
*
|
|
||||||
* If the file is not owned by the user, the owner is not
|
|
||||||
* changed.
|
|
||||||
*
|
|
||||||
* If the file is not group-owned by the group, the
|
|
||||||
* group-owner is not changed.
|
|
||||||
*/
|
|
||||||
if (((uid_t) -1 == old_uid) || (sb.st_uid == old_uid)) {
|
|
||||||
tmpuid = new_uid;
|
|
||||||
}
|
|
||||||
if (((gid_t) -1 == old_gid) || (sb.st_gid == old_gid)) {
|
|
||||||
tmpgid = new_gid;
|
|
||||||
}
|
|
||||||
if (((uid_t) -1 != tmpuid) || ((gid_t) -1 != tmpgid)) {
|
|
||||||
rc = LCHOWN (new_name, tmpuid, tmpgid);
|
|
||||||
if (0 != rc) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free (new_name);
|
|
||||||
(void) closedir (dir);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Now do the root of the tree
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((0 == rc) && (stat (root, &sb) == 0)) {
|
|
||||||
uid_t tmpuid = (uid_t) -1;
|
|
||||||
gid_t tmpgid = (gid_t) -1;
|
|
||||||
if (((uid_t) -1 == old_uid) || (sb.st_uid == old_uid)) {
|
|
||||||
tmpuid = new_uid;
|
|
||||||
}
|
|
||||||
if (((gid_t) -1 == old_gid) || (sb.st_gid == old_gid)) {
|
|
||||||
tmpgid = new_gid;
|
|
||||||
}
|
|
||||||
if (((uid_t) -1 != tmpuid) || ((gid_t) -1 != tmpgid)) {
|
|
||||||
rc = LCHOWN (root, tmpuid, tmpgid);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rc = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2001, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2001, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -43,6 +20,7 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* chown_tty() sets the login tty to be owned by the new user ID
|
* chown_tty() sets the login tty to be owned by the new user ID
|
||||||
@@ -75,6 +53,7 @@ void chown_tty (const struct passwd *info)
|
|||||||
if ( (fchown (STDIN_FILENO, info->pw_uid, gid) != 0)
|
if ( (fchown (STDIN_FILENO, info->pw_uid, gid) != 0)
|
||||||
|| (fchmod (STDIN_FILENO, (mode_t)getdef_num ("TTYPERM", 0600)) != 0)) {
|
|| (fchmod (STDIN_FILENO, (mode_t)getdef_num ("TTYPERM", 0600)) != 0)) {
|
||||||
int err = errno;
|
int err = errno;
|
||||||
|
FILE *shadow_logfd = log_get_logfd();
|
||||||
|
|
||||||
fprintf (shadow_logfd,
|
fprintf (shadow_logfd,
|
||||||
_("Unable to change owner or mode of tty stdin: %s"),
|
_("Unable to change owner or mode of tty stdin: %s"),
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 - 2011, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2011, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -36,6 +13,7 @@
|
|||||||
#include "groupio.h"
|
#include "groupio.h"
|
||||||
#include "sgroupio.h"
|
#include "sgroupio.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cleanup_report_add_group - Report failure to add a group to the system
|
* cleanup_report_add_group - Report failure to add a group to the system
|
||||||
@@ -48,7 +26,7 @@ void cleanup_report_add_group (void *group_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add group %s", name));
|
SYSLOG ((LOG_ERR, "failed to add group %s", name));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||||
"",
|
"",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -66,7 +44,7 @@ void cleanup_report_del_group (void *group_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to remove group %s", name));
|
SYSLOG ((LOG_ERR, "failed to remove group %s", name));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
audit_logger (AUDIT_DEL_GROUP, log_get_progname(),
|
||||||
"",
|
"",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -83,7 +61,7 @@ void cleanup_report_mod_group (void *cleanup_info)
|
|||||||
gr_dbname (),
|
gr_dbname (),
|
||||||
info->action));
|
info->action));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_ACCT, Prog,
|
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
||||||
info->audit_msg,
|
info->audit_msg,
|
||||||
info->name, AUDIT_NO_ID,
|
info->name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -101,7 +79,7 @@ void cleanup_report_mod_gshadow (void *cleanup_info)
|
|||||||
sgr_dbname (),
|
sgr_dbname (),
|
||||||
info->action));
|
info->action));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_ACCT, Prog,
|
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
||||||
info->audit_msg,
|
info->audit_msg,
|
||||||
info->name, AUDIT_NO_ID,
|
info->name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -121,7 +99,7 @@ void cleanup_report_add_group_group (void *group_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||||
"adding group to /etc/group",
|
"adding group to /etc/group",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -141,7 +119,7 @@ void cleanup_report_add_group_gshadow (void *group_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||||
"adding group to /etc/gshadow",
|
"adding group to /etc/gshadow",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -164,7 +142,7 @@ void cleanup_report_del_group_group (void *group_name)
|
|||||||
"failed to remove group %s from %s",
|
"failed to remove group %s from %s",
|
||||||
name, gr_dbname ()));
|
name, gr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||||
"removing group from /etc/group",
|
"removing group from /etc/group",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -187,7 +165,7 @@ void cleanup_report_del_group_gshadow (void *group_name)
|
|||||||
"failed to remove group %s from %s",
|
"failed to remove group %s from %s",
|
||||||
name, sgr_dbname ()));
|
name, sgr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
audit_logger (AUDIT_ADD_GROUP, log_get_progname(),
|
||||||
"removing group from /etc/gshadow",
|
"removing group from /etc/gshadow",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -203,9 +181,9 @@ void cleanup_report_del_group_gshadow (void *group_name)
|
|||||||
void cleanup_unlock_group (unused void *arg)
|
void cleanup_unlock_group (unused void *arg)
|
||||||
{
|
{
|
||||||
if (gr_unlock () == 0) {
|
if (gr_unlock () == 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: failed to unlock %s\n"),
|
_("%s: failed to unlock %s\n"),
|
||||||
Prog, gr_dbname ());
|
log_get_progname(), gr_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking group file",
|
audit_logger_message ("unlocking group file",
|
||||||
@@ -223,9 +201,9 @@ void cleanup_unlock_group (unused void *arg)
|
|||||||
void cleanup_unlock_gshadow (unused void *arg)
|
void cleanup_unlock_gshadow (unused void *arg)
|
||||||
{
|
{
|
||||||
if (sgr_unlock () == 0) {
|
if (sgr_unlock () == 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: failed to unlock %s\n"),
|
_("%s: failed to unlock %s\n"),
|
||||||
Prog, sgr_dbname ());
|
log_get_progname(), sgr_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking gshadow file",
|
audit_logger_message ("unlocking gshadow file",
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -36,6 +13,7 @@
|
|||||||
#include "pwio.h"
|
#include "pwio.h"
|
||||||
#include "shadowio.h"
|
#include "shadowio.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cleanup_report_add_user - Report failure to add an user to the system
|
* cleanup_report_add_user - Report failure to add an user to the system
|
||||||
@@ -48,7 +26,7 @@ void cleanup_report_add_user (void *user_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add user %s", name));
|
SYSLOG ((LOG_ERR, "failed to add user %s", name));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_USER, Prog,
|
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
||||||
"",
|
"",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -65,7 +43,7 @@ void cleanup_report_mod_passwd (void *cleanup_info)
|
|||||||
pw_dbname (),
|
pw_dbname (),
|
||||||
info->action));
|
info->action));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_ACCT, Prog,
|
audit_logger (AUDIT_USER_ACCT, log_get_progname(),
|
||||||
info->audit_msg,
|
info->audit_msg,
|
||||||
info->name, AUDIT_NO_ID,
|
info->name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -85,7 +63,7 @@ void cleanup_report_add_user_passwd (void *user_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, pw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, pw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_USER, Prog,
|
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
||||||
"adding user to /etc/passwd",
|
"adding user to /etc/passwd",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -105,7 +83,7 @@ void cleanup_report_add_user_shadow (void *user_name)
|
|||||||
|
|
||||||
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, spw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, spw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_USER, Prog,
|
audit_logger (AUDIT_ADD_USER, log_get_progname(),
|
||||||
"adding user to /etc/shadow",
|
"adding user to /etc/shadow",
|
||||||
name, AUDIT_NO_ID,
|
name, AUDIT_NO_ID,
|
||||||
SHADOW_AUDIT_FAILURE);
|
SHADOW_AUDIT_FAILURE);
|
||||||
@@ -120,9 +98,9 @@ void cleanup_report_add_user_shadow (void *user_name)
|
|||||||
void cleanup_unlock_passwd (unused void *arg)
|
void cleanup_unlock_passwd (unused void *arg)
|
||||||
{
|
{
|
||||||
if (pw_unlock () == 0) {
|
if (pw_unlock () == 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: failed to unlock %s\n"),
|
_("%s: failed to unlock %s\n"),
|
||||||
Prog, pw_dbname ());
|
log_get_progname(), pw_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking passwd file",
|
audit_logger_message ("unlocking passwd file",
|
||||||
@@ -139,9 +117,9 @@ void cleanup_unlock_passwd (unused void *arg)
|
|||||||
void cleanup_unlock_shadow (unused void *arg)
|
void cleanup_unlock_shadow (unused void *arg)
|
||||||
{
|
{
|
||||||
if (spw_unlock () == 0) {
|
if (spw_unlock () == 0) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: failed to unlock %s\n"),
|
_("%s: failed to unlock %s\n"),
|
||||||
Prog, spw_dbname ());
|
log_get_progname(), spw_dbname ());
|
||||||
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger_message ("unlocking shadow file",
|
audit_logger_message ("unlocking shadow file",
|
||||||
|
|||||||
@@ -1,34 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1991 , Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1991 , Julianne Frances Haugh
|
||||||
* Copyright (c) 1991 , Chip Rosenthal
|
* SPDX-FileCopyrightText: 1991 , Chip Rosenthal
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2010, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -39,9 +16,6 @@
|
|||||||
|
|
||||||
#ident "$Id$"
|
#ident "$Id$"
|
||||||
|
|
||||||
/* local function prototypes */
|
|
||||||
static bool is_listed (const char *cfgin, const char *tty, bool def);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is now rather generic function which decides if "tty" is listed
|
* This is now rather generic function which decides if "tty" is listed
|
||||||
* under "cfgin" in config (directly or indirectly). Fallback to default if
|
* under "cfgin" in config (directly or indirectly). Fallback to default if
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2001, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2001, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2010, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -55,6 +32,7 @@
|
|||||||
#ifdef WITH_ATTR
|
#ifdef WITH_ATTR
|
||||||
#include <attr/libattr.h>
|
#include <attr/libattr.h>
|
||||||
#endif /* WITH_ATTR */
|
#endif /* WITH_ATTR */
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
|
|
||||||
static /*@null@*/const char *src_orig;
|
static /*@null@*/const char *src_orig;
|
||||||
@@ -69,42 +47,43 @@ struct link_name {
|
|||||||
};
|
};
|
||||||
static /*@exposed@*/struct link_name *links;
|
static /*@exposed@*/struct link_name *links;
|
||||||
|
|
||||||
static int copy_entry (const char *src, const char *dst,
|
struct path_info {
|
||||||
|
const char *full_path;
|
||||||
|
int dirfd;
|
||||||
|
const char *name;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int copy_entry (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
static int copy_dir (const char *src, const char *dst,
|
static int copy_dir (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
#ifdef S_IFLNK
|
|
||||||
static /*@null@*/char *readlink_malloc (const char *filename);
|
static /*@null@*/char *readlink_malloc (const char *filename);
|
||||||
static int copy_symlink (const char *src, const char *dst,
|
static int copy_symlink (const struct path_info *src, const struct path_info *dst,
|
||||||
unused bool reset_selinux,
|
unused bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
#endif /* S_IFLNK */
|
static int copy_hardlink (const struct path_info *dst,
|
||||||
static int copy_hardlink (const char *dst,
|
|
||||||
unused bool reset_selinux,
|
unused bool reset_selinux,
|
||||||
struct link_name *lp);
|
struct link_name *lp);
|
||||||
static int copy_special (const char *src, const char *dst,
|
static int copy_special (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
static int copy_file (const char *src, const char *dst,
|
static int copy_file (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
static int chown_if_needed (const char *dst, const struct stat *statp,
|
static int chownat_if_needed (const struct path_info *dst, const struct stat *statp,
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
static int lchown_if_needed (const char *dst, const struct stat *statp,
|
|
||||||
uid_t old_uid, uid_t new_uid,
|
|
||||||
gid_t old_gid, gid_t new_gid);
|
|
||||||
static int fchown_if_needed (int fdst, const struct stat *statp,
|
static int fchown_if_needed (int fdst, const struct stat *statp,
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid);
|
gid_t old_gid, gid_t new_gid);
|
||||||
@@ -113,9 +92,11 @@ static int fchown_if_needed (int fdst, const struct stat *statp,
|
|||||||
/*
|
/*
|
||||||
* error_acl - format the error messages for the ACL and EQ libraries.
|
* error_acl - format the error messages for the ACL and EQ libraries.
|
||||||
*/
|
*/
|
||||||
static void error_acl (struct error_context *ctx, const char *fmt, ...)
|
format_attr(printf, 2, 3)
|
||||||
|
static void error_acl (unused struct error_context *ctx, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
FILE *shadow_logfd = log_get_logfd();
|
||||||
|
|
||||||
/* ignore the case when destination does not support ACLs
|
/* ignore the case when destination does not support ACLs
|
||||||
* or extended attributes */
|
* or extended attributes */
|
||||||
@@ -125,7 +106,7 @@ static void error_acl (struct error_context *ctx, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
(void) fprintf (shadow_logfd, _("%s: "), Prog);
|
(void) fprintf (shadow_logfd, _("%s: "), log_get_progname());
|
||||||
if (vfprintf (shadow_logfd, fmt, ap) != 0) {
|
if (vfprintf (shadow_logfd, fmt, ap) != 0) {
|
||||||
(void) fputs (_(": "), shadow_logfd);
|
(void) fputs (_(": "), shadow_logfd);
|
||||||
}
|
}
|
||||||
@@ -134,10 +115,61 @@ static void error_acl (struct error_context *ctx, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct error_context ctx = {
|
static struct error_context ctx = {
|
||||||
error_acl
|
error_acl, NULL, NULL
|
||||||
};
|
};
|
||||||
#endif /* WITH_ACL || WITH_ATTR */
|
#endif /* WITH_ACL || WITH_ATTR */
|
||||||
|
|
||||||
|
#ifdef WITH_ACL
|
||||||
|
static int perm_copy_path(const struct path_info *src,
|
||||||
|
const struct path_info *dst,
|
||||||
|
struct error_context *errctx)
|
||||||
|
{
|
||||||
|
int src_fd, dst_fd, ret;
|
||||||
|
|
||||||
|
src_fd = openat(src->dirfd, src->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
|
if (src_fd < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dst_fd = openat(dst->dirfd, dst->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
|
if (dst_fd < 0) {
|
||||||
|
(void) close (src_fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = perm_copy_fd(src->full_path, src_fd, dst->full_path, dst_fd, errctx);
|
||||||
|
(void) close (src_fd);
|
||||||
|
(void) close (dst_fd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif /* WITH_ACL */
|
||||||
|
|
||||||
|
#ifdef WITH_ATTR
|
||||||
|
static int attr_copy_path(const struct path_info *src,
|
||||||
|
const struct path_info *dst,
|
||||||
|
int (*callback) (const char *, struct error_context *),
|
||||||
|
struct error_context *errctx)
|
||||||
|
{
|
||||||
|
int src_fd, dst_fd, ret;
|
||||||
|
|
||||||
|
src_fd = openat(src->dirfd, src->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
|
if (src_fd < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dst_fd = openat(dst->dirfd, dst->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
|
if (dst_fd < 0) {
|
||||||
|
(void) close (src_fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = attr_copy_fd(src->full_path, src_fd, dst->full_path, dst_fd, callback, errctx);
|
||||||
|
(void) close (src_fd);
|
||||||
|
(void) close (dst_fd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif /* WITH_ATTR */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* remove_link - delete a link from the linked list
|
* remove_link - delete a link from the linked list
|
||||||
*/
|
*/
|
||||||
@@ -210,51 +242,36 @@ static /*@exposed@*/ /*@null@*/struct link_name *check_link (const char *name, c
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static int copy_tree_impl (const struct path_info *src, const struct path_info *dst,
|
||||||
* copy_tree - copy files in a directory tree
|
|
||||||
*
|
|
||||||
* copy_tree() walks a directory tree and copies ordinary files
|
|
||||||
* as it goes.
|
|
||||||
*
|
|
||||||
* When reset_selinux is enabled, extended attributes (and thus
|
|
||||||
* SELinux attributes) are not copied.
|
|
||||||
*
|
|
||||||
* old_uid and new_uid are used to set the ownership of the copied
|
|
||||||
* files. Unless old_uid is set to -1, only the files owned by
|
|
||||||
* old_uid have their ownership changed to new_uid. In addition, if
|
|
||||||
* new_uid is set to -1, no ownership will be changed.
|
|
||||||
*
|
|
||||||
* The same logic applies for the group-ownership and
|
|
||||||
* old_gid/new_gid.
|
|
||||||
*/
|
|
||||||
int copy_tree (const char *src_root, const char *dst_root,
|
|
||||||
bool copy_root, bool reset_selinux,
|
bool copy_root, bool reset_selinux,
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid)
|
gid_t old_gid, gid_t new_gid)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int dst_fd, src_fd, err = 0;
|
||||||
bool set_orig = false;
|
bool set_orig = false;
|
||||||
struct DIRECT *ent;
|
const struct dirent *ent;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
|
||||||
if (copy_root) {
|
if (copy_root) {
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
if (access (dst_root, F_OK) == 0) {
|
|
||||||
|
if ( fstatat (dst->dirfd, dst->name, &sb, 0) == 0
|
||||||
|
|| errno != ENOENT) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LSTAT (src_root, &sb) == -1) {
|
if (fstatat (src->dirfd, src->name, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!S_ISDIR (sb.st_mode)) {
|
if (!S_ISDIR (sb.st_mode)) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
"%s: %s is not a directory",
|
"%s: %s is not a directory",
|
||||||
Prog, src_root);
|
log_get_progname(), src->full_path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return copy_entry (src_root, dst_root, reset_selinux,
|
return copy_entry (src, dst, reset_selinux,
|
||||||
old_uid, new_uid, old_gid, new_gid);
|
old_uid, new_uid, old_gid, new_gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,8 +281,14 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
* target is created. It assumes the target directory exists.
|
* target is created. It assumes the target directory exists.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( (access (src_root, F_OK) != 0)
|
src_fd = openat (src->dirfd, src->name, O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
|| (access (dst_root, F_OK) != 0)) {
|
if (src_fd < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dst_fd = openat (dst->dirfd, dst->name, O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||||
|
if (dst_fd < 0) {
|
||||||
|
(void) close (src_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,14 +299,16 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
* regular files (and directories ...) are copied, and no file
|
* regular files (and directories ...) are copied, and no file
|
||||||
* is made set-ID.
|
* is made set-ID.
|
||||||
*/
|
*/
|
||||||
dir = opendir (src_root);
|
dir = fdopendir (src_fd);
|
||||||
if (NULL == dir) {
|
if (NULL == dir) {
|
||||||
|
(void) close (src_fd);
|
||||||
|
(void) close (dst_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_orig == NULL) {
|
if (src_orig == NULL) {
|
||||||
src_orig = src_root;
|
src_orig = src->full_path;
|
||||||
dst_orig = dst_root;
|
dst_orig = dst->full_path;
|
||||||
set_orig = true;
|
set_orig = true;
|
||||||
}
|
}
|
||||||
while ((0 == err) && (ent = readdir (dir)) != NULL) {
|
while ((0 == err) && (ent = readdir (dir)) != NULL) {
|
||||||
@@ -296,8 +321,8 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
char *dst_name;
|
char *dst_name;
|
||||||
size_t src_len = strlen (ent->d_name) + 2;
|
size_t src_len = strlen (ent->d_name) + 2;
|
||||||
size_t dst_len = strlen (ent->d_name) + 2;
|
size_t dst_len = strlen (ent->d_name) + 2;
|
||||||
src_len += strlen (src_root);
|
src_len += strlen (src->full_path);
|
||||||
dst_len += strlen (dst_root);
|
dst_len += strlen (dst->full_path);
|
||||||
|
|
||||||
src_name = (char *) malloc (src_len);
|
src_name = (char *) malloc (src_len);
|
||||||
dst_name = (char *) malloc (dst_len);
|
dst_name = (char *) malloc (dst_len);
|
||||||
@@ -309,12 +334,22 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
* Build the filename for both the source and
|
* Build the filename for both the source and
|
||||||
* the destination files.
|
* the destination files.
|
||||||
*/
|
*/
|
||||||
(void) snprintf (src_name, src_len, "%s/%s",
|
struct path_info src_entry, dst_entry;
|
||||||
src_root, ent->d_name);
|
|
||||||
(void) snprintf (dst_name, dst_len, "%s/%s",
|
|
||||||
dst_root, ent->d_name);
|
|
||||||
|
|
||||||
err = copy_entry (src_name, dst_name,
|
(void) snprintf (src_name, src_len, "%s/%s",
|
||||||
|
src->full_path, ent->d_name);
|
||||||
|
(void) snprintf (dst_name, dst_len, "%s/%s",
|
||||||
|
dst->full_path, ent->d_name);
|
||||||
|
|
||||||
|
src_entry.full_path = src_name;
|
||||||
|
src_entry.dirfd = dirfd(dir);
|
||||||
|
src_entry.name = ent->d_name;
|
||||||
|
|
||||||
|
dst_entry.full_path = dst_name;
|
||||||
|
dst_entry.dirfd = dst_fd;
|
||||||
|
dst_entry.name = ent->d_name;
|
||||||
|
|
||||||
|
err = copy_entry (&src_entry, &dst_entry,
|
||||||
reset_selinux,
|
reset_selinux,
|
||||||
old_uid, new_uid,
|
old_uid, new_uid,
|
||||||
old_gid, new_gid);
|
old_gid, new_gid);
|
||||||
@@ -328,6 +363,7 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) closedir (dir);
|
(void) closedir (dir);
|
||||||
|
(void) close (dst_fd);
|
||||||
|
|
||||||
if (set_orig) {
|
if (set_orig) {
|
||||||
src_orig = NULL;
|
src_orig = NULL;
|
||||||
@@ -374,7 +410,7 @@ int copy_tree (const char *src_root, const char *dst_root,
|
|||||||
* old_gid) will be modified, unless old_uid (resp. old_gid) is set
|
* old_gid) will be modified, unless old_uid (resp. old_gid) is set
|
||||||
* to -1.
|
* to -1.
|
||||||
*/
|
*/
|
||||||
static int copy_entry (const char *src, const char *dst,
|
static int copy_entry (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid)
|
gid_t old_gid, gid_t new_gid)
|
||||||
@@ -382,32 +418,32 @@ static int copy_entry (const char *src, const char *dst,
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
struct link_name *lp;
|
struct link_name *lp;
|
||||||
struct timeval mt[2];
|
struct timespec mt[2];
|
||||||
|
|
||||||
if (LSTAT (src, &sb) == -1) {
|
if (fstatat(src->dirfd, src->name, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
|
||||||
/* If we cannot stat the file, do not care. */
|
/* If we cannot stat the file, do not care. */
|
||||||
} else {
|
} else {
|
||||||
#ifdef HAVE_STRUCT_STAT_ST_ATIM
|
#ifdef HAVE_STRUCT_STAT_ST_ATIM
|
||||||
mt[0].tv_sec = sb.st_atim.tv_sec;
|
mt[0].tv_sec = sb.st_atim.tv_sec;
|
||||||
mt[0].tv_usec = sb.st_atim.tv_nsec / 1000;
|
mt[0].tv_nsec = sb.st_atim.tv_nsec;
|
||||||
#else /* !HAVE_STRUCT_STAT_ST_ATIM */
|
#else /* !HAVE_STRUCT_STAT_ST_ATIM */
|
||||||
mt[0].tv_sec = sb.st_atime;
|
mt[0].tv_sec = sb.st_atime;
|
||||||
# ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
|
# ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
|
||||||
mt[0].tv_usec = sb.st_atimensec / 1000;
|
mt[0].tv_nsec = sb.st_atimensec;
|
||||||
# else /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
|
# else /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
|
||||||
mt[0].tv_usec = 0;
|
mt[0].tv_nsec = 0;
|
||||||
# endif /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
|
# endif /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */
|
||||||
#endif /* !HAVE_STRUCT_STAT_ST_ATIM */
|
#endif /* !HAVE_STRUCT_STAT_ST_ATIM */
|
||||||
|
|
||||||
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
||||||
mt[1].tv_sec = sb.st_mtim.tv_sec;
|
mt[1].tv_sec = sb.st_mtim.tv_sec;
|
||||||
mt[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
|
mt[1].tv_nsec = sb.st_mtim.tv_nsec;
|
||||||
#else /* !HAVE_STRUCT_STAT_ST_MTIM */
|
#else /* !HAVE_STRUCT_STAT_ST_MTIM */
|
||||||
mt[1].tv_sec = sb.st_mtime;
|
mt[1].tv_sec = sb.st_mtime;
|
||||||
# ifdef HAVE_STRUCT_STAT_ST_MTIMENSEC
|
# ifdef HAVE_STRUCT_STAT_ST_MTIMENSEC
|
||||||
mt[1].tv_usec = sb.st_mtimensec / 1000;
|
mt[1].tv_nsec = sb.st_mtimensec;
|
||||||
# else /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
|
# else /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
|
||||||
mt[1].tv_usec = 0;
|
mt[1].tv_nsec = 0;
|
||||||
# endif /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
|
# endif /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */
|
||||||
#endif /* !HAVE_STRUCT_STAT_ST_MTIM */
|
#endif /* !HAVE_STRUCT_STAT_ST_MTIM */
|
||||||
|
|
||||||
@@ -416,7 +452,6 @@ static int copy_entry (const char *src, const char *dst,
|
|||||||
old_uid, new_uid, old_gid, new_gid);
|
old_uid, new_uid, old_gid, new_gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef S_IFLNK
|
|
||||||
/*
|
/*
|
||||||
* Copy any symbolic links
|
* Copy any symbolic links
|
||||||
*/
|
*/
|
||||||
@@ -425,13 +460,12 @@ static int copy_entry (const char *src, const char *dst,
|
|||||||
err = copy_symlink (src, dst, reset_selinux, &sb, mt,
|
err = copy_symlink (src, dst, reset_selinux, &sb, mt,
|
||||||
old_uid, new_uid, old_gid, new_gid);
|
old_uid, new_uid, old_gid, new_gid);
|
||||||
}
|
}
|
||||||
#endif /* S_IFLNK */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See if this is a previously copied link
|
* See if this is a previously copied link
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if ((lp = check_link (src, &sb)) != NULL) {
|
else if ((lp = check_link (src->full_path, &sb)) != NULL) {
|
||||||
err = copy_hardlink (dst, reset_selinux, lp);
|
err = copy_hardlink (dst, reset_selinux, lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,9 +504,9 @@ static int copy_entry (const char *src, const char *dst,
|
|||||||
*
|
*
|
||||||
* Return 0 on success, -1 on error.
|
* Return 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
static int copy_dir (const char *src, const char *dst,
|
static int copy_dir (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid)
|
gid_t old_gid, gid_t new_gid)
|
||||||
{
|
{
|
||||||
@@ -484,15 +518,15 @@ static int copy_dir (const char *src, const char *dst,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
if (set_selinux_file_context (dst, S_IFDIR) != 0) {
|
if (set_selinux_file_context (dst->full_path, S_IFDIR) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SELINUX */
|
#endif /* WITH_SELINUX */
|
||||||
if ( (mkdir (dst, statp->st_mode) != 0)
|
if ( (mkdirat (dst->dirfd, dst->name, statp->st_mode) != 0)
|
||||||
|| (chown_if_needed (dst, statp,
|
|| (chownat_if_needed (dst, statp,
|
||||||
old_uid, new_uid, old_gid, new_gid) != 0)
|
old_uid, new_uid, old_gid, new_gid) != 0)
|
||||||
#ifdef WITH_ACL
|
#ifdef WITH_ACL
|
||||||
|| ( (perm_copy_file (src, dst, &ctx) != 0)
|
|| ( (perm_copy_path (src, dst, &ctx) != 0)
|
||||||
&& (errno != 0))
|
&& (errno != 0))
|
||||||
#else /* !WITH_ACL */
|
#else /* !WITH_ACL */
|
||||||
|| (chmod (dst, statp->st_mode) != 0)
|
|| (chmod (dst, statp->st_mode) != 0)
|
||||||
@@ -506,19 +540,18 @@ static int copy_dir (const char *src, const char *dst,
|
|||||||
* additional logic so that no unexpected permissions result.
|
* additional logic so that no unexpected permissions result.
|
||||||
*/
|
*/
|
||||||
|| ( !reset_selinux
|
|| ( !reset_selinux
|
||||||
&& (attr_copy_file (src, dst, NULL, &ctx) != 0)
|
&& (attr_copy_path (src, dst, NULL, &ctx) != 0)
|
||||||
&& (errno != 0))
|
&& (errno != 0))
|
||||||
#endif /* WITH_ATTR */
|
#endif /* WITH_ATTR */
|
||||||
|| (copy_tree (src, dst, false, reset_selinux,
|
|| (copy_tree_impl (src, dst, false, reset_selinux,
|
||||||
old_uid, new_uid, old_gid, new_gid) != 0)
|
old_uid, new_uid, old_gid, new_gid) != 0)
|
||||||
|| (utimes (dst, mt) != 0)) {
|
|| (utimensat (dst->dirfd, dst->name, mt, AT_SYMLINK_NOFOLLOW) != 0)) {
|
||||||
err = -1;
|
err = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef S_IFLNK
|
|
||||||
/*
|
/*
|
||||||
* readlink_malloc - wrapper for readlink
|
* readlink_malloc - wrapper for readlink
|
||||||
*
|
*
|
||||||
@@ -565,9 +598,9 @@ static /*@null@*/char *readlink_malloc (const char *filename)
|
|||||||
*
|
*
|
||||||
* Return 0 on success, -1 on error.
|
* Return 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
static int copy_symlink (const char *src, const char *dst,
|
static int copy_symlink (const struct path_info *src, const struct path_info *dst,
|
||||||
unused bool reset_selinux,
|
unused bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid)
|
gid_t old_gid, gid_t new_gid)
|
||||||
{
|
{
|
||||||
@@ -585,7 +618,7 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
* destination directory name.
|
* destination directory name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
oldlink = readlink_malloc (src);
|
oldlink = readlink_malloc (src->full_path);
|
||||||
if (NULL == oldlink) {
|
if (NULL == oldlink) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -605,13 +638,13 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
if (set_selinux_file_context (dst, S_IFLNK) != 0) {
|
if (set_selinux_file_context (dst->full_path, S_IFLNK) != 0) {
|
||||||
free (oldlink);
|
free (oldlink);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SELINUX */
|
#endif /* WITH_SELINUX */
|
||||||
if ( (symlink (oldlink, dst) != 0)
|
if ( (symlinkat (oldlink, dst->dirfd, dst->name) != 0)
|
||||||
|| (lchown_if_needed (dst, statp,
|
|| (chownat_if_needed (dst, statp,
|
||||||
old_uid, new_uid, old_gid, new_gid) != 0)) {
|
old_uid, new_uid, old_gid, new_gid) != 0)) {
|
||||||
/* FIXME: there are no modes on symlinks, right?
|
/* FIXME: there are no modes on symlinks, right?
|
||||||
* ACL could be copied, but this would be much more
|
* ACL could be copied, but this would be much more
|
||||||
@@ -625,18 +658,12 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
}
|
}
|
||||||
free (oldlink);
|
free (oldlink);
|
||||||
|
|
||||||
#ifdef HAVE_LUTIMES
|
if (utimensat (dst->dirfd, dst->name, mt, AT_SYMLINK_NOFOLLOW) != 0) {
|
||||||
/* 2007-10-18: We don't care about
|
return -1;
|
||||||
* exit status of lutimes because
|
}
|
||||||
* it returns ENOSYS on many system
|
|
||||||
* - not implemented
|
|
||||||
*/
|
|
||||||
(void) lutimes (dst, mt);
|
|
||||||
#endif /* HAVE_LUTIMES */
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* S_IFLNK */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copy_hardlink - copy a hardlink
|
* copy_hardlink - copy a hardlink
|
||||||
@@ -645,13 +672,13 @@ static int copy_symlink (const char *src, const char *dst,
|
|||||||
*
|
*
|
||||||
* Return 0 on success, -1 on error.
|
* Return 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
static int copy_hardlink (const char *dst,
|
static int copy_hardlink (const struct path_info *dst,
|
||||||
unused bool reset_selinux,
|
unused bool reset_selinux,
|
||||||
struct link_name *lp)
|
struct link_name *lp)
|
||||||
{
|
{
|
||||||
/* FIXME: selinux, ACL, Extended Attributes needed? */
|
/* FIXME: selinux, ACL, Extended Attributes needed? */
|
||||||
|
|
||||||
if (link (lp->ln_name, dst) != 0) {
|
if (linkat (AT_FDCWD, lp->ln_name, dst->dirfd, dst->name, 0) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,28 +702,28 @@ static int copy_hardlink (const char *dst,
|
|||||||
*
|
*
|
||||||
* Return 0 on success, -1 on error.
|
* Return 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
static int copy_special (const char *src, const char *dst,
|
static int copy_special (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid)
|
gid_t old_gid, gid_t new_gid)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
if (set_selinux_file_context (dst, statp->st_mode & S_IFMT) != 0) {
|
if (set_selinux_file_context (dst->full_path, statp->st_mode & S_IFMT) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SELINUX */
|
#endif /* WITH_SELINUX */
|
||||||
|
|
||||||
if ( (mknod (dst, statp->st_mode & ~07777, statp->st_rdev) != 0)
|
if ( (mknodat (dst->dirfd, dst->name, statp->st_mode & ~07777U, statp->st_rdev) != 0)
|
||||||
|| (chown_if_needed (dst, statp,
|
|| (chownat_if_needed (dst, statp,
|
||||||
old_uid, new_uid, old_gid, new_gid) != 0)
|
old_uid, new_uid, old_gid, new_gid) != 0)
|
||||||
#ifdef WITH_ACL
|
#ifdef WITH_ACL
|
||||||
|| ( (perm_copy_file (src, dst, &ctx) != 0)
|
|| ( (perm_copy_path (src, dst, &ctx) != 0)
|
||||||
&& (errno != 0))
|
&& (errno != 0))
|
||||||
#else /* !WITH_ACL */
|
#else /* !WITH_ACL */
|
||||||
|| (chmod (dst, statp->st_mode & 07777) != 0)
|
|| (fchmodat (dst->dirfd, dst->name, statp->st_mode & 07777, AT_SYMLINK_NOFOLLOW) != 0)
|
||||||
#endif /* !WITH_ACL */
|
#endif /* !WITH_ACL */
|
||||||
#ifdef WITH_ATTR
|
#ifdef WITH_ATTR
|
||||||
/*
|
/*
|
||||||
@@ -707,16 +734,52 @@ static int copy_special (const char *src, const char *dst,
|
|||||||
* additional logic so that no unexpected permissions result.
|
* additional logic so that no unexpected permissions result.
|
||||||
*/
|
*/
|
||||||
|| ( !reset_selinux
|
|| ( !reset_selinux
|
||||||
&& (attr_copy_file (src, dst, NULL, &ctx) != 0)
|
&& (attr_copy_path (src, dst, NULL, &ctx) != 0)
|
||||||
&& (errno != 0))
|
&& (errno != 0))
|
||||||
#endif /* WITH_ATTR */
|
#endif /* WITH_ATTR */
|
||||||
|| (utimes (dst, mt) != 0)) {
|
|| (utimensat (dst->dirfd, dst->name, mt, AT_SYMLINK_NOFOLLOW) != 0)) {
|
||||||
err = -1;
|
err = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* full_write - write entire buffer
|
||||||
|
*
|
||||||
|
* Write up to count bytes from the buffer starting at buf to the
|
||||||
|
* file referred to by the file descriptor fd.
|
||||||
|
* Retry in case of a short write.
|
||||||
|
*
|
||||||
|
* Returns the number of bytes written on success, -1 on error.
|
||||||
|
*/
|
||||||
|
static ssize_t full_write(int fd, const void *buf, size_t count) {
|
||||||
|
ssize_t written = 0;
|
||||||
|
|
||||||
|
while (count > 0) {
|
||||||
|
ssize_t res;
|
||||||
|
|
||||||
|
res = write(fd, buf, count);
|
||||||
|
if (res < 0) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
written += res;
|
||||||
|
buf = (const unsigned char*)buf + res;
|
||||||
|
count -= (size_t)res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copy_file - copy a file
|
* copy_file - copy a file
|
||||||
*
|
*
|
||||||
@@ -727,34 +790,32 @@ static int copy_special (const char *src, const char *dst,
|
|||||||
*
|
*
|
||||||
* Return 0 on success, -1 on error.
|
* Return 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
static int copy_file (const char *src, const char *dst,
|
static int copy_file (const struct path_info *src, const struct path_info *dst,
|
||||||
bool reset_selinux,
|
bool reset_selinux,
|
||||||
const struct stat *statp, const struct timeval mt[],
|
const struct stat *statp, const struct timespec mt[],
|
||||||
uid_t old_uid, uid_t new_uid,
|
uid_t old_uid, uid_t new_uid,
|
||||||
gid_t old_gid, gid_t new_gid)
|
gid_t old_gid, gid_t new_gid)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int ifd;
|
int ifd;
|
||||||
int ofd;
|
int ofd;
|
||||||
char buf[1024];
|
|
||||||
ssize_t cnt;
|
|
||||||
|
|
||||||
ifd = open (src, O_RDONLY);
|
ifd = openat (src->dirfd, src->name, O_RDONLY|O_NOFOLLOW|O_CLOEXEC);
|
||||||
if (ifd < 0) {
|
if (ifd < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
if (set_selinux_file_context (dst, S_IFREG) != 0) {
|
if (set_selinux_file_context (dst->full_path, S_IFREG) != 0) {
|
||||||
(void) close (ifd);
|
(void) close (ifd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SELINUX */
|
#endif /* WITH_SELINUX */
|
||||||
ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, statp->st_mode & 07777);
|
ofd = openat (dst->dirfd, dst->name, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | O_NOFOLLOW | O_CLOEXEC, statp->st_mode & 07777);
|
||||||
if ( (ofd < 0)
|
if ( (ofd < 0)
|
||||||
|| (fchown_if_needed (ofd, statp,
|
|| (fchown_if_needed (ofd, statp,
|
||||||
old_uid, new_uid, old_gid, new_gid) != 0)
|
old_uid, new_uid, old_gid, new_gid) != 0)
|
||||||
#ifdef WITH_ACL
|
#ifdef WITH_ACL
|
||||||
|| ( (perm_copy_fd (src, ifd, dst, ofd, &ctx) != 0)
|
|| ( (perm_copy_fd (src->full_path, ifd, dst->full_path, ofd, &ctx) != 0)
|
||||||
&& (errno != 0))
|
&& (errno != 0))
|
||||||
#else /* !WITH_ACL */
|
#else /* !WITH_ACL */
|
||||||
|| (fchmod (ofd, statp->st_mode & 07777) != 0)
|
|| (fchmod (ofd, statp->st_mode & 07777) != 0)
|
||||||
@@ -768,7 +829,7 @@ static int copy_file (const char *src, const char *dst,
|
|||||||
* additional logic so that no unexpected permissions result.
|
* additional logic so that no unexpected permissions result.
|
||||||
*/
|
*/
|
||||||
|| ( !reset_selinux
|
|| ( !reset_selinux
|
||||||
&& (attr_copy_fd (src, ifd, dst, ofd, NULL, &ctx) != 0)
|
&& (attr_copy_fd (src->full_path, ifd, dst->full_path, ofd, NULL, &ctx) != 0)
|
||||||
&& (errno != 0))
|
&& (errno != 0))
|
||||||
#endif /* WITH_ATTR */
|
#endif /* WITH_ATTR */
|
||||||
) {
|
) {
|
||||||
@@ -779,8 +840,24 @@ static int copy_file (const char *src, const char *dst,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((cnt = read (ifd, buf, sizeof buf)) > 0) {
|
while (true) {
|
||||||
if (write (ofd, buf, (size_t)cnt) != cnt) {
|
char buf[8192];
|
||||||
|
ssize_t cnt;
|
||||||
|
|
||||||
|
cnt = read (ifd, buf, sizeof buf);
|
||||||
|
if (cnt < 0) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
(void) close (ofd);
|
||||||
|
(void) close (ifd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (cnt == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (full_write (ofd, buf, (size_t)cnt) < 0) {
|
||||||
(void) close (ofd);
|
(void) close (ofd);
|
||||||
(void) close (ifd);
|
(void) close (ifd);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -788,23 +865,13 @@ static int copy_file (const char *src, const char *dst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
(void) close (ifd);
|
(void) close (ifd);
|
||||||
|
|
||||||
#ifdef HAVE_FUTIMES
|
|
||||||
if (futimes (ofd, mt) != 0) {
|
|
||||||
(void) close (ofd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_FUTIMES */
|
|
||||||
|
|
||||||
if (close (ofd) != 0) {
|
if (close (ofd) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_FUTIMES
|
if (utimensat (dst->dirfd, dst->name, mt, AT_SYMLINK_NOFOLLOW) != 0) {
|
||||||
if (utimes(dst, mt) != 0) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* !HAVE_FUTIMES */
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -839,7 +906,70 @@ static int chown_function ## _if_needed (type_dst dst, \
|
|||||||
return chown_function (dst, tmpuid, tmpgid); \
|
return chown_function (dst, tmpuid, tmpgid); \
|
||||||
}
|
}
|
||||||
|
|
||||||
def_chown_if_needed (chown, const char *)
|
|
||||||
def_chown_if_needed (lchown, const char *)
|
|
||||||
def_chown_if_needed (fchown, int)
|
def_chown_if_needed (fchown, int)
|
||||||
|
|
||||||
|
static int chownat_if_needed (const struct path_info *dst,
|
||||||
|
const struct stat *statp,
|
||||||
|
uid_t old_uid, uid_t new_uid,
|
||||||
|
gid_t old_gid, gid_t new_gid)
|
||||||
|
{
|
||||||
|
uid_t tmpuid = (uid_t) -1;
|
||||||
|
gid_t tmpgid = (gid_t) -1;
|
||||||
|
|
||||||
|
/* Use new_uid if old_uid is set to -1 or if the file was
|
||||||
|
* owned by the user. */
|
||||||
|
if (((uid_t) -1 == old_uid) || (statp->st_uid == old_uid)) {
|
||||||
|
tmpuid = new_uid;
|
||||||
|
}
|
||||||
|
/* Otherwise, or if new_uid was set to -1, we keep the same
|
||||||
|
* owner. */
|
||||||
|
if ((uid_t) -1 == tmpuid) {
|
||||||
|
tmpuid = statp->st_uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((gid_t) -1 == old_gid) || (statp->st_gid == old_gid)) {
|
||||||
|
tmpgid = new_gid;
|
||||||
|
}
|
||||||
|
if ((gid_t) -1 == tmpgid) {
|
||||||
|
tmpgid = statp->st_gid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fchownat (dst->dirfd, dst->name, tmpuid, tmpgid, AT_SYMLINK_NOFOLLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* copy_tree - copy files in a directory tree
|
||||||
|
*
|
||||||
|
* copy_tree() walks a directory tree and copies ordinary files
|
||||||
|
* as it goes.
|
||||||
|
*
|
||||||
|
* When reset_selinux is enabled, extended attributes (and thus
|
||||||
|
* SELinux attributes) are not copied.
|
||||||
|
*
|
||||||
|
* old_uid and new_uid are used to set the ownership of the copied
|
||||||
|
* files. Unless old_uid is set to -1, only the files owned by
|
||||||
|
* old_uid have their ownership changed to new_uid. In addition, if
|
||||||
|
* new_uid is set to -1, no ownership will be changed.
|
||||||
|
*
|
||||||
|
* The same logic applies for the group-ownership and
|
||||||
|
* old_gid/new_gid.
|
||||||
|
*/
|
||||||
|
int copy_tree (const char *src_root, const char *dst_root,
|
||||||
|
bool copy_root, bool reset_selinux,
|
||||||
|
uid_t old_uid, uid_t new_uid,
|
||||||
|
gid_t old_gid, gid_t new_gid)
|
||||||
|
{
|
||||||
|
const struct path_info src = {
|
||||||
|
.full_path = src_root,
|
||||||
|
.dirfd = AT_FDCWD,
|
||||||
|
.name = src_root
|
||||||
|
};
|
||||||
|
const struct path_info dst = {
|
||||||
|
.full_path = dst_root,
|
||||||
|
.dirfd = AT_FDCWD,
|
||||||
|
.name = dst_root
|
||||||
|
};
|
||||||
|
|
||||||
|
return copy_tree_impl(&src, &dst, copy_root, reset_selinux,
|
||||||
|
old_uid, new_uid, old_gid, new_gid);
|
||||||
|
}
|
||||||
|
|||||||
46
libmisc/date_to_str.c
Normal file
46
libmisc/date_to_str.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Alejandro Colomar <alx.manpages@gmail.com>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the copyright holders or contributors may not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#ident "$Id$"
|
||||||
|
|
||||||
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
void date_to_str (size_t size, char buf[size], long date)
|
||||||
|
{
|
||||||
|
time_t t;
|
||||||
|
|
||||||
|
t = date;
|
||||||
|
if (date < 0)
|
||||||
|
(void) strncpy (buf, "never", size);
|
||||||
|
else
|
||||||
|
(void) strftime (buf, size, "%Y-%m-%d", gmtime (&t));
|
||||||
|
buf[size - 1] = '\0';
|
||||||
|
}
|
||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2008, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2008, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1992, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1992, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1999, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz
|
||||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -40,6 +17,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
/*
|
/*
|
||||||
* NEWENVP_STEP must be a power of two. This is the number
|
* NEWENVP_STEP must be a power of two. This is the number
|
||||||
* of (char *) pointers to allocate at a time, to avoid using
|
* of (char *) pointers to allocate at a time, to avoid using
|
||||||
@@ -50,7 +28,7 @@ size_t newenvc = 0;
|
|||||||
/*@null@*/char **newenvp = NULL;
|
/*@null@*/char **newenvp = NULL;
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
static const char *forbid[] = {
|
static const char *const forbid[] = {
|
||||||
"_RLD_=",
|
"_RLD_=",
|
||||||
"BASH_ENV=", /* GNU creeping featurism strikes again... */
|
"BASH_ENV=", /* GNU creeping featurism strikes again... */
|
||||||
"ENV=",
|
"ENV=",
|
||||||
@@ -69,7 +47,7 @@ static const char *forbid[] = {
|
|||||||
|
|
||||||
/* these are allowed, but with no slashes inside
|
/* these are allowed, but with no slashes inside
|
||||||
(to work around security problems in GNU gettext) */
|
(to work around security problems in GNU gettext) */
|
||||||
static const char *noslash[] = {
|
static const char *const noslash[] = {
|
||||||
"LANG=",
|
"LANG=",
|
||||||
"LANGUAGE=",
|
"LANGUAGE=",
|
||||||
"LC_", /* anything with the LC_ prefix */
|
"LC_", /* anything with the LC_ prefix */
|
||||||
@@ -171,7 +149,7 @@ void addenv (const char *string, /*@null@*/const char *value)
|
|||||||
}
|
}
|
||||||
newenvp = __newenvp;
|
newenvp = __newenvp;
|
||||||
} else {
|
} else {
|
||||||
(void) fputs (_("Environment overflow\n"), shadow_logfd);
|
(void) fputs (_("Environment overflow\n"), log_get_logfd());
|
||||||
newenvc--;
|
newenvc--;
|
||||||
free (newenvp[newenvc]);
|
free (newenvp[newenvc]);
|
||||||
}
|
}
|
||||||
@@ -207,7 +185,7 @@ void set_env (int argc, char *const *argv)
|
|||||||
noname++;
|
noname++;
|
||||||
addenv (variable, *argv);
|
addenv (variable, *argv);
|
||||||
} else {
|
} else {
|
||||||
const char **p;
|
const char *const *p;
|
||||||
|
|
||||||
for (p = forbid; NULL != *p; p++) {
|
for (p = forbid; NULL != *p; p++) {
|
||||||
if (strncmp (*argv, *p, strlen (*p)) == 0) {
|
if (strncmp (*argv, *p, strlen (*p)) == 0) {
|
||||||
@@ -240,7 +218,7 @@ void set_env (int argc, char *const *argv)
|
|||||||
void sanitize_env (void)
|
void sanitize_env (void)
|
||||||
{
|
{
|
||||||
char **envp = environ;
|
char **envp = environ;
|
||||||
const char **bad;
|
const char *const *bad;
|
||||||
char **cur;
|
char **cur;
|
||||||
char **move;
|
char **move;
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1989 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1989 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
||||||
* Copyright (c) 2002 - 2005, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2002 - 2005, Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 - 2010, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2010, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -232,13 +209,8 @@ int failcheck (uid_t uid, struct faillog *fl, bool failed)
|
|||||||
void failprint (const struct faillog *fail)
|
void failprint (const struct faillog *fail)
|
||||||
{
|
{
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
|
|
||||||
#if HAVE_STRFTIME
|
|
||||||
char lasttimeb[256];
|
char lasttimeb[256];
|
||||||
char *lasttime = lasttimeb;
|
char *lasttime = lasttimeb;
|
||||||
#else
|
|
||||||
char *lasttime;
|
|
||||||
#endif
|
|
||||||
time_t NOW;
|
time_t NOW;
|
||||||
|
|
||||||
if (0 == fail->fail_cnt) {
|
if (0 == fail->fail_cnt) {
|
||||||
@@ -248,31 +220,11 @@ void failprint (const struct faillog *fail)
|
|||||||
tp = localtime (&(fail->fail_time));
|
tp = localtime (&(fail->fail_time));
|
||||||
(void) time (&NOW);
|
(void) time (&NOW);
|
||||||
|
|
||||||
#if HAVE_STRFTIME
|
|
||||||
/*
|
/*
|
||||||
* Print all information we have.
|
* Print all information we have.
|
||||||
*/
|
*/
|
||||||
(void) strftime (lasttimeb, sizeof lasttimeb, "%c", tp);
|
(void) strftime (lasttimeb, sizeof lasttimeb, "%c", tp);
|
||||||
#else
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Do the same thing, but don't use strftime since it
|
|
||||||
* probably doesn't exist on this system
|
|
||||||
*/
|
|
||||||
lasttime = asctime (tp);
|
|
||||||
lasttime[24] = '\0';
|
|
||||||
|
|
||||||
if ((NOW - fail->fail_time) < YEAR) {
|
|
||||||
lasttime[19] = '\0';
|
|
||||||
}
|
|
||||||
if ((NOW - fail->fail_time) < DAY) {
|
|
||||||
lasttime = lasttime + 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (' ' == *lasttime) {
|
|
||||||
lasttime++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*@-formatconst@*/
|
/*@-formatconst@*/
|
||||||
(void) printf (ngettext ("%d failure since last login.\n"
|
(void) printf (ngettext ("%d failure since last login.\n"
|
||||||
"Last was %s on %s.\n",
|
"Last was %s on %s.\n",
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1997 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1997 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2008 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|||||||
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 2008 - 2011, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2011, Nicolas François
|
||||||
* Copyright (c) 2014, Red Hat, Inc.
|
* SPDX-FileCopyrightText: 2014, Red Hat, Inc.
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -38,6 +15,7 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "groupio.h"
|
#include "groupio.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_ranges - Get the minimum and maximum ID ranges for the search
|
* get_ranges - Get the minimum and maximum ID ranges for the search
|
||||||
@@ -74,10 +52,10 @@ static int get_ranges (bool sys_group, gid_t *min_id, gid_t *max_id,
|
|||||||
|
|
||||||
/* Check that the ranges make sense */
|
/* Check that the ranges make sense */
|
||||||
if (*max_id < *min_id) {
|
if (*max_id < *min_id) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (log_get_logfd(),
|
||||||
_("%s: Invalid configuration: SYS_GID_MIN (%lu), "
|
_("%s: Invalid configuration: SYS_GID_MIN (%lu), "
|
||||||
"GID_MIN (%lu), SYS_GID_MAX (%lu)\n"),
|
"GID_MIN (%lu), SYS_GID_MAX (%lu)\n"),
|
||||||
Prog, (unsigned long) *min_id,
|
log_get_progname(), (unsigned long) *min_id,
|
||||||
getdef_ulong ("GID_MIN", 1000UL),
|
getdef_ulong ("GID_MIN", 1000UL),
|
||||||
(unsigned long) *max_id);
|
(unsigned long) *max_id);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -97,10 +75,10 @@ static int get_ranges (bool sys_group, gid_t *min_id, gid_t *max_id,
|
|||||||
|
|
||||||
/* Check that the ranges make sense */
|
/* Check that the ranges make sense */
|
||||||
if (*max_id < *min_id) {
|
if (*max_id < *min_id) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (log_get_logfd(),
|
||||||
_("%s: Invalid configuration: GID_MIN (%lu), "
|
_("%s: Invalid configuration: GID_MIN (%lu), "
|
||||||
"GID_MAX (%lu)\n"),
|
"GID_MAX (%lu)\n"),
|
||||||
Prog, (unsigned long) *min_id,
|
log_get_progname(), (unsigned long) *min_id,
|
||||||
(unsigned long) *max_id);
|
(unsigned long) *max_id);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -120,7 +98,7 @@ static int get_ranges (bool sys_group, gid_t *min_id, gid_t *max_id,
|
|||||||
static int check_gid (const gid_t gid,
|
static int check_gid (const gid_t gid,
|
||||||
const gid_t gid_min,
|
const gid_t gid_min,
|
||||||
const gid_t gid_max,
|
const gid_t gid_max,
|
||||||
bool *used_gids)
|
const bool *used_gids)
|
||||||
{
|
{
|
||||||
/* First test that the preferred ID is in the range */
|
/* First test that the preferred ID is in the range */
|
||||||
if (gid < gid_min || gid > gid_max) {
|
if (gid < gid_min || gid > gid_max) {
|
||||||
@@ -213,10 +191,10 @@ int find_new_gid (bool sys_group,
|
|||||||
* more likely to want to stop and address the
|
* more likely to want to stop and address the
|
||||||
* issue.
|
* issue.
|
||||||
*/
|
*/
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Encountered error attempting to use "
|
_("%s: Encountered error attempting to use "
|
||||||
"preferred GID: %s\n"),
|
"preferred GID: %s\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,9 +221,9 @@ int find_new_gid (bool sys_group,
|
|||||||
/* Create an array to hold all of the discovered GIDs */
|
/* Create an array to hold all of the discovered GIDs */
|
||||||
used_gids = malloc (sizeof (bool) * (gid_max +1));
|
used_gids = malloc (sizeof (bool) * (gid_max +1));
|
||||||
if (NULL == used_gids) {
|
if (NULL == used_gids) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: failed to allocate memory: %s\n"),
|
_("%s: failed to allocate memory: %s\n"),
|
||||||
Prog, strerror (errno));
|
log_get_progname(), strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset (used_gids, false, sizeof (bool) * (gid_max + 1));
|
memset (used_gids, false, sizeof (bool) * (gid_max + 1));
|
||||||
@@ -323,10 +301,10 @@ int find_new_gid (bool sys_group,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique system GID (%s). "
|
_("%s: Can't get unique system GID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG ((LOG_ERR,
|
SYSLOG ((LOG_ERR,
|
||||||
"Error checking available GIDs: %s",
|
"Error checking available GIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -366,10 +344,10 @@ int find_new_gid (bool sys_group,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique system GID (%s). "
|
_("%s: Can't get unique system GID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG ((LOG_ERR,
|
SYSLOG ((LOG_ERR,
|
||||||
"Error checking available GIDs: %s",
|
"Error checking available GIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -426,10 +404,10 @@ int find_new_gid (bool sys_group,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique GID (%s). "
|
_("%s: Can't get unique GID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG ((LOG_ERR,
|
SYSLOG ((LOG_ERR,
|
||||||
"Error checking available GIDs: %s",
|
"Error checking available GIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -469,10 +447,10 @@ int find_new_gid (bool sys_group,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique GID (%s). "
|
_("%s: Can't get unique GID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG ((LOG_ERR,
|
SYSLOG ((LOG_ERR,
|
||||||
"Error checking available GIDs: %s",
|
"Error checking available GIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -488,9 +466,9 @@ int find_new_gid (bool sys_group,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The code reached here and found no available IDs in the range */
|
/* The code reached here and found no available IDs in the range */
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique GID (no more available GIDs)\n"),
|
_("%s: Can't get unique GID (no more available GIDs)\n"),
|
||||||
Prog);
|
log_get_progname());
|
||||||
SYSLOG ((LOG_WARN, "no more available GIDs on the system"));
|
SYSLOG ((LOG_WARN, "no more available GIDs on the system"));
|
||||||
free (used_gids);
|
free (used_gids);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -1,29 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012 Eric Biederman
|
* SPDX-FileCopyrightText: 2012 Eric Biederman
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -37,6 +15,7 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "subordinateio.h"
|
#include "subordinateio.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find_new_sub_gids - Find a new unused range of GIDs.
|
* find_new_sub_gids - Find a new unused range of GIDs.
|
||||||
@@ -60,18 +39,18 @@ int find_new_sub_gids (gid_t *range_start, unsigned long *range_count)
|
|||||||
count = getdef_ulong ("SUB_GID_COUNT", 65536);
|
count = getdef_ulong ("SUB_GID_COUNT", 65536);
|
||||||
|
|
||||||
if (min > max || count >= max || (min + count - 1) > max) {
|
if (min > max || count >= max || (min + count - 1) > max) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (log_get_logfd(),
|
||||||
_("%s: Invalid configuration: SUB_GID_MIN (%lu),"
|
_("%s: Invalid configuration: SUB_GID_MIN (%lu),"
|
||||||
" SUB_GID_MAX (%lu), SUB_GID_COUNT (%lu)\n"),
|
" SUB_GID_MAX (%lu), SUB_GID_COUNT (%lu)\n"),
|
||||||
Prog, min, max, count);
|
log_get_progname(), min, max, count);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
start = sub_gid_find_free_range(min, max, count);
|
start = sub_gid_find_free_range(min, max, count);
|
||||||
if (start == (gid_t)-1) {
|
if (start == (gid_t)-1) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique subordinate GID range\n"),
|
_("%s: Can't get unique subordinate GID range\n"),
|
||||||
Prog);
|
log_get_progname());
|
||||||
SYSLOG ((LOG_WARN, "no more available subordinate GIDs on the system"));
|
SYSLOG ((LOG_WARN, "no more available subordinate GIDs on the system"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012 Eric Biederman
|
* SPDX-FileCopyrightText: 2012 Eric Biederman
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -37,6 +15,7 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "subordinateio.h"
|
#include "subordinateio.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find_new_sub_uids - Find a new unused range of UIDs.
|
* find_new_sub_uids - Find a new unused range of UIDs.
|
||||||
@@ -60,18 +39,18 @@ int find_new_sub_uids (uid_t *range_start, unsigned long *range_count)
|
|||||||
count = getdef_ulong ("SUB_UID_COUNT", 65536);
|
count = getdef_ulong ("SUB_UID_COUNT", 65536);
|
||||||
|
|
||||||
if (min > max || count >= max || (min + count - 1) > max) {
|
if (min > max || count >= max || (min + count - 1) > max) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (log_get_logfd(),
|
||||||
_("%s: Invalid configuration: SUB_UID_MIN (%lu),"
|
_("%s: Invalid configuration: SUB_UID_MIN (%lu),"
|
||||||
" SUB_UID_MAX (%lu), SUB_UID_COUNT (%lu)\n"),
|
" SUB_UID_MAX (%lu), SUB_UID_COUNT (%lu)\n"),
|
||||||
Prog, min, max, count);
|
log_get_progname(), min, max, count);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
start = sub_uid_find_free_range(min, max, count);
|
start = sub_uid_find_free_range(min, max, count);
|
||||||
if (start == (uid_t)-1) {
|
if (start == (uid_t)-1) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique subordinate UID range\n"),
|
_("%s: Can't get unique subordinate UID range\n"),
|
||||||
Prog);
|
log_get_progname());
|
||||||
SYSLOG ((LOG_WARN, "no more available subordinate UIDs on the system"));
|
SYSLOG ((LOG_WARN, "no more available subordinate UIDs on the system"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 2008 - 2011, Nicolas François
|
* SPDX-FileCopyrightText: 2008 - 2011, Nicolas François
|
||||||
* Copyright (c) 2014, Red Hat, Inc.
|
* SPDX-FileCopyrightText: 2014, Red Hat, Inc.
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -38,6 +15,7 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "pwio.h"
|
#include "pwio.h"
|
||||||
#include "getdef.h"
|
#include "getdef.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_ranges - Get the minimum and maximum ID ranges for the search
|
* get_ranges - Get the minimum and maximum ID ranges for the search
|
||||||
@@ -74,10 +52,10 @@ static int get_ranges (bool sys_user, uid_t *min_id, uid_t *max_id,
|
|||||||
|
|
||||||
/* Check that the ranges make sense */
|
/* Check that the ranges make sense */
|
||||||
if (*max_id < *min_id) {
|
if (*max_id < *min_id) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (log_get_logfd(),
|
||||||
_("%s: Invalid configuration: SYS_UID_MIN (%lu), "
|
_("%s: Invalid configuration: SYS_UID_MIN (%lu), "
|
||||||
"UID_MIN (%lu), SYS_UID_MAX (%lu)\n"),
|
"UID_MIN (%lu), SYS_UID_MAX (%lu)\n"),
|
||||||
Prog, (unsigned long) *min_id,
|
log_get_progname(), (unsigned long) *min_id,
|
||||||
getdef_ulong ("UID_MIN", 1000UL),
|
getdef_ulong ("UID_MIN", 1000UL),
|
||||||
(unsigned long) *max_id);
|
(unsigned long) *max_id);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -97,10 +75,10 @@ static int get_ranges (bool sys_user, uid_t *min_id, uid_t *max_id,
|
|||||||
|
|
||||||
/* Check that the ranges make sense */
|
/* Check that the ranges make sense */
|
||||||
if (*max_id < *min_id) {
|
if (*max_id < *min_id) {
|
||||||
(void) fprintf (shadow_logfd,
|
(void) fprintf (log_get_logfd(),
|
||||||
_("%s: Invalid configuration: UID_MIN (%lu), "
|
_("%s: Invalid configuration: UID_MIN (%lu), "
|
||||||
"UID_MAX (%lu)\n"),
|
"UID_MAX (%lu)\n"),
|
||||||
Prog, (unsigned long) *min_id,
|
log_get_progname(), (unsigned long) *min_id,
|
||||||
(unsigned long) *max_id);
|
(unsigned long) *max_id);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -120,7 +98,7 @@ static int get_ranges (bool sys_user, uid_t *min_id, uid_t *max_id,
|
|||||||
static int check_uid(const uid_t uid,
|
static int check_uid(const uid_t uid,
|
||||||
const uid_t uid_min,
|
const uid_t uid_min,
|
||||||
const uid_t uid_max,
|
const uid_t uid_max,
|
||||||
bool *used_uids)
|
const bool *used_uids)
|
||||||
{
|
{
|
||||||
/* First test that the preferred ID is in the range */
|
/* First test that the preferred ID is in the range */
|
||||||
if (uid < uid_min || uid > uid_max) {
|
if (uid < uid_min || uid > uid_max) {
|
||||||
@@ -213,10 +191,10 @@ int find_new_uid(bool sys_user,
|
|||||||
* more likely to want to stop and address the
|
* more likely to want to stop and address the
|
||||||
* issue.
|
* issue.
|
||||||
*/
|
*/
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Encountered error attempting to use "
|
_("%s: Encountered error attempting to use "
|
||||||
"preferred UID: %s\n"),
|
"preferred UID: %s\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,9 +221,9 @@ int find_new_uid(bool sys_user,
|
|||||||
/* Create an array to hold all of the discovered UIDs */
|
/* Create an array to hold all of the discovered UIDs */
|
||||||
used_uids = malloc (sizeof (bool) * (uid_max +1));
|
used_uids = malloc (sizeof (bool) * (uid_max +1));
|
||||||
if (NULL == used_uids) {
|
if (NULL == used_uids) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: failed to allocate memory: %s\n"),
|
_("%s: failed to allocate memory: %s\n"),
|
||||||
Prog, strerror (errno));
|
log_get_progname(), strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset (used_uids, false, sizeof (bool) * (uid_max + 1));
|
memset (used_uids, false, sizeof (bool) * (uid_max + 1));
|
||||||
@@ -323,10 +301,10 @@ int find_new_uid(bool sys_user,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique system UID (%s). "
|
_("%s: Can't get unique system UID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG ((LOG_ERR,
|
SYSLOG ((LOG_ERR,
|
||||||
"Error checking available UIDs: %s",
|
"Error checking available UIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -366,10 +344,10 @@ int find_new_uid(bool sys_user,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique system UID (%s). "
|
_("%s: Can't get unique system UID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG((LOG_ERR,
|
SYSLOG((LOG_ERR,
|
||||||
"Error checking available UIDs: %s",
|
"Error checking available UIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -426,10 +404,10 @@ int find_new_uid(bool sys_user,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique UID (%s). "
|
_("%s: Can't get unique UID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG ((LOG_ERR,
|
SYSLOG ((LOG_ERR,
|
||||||
"Error checking available UIDs: %s",
|
"Error checking available UIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -469,10 +447,10 @@ int find_new_uid(bool sys_user,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!nospam) {
|
if (!nospam) {
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique UID (%s). "
|
_("%s: Can't get unique UID (%s). "
|
||||||
"Suppressing additional messages.\n"),
|
"Suppressing additional messages.\n"),
|
||||||
Prog, strerror (result));
|
log_get_progname(), strerror (result));
|
||||||
SYSLOG ((LOG_ERR,
|
SYSLOG ((LOG_ERR,
|
||||||
"Error checking available UIDs: %s",
|
"Error checking available UIDs: %s",
|
||||||
strerror (result)));
|
strerror (result)));
|
||||||
@@ -488,9 +466,9 @@ int find_new_uid(bool sys_user,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The code reached here and found no available IDs in the range */
|
/* The code reached here and found no available IDs in the range */
|
||||||
fprintf (shadow_logfd,
|
fprintf (log_get_logfd(),
|
||||||
_("%s: Can't get unique UID (no more available UIDs)\n"),
|
_("%s: Can't get unique UID (no more available UIDs)\n"),
|
||||||
Prog);
|
log_get_progname());
|
||||||
SYSLOG ((LOG_WARN, "no more available UIDs on the system"));
|
SYSLOG ((LOG_WARN, "no more available UIDs on the system"));
|
||||||
free (used_uids);
|
free (used_uids);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -1,32 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1997 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1997 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2005 , Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GETDATE_H_
|
#ifndef _GETDATE_H_
|
||||||
|
|||||||
@@ -31,37 +31,14 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
|
|
||||||
# define IN_CTYPE_DOMAIN(c) 1
|
|
||||||
#else
|
|
||||||
# define IN_CTYPE_DOMAIN(c) isascii(c)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
|
|
||||||
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
|
|
||||||
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
|
|
||||||
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
|
|
||||||
|
|
||||||
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
|
|
||||||
- Its arg may be any int or unsigned int; it need not be an unsigned char.
|
|
||||||
- It's guaranteed to evaluate its argument exactly once.
|
|
||||||
- It's typically faster.
|
|
||||||
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
|
|
||||||
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
|
|
||||||
it's important to use the locale's definition of `digit' even when the
|
|
||||||
host does not conform to Posix. */
|
|
||||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
|
||||||
|
|
||||||
#include "getdate.h"
|
#include "getdate.h"
|
||||||
|
|
||||||
#if defined (STDC_HEADERS)
|
#include <string.h>
|
||||||
# include <string.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Some old versions of bison generate parsers that use bcopy.
|
/* Some old versions of bison generate parsers that use bcopy.
|
||||||
That loses on systems that don't provide the function, so we have
|
That loses on systems that don't provide the function, so we have
|
||||||
to redefine it here. */
|
to redefine it here. */
|
||||||
#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
|
#if !defined (HAVE_BCOPY) && !defined (bcopy)
|
||||||
# define bcopy(from, to, len) memcpy ((to), (from), (len))
|
# define bcopy(from, to, len) memcpy ((to), (from), (len))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -651,7 +628,7 @@ static int LookupWord (char *buff)
|
|||||||
|
|
||||||
/* Make it lowercase. */
|
/* Make it lowercase. */
|
||||||
for (p = buff; '\0' != *p; p++)
|
for (p = buff; '\0' != *p; p++)
|
||||||
if (ISUPPER (*p))
|
if (isupper (*p))
|
||||||
*p = tolower (*p);
|
*p = tolower (*p);
|
||||||
|
|
||||||
if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
|
if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
|
||||||
@@ -732,7 +709,7 @@ static int LookupWord (char *buff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Military timezones. */
|
/* Military timezones. */
|
||||||
if (buff[1] == '\0' && ISALPHA (*buff))
|
if (buff[1] == '\0' && isalpha (*buff))
|
||||||
{
|
{
|
||||||
for (tp = MilitaryTable; tp->name; tp++)
|
for (tp = MilitaryTable; tp->name; tp++)
|
||||||
if (strcmp (buff, tp->name) == 0)
|
if (strcmp (buff, tp->name) == 0)
|
||||||
@@ -771,30 +748,30 @@ yylex (void)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
while (ISSPACE (*yyInput))
|
while (isspace (*yyInput))
|
||||||
yyInput++;
|
yyInput++;
|
||||||
|
|
||||||
if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')
|
if (isdigit (c = *yyInput) || c == '-' || c == '+')
|
||||||
{
|
{
|
||||||
if (c == '-' || c == '+')
|
if (c == '-' || c == '+')
|
||||||
{
|
{
|
||||||
sign = c == '-' ? -1 : 1;
|
sign = c == '-' ? -1 : 1;
|
||||||
if (!ISDIGIT (*++yyInput))
|
if (!isdigit (*++yyInput))
|
||||||
/* skip the '-' sign */
|
/* skip the '-' sign */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sign = 0;
|
sign = 0;
|
||||||
for (yylval.Number = 0; ISDIGIT (c = *yyInput++);)
|
for (yylval.Number = 0; isdigit (c = *yyInput++);)
|
||||||
yylval.Number = 10 * yylval.Number + c - '0';
|
yylval.Number = 10 * yylval.Number + c - '0';
|
||||||
yyInput--;
|
yyInput--;
|
||||||
if (sign < 0)
|
if (sign < 0)
|
||||||
yylval.Number = -yylval.Number;
|
yylval.Number = -yylval.Number;
|
||||||
return (0 != sign) ? tSNUMBER : tUNUMBER;
|
return (0 != sign) ? tSNUMBER : tUNUMBER;
|
||||||
}
|
}
|
||||||
if (ISALPHA (c))
|
if (isalpha (c))
|
||||||
{
|
{
|
||||||
for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.';)
|
for (p = buff; (c = *yyInput++, isalpha (c)) || c == '.';)
|
||||||
if (p < &buff[sizeof buff - 1])
|
if (p < &buff[sizeof buff - 1])
|
||||||
*p++ = c;
|
*p++ = c;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|||||||
@@ -1,33 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2000 - 2006, Tomasz Kłoczko
|
* SPDX-FileCopyrightText: 2000 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2009, Nicolas François
|
* SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 , Nicolas François
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -48,7 +25,7 @@
|
|||||||
* If the range is valid, getrange returns 1.
|
* If the range is valid, getrange returns 1.
|
||||||
* If the range is not valid, getrange returns 0.
|
* If the range is not valid, getrange returns 0.
|
||||||
*/
|
*/
|
||||||
int getrange (char *range,
|
int getrange (const char *range,
|
||||||
unsigned long *min, bool *has_min,
|
unsigned long *min, bool *has_min,
|
||||||
unsigned long *max, bool *has_max)
|
unsigned long *max, bool *has_max)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,30 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Chris Lamb
|
* SPDX-FileCopyrightText: 2017, Chris Lamb
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. The name of the copyright holders or contributors may not be used to
|
|
||||||
* endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -36,6 +13,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
#include "shadowlog.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gettime() returns the time as the number of seconds since the Epoch
|
* gettime() returns the time as the number of seconds since the Epoch
|
||||||
@@ -50,6 +28,7 @@
|
|||||||
char *source_date_epoch;
|
char *source_date_epoch;
|
||||||
time_t fallback;
|
time_t fallback;
|
||||||
unsigned long long epoch;
|
unsigned long long epoch;
|
||||||
|
FILE *shadow_logfd = log_get_logfd();
|
||||||
|
|
||||||
fallback = time (NULL);
|
fallback = time (NULL);
|
||||||
source_date_epoch = shadow_getenv ("SOURCE_DATE_EPOCH");
|
source_date_epoch = shadow_getenv ("SOURCE_DATE_EPOCH");
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user