Commit Graph

1177 Commits

Author SHA1 Message Date
nekral-guest
c8f45eda53 * lib/defines.h: Added MIN and MAX macros.
* libmisc/salt.c: Removed MIN and MAX macros.
2009-04-21 22:06:09 +00:00
nekral-guest
5ad0d896f1 Added more comments to the changelog entry. 2009-04-20 14:06:06 +00:00
nekral-guest
9efd6a53d2 * NEWS, src/lastlog.c: Fix regression causing empty reports. 2009-04-20 14:04:48 +00:00
nekral-guest
18fdfee274 * src/login.c: Get rid of pwent. pwd is sufficient as long as it
is always coming from xgetpwnam. There is no need to copy pwd to
	pwent, this was not a good idea anyway as the strings from pwd
	were not duplicated.
	* src/login.c: Always free the pwd and spwd structure when we
	retrieve a new one. This will clear the password of the previous
	user from the memory.
	* src/login.c: user_passwd is used to keep point to the password
	of the user being authenticated.
	* src/login.c: (non PAM) Fail if the user's entry cannot be found
	after the user updated her password (if expire() requested an
	update).
	* src/login.c: If the user does not exist on the system, there is
	no need to build a pwd structure (with shell).
2009-04-20 13:29:15 +00:00
nekral-guest
a6ac4dda75 * src/login.c: ttytype already checks for TTYTYPE_FILE and TERM.
Just call ttytype.
2009-04-20 13:12:09 +00:00
nekral-guest
c694843da5 * src/login.c: Open the PAM session before pam_setcred and before
initgroups. This is more consistent with rfc86.0.
2009-04-20 12:54:17 +00:00
nekral-guest
432faba3e1 * src/login.c: Added helper functions get_pam_user() and
get_failent_user().
2009-04-20 12:47:04 +00:00
nekral-guest
70e1a5c9b6 * src/login.c: Added parameter to check_nologin. This will help
getting rid of the global pwent variable.
2009-04-20 12:33:01 +00:00
nekral-guest
61c1d100dc * src/login.c: Added comments.
* src/login.c: Close the user and group files before dropping root
	privileges.
2009-04-20 12:27:27 +00:00
nekral-guest
d4158bdf77 * src/login.c: We do not need to keep the old umask. Discard the
umask() return value.
2009-04-20 12:16:07 +00:00
nekral-guest
1bcf2ffb59 * libmisc/hushed.c, lib/prototypes.h, src/login.c: Change the
hushed() prototype to take a username instead of a passwd
	structure in argument. The passwd entry is retrieved withing
	hushed().
2009-04-20 11:48:59 +00:00
nekral-guest
87ac185752 * libmisc/setugid.c: Updated comments. 2009-04-20 11:43:36 +00:00
nekral-guest
22fbd774dc * libmisc/failure.h, libmisc/failure.c, src/login.c: Added
username as first parameter of failtmp to avoid issues with
	non-null terminated ut_user, unavailability of ut_user, incomplete
	username (that should not happen currently).
2009-04-20 11:39:16 +00:00
nekral-guest
f3bea401e9 * libmisc/ttytype.c: Add brackets and parenthesis.
* libmisc/ttytype.c: Avoid assignments in comparisons.
2009-04-20 11:31:05 +00:00
nekral-guest
2ce68e8aec * lib/pwio.c, lib/shadowio.c, lib/groupio.c, lib/sgroupio.c: Fill
the password fields with zeros before they are freed.
2009-04-20 11:29:17 +00:00
nekral-guest
bf66861e3f * po/ko.po: Updated Korean translation. 2009-04-19 16:26:17 +00:00
nekral-guest
131e95ffaf * NEWS, src/login.c: Also check if the authentication token of the
user has to be updated in case the user was already authenticated.
2009-04-19 16:22:17 +00:00
nekral-guest
ca10b825c7 * src/login.c: fflg is already restricted to root. Move
pam_acct_mgmt(), in case of fflg, earlier. This is equivalent and
	simplifies the code.
