summaryrefslogtreecommitdiffstats
path: root/lib/libutil
Commit message (Collapse)AuthorAgeFilesLines
* Fix IEC / SI binary prefixes (Ki, Mi, Gi, etc) production by humanize_number(3)bapt2012-09-121-1/+1
| | | | | | PR: bin/171487 Submitted by: matthew MFC after: 1 week
* Switch the default password hash from md5 to sha512.des2012-06-191-1/+1
| | | | MFC after: 1 week
* Revert user comparison back to user names as some user can share uids (root/toorbapt2012-06-191-6/+13
| | | | | | | | | | | 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
* Finally nuke auth.conf, nine years after it was deprecated. The onlydes2012-06-125-127/+7
| | | | | | | | | | | | | | | | | | thing it was still used for was to set the "global default" password hash. Since the stock auth.conf contained nothing but comments, the global default was actually the first algorithm in crypt(3)'s list, which happens to be DES; I take the fact that nobody noticed as proof that it was not used outside of crypt(3). The only other use in our tree was in the Kerberos support code in in tinyware's passwd(1). I removed that code in an earlier commit; it would not have compiled anyway, as it only supported Kerberos IV. The auth_getval() function is now a stub that always returns NULL, which has the same effect as a functional auth_getval() with an empty auth.conf. MFC after: 3 weeks
* Document that we also support sha256 and sha512.des2012-06-081-1/+3
| | | | MFC after: 1 week
* General mdoc(7) and typo fixes.gjb2012-05-121-1/+2
| | | | | | PR: 167804 Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org) MFC after: 3 days
* mdoc: terminate quoted strings.joel2012-03-301-53/+53
|
* mandoc complains loudly when <TAB>s are misused in columnated lists. Fixjoel2012-03-291-1/+1
| | | | | this syntax violation and while I'm here also convert <TAB> to Ta and adjust quotation marks in order to prevent this problem in the future.
* Remove trailing whitespace per mdoc lint warningeadler2012-03-292-4/+4
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* mdoc: sort prologue macros.joel2012-03-262-2/+2
|
* This string should be quoted.joel2012-03-261-1/+1
| | | | Noticed by: brueffer
* mdoc: terminate quoted strings.joel2012-03-261-21/+21
| | | | Reviewed by: brueffer
* Fix various typos in manual pages.gjb2012-02-251-2/+2
| | | | | | Submitted by: amdmi3 PR: 165431 MFC after: 1 week
* Set the O_CLOEXEC flag when opening the pidfile to avoid leaking theghelmer2012-02-201-1/+1
| | | | | | | file descriptor via exec(3). Now that daemon(8) has been fixed to resolve the issue noted by trociny, the consensus is that this change should be OK.
* Detect file modification properly by using tv_nsec.ed2012-02-101-1/+2
| | | | | | | POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond precision to detect file modification. MFC after: 2 weeks
* Fix NULL ptr dereference in setusercontext if pwd is null,eadler2012-02-091-3/+6
| | | | | | | | | | | LOGIN_SETPRIORITY is set, and setting the priority (rtprio or setpriority) fails. PR: kern/164238 Submitted by: Alexander Wittig <alexander@wittig.name> Reviewed by: des Approved by: cperciva MFC after: 1 month
* Add a comment to the example that pidfile_* functions can handle pfh being NULL.pjd2012-02-081-0/+5
| | | | MFC after: 3 days
* Note that calling pidfile_write(3) multiple times is fine.pjd2012-02-081-1/+4
| | | | MFC after: 3 days
* Using the O_CLOEXEC flag on open(2) caused the pidfile lock to be lostghelmer2012-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | when the child process execs daemon's target program thanks to flock(2) semantics. So, we apparently have to leak the open pidfile's file descriptor to keep the lock for the pidfile(3) functions to work properly. Test case demonstrated by trociny: ref8-amd64:/home/trociny% uname -r 8.2-STABLE ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 daemon: process already running, pid: 19799 kopusha:~% uname -r 10.0-CURRENT kopusha:~% daemon -p /tmp/sleep.pid sleep 10 kopusha:~% daemon -p /tmp/sleep.pid sleep 10 kopusha:~%
* Consensus between bde and pjd seemed to be that if the function namesghelmer2012-01-261-8/+8
| | | | | | are lined up, then any * after a long type should appear after the type instead of being in front of the function name on the following line.
* Make the comments consistent (capitalization, punctuation, andghelmer2012-01-261-6/+10
| | | | | | format). Requested by bde
* Restore the parenthesis that are necessary around the constant values.ghelmer2012-01-261-7/+7
| | | | Requested by bde.
* Remove unnecessary includes from these libutil man pages.ghelmer2012-01-163-4/+0
| | | | Requested by bde (as was the previous commit).
* Fix more disorder in prototypes and constants.ghelmer2012-01-161-46/+43
| | | | | | Fix header comments for each section of constants. Fix whitespace in #define lines. Fix unnecessary parenthesis in constants.
* Move struct pidfh definition into pidfile.c, and leave a forward declarationghelmer2012-01-122-12/+13
| | | | | | | | | for pidfh in libutil.h in its place. This allows us to hide the contents of the pidfh structure, and also allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the pidfile_* function prototypes. Suggested by pjd.
* Fix disorder in MAN and MLINKS lists.ghelmer2012-01-121-37/+37
| | | | Requested by bde.
* More prototype formatting fixes, struct member formatting fixes,ghelmer2012-01-121-10/+17
| | | | | | and namespace fix for property_find() prototype. Provided by bde.
* pidfile_open() no longer uses fcntl() to set the close-on-exec flag.ghelmer2012-01-121-2/+1
|
* Fix prototype formatting (indentation, long lines, and continued lines).ghelmer2012-01-111-23/+30
| | | | Requested by bde.
* Fix namespace issues with prototype parameter names.ghelmer2012-01-111-32/+32
| | | | | | Add missing prototype parameter names. Requested by bde.
* Fix forward structure declaration and prototype disorder.ghelmer2012-01-111-34/+33
| | | | Requested by bde.
* jilles pointed out that O_CLOEXEC could be used in the open(2) flagsghelmer2012-01-111-14/+1
| | | | | | rather than using fcntl(2) later, and in addition to saving a system call, removes a possible race with fork/exec from threads or signal handlers.
* Constify arguments.pjd2012-01-112-3/+3
|
* Add link for pidfile_fileno.3 to pidfile.3 - thanks again pjd!ghelmer2012-01-101-1/+2
|
* Style fixes courtesy of pjd.ghelmer2012-01-102-2/+5
|
* Document that pidfile_open() now sets the FD_CLOEXEC flag on the openghelmer2012-01-101-0/+4
| | | | | file descriptor, and that errors can be returned as a result of the fcntl(2) system call.
* Add pidfile_fileno() to obtain the file descriptor for an openghelmer2012-01-103-2/+39
| | | | pidfile.
* Set the FD_CLOEXEC flag on the open pidfile file descriptor.ghelmer2012-01-101-0/+14
| | | | Discussed with: pjd, des
* Convert files to UTF-8 and add some copyright markers where missing.uqs2012-01-072-2/+2
|
* Add new pw_make_v7 to make a passwd line (in v7 format) out of a struct passwdbapt2012-01-052-1/+16
| | | | | | while here, fix missing parentheses of the return statement of pw_make. Approved by: des (mentor)
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-1/+1
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* Modify pw_copy:bapt2011-12-153-13/+332
| | | | | | | | | | | | | - 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
* In pidfile_open(), if the pidfile is locked, but empty (PID is not stored yet)pjd2011-10-162-22/+27
| | | | | | | | | | | and the caller requested other process' PID by passing non-NULL pidptr argument, we will wait at most 100ms for the PID to show up in the file and if it won't, we will store -1 in *pidptr. From now on, pidfile_open() function never sets errno to EAGAIN on failure. In collaboration with: des MFC after: 1 week
* Add missing "swapuse" resource limit.trasz2011-07-091-1/+2
|
* - Commit work from libprocstat project. These patches add support for runtimestas2011-05-126-2/+325
| | | | | | | | | | | | | | | | | | | | | | | file and processes information retrieval from the running kernel via sysctl in the form of new library, libprocstat. The library also supports KVM backend for analyzing memory crash dumps. Both procstat(1) and fstat(1) utilities have been modified to take advantage of the library (as the bonus point the fstat(1) utility no longer need superuser privileges to operate), and the procstat(1) utility is now able to display information from memory dumps as well. The newly introduced fuser(1) utility also uses this library and able to operate via sysctl and kvm backends. The library is by no means complete (e.g. KVM backend is missing vnode name resolution routines, and there're no manpages for the library itself) so I plan to improve it further. I'm commiting it so it will get wider exposure and review. We won't be able to MFC this work as it relies on changes in HEAD, which was introduced some time ago, that break kernel ABI. OTOH we may be able to merge the library with KVM backend if we really need it there. Discussed with: rwatson
* Don't duplicate define the stdint types.obrien2011-05-051-10/+1
|
* Add support for IEE/IEC (and now also SI) power of two notions ofdelphij2011-04-123-27/+89
| | | | | | | | | | prefixes (Ki, Mi, Gi...) for humanize_number(3). Note that applications has to pass HN_IEC_PREFIXES to use this feature for backward compatibility reasons. Reviewed by: arundel MFC after: 2 weeks
* Add missing resource limits:pluknet2011-03-241-12/+14
| | | | | | | - RLIMIT_NPTS - RLIMIT_SWAP MFC after: 1 week
* humanize_number(3) multiply the input number by 100, which could cause andelphij2011-03-231-16/+24
| | | | | | | | | | | | integer overflow when the input is very large (for example, 100 Pi would become about 10 Ei which exceeded signed int64_t). Solve this issue by splitting the division into two parts and avoid the multiplication. PR: bin/146205 Reviewed by: arundel MFC after: 1 month
* s/buffer/buf as is used in the code.gjb2011-03-211-5/+5
| | | | | Submitted by: arundel (via doc@) MFC after: 3 days
OpenPOWER on IntegriCloud