Commit Graph

531 Commits

Author SHA1 Message Date
jruoho
0c84062280 Note strpct(3). 2011-08-29 12:32:54 +00:00
wiz
10b0d879be Minor cleanup. 2011-08-28 17:21:28 +00:00
christos
e7295d23ac add strpct, requested by joerg 2011-08-28 07:45:13 +00:00
jruoho
e2ab801e81 Xref chflags(2) and stat_flags(3) with each other. 2011-08-06 11:28:24 +00:00
christos
322a9e7966 fix freudian slip 2011-04-24 01:56:44 +00:00
jmmv
255271589f Extend pidfile(3) to support creating pid files in arbitrary locations.
If the argument provided to pidfile(3) contains a '/', then the value is
considered to be an absolute/relative path and the pid file is created
in the given location.

Otherwise, pidfile(3) behaves as before and treats the provided value as
a basename to construct a pid file in /var/run/<basename>.pid.  This means
that to create a pid file named "foo.pid" in the current directory, one
must specify "./foo.pid".
2011-03-29 13:55:37 +00:00
njoly
119aff4da3 Fix sigprocmask section (3 -> 2). 2011-03-27 12:53:16 +00:00
christos
6ef213c85c restore lost overlow check fix. 2010-12-24 15:47:39 +00:00
christos
5448347830 make this thread-safe. We could use localtime_tz and make it even better,
but not now.
2010-12-24 03:37:37 +00:00
wiz
c03e55e8e9 Remove trailing whitespace. 2010-12-22 09:12:28 +00:00
christos
a504543f04 fix incorrect overflow check from Nicholas Joly 2010-12-21 18:13:02 +00:00
christos
537ea48995 - document limitations
- add extra number name parsing
2010-12-21 00:15:10 +00:00
christos
2e63e08217 - fix off by one in comparison with 69 (it should be 70)
- add aliases for 1 (one), 2 (two), etc.
- allow parsing of HH:MM:SS.sss as the man page mentions, and ignore sss
2010-12-21 00:14:10 +00:00
christos
49f71b9cd5 PR/42549: Izumi Tsutsui: parsedate does not work after 2038.
Fix multiple issues:
- Remove bogus 2038 check and add overflow checks in the appropriate places.
- Correct incomplete leap year calculation that broke things after 2100.
- Check localtime return values
- Change int calculations to time_t to avoid oveflow.
- Consistently check/return -1 and remove bogus comment about not being
  able to return -1.

