| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unable to find an editor, vipw would give this error:
# env EDITOR=fnord vipw
vipw: pw_edit(): No such file or directory
vigr or crontab do better:
# env EDITOR=fnord crontab -e
crontab: no crontab for root - using an empty one
crontab: fnord: No such file or directory
crontab: "fnord" exited with status 1
After this change, vipw behaves more like vigr or crontab:
# env EDITOR=fnord vipw
vipw: fnord: No such file or directory
vipw: "fnord" exited with status 1
Reviewed by: rpokala, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25369
Notes:
svn path=/head/; revision=362430
|
| |
|
|
|
|
|
| |
Each of the err() family of functions already takes care of that.
Notes:
svn path=/head/; revision=362429
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
data from /etc/passwd rather than /etc/master.passwd.
The libc getpwent(3) and related functions automatically read master.passwd
when run by root, or passwd when run by a non-root user. When run by non-
root, getpwent() copes with the missing data by setting the corresponding
fields in the passwd struct to known values (zeroes for numbers, or a
pointer to an empty string for literals). When libutil's pw_scan(3) was
used to parse a line without the root-accessible data, it was leaving
garbage in the corresponding fields.
These changes rename the static pw_init() function used by getpwent() and
friends to __pw_initpwd(), and move it into pw_scan.c so that common init
code can be shared between libc and libutil. pw_scan(3) now calls
__pw_initpwd() before __pw_scan(), just like the getpwent() family does, so
that reading an arbitrary passwd file in either format and parsing it with
pw_scan(3) returns the same results as getpwent(3) would.
This also adds a new pw_initpwd(3) function to libutil, so that code which
creates passwd structs from scratch in some manner that doesn't involve
pw_scan() can initialize the struct to the values expected by lots of
existing code, which doesn't expect to encounter NULL pointers or garbage
values in some fields.
Notes:
svn path=/head/; revision=336746
|
| |
|
|
|
|
|
|
|
| |
- Define NO__SCCSID in CFLAGS to preserve existing behavior of omitting
SCCS IDs by default.
- While here, fix the $FreeBSD$ in pw_util.c to use __FBSDID.
Notes:
svn path=/head/; revision=334106
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
Notes:
svn path=/head/; revision=326025
|
| |
|
|
|
|
|
|
|
|
|
| |
Make some use of reallocarray, attempting to limit it to cases where the
parameters are unsigned and there is some theoretical chance of overflow.
MFC afer: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9980
Notes:
svn path=/head/; revision=317265
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.
Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96
Notes:
svn path=/head/; revision=314436
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This allows pw(8) to operate on passwd and group files with longer lines
than could be accomodated by a stack buffer. It doesn't take more than a
few hundred users to exceed 8192 bytes in /etc/group.
MFC after: 3 weeks
Sponsored by: The University of Oslo
Notes:
svn path=/head/; revision=309269
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r285050 fixed a bug in pw that could lead to /etc/passwd or /etc/group
corruption on power loss. However, it fixed it by opening those files with
O_SYNC, which is very slow, especially on ZFS. This change replaces O_SYNC
with appropriately placed fsync()s instead, which is much faster. Using a
ZFS tmpdir, the time to run pw's kyua tests drops from 245s to 35s.
Reviewed by: allanjude, bapt, vangyzen, garga
Tested on pfSense by: garga
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8319
Notes:
svn path=/head/; revision=308806
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a couple of places in the source three where we call
basename() on constant strings. This is bad, because the prototype
standardized by POSIX allows the implementation to use its argument as a
storage buffer.
This change eliminates some of these unportable calls to basename() in
cases where it was only added for cosmetical reasons, namely to trim
argv[0]. There's nothing wrong with setting argv[0] to the full path.
Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D6093
Notes:
svn path=/head/; revision=298876
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
temporary file is created and then a rename() call move it to official file.
This operation didn't have any check to make sure data was written to disk
and if a power cycle happens system could end up with a 0 length passwd
or group database.
There is a pfSense bug with more infor about it:
https://redmine.pfsense.org/issues/4523
The following changes were made to protect passwd and group operations:
* lib/libutil/gr_util.c:
- Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file
- After rename(), fsync() call on directory for faster result
* lib/libutil/pw_util.c
- Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file
* usr.sbin/pwd_mkdb/pwd_mkdb.c
- Added O_SYNC flag on dbopen() calls
- After rename(), fsync() call on directory for faster result
* lib/libutil/pw_util.3
- pw_lock() returns a file descriptor to master password file on success
Differential Revision: https://reviews.freebsd.org/D2978
Approved by: bapt
Sponsored by: Netgate
Notes:
svn path=/head/; revision=285050
|
| |
|
|
| |
Notes:
svn path=/head/; revision=283984
|
| |
|
|
|
|
|
|
|
|
|
| |
it takes a new argument allowing to specify the endianness of the database
to generate
Differential Revision: https://reviews.freebsd.org/D2730
Reviewed by: ian
Notes:
svn path=/head/; revision=283969
|
| |
|
|
|
|
|
| |
Requested by: jilles
Notes:
svn path=/head/; revision=244744
|
| |
|
|
| |
Notes:
svn path=/head/; revision=244735
|
| |
|
|
|
|
|
| |
Reported by: Garrett Cooper <yanegomi@gmail.com>
Notes:
svn path=/head/; revision=242324
|
| |
|
|
|
|
|
|
|
| |
a directory.
MFC after: 1 month
Notes:
svn path=/head/; revision=242319
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
for example)
get the username information from old_pw structures to still allow renaming of a
user.
Reported by: Claude Buisson <clbuisson@orange.fr>
Approved by: des (mentor)
MFC after: 3 weeks
Notes:
svn path=/head/; revision=237268
|
| |
|
|
|
|
|
|
|
|
| |
POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond
precision to detect file modification.
MFC after: 2 weeks
Notes:
svn path=/head/; revision=231383
|
| |
|
|
|
|
|
|
|
| |
while here, fix missing parentheses of the return statement of pw_make.
Approved by: des (mentor)
Notes:
svn path=/head/; revision=229572
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- if pw is NULL and oldpw is not NULL then the oldpw is deleted
- if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid
then it renames the user
add new gr_* functions so now gr_util API is similar to pw_util API,
this allow to manipulate groups in a safe way.
Reviewed by: des
Approved by: des
MFC after: 1 month
Notes:
svn path=/head/; revision=228545
|
| |
|
|
|
|
|
| |
sprintf(3).
Notes:
svn path=/head/; revision=211392
|
| |
|
|
|
|
|
|
|
| |
Replace it to avoid conflict.
MFC after: 3 weeks
Notes:
svn path=/head/; revision=199826
|
| |
|
|
| |
Notes:
svn path=/head/; revision=165906
|
| |
|
|
| |
Notes:
svn path=/head/; revision=162141
|
| |
|
|
|
|
|
|
|
|
|
| |
(copy it silently, do not dereference NULL pointer).
PR: bin/102848
Reviewed by: security-officer (cperciva)
MFC after: 1 week
Notes:
svn path=/head/; revision=161997
|
| |
|
|
|
|
|
|
|
| |
to variadic functions.
Approved by: das (mentor)
Notes:
svn path=/head/; revision=129392
|
| |
|
|
| |
Notes:
svn path=/head/; revision=121193
|
| |
|
|
| |
Notes:
svn path=/head/; revision=116344
|
| |
|
|
| |
Notes:
svn path=/head/; revision=113333
|
| |
|
|
|
|
|
|
|
| |
preparing to edit it.
PR: bin/50563
Notes:
svn path=/head/; revision=113305
|
| |
|
|
|
|
|
|
|
|
| |
or the tty, just block selected signals in the parent like system(3) does.
Many thanks to bde for his assistance in finding the correct solution.
PR: bin/50679
Notes:
svn path=/head/; revision=113301
|
| |
|
|
|
|
|
|
|
|
|
| |
proper way to fix this. The way this works is to prepend "exec " to
the editor command to eliminate the "shell in the middle" which prevents
us from properly reawakening the editor after a SIGTSTP.
PR: bin/50679
Notes:
svn path=/head/; revision=113265
|
| |
|
|
|
|
|
|
|
|
| |
variable.
PR: 48748
Reviewed by: mike (mentor)
Notes:
svn path=/head/; revision=112328
|
| |
|
|
|
|
|
| |
Submitted by: joerg
Notes:
svn path=/head/; revision=106140
|
| |
|
|
|
|
|
|
|
|
| |
Distinguish between a held lock and a failed lock op.
If rpc.lockd is not running on a diskless client this makes clearer
what the problem is.
Notes:
svn path=/head/; revision=98693
|
| |
|
|
|
|
|
| |
Sponsored by: DARPA, NAI Labs
Notes:
svn path=/head/; revision=96220
|
| |
|
|
|
|
|
| |
Sponsored by: DARPA, NAI Labs
Notes:
svn path=/head/; revision=96199
|
| |
|
|
|
|
|
|
|
|
|
|
| |
them to point at static strings that contain the default paths. This
makes 'vipw -d' work again (I broke it in rev 1.21; apologies for taking
so long to fix it.)
Spotted by: Olivier Houchard <doginou@cognet.ci0.org>
Sponsored by: DARPA, NAI Labs
Notes:
svn path=/head/; revision=94897
|
| |
|
|
| |
Notes:
svn path=/head/; revision=94776
|
| |
|
|
|
|
|
| |
Sponsored by: DARPA, NAI Labs
Notes:
svn path=/head/; revision=90233
|
| |
|
|
|
|
|
| |
Idea from: Theo de Raadt <deraadt@openbsd.org>
Notes:
svn path=/head/; revision=79452
|
| |
|
|
|
|
|
| |
Reviewed by: kris
Notes:
svn path=/head/; revision=75821
|
| |
|
|
| |
Notes:
svn path=/head/; revision=62988
|
| |
|
|
| |
Notes:
svn path=/head/; revision=50479
|
| |
|
|
|
|
|
| |
function is also used by chpass(1) and passwd(1).
Notes:
svn path=/head/; revision=48328
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
secure permissions in case the user attempts to save something to
a file of his own.
Move umask stuff out of pw_init() into main() for better visibility
of overall umask tweaking logic.
PR: misc/11797
Notes:
svn path=/head/; revision=48241
|
| |
|
|
|
|
|
|
|
|
| |
for the password files.
PR: 2703
Submitted by: jmg
Notes:
svn path=/head/; revision=48232
|
| |
|
|
| |
Notes:
svn path=/head/; revision=41711
|
| |
|
|
|
|
|
|
| |
just been replaced. After our lock succeeds we check if st_nlink is 0
and if it is we close the descriptor and retry our open/lock sequence.
Notes:
svn path=/head/; revision=41710
|