2009-04-19 16:09:00 +00:00
nekral-guest
2ed05e548b * libmisc/utmp.c: Always call endutent or endutxent when setutent
or setutxent were used.
2009-04-19 15:28:38 +00:00
nekral-guest
8156c3b0be * src/login.c: Added comment to make sure PAM_RHOST or PAM_TTY do
not get set to unsanitized values.
2009-04-19 13:33:24 +00:00
nekral-guest
d2a822fe39 * libmisc/utmp.c: Do not trust the current utmp entry's ut_line.
Always set ut_line based on ttyname(0).
2009-04-17 21:25:30 +00:00
nekral-guest
5298ac3dd9 * NEWS, src/login.c: Do not trust the current utmp entry's ut_line
to set PAM_TTY.
2009-04-17 20:40:26 +00:00
nekral-guest
c49371e423 * configure.in: Updated version number. 2009-04-15 21:46:42 +00:00
nekral-guest
76f7ae8d7d * po/shadow.pot, man/po/shadow-man-pages.pot: Regenerated.
* po/*.po, man/po/*.po: Updated PO files.
2009-04-15 21:46:06 +00:00
nekral-guest
4d2bee2e23 * NEWS, src/userdel.c: Fixed SE Linux support. semanage should be
called at the end.
	* src/useradd.c: Always call selinux_update_mapping() (i.e.
	semanage), not only when -Z is used.
2009-04-15 21:14:08 +00:00
nekral-guest
a24058d660 * NEWS, srclib/getlong.c: Fix parsing of octal numbers.
* NEWS, src/login.c: Fix segfault when no user is provided on the
	command line.
2009-04-15 17:50:17 +00:00
nekral-guest
70d9bc6233 libmisc/system.c was contributed by Dan Walsh. 2009-04-15 17:42:34 +00:00
nekral-guest
5fa86c2b42 * NEW, src/vipw.c: SE Linux: Set the default context to the
context of the file being edited. This ensures that the backup
	file inherit from the file's context.
2009-04-15 17:42:27 +00:00
nekral-guest
acc3423c96 * man/usermod.8.xml: There are no default values for --inactive
and --gid. If the options are no provided, the original values are
	not changed.
2009-04-14 22:19:11 +00:00
nekral-guest
0b4b3d63da * po/shadow.pot, man/po/shadow-man-pages.pot: Regenerated.
* po/*.po, man/po/*.po: Updated PO files.
2009-04-12 01:24:45 +00:00
nekral-guest
6b46161f2d * src/su.c: If there are no root account, or if the root account
has an UID != 0, default to the first UID 0 account.
2009-04-12 00:28:32 +00:00
nekral-guest
08a212ccae * src/login.c: Restore the echoctl, echoke, onclr flags to the
terminal termio flags. Reset echoprt, noflsh, tostop. This
	behavior seems to have change by mistake in earlier releases
	(4.0.8, for no obvious reason).
2009-04-12 00:17:36 +00:00
nekral-guest
64a9f33ffa * src/login.c: Fix the count of failures before login exits in
case of PAM enabled configurations.
2009-04-12 00:08:26 +00:00
nekral-guest
bc0f4fa509 * man/passwd.1.xml: Document that passwd uses PAM to authenticate
and change passwords on PAM-enabled builds.
2009-04-11 23:32:00 +00:00
nekral-guest
681c1d12b5 * src/newusers.c: Add more information to the mkdir and chown
failure messages.
2009-04-11 23:30:44 +00:00
nekral-guest
ce156b578f * man/po/fr.po: Updated some login.defs entries. Thanks to
Belkacem Abbas.
2009-04-11 22:41:00 +00:00
nekral-guest
4e32b9fea9 * man/login.defs.d/MAX_MEMBERS_PER_GROUP.xml,
man/login.defs.d/CONSOLE_GROUPS.xml: Fix typos.
2009-04-11 22:36:11 +00:00
nekral-guest
5a56996eef * man/es/Makefile.am: Disable the distribution of Spanish
manpages. They are outdated. Please contact
	pkg-shadow-devel@lists.alioth.debian.org if you wish to provide
	updates.
2009-04-11 18:57:14 +00:00
nekral-guest
554d4f6b95 * src/usermod.c, src/useraddd.c: Fix the usage string so that it
does not change depending on the configure option. Use a format.
2009-04-11 18:39:56 +00:00
nekral-guest
80a30dfe6f * src/gpasswd.c: Fix the usage of the unused macro. 2009-04-11 18:37:59 +00:00
nekral-guest
cab74eddef * lib/prototypes.h, libmisc/age.c, src/expiry.c, src/login.c: A
shadow entry is now sufficient for agecheck. Remove the first
	passwd entry parameter.
2009-04-11 18:37:08 +00:00
nekral-guest
42590e062f * src/userdel.c: Rename argv to args to avoid nameclash with the
main() parameters.
2009-04-11 16:52:45 +00:00
nekral-guest
3fdefd3e40 * src/useradd.c, src/usermod.c: Only call selinux_update_mapping()
if Zflg is set.
2009-04-11 16:47:32 +00:00
nekral-guest
60a7cc9d7c * libmisc/getgr_nam_gid.c: Added support for NULL argument.
* libmisc/chowntty.c: Reuse getgr_nam_gid(), and get rid of atol().
2009-04-11 16:23:21 +00:00
nekral-guest
ca1bb50c24 * libmisc/find_new_gid.c, libmisc/find_new_uid.c: For system
accounts, return the first unused ID, starting from the max value.
	This could be useful later to increase the static IDs range.
2009-04-11 16:00:45 +00:00
nekral-guest
8d136297c4 * NEWS, src/useradd.c, man/useradd.8.xml: add -Z option to map
SELinux user for user's login.
	* NEWS, src/usermod.c, man/usermod.8.xml: Likewise.
	* libmisc/system.c, libmisc/Makefile.am, lib/prototypes.h: Added
	safe_system(). Used to run semanage.
	* lib/prototypes.h, libmisc/copydir.c: Make a
	selinux_file_context() an extern function.
	* libmisc/copydir.c: Reset SELinux to create files with default
	contexts at the end of copy_tree().
	* NEWS, src/userdel.c: Delete the SELinux user mapping for user's
	login.
2009-04-11 15:34:10 +00:00
nekral-guest
2c400eff94 * src/useradd.c (get_defaults): Close the default file after the
default values were read.
2009-04-11 14:55:49 +00:00
bubulle
5d9c298e9d Slovak translation updated 2009-04-11 13:53:41 +00:00
nekral-guest
413bb19543 * lib/Makefile.am, lib/prototypes.h: Added sgetspent.c. 2009-04-10 22:35:43 +00:00
nekral-guest
db337babbc * po/POTFILES.in: Added missing files. Sorted. 2009-04-10 22:35:37 +00:00
nekral-guest
84f5ca951c * lib/getdef.c: Use getlong instead of strtol/strtoul.
* libmisc/getlong, lib/getlong.c, libmisc/Makefile.am,
	lib/Makefile.am: getlong.c moved from libmisc/ to lib/.
2009-04-10 22:35:26 +00:00
nekral-guest
9a7f5c6b16 * lib/shadow.c: Replace strtol() by getlong(). Also detect more
issues in a numerical shadow entry field.
2009-04-10 22:35:14 +00:00
nekral-guest
b5200cf753 * lib/sgetspent.c: Only compile ifndef HAVE_SGETSPENT 2009-04-10 22:35:07 +00:00
nekral-guest
686ac847aa Revert " * lib/sgetspent.c: Removed (is not used / compiled) anymore."
This reverts commit dbeb402f0b0befd8c48b68d53277e1bd1b5f751b.
2009-04-10 22:35:01 +00:00
nekral-guest
e075442345 * lib/sgetspent.c: Removed (is not used / compiled) anymore. 2009-04-10 22:34:55 +00:00
nekral-guest
c7258f22d8 * lib/sgetspent.c: Replace strtol() by getlong(). Also detect more
issues in a numerical shadow entry field.
2009-04-10 22:34:49 +00:00
nekral-guest
304b0ec202 * src/chage.c: expdays renamed to expdate. It is a date, even if
expressed in a number of days since Jan 1, 1970.
	* src/chage.c: Likewise: lastday renamed to lstchgdate. Also fix
	the --lastday documentation.
2009-04-10 22:34:42 +00:00
nekral-guest
52238dd6a7 * src/chage.c: More strtol() replaced by getlong(). 2009-04-10 22:34:36 +00:00
nekral-guest
66e39884e2 * lib/prototypes.h: pwd_to_spwd() should be declared if USE_PAM is
NOT defined.
2009-04-10 22:34:29 +00:00
nekral-guest
d548bf4742 * src/passwd.c: Replace getnumber() by getlong(). This permits to
get rid of another strtol().
2009-04-10 22:34:23 +00:00
nekral-guest
1675ca3378 * libmisc/getlong.c: Include both <stdlib.h> and <errno.h> needed
for strtol and errno, and do not include "defines.h" (not needed).
2009-04-10 22:34:17 +00:00
nekral-guest
77459dc27d * src/useradd.c, src/usermod.c, libmisc/getgr_nam_gid.c,
libmisc/Makefile.am, lib/prototypes.h: Moved getgr_nam_gid() from
	src/useradd.c and src/usermod.c to libmisc/getgr_nam_gid.c.
2009-04-10 22:34:10 +00:00
nekral-guest
ffd3e43ad8 * src/useradd.c: Get rid of strtol.
* src/useradd.c: Provide better warning in case a default GROUP or
	INACTIVE value is not valid in /etc/default/useradd.
2009-04-10 22:34:04 +00:00
nekral-guest
95bc6eb7b2 * src/useradd.c: Re-indent. 2009-04-10 22:33:57 +00:00
nekral-guest
06c81b67c2 * src/useradd.c: Use getlong instead of get_number. 2009-04-10 22:33:50 +00:00
nekral-guest
c3f109556a * src/usermod.c: Re-indent.
* src/usermod.c: Specifying a inactivity value < -1 is not valid.
2009-04-10 22:33:43 +00:00
nekral-guest
f481938cc5 * po/*.po, man/po/*.po: Updated PO files. 2009-04-05 23:52:46 +00:00
nekral-guest
b9df8b5817 * configure.in: Prepare the next 4.1.3 release. 2009-04-05 22:35:12 +00:00
nekral-guest
ac52639b77 * libmisc/setugid.c libmisc/age.c (setup_uid_gid): is_console is
never set ifndef USE_PAM. Change the prototype of setup_uid_gid()
	when USE_PAM is not defined. This permits to remove add_groups
	from PAM builds.  setup_uid_gid is already subject to
	HAVE_INITGROUPS.
2009-04-05 22:33:00 +00:00
nekral-guest
a51954203e * lib/prototypes.h, libmisc/addgrps.c: restrict add_groups() to
ifndef USE_PAM.
	* lib/prototypes.h: Remove the declaration of add_cons_grps(). The
	function does not exist.
	* libmisc/age.c (setup_uid_gid): is_console is never set ifndef
	USE_PAM. Change the prototype of setup_uid_gid() when USE_PAM is
	not defined. This permits to remove add_groups from PAM builds.
	setup_uid_gid is already subject to HAVE_INITGROUPS.
	* libmisc/pwd2spwd.c (pwd_to_spwd): pwd_to_spwd() is not used in
	PAM builds.
2009-04-05 22:29:42 +00:00
nekral-guest
021066a980 * src/passwd.c: do_update_age is only used ifndef USE_PAM. Make it
more explicit.
2009-04-05 22:04:31 +00:00
nekral-guest
a1cac18ac3 * src/useradd.c: Set errno to 0 before calling strtol. 2009-04-05 22:02:50 +00:00
nekral-guest
2a3b84b888 * libmisc/isexpired.c: If there are no shadow entry, there is no
need to convert the password entry to a shadow entry. The password
	is valid.
2009-04-05 22:02:00 +00:00
nekral-guest
682eedb167 * man/usermod.8.xml: Split some paragraphs into smaller units. 2009-04-05 21:23:55 +00:00
nekral-guest
2f85113366 * man/shadow.5.xml: Rewrote to mention the meaning of special
values.
2009-04-05 21:23:35 +00:00
nekral-guest
b23443630c * libmisc/pwd2spwd.c, src/chpasswd.c, src/newusers.c,
src/passwd.c, src/pwck.c, src/pwconv.c, src/useradd.c,
	src/usermod.c: On Jan 01, 1970, do not set the sp_lstchg field to
	0 (which means that the password shall be changed during the next
	login), but use -1 (password aging disabled).
	* src/passwd.c: Do not check sp_min if sp_lstchg is null or -1.
2009-04-05 21:23:27 +00:00
nekral-guest
7585fa0fe9 * src/chage.c: When no shadow entry exist, thedefault sp_lstchg
value should be -1 (no aging) rather than 0 (password must be
	changed).
	* src/chage.c: For password expiration and inactivity, indicate
	that the password must be changed when sp_lstchg is null rather
	than indicating that expiration and inactivity are not enabled.
2009-04-05 21:23:17 +00:00
nekral-guest
1ba2139d5c * libmisc/isexpired.c: Document the isexpired return value. 2009-04-05 21:23:06 +00:00
nekral-guest
f67403ba01 * libmisc/age.c: Return a specific message when sp_lstchg is null. 2009-04-05 21:22:53 +00:00
nekral-guest
d4fc74e43c * lib/sgetpwent.c, lib/sgetgrent.c: Use get_uid and get_gid to
validate the UIDs or GIDs instead of atoi/strtol.
2009-03-21 20:29:58 +00:00
nekral-guest
a1dd26d2d6 * libmisc/get_gid.c, libmisc/get_uid.c, libmisc/Makefile.am,
lib/get_gid.c, lib/get_uid.c, lib/Makefile.am: get_uid.c and
	get_gid.c moved from libmisc/ to lib/.
2009-03-21 20:24:37 +00:00
nekral-guest
503976fc6a * src/grpck.c (check_members): When a member is removed, do not
increase the index.
	* src/grpck.c: Fix typo in messages and comments.
2009-03-21 19:42:48 +00:00
nekral-guest
dab1523df5 * libmisc/sulog.c: Likewise for the su log. 2009-03-21 19:32:14 +00:00
nekral-guest
a65c2c9b18 * src/vipw.c: Likewise for the backup file. 2009-03-21 19:28:02 +00:00
nekral-guest
5331930716 * src/usermod.c: Likewise for the faillog and lastlog file. 2009-03-21 19:25:02 +00:00
nekral-guest
96c7b12bc4 * src/useradd.c: Likewise for the default file, faillog, lastlog,
and mail spool.
2009-03-21 19:18:06 +00:00
nekral-guest
5dd5f51700 * lib/commonio.c: Call fsync before closing the backup file. This
ensures that the backup file is flushed to the storage medium.
2009-03-21 19:12:00 +00:00
nekral-guest
a8e9fc86eb * src/groupmod.c: Embed gshadow related cleanup in #ifdef
SHADOWGRP.
2009-03-15 21:38:08 +00:00
nekral-guest
a402c4db3b * src/usermod.c: get_number() replaced by getlong().
* src/usermod.c: When the user is renamed, make sure we do not
	override an user with the same name (in passwd or shadow).
2009-03-15 21:34:20 +00:00
nekral-guest
780af2653a * src/gpasswd.c: log_gpasswd_success_gshadow is in the cleanup
stack only when the shadow group file is present.
2009-03-15 21:32:26 +00:00
nekral-guest
9372111aaa * NEWS, src/userdel.c: Make sure the user exists in the shadow
database before calling spw_remove().
	* NEWS, src/userdel.c: When the user's group is removed, make sure
	the group is in the gshadow database before calling sgr_remove().
	* src/userdel.c: Improve warning's wording.
2009-03-15 21:29:16 +00:00
nekral-guest
9fda9f5c28 * libmisc/cleanup.c: Fix del_cleanup. The arguments were not
desynchronized with the cleanup functions.
	* libmisc/cleanup.c: cleanup_function_args is an array of void
	pointer, not strings.
2009-03-15 21:15:48 +00:00
nekral-guest
80135cdc17 * libmisc/find_new_gid.c: Fix find_new_gid() the current group
database was not taken into account.
2009-03-15 21:12:57 +00:00
nekral-guest
6aa874a0a0 * libmisc/addgrps.c: Fix compilation warnings. 2009-03-15 21:10:35 +00:00
nekral-guest
d1dac25379 * man/po/Makefile.in.in: xml2po cannot exclude one entity for
expansion. Make sure config.xml does not exist when the POT file
	is created in order to keep the configurations in the POT file
	* man/generate_translations.mak: make sure config.xml does not
	exist neither when the translated XML is generated. Add the
	missing %config; (strip out by xml2po). and make sure config.xml
	is present when the translated manpage is generated.
	* man/generate_mans.mak: config.xml is needed for the generation
	of manpages (already in the .deps for the English manpages, but
	needed for the translations).
	* man/Makefile.am: Added missing CREATE_HOME.xml.
2009-03-14 16:18:06 +00:00
nekral-guest
526e7ac972 * man/generate_mans.deps: Added Makefile dependency rules. 2009-03-14 13:29:55 +00:00
nekral-guest
d60f0a1a10 * etc/login.defs: Added note for PAM enabled configurations. 2009-03-14 13:20:25 +00:00
nekral-guest
8411a8e8b4 * man/Makefile.am: Compute the dependencies for building the
manpages.
2009-03-14 13:16:55 +00:00
nekral-guest
295106b6a8 * libmisc/addgrps.c: Fix warnings. 2009-03-14 13:13:47 +00:00
nekral-guest
29381bf9d6 * man/po/fr.po: Added missing space. 2009-03-14 13:08:49 +00:00
nekral-guest
5a5cf15430 * man/lastlog.8.xml: Document that there might be entries, for
deleted users, that are not displayed.
2009-03-14 11:11:04 +00:00
nekral-guest
884a2de437 * man/chgpasswd.8.xml, man/chpasswd.8.xml: Fix the man page in
case SHA crypt is not supported.
2009-03-14 11:09:57 +00:00
nekral-guest
5349c79d12 * man/vipw.8.xml: MAX_MEMBERS_PER_GROUP is not used by vipw and
vigr.
2009-03-14 11:08:39 +00:00
nekral-guest
9ee627fe02 * man/login.defs.5.xml: Indicate that sg uses the same variables
as newgrp.
	* man/login.defs.5.xml: vipw does not use any variable.
	* man/login.defs.5.xml: In PAM enabled configurations, login still
	uses some login.defs variables.
2009-03-13 23:17:43 +00:00
nekral-guest
1def19ecea * man/usermod.8.xml: use a <replaceable> instead of a
<emphasis remap='I'>.
2009-03-13 23:14:18 +00:00
nekral-guest
dc857372ed * man/newusers.8.xml: Document the behavior of newusers for each
field.
	* man/newusers.8.xml: Do not add the note on PAM on non-PAM
	enabled configurations.
2009-03-13 23:12:06 +00:00
nekral-guest
730fc8fc33 * src/faillog.c: Added support for the specification of a range of
users with -u.
	* src/faillog.c: Do not call print_one() for users which do not
	exist.
	* src/faillog.c: Make sure the user's entry is not outside the
	faillog file and initialize the faillog structure in that case.
	* src/faillog.c: Move print_one() closer to print().
	* src/faillog.c: reset(), setmax(), set_locktime() can also change
	entries of user which do not exist.
	* src/faillog.c: reset(), setmax() and set_locktime() shall not
	create entries for users which have no entries if the value has to
	be set to 0.
	* src/faillog.c: reset(), setmax() and set_locktime(): better
	handling of users whose entry is outside the faillog file.
	* src/faillog.c: Improved option handling. Options can now be
	specified in any order.
	* src/faillog.c: Improved warnings when options are not
	compatible or when the faillog cannot be open with the right mode.
	* src/faillog.c: Only fstat the faillog file once.
	* man/faillog.8.xml: Improved documentation.
2009-03-13 22:49:20 +00:00
nekral-guest
fafe281d31 * src/useradd.c, man/useradd.8.xml: Added long name for the -l
option: --no-log-init.
2009-03-13 22:30:38 +00:00
nekral-guest
f98b47eb55 * src/chpasswd.c: Make sure the SHA related variables is not
compiled when disabled at configuration time.
	* src/chgpasswd.c: Make sure the SHA related variables is not
	compiled when disabled at configuration time.
	* src/chgpasswd.c: Fix the test for getlong() failure.
2009-03-13 22:28:27 +00:00
nekral-guest
e3e64317e8 * src/newusers.c: Make sure the SHA related variables are not
compiled when disabled at configuration time.
	* src/newusers.c: Added FIXME
2009-03-13 22:26:35 +00:00
nekral-guest
f2c8017df4 * src/gpasswd.c: Remove the documentation of options from the
main() documentation. It will always be outdated here.
2009-03-13 22:21:26 +00:00
nekral-guest
bf9036d27a * src/lastlog.c: lastlog variable renamed to ll to avoid name
clash with the structure.
	* src/lastlog.c: check the offset in print_one() so that it is
	used for the display of one entry or a set of entries.
	* src/lastlog.c: Do not loop over the whole user database when -u
	is used with a single user.
	* src/lastlog.c: Check the size of the lastlog file so that we
	can identify failures to read.
2009-03-13 22:20:20 +00:00
nekral-guest
87da822c7f * libmisc/salt.c: Removed l64a prototype. The libc declaration is
non static, but the internal definition is static.
2009-03-13 19:17:24 +00:00
nekral-guest
27153ae92b * src/gpasswd.c: log_gpasswd_success_gshadow only exists ifdef
SHADOWGRP.
2009-03-08 23:29:46 +00:00
nekral-guest
28d7f83c87 * NEWS, src/newusers.c, src/usermod.c, src/useradd.c,
src/groupmod.c, src/groupadd.c: Make sure no user or group are
	created with an ID set to -1.
2009-03-08 20:43:15 +00:00
nekral-guest
c1052e2df2 * NEWS, src/grpck.c, src/pwck.c: Issue a warning if an ID is set
to -1.
2009-03-08 20:29:22 +00:00
nekral-guest
0e2a3979f4 * libmisc/get_gid.c, libmisc/get_uid.c, libmisc/Makefile.am,
lib/prototypes.h: Added get_uid() and get_gid() to parse user and
	group IDs.
2009-03-08 20:26:56 +00:00
nekral-guest
186ea0e203 * libmisc/getlong.c: Make sure the getlong argument is not empty. 2009-03-08 20:21:24 +00:00
nekral-guest
f47d9eba94 * contrib/adduser-old.c, contrib/adduser.c: Do not use the target
of snprintf in one of the format's parameters.
2009-03-07 16:32:11 +00:00
nekral-guest
7368452e49 * man/groupmems.8.xml: groupmems does not create new user. 2009-03-07 16:30:49 +00:00
nekral-guest
b46fd9a2b4 * NEWS, po/LINGUAS, po/kk.po: Added Kazakh translation. Thanks to
Timur Birsh <taem@linukz.org>.
2009-03-03 20:53:20 +00:00
nekral-guest
a62e781248 * libmisc/find_new_gid.c, libmisc/find_new_uid.c: Avoid calling
getgrent()/getpwent() after they return NULL. This caused LDAP to
	return at the beginning of the group/user entries.
2009-02-22 23:23:15 +00:00
nekral-guest
32ef9c2135 * man/nologin.8.xml: Fix typo (HYSTORY -> HISTORY). 2009-01-27 18:17:54 +00:00
nekral-guest
f2d6449374 * NEWS, src/gpasswd.c: Only report success to audit and syslog
when the changes are committed to the system. Do not log failure
	for on-memory changes to audit or syslog. Make sure failures and
	inconsistencies will be reported in case of unexpected failures
	(e.g. malloc failures). Only specify an audit message if it is not
	implicitly implied by the type argument. Removed fail_exit
	(replaced by atexit(do_cleanups)). Log failures in case of
	permission denied.
2009-01-26 22:03:37 +00:00
nekral-guest
af96cba0cc * etc/login.defs: Improve the documentation of UMASK. 2009-01-19 10:21:50 +00:00
nekral-guest
a684cadbb6 * man/useradd.8.xml, man/login.defs.d/CREATE_HOME.xml,
man/login.defs.5.xml: Document the CREATE_HOME variable.
2009-01-19 10:00:53 +00:00
nekral-guest
6c85ca9661 * man/limits.5.xml: Remove space before an end of tag. 2009-01-19 09:51:53 +00:00
nekral-guest
de60b7b2de * man/login.defs.d/UMASK.xml: Indicate how UMASK is used and
limitations.
2009-01-19 09:51:00 +00:00
nekral-guest
d8c9236a18 * NEWS, src/su.c: Preserve COLORTERM in addition to TERM when su
is called with the -l option.
2009-01-06 20:13:31 +00:00
nekral-guest
2bb7007fcb * libmisc/chkname.c: Use a bool when possible instead of integers.
* libmisc/chkname.c: Add brackets and parenthesis.
2008-12-23 22:42:22 +00:00
nekral-guest
4c7d798307 * man/groupadd.8.xml, configure.in, man/config.xml.in: Use the
real group name length limit in the documentation.
2008-12-23 22:36:44 +00:00
nekral-guest
3cb730bcfe * src/Makefile.am: Only link with the needed library. When
compiled with PAM support, chfn, chsh, login, newgrp, passwd, and
	su do not need the libcrypt library.
2008-12-23 00:44:29 +00:00
nekral-guest
1b0a32d71c * libmisc/cleanup_group.c: Fix compilation when compiled without
shadow group support.
2008-12-23 00:39:54 +00:00
nekral-guest
915ec6531a * src/groupdel.c: Remove the fail_exit () declaration. 2008-12-22 23:23:14 +00:00
nekral-guest
0bd396011a * src/gpasswd.c: Fix the support for usernames with arbitrary
length.
2008-12-22 22:13:23 +00:00
nekral-guest
6405b58a98 * libmisc/chkname.c: Remove outdated comments. 2008-12-22 22:08:13 +00:00
nekral-guest
9d977dba8e * src/groupdel.c: Re-indent. 2008-12-22 22:07:12 +00:00
nekral-guest
ad7a108d60 * src/groupmod.c: Re-indent.
* src/groupmod.c: Do not add the command synopsis to the main ()
	documentation. This avoids outdated information.
2008-12-22 22:06:27 +00:00
nekral-guest
fca6aeeea2 * src/groupadd.c: Re-indent. 2008-12-22 22:03:34 +00:00
nekral-guest
5b8ff14caf * libmisc/audit_help.c: Added audit_logger_message() to log
messages not related to an account.
	* lib/prototypes.h, libmisc/cleanup.c, libmisc/cleanup_group.c,
	libmisc/cleanup_user.c, libmisc/Makefile.am: Added stack of
	cleanup functions to be executed on exit.
	* NEWS, src/groupadd.c, src/groupdel.c, src/groupmod.c: Only
	report success to audit and syslog when the changes are committed
	to the system. Do not log failure for on-memory changes to audit
	or syslog. Make sure failures and inconsistencies will be reported
	in case of unexpected failures (e.g. malloc failures). Only
	specify an audit message if it is not implicitly implied by the
	type argument. Removed fail_exit (replaced by atexit(do_cleanups)).
2008-12-22 21:52:43 +00:00
nekral-guest
a438c2f184 * NEWS, src/gpasswd.c: Added support usernames with arbitrary
length.
2008-12-15 21:54:53 +00:00
nekral-guest
66cb5b33ad * configure.in: Fix the "$enable_acct_tools_setuid" = "yes" test. 2008-11-30 01:32:38 +00:00
nekral-guest
c28c443d8f * NEWS, configure.in, libmisc/chkname.c: make group max length a
configure option.  The configure behavior encoded is:
	<no option> -> default of 16 (like today);
	--with-group-name-max-length -> default of 16;
	--without-group-name-max-length -> no max length;
	--with-group-name-max-length=n > max is set to n.
2008-11-30 01:29:40 +00:00
nekral-guest
93358ac3de * src/su.c: (!USE_PAM) Provide visible information indicating that
su was denied.
2008-11-23 12:10:21 +00:00
nekral-guest
0667aee3cc * man/ja/login.1: Fix the path of the utmp and wtmp files. 2008-11-23 00:16:53 +00:00
nekral-guest
2297508f13 * man/su.1.xml: Fix the su synopsis. username is referenced in the
manpage, not LOGIN.
2008-11-23 00:16:10 +00:00
nekral-guest
1a04bbb044 * libmisc/chowntty.c: Only closelog() when failure cause an exit. 2008-11-23 00:06:56 +00:00
nekral-guest
cf31f05cfb * libmisc/chowntty.c: Improve the logs for fchown and fchmod
failures.
2008-11-23 00:05:39 +00:00
nekral-guest
a324a7f13f * NEWS, libmisc/chowntty.c, libmisc/utmp.c: is_my_tty() moved from
utmp.c to chowntty.c. checkutmp() now only uses an existing utmp
	entry if the pid matches and ut_line matches with the current tty.
	This fixes a possible DOS when entries can be forged in the utmp
	file.
	* libmisc/chowntty.c, src/login.c, lib/prototypes.h: Remove the
	tty argument from chown_tty. chown_tty always changes stdin and
	does not need this argument anymore.
2008-11-22 23:56:11 +00:00
nekral-guest
eb4097180b * NEWS, libmisc/chowntty.c: Fix a race condition that could lead to
gaining ownership or changing mode of arbitrary files.
2008-11-22 23:22:16 +00:00
nekral-guest
c0311206c8 * man/gshadow.5.xml, man/shadow.5.xml, man/passwd.5.xml,
man/grpck.8.xml: Sorted SEE ALSO references.
	* man/gshadow.5.xml: Added reference to grpck(8) and grpconv(8).
	* man/pwck.8.xml: Added reference to grpck(8).
	* man/shadow.5.xml: Added reference to pwck(8).
	* man/passwd.5.xml: Added reference to pwck(8).
	* man/grpck.8.xml: Added reference to pwck(8).
2008-10-11 12:59:02 +00:00
nekral-guest
4b2f537795 * man/*.xml, man/login.defs.d/*.xml: Added copyright and licence
header.
2008-10-11 11:44:43 +00:00
nekral-guest
4d49f543dd * src/login.c: Always check the return value of the pam_* APIs. 2008-09-20 21:17:26 +00:00
nekral-guest
d400af51fa * src/login.c, man/login.1.xml: the username is not an optional
parameter of -f. Fix the getopt optstring, remove the parsing of
	username in the -f processing block, and remove unnecessary checks
	(username cannot be parsed twice anymore), better documentation of
	the synopsis.
2008-09-20 20:20:19 +00:00
nekral-guest
c8d2175981 * src/login.c: Erase the username later since it it used for the
fake password check (in case of empty password).
2008-09-20 20:05:22 +00:00
nekral-guest
11c7543c76 * src/login.c: Explicitly tag the end of the #ifdef RLOGIN
sections.
2008-09-20 20:03:04 +00:00
nekral-guest
29d4533047 * src/login.c: Check that no username is specified with -r.
* src/login.c: Make sure a username is specified with -f.
2008-09-20 20:00:51 +00:00
nekral-guest
c813e692a2 * src/login.c: Copy the name of the user authenticated by PAM to
username. This simplify later logging (avoid USE_PAM
	conditional).
2008-09-20 19:54:35 +00:00
nekral-guest
65e32d850c * src/login.c: Use a dynamic buffer for usernames. 2008-09-20 19:44:12 +00:00
nekral-guest
9f2ce12b28 * src/login.c: Existence of pam_user was already checked. pwd was
already copied to pwent. Remove duplicated code.
2008-09-20 16:23:04 +00:00
nekral-guest
f4860274be * src/login.c: check_flags() renamed process_flags(). All flag
processing blocs moved to process_flags().
2008-09-20 16:21:46 +00:00
nekral-guest
6b17118e72 * src/logoutd.c, src/userdel.c: Re-indent. This helps pmccabe. 2008-09-20 14:56:10 +00:00
nekral-guest
54a0762bbb * src/login.c: Re-indent. 2008-09-20 14:39:09 +00:00
nekral-guest
1e3f19ad89 * src/login.c: Add missing closing }. This was probably never
noticed because UT_ADDR is never defined.
2008-09-20 14:21:51 +00:00
nekral-guest
5b73a0492d * src/login.c: Do not mix USE_PAM and !USE_PAM code. 2008-09-20 14:17:20 +00:00
nekral-guest
9fa519c983 * src/login.c: Use failent_user to log to audit. username is the
caller, not the user login tries to authenticate.
	* src/login.c: Use pwd->pw_name instead of pwd->pw_uid. This might
	be more precise (name must be unique, uid might not be).
2008-09-20 13:20:31 +00:00
nekral-guest
c71e7861ed * man/passwd.1.xml: passwd cannot change the full name of the
user, the user's login shell; but it can change the account or
	password validity period. Thanks to Reuben Thomas.
2008-09-20 10:53:00 +00:00
nekral-guest
f3df48ab4f * src/useradd.c: Added missing declaration of Mflg.
* src/pwck.c: Only unlock files if they were locked before (e.g.
	not in read-only mode).
	* src/pwck.c: Quote the username in error messages (harmonization
	with other messages).
	* libmisc/find_new_gid.c: Fixed typo (s/grp->gr_gid/group_id/).
	* libmisc/find_new_gid.c: Likewise.
2008-09-14 13:42:10 +00:00
nekral-guest
5df1f2f683 * libmisc/setugid.c, src/login_nopam.c, src/suauth.c,
lib/getdef.c: Replace the %m format string by strerror(). This
	avoids errno to be reset between the system call error and the
	report function.
2008-09-13 18:03:50 +00:00
nekral-guest
0833bc3cc0 * lib/commonio.c: Ignore the return value of umask() when the mask
is set to the old value.
2008-09-13 11:55:50 +00:00
nekral-guest
b18d46e68d * NEWS, etc/login.defs: New CREATE_HOME variable to tell useradd
to create a home directory for new users.
	* src/useradd.c, man/useradd.8.xml: New -M/--no-create-home option
	and CREATE_HOME usage. System accounts are not impacted by
	CREATE_HOME.
	* man/useradd.8.xml: Indicate that a new group is created by
	default.
	* src/useradd.c: Removed TODO item (moved to the TODO file).
2008-09-13 11:55:41 +00:00
nekral-guest
d1f92a2225 * po/cs.po: Updated Czech translation.
Thanks to Miroslav Kuře
2008-09-13 11:55:30 +00:00
nekral-guest
a279244709 * man/login.defs.d/USERGROUPS_ENAB.xml: Fix typo: new <para> tag
before the previous one is closed. This caused a missng
	explanation for USERGROUPS_ENAB.
2008-09-13 11:55:20 +00:00
nekral-guest
b12db09e31 * man/groupadd.8.xml: Remove the list of (short) options from the
SYNOPSIS. Replaced with [options] for consistency with other tools
	and maintainability.
2008-09-13 11:55:08 +00:00
nekral-guest
8c060833c8 From RedHat's patch shadow-4.1.2-sysAccountDownhill.patch
Thanks to Peter Vrabec.
	* NEWS, libmisc/find_new_gid.c, libmisc/find_new_uid.c: Build an
	index of used IDs to avoid a database request for each id in the
	allowed range (when the highest allowed ID is already used).
	This speedups the addition of users or groups when the highest
	allowed ID is already used. The additional memory usage of the
	tools should be acceptable when UID_MAX/SYS_UID_MAX are set to a
	reasonable number.
2008-09-13 11:54:49 +00:00
nekral-guest
70c9eeff05 * configure.in: Fix the dependency of ACCT_TOOLS_SETUID on
USE_PAM. Build failed with --without-libpam.
2008-09-07 20:40:41 +00:00
nekral-guest
f91b828708 * libmisc/copydir.c: Call utimes() after closing the file. 2008-09-07 00:51:17 +00:00
nekral-guest
828e9d095e * libmisc/copydir.c, configure.in: Check for the presence of
st_mtim and st_mtimensec, as for st_atim and st_atimensec.
2008-09-07 00:05:38 +00:00
nekral-guest
bab84a13ff Additional PAM cleanup:
* src/userdel.c, src/newusers.c, src/chpasswd.c, src/chfn.c,
	src/groupmems.c, src/usermod.c, src/groupdel.c, src/chgpasswd.c,
	src/useradd.c, src/groupmod.c, src/groupadd.c, src/chage.c,
	src/chsh.c: If the username cannot be determined, report it as
	such (not a PAM authentication failure).
2008-09-06 23:46:44 +00:00
nekral-guest
4976708c00 * src/gpasswd.c: Document the long options in the usage. 2008-09-06 22:20:19 +00:00
nekral-guest
8b3029e430 * NEWS: Added configure --enable-account-tools-setuid (default) /
--disable-account-tools-setuid options. This permits to disable
	the PAM authentication of the caller for chage, chgpasswd,
	chpasswd, groupadd, groupdel, groupmod, newusers, useradd,
	userdel, and usermod.  This authentication is not necessary when
	these tools are not installed setuid root.
2008-09-06 21:42:26 +00:00
nekral-guest
f8aef607ae * configure.in: Added option --enable-account-tools-setuid to
enable/disable the usage of PAM to authenticate the callers of
	account management tools: chage, chgpasswd, chpasswd, groupadd,
	groupdel, groupmod, useradd, userdel, usermod.
	* src/Makefile.am: Do not link the above tools with libpam if
	account-tools-setuid is disabled.
	* src/userdel.c, src/newusers.c, src/chpasswd.c, src/usermod.c,
	src/groupdel.c, src/chgpasswd.c, src/useradd.c, src/groupmod.c,
	src/groupadd.c, src/chage.c: Implement ACCT_TOOLS_SETUID
	(--enable-account-tools-setuid).
	* etc/pam.d/Makefile.am: Install the pam service file for the
	above tools only when needed.
	* src/useradd.c, src/userdel.c, src/usermod.c: It is no more
	needed to initialize retval to PAM_SUCCESS.
2008-09-06 21:35:37 +00:00
nekral-guest
bbae92e76f * libmisc/tz.c: tz() is only used when USE_PAM is not defined.
* lib/prototypes.h: Indicate functions whose presence depends on
	the USE_PAM flag.
2008-09-06 16:43:21 +00:00
nekral-guest
70cf08329b * src/groupmems.c: Call open_files() and close_files().
* src/groupmems.c: Always call check_perms(), which takes care of
	checking if --list is used.
2008-09-06 16:27:21 +00:00
nekral-guest
18b7c8d188 * libmisc/obscure.c: Compare characters to '\0', not NULL. 2008-09-06 15:59:28 +00:00
nekral-guest
f34a638b38 * lib/defines.h: Do not include <config.h>. This complicate
undefining some configuration macros when the file is included
	multiple times.
	* libmisc/xgetXXbyYY.c, libmisc/xgetpwnam.c, libmisc/xgetpwuid.c,
	libmisc/xgetgrgid.c, libmisc/xgetgrnam.c, libmisc/xgetspnam.c:
	Include <config.h> from teh compiled C file, not the included
	getXXbyYY.c.
2008-09-06 15:58:23 +00:00
nekral-guest
18fc4505d3 * src/userdel.c, src/newusers.c, src/chpasswd.c, src/chfn.c,
src/groupmems.c, src/usermod.c, src/groupdel.c, src/chgpasswd.c,
	src/useradd.c, src/groupmod.c, src/groupadd.c, src/chage.c,
	src/chsh.c: Simplify the PAM error handling. Do not keep the pamh
	handle, but terminate the PAM transaction as soon as possible if
	there are no PAM session opened.
2008-09-06 13:28:02 +00:00
nekral-guest
ee4e367ea8 * src/newgrp.c, src/userdel.c, src/grpck.c, src/gpasswd.c,
src/newusers.c, src/pwconv.c, src/chpasswd.c, src/logoutd.c,
	src/chfn.c, src/groupmems.c, src/usermod.c, src/pwunconv.c,
	src/expiry.c, src/groupdel.c, src/chgpasswd.c, src/useradd.c,
	src/su.c, src/groupmod.c, src/passwd.c, src/pwck.c,
	src/groupadd.c, src/chage.c, src/login.c, src/grpconv.c,
	src/groups.c, src/grpunconv.c, src/chsh.c: Prog is now global (not
	static to the file) so that it can be used by the helper functions
	of libmisc.
	* lib/prototypes.h: Added extern char *Prog.
	* libmisc/find_new_gid.c, libmisc/find_new_uid.c: Indicate the
	program name with the warning.
2008-09-06 12:51:53 +00:00
nekral-guest
7034a913fd * configure.in: Check if AUDIT_ADD_USER, AUDIT_DEL_USER,
AUDIT_ADD_GROUP, and AUDIT_DEL_GROUP are defined in <libaudit.h>.
2008-09-04 22:34:20 +00:00
nekral-guest
e3ebd2c736 * src/useradd.c: Fix comment of lflg: it is also used for faillog. 2008-09-04 20:46:00 +00:00
nekral-guest
7e17182e4c * NEWS, src/groupmems.c, man/groupmems.8.xml: Document the long
options.
2008-09-04 20:20:20 +00:00
nekral-guest
7e0008a2d7 * lib/prototypes.h, libmisc/audit_help.c: Define new type
shadow_audit_result for the result argument of audit_logger().
	This permits stronger type checking and a better readability of
	the results (SHADOW_AUDIT_FAILURE/SHADOW_AUDIT_SUCCESS constants).
	* src/groupadd.c, src/groupdel.c, src/useradd.c, src/userdel.c:
	Use the SHADOW_AUDIT_FAILURE/SHADOW_AUDIT_SUCCESS results instead
	of 0 or 1 in audit_logger().
2008-09-04 19:36:27 +00:00
nekral-guest
3dcaaf87e7 * src/userdel.c: Log failures to remove the mailbox to syslog and
audit.
	* src/userdel.c: Log successful removal of home directory to audit
	only in case of success.
	* src/userdel.c: Move the audit log of failure to remove the home
	directory before the call to function that may exit.
	* src/userdel.c: Document that errors is only used to count errors
	during the removal of the home directory.
2008-09-03 21:22:04 +00:00
nekral-guest
f3c7ca59c5 * src/useradd.c: Log errors to syslog in grp_update() since
changes have started to be reported to syslog.
	* src/userdel.c: Fix some result parameters sent to
	audit_logger().

	* NEWS: Following changes from a patch contributed by Steve Grubb
	<sgrubb@redhat.com>
	* src/groupadd.c: Log to audit with type AUDIT_ADD_GROUP instead
	of AUDIT_USER_CHAUTHTOK.
	* src/groupdel.c: Log to audit with type AUDIT_DEL_GROUP instead 
	of AUDIT_USER_CHAUTHTOK.
	* src/useradd.c: Log to audit with type AUDIT_ADD_USER /
	AUDIT_ADD_GROUP / AUDIT_USYS_CONFIG instead of
	AUDIT_USER_CHAUTHTOK.
	* src/useradd.c: Add missing logs to audit.
	* src/userdel.c: Log to audit with type AUDIT_DEL_USER /
	AUDIT_DEL_GROUP instead of AUDIT_USER_CHAUTHTOK.
	* src/userdel.c: Add missing logs to audit.
2008-09-03 21:02:32 +00:00
nekral-guest
ba98ffe152 Add Tobias' name. 2008-09-02 18:49:56 +00:00
nekral-guest
abddd42aa0 * src/groupmems.c: Remove duplicated gr_open(). 2008-08-31 17:41:03 +00:00
nekral-guest
118303b9da * man/useradd.8.xml: Document that -o is only valid with -u 2008-08-31 17:31:08 +00:00
nekral-guest
f74d7a9fd0 * man/useradd.8.xml: Document the /etc/default/useradd variables.
* man/useradd.8.xml: Fix the documentation of the GROUP variable
	(and -g/--gid option).
2008-08-31 17:31:00 +00:00
nekral-guest
a109ff1d85 * shadow.spec.in: Fix the source (new FTP). 2008-08-31 17:30:45 +00:00
nekral-guest
614e95af39 * src/su.c: Add brackets and parenthesis.
* src/su.c: Avoid implicit conversion of pointers to booleans.
2008-08-31 17:30:30 +00:00
nekral-guest
05e4cf9aae * libmisc/list.c: Added assertions for non NULL parameters. 2008-08-31 17:30:21 +00:00
nekral-guest
d2c11f8bee * libmisc/list.c: Remove historical comment. 2008-08-31 17:30:12 +00:00
nekral-guest
c04189bfb6 * src/pwconv.c, src/pwunconv.c: Fail if unexpected parameters are
provided.
2008-08-31 17:30:00 +00:00
nekral-guest
6c5e97e745 * src/passwd.c: Add brackets and parenthesis.
* src/passwd.c: Avoid implicit conversion of pointers to booleans.
	* src/passwd.c: Avoid assignments in comparisons.
2008-08-31 17:29:51 +00:00
nekral-guest
87b56b19fb * NEWS, src/groupmems.c, man/groupmems.8.xml: Added support for
shadow groups.
	* src/groupmems.c: Use fail_exit() instead of exit().
2008-08-31 17:29:34 +00:00
nekral-guest
046fe0cfe0 * src/groupmems.c: Avoid mixed declarations and code. 2008-08-31 17:29:17 +00:00
nekral-guest
81e1dbc90e * src/groupmems.c: The grp structure returned by gr_locate is a
const. Duplicate this structure before working on it.
	* src/groupmems.c: Do not fail and do not display warnings if a
	close failure happens with the --list option. (Files are opened
	read-only).
2008-08-31 17:29:08 +00:00
nekral-guest
281721cd15 * src/gpasswd.c: Replace the 'valid' variable by is_valid to avoid
clashes with the valid() function.
2008-08-31 17:28:59 +00:00
nekral-guest
0fcae007a0 * libmisc/obscure.c: Add brackets and parenthesis.
* libmisc/obscure.c: Avoid implicit conversion of pointers / chars to
	booleans.
	* libmisc/obscure.c: Simplify the list of if.
2008-08-31 17:28:49 +00:00
nekral-guest
6b3266f228 * src/passwd.c: Fix a typo in the Usage string. 2008-08-31 17:28:39 +00:00
nekral-guest
ce4152c817 * src/logoutd.c: Fail if
unexpected parameters are provided.
2008-08-31 17:28:30 +00:00
nekral-guest
73877b22c4 * src/grpunconv.c: Fail if unexpected parameters
are provided.
	* src/grpunconv.c: Indicate that argc is not used
	in the no SHADOWGRP version.
2008-08-31 17:28:21 +00:00
nekral-guest
bf3e8f290c * src/grpconv.c, src/groups.c: Name the parameters in the
prototypes of the static functions.
	* src/grpconv.c: Fail if unexpected parameters are provided.
	* src/grpconv.c: Indicate that argc is not used in the no
	SHADOWGRP version.
2008-08-31 17:28:12 +00:00
nekral-guest
399f453b4d * src/chgpasswd.c, src/chpasswd.c: Removed variable ok, which is
no more used.
2008-08-31 17:27:56 +00:00
nekral-guest
8e6c4b2e07 * src/chage.c: Fix the format for long integers (from %ul to %lu). 2008-08-31 17:27:47 +00:00
nekral-guest
4507bd32af * libmisc/utmp.c: Mark the line and host arguments of setutmp() as
not used in the __linux__ version.
2008-08-31 17:27:37 +00:00
nekral-guest
e9a14b2409 * lib/nscd.c: Avoid redefinition of _GNU_SOURCE. 2008-08-31 17:27:26 +00:00
nekral-guest
cd6a300222 * configure.in, src/login.c: Do not use HAVE_PAM_FAIL_DELAY, but
HAS_PAM_FAIL_DELAY, to avoid a redefinition with Linux PAM.
2008-08-31 17:27:16 +00:00
nekral-guest
978b3ef881 * configure.in: Indentation fix. 2008-08-31 17:27:06 +00:00
nekral-guest
da693710f6 Revert " * src/groupmems.c: Added function open_°files and close_files to"
This reverts commit eb3860eb3647d1b092ffe9baa1eb2f73a27a0d87.
2008-08-31 17:26:55 +00:00
nekral-guest
71656e3cba * src/groupmems.c: Added function open_°files and close_files to
ease the support of gshadow.
	* src/groupmems.c: Always call check_perms(). This function now
	succeed when the requested action is to list the members.
2008-08-30 18:34:43 +00:00
nekral-guest
72d75d50d9 * src/groupmems.c: Added functions add_user(), remove_user(), and
purge_members() to ease the support of gshadow.
2008-08-30 18:34:24 +00:00
nekral-guest
cdf963b2b3 * src/expiry.c: Use Basename for Prog.
* src/expiry.c: Added missing OPENLOG.
2008-08-30 18:34:04 +00:00
nekral-guest
de11907053 * lib/nscd.c: Make sure the file is not empty when configured
without nscd support.
2008-08-30 18:33:13 +00:00
nekral-guest
8075d27e32 * configure.in: Remove the USE_NSCD AM_CONDITIONAL (USE_NSCD is
not used in any Makefile.am).
	* configure.in: Make sure posix_spawn is present when configured
	with nscd support.
2008-08-30 18:32:43 +00:00
nekral-guest
7109072b8f * lib/groupmem.c, lib/pwmem.c, lib/shadowmem.c: Added brackets and
parenthesis.
	* lib/groupmem.c, lib/pwmem.c, lib/shadowmem.c: Avoid assignments
	in comparisons.
2008-08-30 18:32:19 +00:00
nekral-guest
cf4aea18b4 * libmisc/mail.c: Added brackets and parenthesis.
* libmisc/mail.c: Avoid assignments in comparisons.
2008-08-30 18:31:56 +00:00
nekral-guest
68b7aad535 * configure.in: Check if the stat structure has a st_atim or
st_atimensec field.
	* libmisc/copydir.c: Conditionally use the stat's st_atim and
	st_atimensec fields.
2008-08-30 18:31:21 +00:00
nekral-guest
f86b2704d5 * lib/groupio.h, lib/prototypes.h, lib/pwio.h, lib/sgetgrent.c:
Include <sys/types.h> before <pwd.h> and <grp.h>. It is necessary
	for the definition of uid_t and gid_t.
	* lib/pwmem.c: do not include <pwd.h>, "pwio.h" is sufficient
	here.
2008-08-30 18:30:58 +00:00
nekral-guest
c59126a817 * configure.in, lib/nscd.h, lib/nscd.c: Added --with-nscd flag to
support systems without nscd.
2008-08-30 18:30:36 +00:00
nekral-guest
76ea48bb64 * NEWS: Added support for uclibc.
* configure.in, libmisc/copydir.c: futimes() and lutimes() are not
	standard. Check if they are implemented before using them. Do not
	set the time of links if lutimes() does not exist, and use
	utimes() as a replacement for futimes().
2008-08-30 18:29:55 +00:00
nekral-guest
0802405344 * src/groupmems.c: Handle the options alphabetically. 2008-08-30 18:29:31 +00:00
nekral-guest
0c7df2f9a0 * src/groupmems.c: When removing an user, check if deluser is on
the list, not adduser. This fixes a segmentation fault for every
	call of groupmems -d.
	* libmisc/list.c: Add assertions to help identifying these issues.
	* libmisc/list.c: Avoid implicit conversion of pointers to
	booleans.
2008-08-30 18:29:08 +00:00
nekral-guest
77f81fa0b6 * NEWS, src/groupmems.c: Use the "groupmems" PAM service name
instead of "groupmod".
2008-08-30 18:28:45 +00:00
nekral-guest
8851893412 * src/chfn.c: Merge some translated messages.
* src/groupmems.c, src/groupadd.c, src/gpasswd.c, src/chsh.c,
	src/chfn.c: Harmonize *_update() failure messages.
	* src/groupmems.c: Harmonize gr_close() failure messages.
	* src/newgrp.c: Harmonize "unknown GID" messages.
	* src/newusers.c: Move the pwd declaration to a inner block scope.
2008-08-30 18:28:24 +00:00
nekral-guest
aa2fee4969 * src/useradd.c: Harmonize some error messages.
* src/userdel.c: Add log to syslog when the mail file could not be
	removed.
	* src/userdel.c: Give more context an error message (merge with
	perror()).
	* src/usermod.c: Harmonize some error messages.
2008-08-30 18:27:59 +00:00
nekral-guest
d7b55ce2bb * src/groupmems.c: Check the return value of gr_update().
* src/chage.c, src/chfn.c, src/chgpasswd.c, src/chpasswd.c,
	src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupmems.c,
	src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c,
	src/passwd.c, src/pwck.c, src/pwconv.c, src/pwunconv.c,
	src/useradd.c, src/userdel.c, src/usermod.c: Harmonize the error
	message sent to stderr in case of *_update () failure.
	* src/chage.c, src/chsh.c, src/groupadd.c, src/passwd.c: Do not
	log to syslog when pw_update() or spw_update() fail.
	* src/newusers.c: Do not log specific error message to stderr when
	sgr_update() fails.
	* src/pwconv.c: Remove duplicated definition of Prog.
2008-08-30 18:27:34 +00:00
nekral-guest
38a50366bc * src/chfn.c, src/chsh.c, src/expiry.c, src/gpasswd.c,
src/newgrp.c, src/passwd.c, src/su.c: Use the same stderr and
	syslog warnings when the username cannot be determined.
	* src/newgrp.c: Reuse the same stderr message for groups which do
	not exist in the system.
2008-08-30 18:27:07 +00:00
nekral-guest
307f703b99 * src/usermod.c: Log errors while *_close to syslog.
* src/usermod.c: Added missing }
2008-08-22 02:34:04 +00:00
nekral-guest
306f19b805 * src/grpconv.c: Use Basename for the definition of Prog. Prog
needs a file visibility.
	* src/grpunconv.c: Likewise.
2008-08-22 02:33:08 +00:00
nekral-guest
a3be8ff055 * src/chfn.c: Do not exit on pw_unlock failures.
* src/grpconv.c, src/grpunconv.c, src/pwconv.c, src/pwunconv.c,
	src/vipw.c: Open syslog with the right identification name.
	* src/vipw.c: Log unlock errors to syslog.
	* src/vipw.c: Log edits to syslog.
	* src/chage.c, src/chfn.c, src/chsh.c, src/gpasswd.c,
	src/groupadd.c, src/groupdel.c, src/groupmod.c, src/grpconv.c,
	src/grpunconv.c, src/passwd.c, src/pwck.c, src/pwunconv.c,
	src/useradd.c, src/usermod.c: Harmonize the syslog levels. Failure
	to close or unlock are errors. Failure to open files are warnings.
2008-08-22 02:30:33 +00:00
nekral-guest
c9119dc6bb * src/newusers.c: Open syslog with the right identification name.
* src/newusers.c: Mark the files as locked only if they are really
	locked (i.e. if shadow is not enabled, the files are not locked).
2008-08-22 02:29:31 +00:00
nekral-guest
cfeacc4d67 * NEWS, src/gpasswd.c: Use getopt_long instead of getopt. Added
support for long options --add (-a), --delete (-d),
	--remove-password (-r), --restrict (-R), --administrators (-A),
	and --members (-M)
	* man/gpasswd.1.xml: Document the new long options.
	* src/gpasswd.c: The sgrp structure is only used if SHADOWGRP is
	defined.
2008-08-22 02:28:15 +00:00
nekral-guest
2bdcb9c33d * src/grpck.c: Added function fail_exit(). Check failure to unlock
files. Report errors to stderr and syslog, but continue.
	* src/grpconv.c: Check failure to unlock files. Report errors to
	stderr and syslog, but continue.
2008-08-22 02:26:46 +00:00
nekral-guest
7ae6b8fc34 * src/passwd.c: Check failure to unlock files. Report errors to
stderr and syslog, but continue.
2008-08-22 02:24:29 +00:00
nekral-guest
82779cd336 * src/chfn.c, src/chgpasswd.c, src/chpasswd.c, src/gpasswd.c,
src/groupadd.c, src/groupdel.c, src/groupmems.c, src/groupmod.c,
	src/grpconv.c, src/grpunconv.c, src/newusers.c, src/pwconv.c,
	src/pwunconv.c, src/useradd.c, src/userdel.c: Harmonize the name
	of the variables keeping the lock status, to match the shadow
	library prefixes.
2008-08-22 02:22:34 +00:00
nekral-guest
82ed690817 * src/chage.c, src/chgpasswd.c, src/chpasswd.c, src/chsh.c,
src/gpasswd.c, src/groupadd.c, src/groupdel.c, src/groupmems.c,
	src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c,
	src/newusers.c, src/passwd.c, src/pwck.c, src/pwconv.c,
	src/pwunconv.c, src/useradd.c, src/userdel.c, src/usermod.c: In
	case of a lock failure, indicate to the user that she can try
	again later. Do not log to syslog.
2008-08-22 02:20:53 +00:00
nekral-guest
1355d5d3eb * NEWS, src/passwd.c: For compatibility with other passwd version,
the --lock an --unlock options do not lock or unlock the user
	account anymore.  They only lock or unlock the user's password.
	* man/passwd.1.xml: Document above change. Document how an account
	can be locked and what a password lock means.
2008-08-22 02:16:21 +00:00
nekral-guest
fa33bb9d0e * man/groupadd.8.xml: Fix the regular expression for group policy.
The final $ character is optional.
	* man/groupadd.8.xml: Likewise.
	* man/groupadd.8.xml: Indicate the maximum size of usernames.
2008-08-15 15:25:53 +00:00
nekral-guest
0ebc407246 * man/po/pl.po: Fix typo in the Polish translation (see
http://bugs.debian.org/491460)
2008-08-15 15:25:23 +00:00
nekral-guest
2c950c5cb5 * man/pl/Makefile.am: Do not build the Polish translation of
login.1 and su.1 (not enough translated). See
	http://bugs.debian.org/491460
2008-08-13 06:55:55 +00:00
nekral-guest
2722e6bb68 * man/shadow.5.xml: Fix typo. The password must be changed before
the maximum number of days, not after.
2008-08-13 06:55:37 +00:00
nekral-guest
5d1795062f * src/groupmems.c: Harmonize the unlock failure messages. 2008-08-09 23:33:46 +00:00
nekral-guest
b6cc69cd8f * src/pwck.c: Added fail_exit().
* src/pwck.c: Report failure to unlock files to stderr and
	syslog.
	* src/pwck.c: Report failure to sort to stderr, and exit with
	E_CANTSORT.
	* man/pwck.8.xml: Document return code 6 (E_CANTSORT).
2008-08-09 23:33:26 +00:00
nekral-guest
10e78fbd8e * src/vipw.c: Report failures to remove files to stderr.
* src/vipw.c: Report failures to unlock files to stderr.
2008-08-09 23:31:36 +00:00
nekral-guest
e3e99974f8 * NEWS, src/groupmems.c: Added syslog support.
* src/groupmems.c: members() renamed display_members() to
	avoid name clash with its members argument.
	* src/groupmems.c: Report failure to unlock to syslog.
	* src/groupmems.c: Harmonize error messages.
	* src/groupmems.c: Report failures to write the new group file to
	syslog (gr_close() failure).
	* src/groupmems.c: Don't use fail_exit for non-failure exit.
2008-08-09 23:28:30 +00:00
nekral-guest
e069125a2c * src/chsh.c: Added fail_exit().
* src/chsh.c: Use fail_exit() instead of exit(), this avoid
	calling closelog() every times.
	* src/chsh.c: Ignore the return value or pam_end().
	* src/chsh.c: Simplify the PAM error handling.
	* src/chsh.c: Report failure to unlock files to stderr and
	syslog.
2008-08-09 23:27:50 +00:00
nekral-guest
69b276a712 * src/chpasswd.c: Added fail_exit().
* src/chpasswd.c: Added support for syslog.
	* src/chpasswd.c: Report failure to unlock files to stderr and
	syslog.
	* src/chpasswd.c: Simplify the PAM error handling.
	* src/chpasswd.c: Report failure during *_close() to syslog.
	* src/chpasswd.c: Ignore the return value or pam_end().
2008-08-09 23:25:18 +00:00
nekral-guest
538db04950 * src/chgpasswd.c: Added fail_exit().
* src/chgpasswd.c: Added support for syslog.
	* src/chgpasswd.c: Report failure to unlock files to stderr and
	syslog.
	* src/chgpasswd.c: Simplify the PAM error handling.
	* src/chgpasswd.c: Report failure during *_close() to syslog.
	* src/chgpasswd.c: Ignore the return value or pam_end().
2008-08-09 23:22:00 +00:00
nekral-guest
e2b778a38e * src/userdel.c: Report failure to remove entries from group or
gshadow to stderr.
	* src/userdel.c: Fail in case of failure during the write of a
	user or group database. Report errors to syslog.
	* src/userdel.c: Do not unlock non locked files.
	* src/userdel.c: Report failure to unlock the passwd or shadow
	file to stderr and syslog.
2008-08-07 08:44:06 +00:00
nekral-guest
85bc9c1d1a * src/pwunconv.c: Report failure to unlock the passwd or shadow
file to stderr and syslog.
2008-08-07 08:03:55 +00:00
nekral-guest
501ae11f51 * src/usermod.c: Report failure to unlock the passwd or shadow
file to stderr and syslog.
2008-08-07 08:03:38 +00:00
nekral-guest
eb6cb5311b * src/newusers.c: Report failure to unlock the passwd or shadow
file to stderr and syslog.
	* src/newusers.c: In case of error when files are open or closed,
	indicate the failing file.
	* src/newusers.c: Do not try to unlock the files manually since
	this is done in fail_exit.
2008-08-07 08:03:13 +00:00
nekral-guest
e3a5f66059 * src/chage.c: Report failure to unlock the passwd or shadow file
to stderr and syslog.
2008-08-07 08:02:52 +00:00
nekral-guest
fd4b6cc52a * src/pwconv.c: Report failure to unlock the passwd or shadow file
to stderr and syslog.
	* src/pwconv.c: Report failure to chmod the backup file.
2008-08-07 08:02:34 +00:00
nekral-guest
93ccc35ff0 * src/grpunconv.c: Report failure to unlock the group or gshadow
files to stderr and syslog.
2008-08-07 08:02:13 +00:00
nekral-guest
ccc49e8841 * src/chfn.c: Added fail_exit(). Check if the passwd file is
locked. Report failures to unlock to stderr and syslog.
	* src/chfn.c: Is case of failure, use fail_exit() rather than
	exit().
	* src/chfn.c: Ignore the return value of pam_end().
2008-08-07 08:01:44 +00:00
nekral-guest
7fc596fb8a * lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h,
lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h:
	Added *_dbname() functions to retrieve the name of the databases.
	* lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h,
	lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h:
	*_name() functions renamed *setname().
	* src/grpck.c, src/pwck.c: Likewise.
	* lib/groupio.h, lib/pwio.h, lib/sgroupio.h, lib/shadowio.h: Added
	the name of the arguments to the prototypes.
	* src/chage, src/chfn.c, src/chgpasswd.c, src/chpasswd.c,
	src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupdel.c,
	src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c,
	src/newusers.c, src/passwd.c, src/pwck.c, src/pwconv.c,
	src/pwunconv.c, src/useradd.c, src/userdel.c, src/usermod.c:
	Harmonize the erro & syslog messages in case of failure of the
	*_lock(), *_open(), *_close(), *_unlock(), *_remove() functions.
	* src/chgpasswd.c, src/chpasswd.c, src/usermod.c: Avoid
	capitalized messages.
	* src/chpasswd.c, src/useradd.c, src/usermod.c: Harmonize messages
	in case of inexistent entries.
	* src/usermod.c:  Harmonize messages in case of already existing
	entries.
	* src/newusers.c, src/useradd.c: Simplify PAM error handling.
	* src/useradd.c: Report failures to unlock files (stderr, syslog,
	and audit). But do not fail (continue).
	* src/useradd.c (open_files): Do not report to syslog & audit
	failures to lock or open the databases. This might be harmless,
	and the logs were not already informed that a change was
	requested.
	* src/usermod.c: It's not the account which is unlocked, but its
	password.
2008-08-06 15:57:31 +00:00
nekral-guest
b0fe7d3a0b * src/groupadd.c: Only call gr_unlock() and sgr_unlock() in the
group or gshadow files were previously locked.
	* src/groupadd.c: Make sure failures are reported to syslog/audit
	after the change is mentioned.
	* src/groupmod.c: Add logging to syslog & audit on lock/unlock
	failures.
	* src/groupmod.c: Make sure issues are reported to syslog or audit
	after the change is mentioned.
	* src/groupdel.c: Only call gr_unlock() and sgr_unlock() in the
	group or gshadow files were previously locked.
	* src/groupdel.c: Simplify the handling of PAM errors.
2008-08-06 15:56:51 +00:00
nekral-guest
2cba7fdfcd * src/groupdel.c: Add logging to syslog & audit on lock/unlock
failures.
2008-08-06 15:54:49 +00:00
nekral-guest
9ddc88dd9d * src/groupdel.c: Harmonize error & syslog messages. 2008-08-06 15:54:16 +00:00
nekral-guest
bc8456425d * src/groupmod.c: Harmonize error & syslog messages. 2008-08-06 15:53:50 +00:00
nekral-guest
7eab6d9958 * src/groupadd.c: Harmonize error & syslog messages.
* src/groupadd.c: Add logging to syslog in some error cases.
2008-08-06 15:53:30 +00:00
nekral-guest
2bf3f0c03c * src/gpasswd.c: Warn and log to syslog and audit when group or
gshadow cannot be unlocked, but do not fail.
2008-08-06 15:52:42 +00:00
nekral-guest
9eea2344fc * src/gpasswd.c: Harmonize error & syslog messages. 2008-08-06 15:52:21 +00:00
nekral-guest
538600ef48 * src/chfn.c, src/chsh.c, src/groupdel.c, src/groupmems.c,
src/groupmod.c, src/grpck.c, src/login.c, src/logoutd.c,
	src/newgrp.c, src/newusers.c, src/passwd.c, src/pwck.c,
	src/suauth.c, src/useradd.c, src/userdel.c, src/usermod.c,
	src/vipw.c: Complete the switch from the `' quotation style to ''.
	Do it also in SYSLOG messages. Quote some parameters. All this
	permits to merge some messages.
2008-08-06 15:51:52 +00:00
nekral-guest
6713942f83 * src/groupmems.c: Only check if the adduser user exists when an
user is specified with -a.
2008-07-30 14:11:09 +00:00
nekral-guest
c6f5ce280f * src/groupmems.c: Fix the groupmems' usage message. The -D option
is in fact -p.
2008-07-30 00:27:55 +00:00
nekral-guest
9aad7a3783 * src/groupmems.c: Replace an if test by an else. 2008-07-27 22:30:47 +00:00
nekral-guest
a22551d56b * src/groupmems.c: Ignore the return value of fputs(). 2008-07-27 22:30:39 +00:00
nekral-guest
d6f96fa07e * src/groupmems.c (whoami): Make sure usr and grp are not NULL
before dereferencing them.
2008-07-27 22:30:31 +00:00
nekral-guest
5a0715fd6c * src/groupmems.c: Use xstrdup() rather than strdup(). 2008-07-27 22:30:22 +00:00
nekral-guest
717110d355 * src/groupmems.c: Add parenthesis.
* src/groupmems.c: Avoid implicit conversion of pointers / chars to
	booleans.
2008-07-27 22:30:12 +00:00
nekral-guest
d5c6257ac2 * NEWS, src/groupmems.c: Allow everybody to list the users of a group.
This information is publicly available in /etc/group.
	* NEWS, src/groupmems.c: Open /etc/group read only for the -l option.
2008-07-27 02:33:37 +00:00
nekral-guest
88fce52fbf * man/groupmems.8.xml: Sort options alphabetically. 2008-07-27 02:11:32 +00:00
nekral-guest
aa035f9853 * src/groupmems.c (check_perms): Simplify. Always call pam_end()
at the end of the authentication.
2008-07-27 01:41:07 +00:00
nekral-guest
b2f5629de8 * src/groupmems.c: Add fail_exit() to remove the group lock file
in case of failure. Replace the calls to exit() by fail_exit().
2008-07-27 01:35:08 +00:00
nekral-guest
db98798134 * src/groupmems.c: Reduce the number of checks. Isolate the
parameters setting and permissions checking.
2008-07-27 01:16:13 +00:00
nekral-guest
d4227e75cd * src/groupmems.c: Add functions process_flags() and check_perms()
from code of main().
	* src/groupmems.c: Harmonize the failure message in case of PAM
	failure with the other programs.
2008-07-27 00:59:42 +00:00
nekral-guest
e6c015e0d0 * src/groupmems.c: Remove isgroup(), which always returns TRUE. 2008-07-27 00:35:04 +00:00
nekral-guest
44db9db053 * src/groupmems.c: Reuse the functions from libmisc/list.c to deal
with user lists. addtogroup() was broken when realloc() move the
	memory area.
	* src/groupmems.c: Report failures with the name of the program.
2008-07-27 00:21:42 +00:00
nekral-guest
4c2ed7b52e * src/groupmems.c: EXIT_READ_GROUP changed to EXIT_INVALID_GROUP.
* src/groupmems.c: EXIT_INVALID_USERNAME changed to EXIT_INVALID_USER.
	* src/groupmems.c: Fix typos.
2008-07-27 00:11:25 +00:00
nekral-guest
6f571dbfc6 * src/groupmems.c: Really use booleans.
* src/groupmems.c: Change isroot() to a macro that returns a
	boolean.
2008-07-26 16:24:27 +00:00
nekral-guest
a363e1c51f * lib/defines.h: Make sure the booleans are defined before using
them.
2008-07-26 16:13:29 +00:00
nekral-guest
b684ea837d 2008-07-26 Nicolas François <nicolas.francois@centraliens.net>
* src/groupmems.c: Added Prog global variable to indicate the name
	of the program in error messages.

2008-07-22  Lukáš Kuklínek  <lkukline@redhat.com>

	* NEWS, src/groupmems.c: Check if the user added to group actually
	exist. RedHat bug #455603
	* NEWS, src/groupmems.c: Check if the group exists in the group
	local database (/etc/group). RedHat bug #456088
2008-07-26 16:11:49 +00:00
nekral-guest
d4eced9b84 * lib/prototypes.h: Fix getrange prototype. 2008-07-21 22:45:49 +00:00
nekral-guest
276e406c0f * README, NEWS, configure.in, lib/pam_defs.h, src/login.c: Add
support for OpenPAM.
2008-07-21 21:14:06 +00:00
nekral-guest
7ac0323c7b * src/chage.c: Ignore the return value of pam_end() before exiting.
* src/chage.c: Ignore return values of strftime(), snprintf(),
	puts(), printf(), and fputs().
	* src/chage.c: Check the return value of asctime().
2008-07-11 22:31:43 +00:00
nekral-guest
95c78ce92b * lib/gshadow.c: Avoid assignments in comparison. 2008-07-11 22:23:42 +00:00
nekral-guest
21c692d23f Re-inject the changes from 4.1.2.1. 2008-07-11 22:20:43 +00:00
nekral-guest
22fb4fe019 * src/usermod.c: Do not call usr_update() if it will have no
effects. This avoid checking if the user exists in the local passwd
	file if not necessary, and thus allow to add LDAP users to local
	groups. (The user is already checked against the system
	configuration with getpwnam()). Thanks to Dan Kopecek.
2008-07-11 21:50:05 +00:00
nekral-guest
62c8e79676 * src/usermod.c: Split update_files() into update_lastlog() and
update_faillog(). Report errors (but don't fail) if the file
	exist, but open(), lseek(), read(), write(), or close() fails.
	* src/usermod.c: Add brackets and parenthesis.
	* src/usermod.c: Ignore the return value of pam_end() before
	exiting.
	* src/usermod.c: Ignore the return value of strftime(),
	snprintf(), and puts().
	* src/usermod.c: Check the return value of gmtime() and asctime(),
	and output the raw time_t on failures.
2008-07-11 20:52:44 +00:00
nekral-guest
e4e3bd5175 * libmisc/setugid.c: Add brackets. 2008-07-11 20:23:07 +00:00
nekral-guest
6298ca94cb * libmisc/env.c: Avoid implicit conversion of pointers / chars to
booleans.
	* libmisc/env.c: Add brackets and parenthesis.
	* libmisc/env.c: Ignore the return value of puts() and fputs().
	* libmisc/env.c: Avoid multi-statements lines.
2008-06-17 21:58:46 +00:00
nekral-guest
5f9226b14b * libmisc/utmp.c: Avoid implicit conversion of pointers / chars to
booleans.
	* libmisc/utmp.c: Add brackets and parenthesis.
	* libmisc/utmp.c: Exit with the EXIT_FAILURE status code in case
	of failure.
	* libmisc/utmp.c: Avoid assignments in comparisons.
	* lib/prototypes.h, libmisc/utmp.c: Change setutmp()'s prototype
	to return an int because pututline() and pututxline() may fail.
2008-06-17 21:13:30 +00:00
nekral-guest
9320075030 * libmisc/audit_help.c: Added one string for translation.
* po/POTFILES.in: Added libmisc/audit_help.c,
	libmisc/find_new_gid.c, libmisc/find_new_uid.c, libmisc/getlong.c,
	libmisc/getrange.c, libmisc/xgetXXbyYY.c, and libmisc/yesno.c.
	Removed libmisc/find_new_ids.c
2008-06-17 20:52:19 +00:00
nekral-guest
ca032792bd * src/useradd.c: If the faillog file exist, warn in case of
failure when open(), lssek(), write() or close() fails when the
	new user's faillog entry is reset.
	* src/useradd.c: Ditto for the lastlog entry.
2008-06-15 22:25:51 +00:00
nekral-guest
abb95d5aab * libmisc/limits.c: Add brackets and parenthesis.
* libmisc/limits.c: Avoid implicit conversion of pointers /
	integers to booleans.
	* libmisc/limits.c: Ignore the return value of umask(). We will
	never return to the original umask.
	* libmisc/limits.c: Avoid multi-statements lines.
	* libmisc/limits.c: Added default to a switch(). Report invalid
	limit strings to syslog.
	* libmisc/limits.c: Ignore the return value of fclose().
	/etc/limits is open read-only.
	* libmisc/limits.c: Ignore the return value of fputs() and
	sleep().
	* libmisc/limits.c: Check the return value of nice() and
	set_filesize_limit(), and report errors to syslog.

	* libmisc/ulimit.c, lib/prototypes.h: Return failures of
	set_filesize_limit(). Change the prototype to return an int
	instead of void.
2008-06-15 21:59:41 +00:00
nekral-guest
dcd480ffd9 * libmisc/failure.c: Try to close the open file if a failure
occured during lseek(), read() or write().
2008-06-15 19:16:34 +00:00
nekral-guest
68cdac68cb * libmisc/log.c: Check return values. If lseek() failed, avoid
reading or writing at an unspecified location. Log to syslog in
	case of failure.
	* libmisc/log.c: Use the right casts.
2008-06-15 19:15:15 +00:00
nekral-guest
e1307ea789 * libmisc/find_new_ids.c, libmisc/find_new_gid.c,
libmisc/find_new_uid.c, libmisc/Makefile.am, lib/prototypes.h:
	Split find_new_ids.c into find_new_gid.c and find_new_uid.c to
	ease the description of login.defs variables in the different
	tools.
2008-06-15 18:33:52 +00:00
nekral-guest
52fe9f62f6 * libmisc/failure.c: Ignore the return value of strftime() and
printf().
	* libmisc/failure.c: Fix syslog call. The UID is not available.
	User the username specified in the utmp/utmpx entry.
2008-06-15 00:01:46 +00:00
nekral-guest
f42160862a * lib/defines.h: Avoid implicit conversion of pointers to
booleans.
	* lib/defines.h: Ignore return values of setlocale() except the
	first call.
	* lib/defines.h: Fix a splint observer warning by using an
	intermediate variable (old_locale).
2008-06-14 23:41:38 +00:00
nekral-guest
1b631c42ef * libmisc/failure.c: Check return values. If lseek() failed, avoid
reading or writing at an unspecified location. Log to syslog in
	case of failure when reading a faillog entry or writing in
	faillog or btmp.
	* libmisc/failure.c: Check if the file exist before opening it.
	* libmisc/failure.c: Log failures of open() and close() when
	necessary.
2008-06-14 23:38:43 +00:00
nekral-guest
0afd6a8312 * lib/prototypes.h: Add the getrange() prototype.
* lib/prototypes.h: Fix the valid_field() prototype (does not
	return an bool).
	* lib/prototypes.h: Fix the valid() prototype (it does return a
	bool).
2008-06-14 21:11:19 +00:00
nekral-guest
4ac21ca652 * lib/getdef.c: Fix the getdef_ulong() prototype.
* lib/getdef.h: Fix the getdef_ulong() prototype.
2008-06-14 21:09:33 +00:00
nekral-guest
dbbae8dcd3 * src/lastlog.c: Use getrange to parse the range of users.
* src/lastlog.c: umin and umax do not need to be signed long. Use
	an unsigned long which might be needed to parse a GID or UID. Add
	the has_umin and has_umax to replace the -1 values.
	* src/lastlog.c: Cast dates to time_t.
	* src/lastlog.c: Prefix lastlog errors with "lastlog: ".
2008-06-14 21:06:53 +00:00
nekral-guest
eed5fc7179 * libmisc/getlong.c: Reset errno before calling strtol().
Otherwise, errno could be already set to ERANGE.
2008-06-14 21:02:52 +00:00
nekral-guest
b8c5483b85 * libmisc/Makefile.am, libmisc/getrange.c: Added function to parse
a range (useful for lastlog).
2008-06-14 21:01:11 +00:00
nekral-guest
4f12c31e3b * src/chsh.c: <signal.h> is not needed. 2008-06-14 15:03:58 +00:00
nekral-guest
53543b9b6a * lib/prototypes.h: Define AUDIT_NO_ID to (unsigned int) -1. This
value should be used when the ID should not be considered.
	* lib/prototypes.h: Fix the prototype of do_rlogin() according to
	earlier changes.
2008-06-13 21:57:47 +00:00
nekral-guest
afafd0f683 * lib/shadow.c: Use SHADOW_SP_FLAG_UNSET for the initial
value of spwd.sp_flag.
	* lib/shadow.c: Add brackets.
	* lib/shadow.c: Avoid implicit conversion of pointers to
	booleans.
	* lib/shadow.c: The size argument of fgets is an int, not a
	size_t.
2008-06-13 21:55:51 +00:00
nekral-guest
d65354efcf * lib/commonio.c: len should be typed ssize_t as it is the return
of read(), and is compared to 0. Cast to size_t when necessary.
2008-06-13 21:53:41 +00:00
nekral-guest
d3abd86df5 * libmisc/find_new_ids.c: Use getdef_ulong to retrieve UIDs/GIDs
from login.defs. Type constants to long integers.
2008-06-13 21:49:57 +00:00
nekral-guest
838f39d0fd * lib/gshadow.c: Use a bool when possible instead of int integers.
* lib/gshadow.c: Remove __setsgNIS() -never used).
	* lib/gshadow.c: Avoid multi-statements lines.
	* lib/gshadow.c: Avoid assignments in comparisons.
	* lib/gshadow.c: ptr[nelem] is a string. Initialize it to NULL
	instead of '\0'.
	* lib/gshadow.c: Add brackets and parenthesis.
	* lib/gshadow.c: The size argument of strncpy is a size_t and the
	size argument of fgets is an int.
2008-06-13 21:45:47 +00:00
nekral-guest
4589ba350f * lib/groupio.c: Add brackets.
* lib/groupio.c: Make sure malloc receives a size_t.
	* lib/groupio.c: Avoid multi-statements lines.
2008-06-13 21:39:24 +00:00
nekral-guest
92143eb7b9 * lib/sgetspent.c: Use SHADOW_SP_FLAG_UNSET for the initial
value of spwd.sp_flag.
2008-06-13 21:36:41 +00:00
nekral-guest
c9679b7954 * lib/getdef.h, lib/getdef.c: Add getdef_ulong().
* lib/getdef.c: Added TODOs because of lack of error checking.
	* lib/getdef.c: The size argument of fgets is an int, not a
	size_t.
	* lib/getdef.c: Avoid multi-statements lines.
2008-06-13 21:35:22 +00:00
nekral-guest
5fc99a117b * src/id.c: Make sure malloc receives a size_t.
* src/id.c: Use a %lu format and cast group and user IDs to
	unsigned long integers.
2008-06-13 21:31:23 +00:00
nekral-guest
87ba782106 * src/sulogin.c: Ignore the return value of signal(). 2008-06-13 21:30:09 +00:00
nekral-guest
dd8a09ce8d * src/groups.c: sys_ngroups is only used when HAVE_GETGROUPS is
defined.
2008-06-13 21:29:13 +00:00
nekral-guest
ba7dde0168 * src/faillog.c: Ignore return value of time() when use with a
non NULL argument.
	* src/faillog.c: Use a %lu format and cast number of days to
	unsigned long integers.
	* src/faillog.c: Cast dates to time_t.
2008-06-13 21:28:11 +00:00
nekral-guest
3a03794bb6 * src/login.c: Ignore the return value of signal().
* src/login.c: Use a %lu format and cast group and user IDs to
	unsigned long integers.
	* src/login.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-13 21:25:15 +00:00
nekral-guest
fe753e24a3 * src/chage.c: Add the arguments' names in the functions
prototypes.
	* src/chage.c: The ID argument of audit_logger is an unsigned
	int. Use AUDIT_NO_ID instead of -1.
	* src/chage.c: print_date() received a time_t.
	* src/chage.c: Use SHADOW_SP_FLAG_UNSET for the initial
	value of spwent.sp_flag.
2008-06-13 21:23:09 +00:00
nekral-guest
42a4604461 * src/groupadd.c: The ID argument of audit_logger is an unsigned
int. Use AUDIT_NO_ID instead of -1.
	* src/groupadd.c: Cast the parsed GID/UID to a gid_t/uid_t.
2008-06-13 21:19:07 +00:00
nekral-guest
a70898fc28 * src/pwck.c: Use a %lu format and cast group and user IDs to
unsigned long integers.
	* src/pwck.c: Cast number of days to a long integer.
	* src/pwck.c: Use the SCALE macro instead of (24L * 3600L)
	for the values to be set in /etc/shadow.
	* src/pwck.c: Use SHADOW_SP_FLAG_UNSET for the initial
	value of spent.sp_flag.
2008-06-13 21:16:01 +00:00
nekral-guest
186eef69dc * src/passwd.c: Ignore return value of time() when use with a
non NULL argument.
	* src/passwd.c: Cast number of days to a long integer.
2008-06-13 21:09:14 +00:00
nekral-guest
c3a380ade8 * src/groupmod.c: The ID argument of audit_logger is an unsigned
int. Use AUDIT_NO_ID instead of -1.
	* src/groupmod.c:  Use a %lu format and cast group and user IDs to
	unsigned long integers.
	* src/groupmod.c: Cast the parsed GID/UID to a gid_t/uid_t.
2008-06-13 21:08:06 +00:00
nekral-guest
936bd6a191 * src/useradd.c: The ID argument of audit_logger is an unsigned
int. Use AUDIT_NO_ID instead of -1.
	* src/useradd.c: Cast the parsed GID/UID to a gid_t/uid_t.
	* src/useradd.c: The size argument of fgets is an int, not a
	size_t.
	* src/useradd.c: Cast number of days to a long integer.
	* src/useradd.c: Use SHADOW_SP_FLAG_UNSET for the initial
	value of spent.sp_flag.
	* src/useradd.c: Use a %lu format and cast group and user IDs to
	unsigned long integers.
2008-06-13 21:06:04 +00:00
nekral-guest
00431d772e * src/su.c: fork() and waitpid() return a pid_t, not an int.
* src/su.c: Add brackets and parenthesis.
	* src/su.c: Ignore the return value of signal().
2008-06-13 21:02:07 +00:00
nekral-guest
a22c7e731a * src/groupdel.c: The ID argument of audit_logger is an unsigned
int. Use AUDIT_NO_ID instead of -1.
2008-06-13 20:59:04 +00:00
nekral-guest
398cf8ee6f * src/expiry.c: Ignore the return value of signal(). 2008-06-13 20:57:20 +00:00
nekral-guest
e50ff5c7b5 * src/newusers.c: Fix the check for GID/UID validity.
* src/newusers.c: Comment why we use both getgrgid() and
	gr_locate_gid().
	* src/newusers.c: Cast the parsed GID/UID to a gid_t/uid_t.
	* src/newusers.c: Cast the number of days to a long integer.
	* src/newusers.c: Use SHADOW_SP_FLAG_UNSET for the initial
	value of spent.sp_flag.
	* src/newusers.c: The size argument of fgets is an int, not a
	size_t.
2008-06-13 20:56:44 +00:00
nekral-guest
906e8c0001 * src/usermod.c: Cast dates to time_t, and number of days to a
long integer.
	* src/usermod.c: Cast UIDs and GIDs to uid_t and gid_t after
	checking the ranges.
	* src/usermod.c: The ID argument of audit_logger is an unsigned
	int.
	* src/usermod.c: read() returns a ssize_t.
	* src/usermod.c: Cast the return value of malloc and make sure it
	receives a size_t.
2008-06-13 20:40:04 +00:00
nekral-guest
2fa4cedb1e * src/logoutd.c: Ignore return value of time() when use with a
non NULL argument.
2008-06-13 20:34:46 +00:00
nekral-guest
47210d9a1a * src/pwconv.c: Use SHADOW_SP_FLAG_UNSET for the initial
value of sp.sp_flag.
	* src/pwconv.c: Cast number of days to a long integer.
2008-06-13 20:33:38 +00:00
nekral-guest
d1881d1b56 * src/gpasswd.c: The ID argument of audit_logger is an unsigned
int.
	* src/gpasswd.c: Ignore the return value of signal(). The signal
	handlers are only changed for the last steps of gpasswd, and there
	is no need to restore them.
2008-06-13 20:29:58 +00:00
nekral-guest
6713a2ce67 * src/userdel.c: The ID argument of audit_logger is an unsigned
int.
	* src/userdel.c: fork() and wait() return a pid_t, not an int.
2008-06-13 20:23:26 +00:00
nekral-guest
f626317e90 * src/newgrp.c: Use a %lu format and cast group and user IDs to
unsigned long integers.
	* src/newgrp.c: The ID argument of audit_logger is an unsigned
	int.
	* src/newgrp.c: Ignore the return value of signal() (the signal
	handlers are assumed to be the default one and are restored
	later).
	* src/newgrp.c: Do not checl if a pid_t is < 0, check if equal
	to (pid_t)-1.
2008-06-13 20:21:24 +00:00
nekral-guest
56327f6298 * libmisc/isexpired.c: Cast number of days to a long integer.
* libmisc/isexpired.c: Add brackets and parenthesis.
2008-06-13 20:12:03 +00:00