Now:
$ date -d 20991201
Tue Dec  1 00:00:00 EST 2099
$ date -d 40991201
Tue Dec  1 00:00:00 EST 4099
$ date -d 10000000991201
Tue Dec  1 00:00:00 EST 1000000099
TIME=0:04.48 CPU=117.8% (5.288u 0.000s) SWAPS=0 (0+95)pf (0i+0o) (0Kc+0Kd)
$ date -d 100000000991201
date: Cannot parse `100000000991201'
TIME=0:53.48 CPU=99.2% (53.086u 0.000s) SWAPS=0 (0+96)pf (0i+0o) (0Kc+0Kd)
Exit 1
2010-12-12 18:39:57 +00:00
wiz
9538d798d1 Fix Dd argument, sort sections. 2010-08-28 15:49:08 +00:00
tron
a38ccbe49f Mention recent enhancement and not that this function is neither
re-entrant nor thread-safe.
2010-08-28 13:42:07 +00:00
christos
389aa89258 PR/43795: Guy Harris: describe return values and error handling. 2010-08-24 12:05:01 +00:00
tron
90493f6f08 Add support for parsing the data format "@<seconds since epoch>" e.g.
"@735275209" for "Tue Apr 20 03:06:49 UTC 1993". This change was inspired
by coreutil's "date" utility.
2010-08-21 16:17:40 +00:00
christos
6afe6deefa Log why pwd_mkdb failed. Currently on aslr systems, pwd_mkdb either aborts
or when s/vfork/fork/ dies with SEGV accessing the the stack. The same abort
effect can be achieved when we remove all resource limits.
2010-08-18 08:32:02 +00:00
christos
90f5be5cdd Log via syslog(3) when we run pwd_mkdb(8). 2010-08-18 08:09:17 +00:00
wiz
0d0949dea8 Mark up NULL with Dv. 2010-05-05 22:05:31 +00:00
jruoho
59d481ff7f Upon lukem@'s request, put the list of functions back.
XXX: Someone, please keep this up-to-date.
2010-05-05 06:11:14 +00:00
jruoho
43f2dd8f20 Rework the example a little. 2010-05-04 07:58:28 +00:00
jruoho
c17db6ca32 Remove the list of functions in the libutil library.
While such lists are nice, they are doomed to be repeatedly out of date due
maintenance costs related to manual updates. Ideally there should be a
common routine to auto-generate these, but in the meantime, just point to
the directory where libutil is implemented.
2010-05-04 07:07:12 +00:00
jruoho
805fdd4774 Use table instead of a list. 2010-05-04 06:53:35 +00:00
jruoho
45b87028bd Use .Fn instead of .Nm. 2010-05-04 06:41:27 +00:00
jruoho
e206128379 .Nm -> .Fn, and one .Pp. 2010-05-03 05:40:37 +00:00
joerg
e382e1d38b Use .In instead of .Aq Pa and variantes for header files. 2010-03-22 22:00:37 +00:00
drochner
7033707525 retire pw_policy(3) -- it is not found useful, there are other
(more common) ways to enforce a password strength policy
approved by elad
2010-01-27 19:10:30 +00:00
tsarna
8c31ceec62 Update my email address to one I have used in this millenium. 2009-10-22 23:08:03 +00:00
pooka
363b14551a In a furious blaze of *facepalm* / "what was i thinking?", fix the
open routine function pointer prototype of opendisk1() to match
the prototype of open().
2009-10-13 22:00:31 +00:00
pooka
aaaf93f1d4 Add opendisk1(), which functions like opendisk(), but takes a function
pointer to the routine to be used for open().
2009-09-08 21:34:57 +00:00
joerg
07c495396f Fix markup. 2009-07-14 18:56:14 +00:00
zafer
282680c9b1 correct spelling error. 2009-06-24 22:31:58 +00:00
christos
87fe4621ba add a link to pw_copyx; from anon ymous 2009-06-20 14:28:29 +00:00
wiz
6a1c80cfff Bump date for previous. 2009-05-13 23:02:52 +00:00
pgoyette
28469fc250 Implement snprintb_m(3) to provide multi-line bit/bit-field decode.
Discussed on tech-kern.
2009-05-13 02:50:31 +00:00
pgoyette
5fae2745d1 Update type of argument 4 from u_quad_t to uint64_t to match the actual
implementation.
2009-05-05 13:12:25 +00:00
wiz
efabe55512 Sort sections. 2009-05-04 20:43:48 +00:00
wiz
83412be2c1 Sort SEE ALSO. 2009-05-04 19:15:36 +00:00
joerg
33c9c1889e Use semantic markup. 2009-04-11 17:26:32 +00:00
joerg
71c479831e Fix markup. 2009-04-11 16:13:49 +00:00
uebayasi
df37ad1752 Correct the order of arguments in EXAMPLE. Bump date. 2009-03-26 05:00:10 +00:00
joerg
e85762f4cf Specify width for tag list 2009-03-10 21:00:47 +00:00
joerg
997634fe14 Fix preamble to match order set out by mdoc(7). Discussed with wiz. 2009-03-09 19:24:26 +00:00
christos
47b68f7fe6 remove pointless static. 2009-02-20 16:44:06 +00:00
lukem
53ff085f8b WARNS=4 2009-01-18 12:13:32 +00:00
lukem
c5eb4ab601 fix -Wsign-compare issues 2009-01-18 11:56:51 +00:00
christos
50728e7823 merge christos-time_t 2009-01-11 02:57:17 +00:00
wiz
b52bc84da9 Sort errors. 2008-12-26 21:02:28 +00:00
christos
16338b1c19 document pw_getpwconf. 2008-12-26 00:49:28 +00:00
wiz
38d39e864c Fix deleto in previous. 2008-12-23 21:46:13 +00:00
christos
9cd6b6e766 fix argument order in example. 2008-12-23 20:53:31 +00:00
christos
fa2088e532 PR/18150: John F. Woods: Print meaningful error messages on inconsistent/
corrupt entries.
2008-12-21 17:54:43 +00:00
wiz
78f0ebffc8 Re-add LIBRARY section. 2008-12-17 14:05:23 +00:00
wiz
f1c9faeb9d Fix some minor mdoclint complaints. 2008-12-17 10:39:22 +00:00
christos
930983f9c3 use the bitmask_snprintf info which is more complete, and adjust it for
reality.
2008-12-16 23:19:16 +00:00
christos
c057bf8352 move snprintb to common 2008-12-16 22:34:40 +00:00
dholland
d5870e1cc6 Clarify that the "amaster" argument of forkpty() is only defined upon
return in the parent process, but the tty name is available to both
the parent and child. Bump date.
2008-11-28 07:17:17 +00:00
wiz
c099cd9e1e Remove trailing whitespace. 2008-11-17 15:21:43 +00:00
wiz
6c6bf72afb Bump date for new section. 2008-11-17 15:21:22 +00:00
ahoka
6afdea3900 SEE ALSO
efun(3)
2008-11-17 14:59:57 +00:00
drochner
1914237fbe include <stdlib.h> explicitely, for exit(), getprogname() etc.
(it happens to be pulled in by the yacc skeleton, but we shouldn't
rely on this)
2008-07-17 16:24:55 +00:00
martin
11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
oster
8b2eb1e024 Add the missing 'n' to 'correspoding'. 2008-02-23 18:35:04 +00:00
dholland
c60100b138 Use STDIN_FILENO and friends instead of magic constants 0/1/2.
Suggested by the patches in PR bin/36551 from Greg A. Woods.
2008-02-09 05:07:26 +00:00
mjf
d4a648c345 Implement a new magic string for magic symlinks, @ruid, which exapnds to the
real user id of the process and use this magic string for per-user tmp.
This should fix PR/35687

Kernel parts reviewed by wrstuden@
2007-12-04 22:09:01 +00:00
rillig
55bf992f36 The e* functions don't call the error handler in every case, just in
case of an error.

Mentioned the error conditions for the various functions.
2007-11-21 09:17:24 +00:00
christos
b093a7796c split LOGIN_SETGROUP -> LOGIN_SETGID|LOGIN_SETGROUPS 2007-10-06 21:51:21 +00:00
lukem
2aa3c760cc support nbtool_config.h. 2007-09-28 09:07:16 +00:00
lukem
e9aa053c09 Add raise_default_signal(3) -- raise the default signal handler.
Can be used by applications that have their own SIGINT (et al)
handlers and want to exit in a manner that correctly
signals to the parent that the process was terminated by a signal.
See http://www.cons.org/cracauer/sigint.html for more info.
Discussed on tech-userlevel@.
2007-09-25 01:13:54 +00:00
pooka
8ffb2866a1 * clarify error behaviour for getmntopts()
* invert getmnt_silent description (a.k.a. "fix it")
2007-08-26 22:53:01 +00:00
pooka
5cf35d2a60 Emulate behaviour described in man page and return NULL if an error occurs. 2007-08-26 22:46:15 +00:00
dyoung
bfa27930cb In sockaddr_snprintf(sbuf, len, fmt, sa), do not write the terminating
null character outside of the byte region [sbuf, sbuf + len).

1) If the length of the buffer is 0, do not write a null character
   at all.  Previously, sockaddr_snprintf() may have been able to
   overwrite sbuf[-1] if len was 0.

2) If the length of the buffer, len, is greater than 0, then write
   the null at sbuf[len - 1].  Previously, sockaddr_snprintf()
   wrote the null at buf[len - 1], where `buf' was a "cursor" that
   did not necessarily equal `sbuf', the start of the buffer.  Now,
   sockaddr_snprintf() always writes the null at sbuf[len - 1].
2007-07-24 08:45:45 +00:00
pooka
060d8639e3 add estrndup() 2007-07-01 21:41:16 +00:00
wiz
e7023c08af Remove pw_error prototype, the function is described in a different man page.
Bump date.

From Slava Semushin in private mail.
2007-02-17 09:37:55 +00:00
elad
5e2e282f9c Add support for per-user /tmp.
Enabled via per_user_tmp in /etc/rc.conf (default off).

See security(8) and rc.conf(5) for more details.

Lots of input from thorpej@ & christos@, thanks!
2007-02-04 08:19:26 +00:00
cbiere
13b350466e Fixed string truncation bug in flags_to_string(): SAPPEND() uses
sizeof(string) but string is a pointer to a malloc()ed buffer.
2007-01-16 17:34:02 +00:00
elad
7e90974e98 Consistent license. 2007-01-09 14:04:44 +00:00
wiz
f77162e1ea Fix typo. 2006-12-23 09:55:47 +00:00
wiz
1073e35f2d Use more macros. Fix section in Xr. 2006-12-23 09:54:11 +00:00
wiz
73188ad828 Quote - when used as minus; uppercase Dt argument; remove dot at end
of SEE ALSO; new sentence, new line.
2006-12-23 07:29:10 +00:00
wiz
57551caad9 Remove trailing whitespace. 2006-12-23 07:26:09 +00:00
christos
af4b090320 From Anon Ymous:
- add __unused
- remove __GNUC__ hack
2006-12-20 16:47:13 +00:00
he
0a97c3f688 Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
 o Bump libutil minor version number
 o Fix uses to include <util.h> to pick up the function definitions
 o Fix most uses of flags_to_string() to release the now-malloc()ed result
2006-12-14 20:09:35 +00:00
christos
33d6b113f2 moved string_to_flags and flags_to_string from ls to libutil. 2006-12-14 19:18:01 +00:00
dyoung
a26b3af0e0 Render the format %% as %. 2006-12-09 20:18:43 +00:00
christos
61261c8531 rename getdate to parsedate to avoid conflict with posix function 2006-11-20 20:33:02 +00:00
christos
a5486efb24 constify 2006-11-17 22:44:16 +00:00
christos
ba26b607a4 add getdate. 2006-11-17 22:10:23 +00:00
christos
8c97c569de include ecalloc() from our anonymous user. 2006-10-20 17:40:39 +00:00
christos
284c960b4d typo from our anonymous user. 2006-10-20 17:40:18 +00:00
christos
40c48e4f33 prevent empty else. 2006-10-15 19:34:51 +00:00
christos
ebed6f0b8c add volatile to prevent gcc clobbering. 2006-10-15 19:33:52 +00:00
christos
2979ced6e8 - Instead of wondering if to syslog an error, do so, but in the called
function.
- use snprintf instead of sprintf.
2006-10-15 19:33:03 +00:00
christos
e7acb44bcf Allow escaping of the separators using a double backslash 2006-10-14 18:53:11 +00:00
pooka
34a6a097c3 add util.h to SYNOPSIS 2006-10-06 15:31:20 +00:00
christos
5863dc6ef1 Coverity CID 4159: Don't memset() needlessly. 2006-09-27 16:20:03 +00:00
wiz
8d8d8f2ebd Slight wording improvement, sort SEE ALSO, remove trailing dot in SEE ALSO. 2006-09-02 23:43:47 +00:00
christos
ec0bdc9542 make this compilable as a tool. 2006-08-28 20:46:26 +00:00
christos
568f6f6f30 Only use __RCSID if we have it. 2006-08-26 23:17:43 +00:00
christos
6e90deb9cb Efun source. 2006-08-26 18:11:45 +00:00
christos
e72710e561 Add efun(3) 2006-08-26 18:11:12 +00:00
drochner
f5015685d4 mention error return value, like getrawpartition(3) 2006-05-26 12:36:59 +00:00
wiz
cb3fc8886b \- is a minus. 2006-05-25 10:56:08 +00:00
christos
dc46554fdb Document that this can fail. 2006-05-25 00:41:24 +00:00
elad
2675cb7714 Allow explicit length by checking it only if we have a length above 0. 2006-04-01 14:51:17 +00:00
elad
f77bbf7c65 set all fields to -1 after allocation, this makes it easier to write
policies.
2006-03-30 18:11:17 +00:00
wiz
c2cc4b2716 Consistently use .Va for errno. Quote "-" for PostScript output. 2006-03-23 19:31:37 +00:00
wiz
c2f9369ee7 Remove trailing whitespace, add 'and' in enumeration. 2006-03-23 19:30:27 +00:00
elad
d7e635e034 plug leaks, coverity cids 1618, 1619. 2006-03-20 17:32:17 +00:00
elad
2b9c10de57 Set errno on failure, and man-page updates. 2006-03-19 22:58:21 +00:00
christos
a3f80bb48f - Don't trash error number returned by the handler; return it instead.
- Add default cases and return EINVAL
- Don't check for NULL arguments and return EFAULT. Let it core-dump instead.
  (or add DIAGASSERT)
- Coverity CID 799: Don't dereference m and n if they are known to be NULL.
  Bail out sooner with EINVAL.
2006-03-19 22:18:25 +00:00
christos
b3044379df Clarify errno's returned by those functions. 2006-03-19 21:56:04 +00:00
christos
6b99850ef0 Coverity CID 1209: Avoid negative close. While I am there fix bugs (open
returning 0 is ok). Reorganize code to factor out common parts, cleanup
syscall checking and error code return.
2006-03-19 21:55:37 +00:00
wiz
bade1adbc5 Fix typo. 2006-02-24 21:07:29 +00:00
wiz
8b9018d2d9 Mark up NULL (with Dv). 2006-02-24 21:06:50 +00:00
elad
bca69c49bf needs assert.h to compile. 2006-02-19 23:13:14 +00:00
elad
f0dd749f9b add _DIAGASSERT as requested by mrg@. 2006-02-19 20:46:29 +00:00
elad
5cd336ae07 When loading a policy with an "nclasses" option, always set the min/max
values for the various character classes to allow any number, just in
case. Also note about that in the man-page.

This makes it easier to use the "nclasses" option.

Note that alternatively we could just memset() to 0xff when doing the
load, but that might lead to more unexpected behavior.
2006-02-18 16:45:01 +00:00
elad
cf6eceb4e7 Don't expose struct pw_policy and use pw_policy_t, use malloc, man-page
fixups.

As discussed on source-changes@.

Okay yamt@, thorpej@.
2006-02-18 16:32:45 +00:00
elad
378a5a27de Some stuff that's been sitting in my tree for too long...
Improve the pw_policy(3) API by splitting it to two functions, one to load
the policy from /etc/passwd.conf and another to test passwords against the
policy.

Some bug fixes, more consistent code, and man-page updates.

Minor for libutil bumped.
2006-02-18 10:52:48 +00:00
christos
349633b5fa make setuserenv and setuserpath take an environment setting function and
an environment pointer and expose them.
bump version.
2005-12-20 21:32:20 +00:00
elad
02197be174 Lint warnings. 2005-09-17 01:51:21 +00:00
elad
769541972d Rename struct pw_policy -> struct pw_policy_handler. 2005-09-16 22:38:48 +00:00
elad
44b5bc7c94 Add pw_policy.3.
From Hisashi T Fujinaka, thanks!
2005-09-14 18:45:40 +00:00
elad
8d6270e665 Introduce pw_policy(3), an easily extendable way of defining password
policies and enforcing them in programs.

Man-page written with much help and tips from David Maxwell, Hubert
Feyrer, and Thomas Klausner.

This bumps libutil minor to 7.

XXX: Need default policy to go in /etc/passwd.conf, and integration
     into local/yp/PAM password changing code.

PR/10206.
2005-09-14 11:36:52 +00:00
christos
3ff3472e11 Use the re-entrant getgr*_r functions. From John Nemeth. 2005-09-14 02:12:34 +00:00
wiz
e315aa9a2a Avoid duplicate if. 2005-09-10 21:55:35 +00:00
elad
232f61fabb Lint warnings. 2005-08-27 16:55:59 +00:00
elad
75beed7e53 Make this compile without warnings. 2005-08-19 10:10:08 +00:00
elad
dd3453b45c Make pw_getconf(3) set errno so we have indication on what went wrong.
Document possible errno values in the manpage.
2005-08-18 21:07:23 +00:00
wiz
98fcd5ac03 Fix capso in Dd argument. 2005-05-16 18:49:24 +00:00
thorpej
f2b0a44663 u_short -> uint16_t 2005-05-15 21:01:34 +00:00
wiz
0bb532e823 Bump date for previous; add commas to make
sentences more readable.
2005-04-13 23:08:03 +00:00
drochner
1a771b22ec Allow for a login.conf file without an explicite "default" class
definition.
The login.conf(5) manpage states that the "default" class is used
*if it exists*.
2005-04-13 20:32:42 +00:00
atatat
a9321bb19a Add the 'A' and 'P' format specifiers which use getaddrinfo(3) to turn
numbers into names (if possible).  Also add the '?' format modifier
that elides the "N/A" if that's what you would normally get.
2005-04-09 02:05:47 +00:00
mycroft
ebfdf0c012 If TIOCPTMGET fails, close /dev/ptm. 2005-01-19 01:54:09 +00:00
christos
163d05f57d PR/28792: FUKAUMI Naoki: passwd: Couldn't generate salt: Invalid argument
I broke the case where /etc/passwd.conf was empty.
2005-01-15 03:07:56 +00:00
dyoung
4d24861fc9 For consistency of sockaddr_snprintf(3) with snprintf(3) and
snprintb(3), do not count the terminating NUL in the return value.
Update the regression tests to match.  Approved by christos@.
2005-01-13 00:44:25 +00:00
christos
4c3e77eff3 add pw_getpwconf(), bump. 2005-01-12 03:34:33 +00:00
christos
ca7489bf5c Avoid spinning if writing to a pty returns 0. This happened to me when
I had a pty with a suspended sshd (why?).
2005-01-08 06:43:16 +00:00
christos
f1a325d103 Unbreak setuserpath(); from Nick Hudson. 2004-12-20 18:42:03 +00:00
wiz
ff7ab08a15 Mmm, API changes without date bumps... bump date for constification. 2004-12-11 16:50:56 +00:00
christos
a5c1a01ed9 WARNS=3; fix cast-qual issues. 2004-12-11 06:41:15 +00:00
christos
70756f97e8 Constify; the api was completely broken before. 2004-12-11 06:40:42 +00:00
peter
192aae95b5 Add missing LIBRARY section.
ok wiz@
2004-12-01 00:06:46 +00:00
christos
5a55e0c902 Don't give write privileges at all if the tty group is missing. 2004-11-25 02:49:46 +00:00
christos
db5d4e2d6a I really want to kill the hard-coding of _TTY_GID. Set the group to the
primary group of the user if the group tty does not exist.
2004-11-24 22:17:19 +00:00