Commit Graph

505 Commits

Author SHA1 Message Date
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
5c04fe9b61 Added missing Prog. 2008-08-09 23:24:15 +00:00
nekral-guest
9c050c54ef Added missing Prog. 2008-08-09 23:23:44 +00:00
nekral-guest
3a07026740 Fix typo: missing O_RDWR parameter to *_open(). 2008-08-09 23:23:12 +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
6461841ccd * Merge two is_shadowgrp blocks.
* Indicate that we continue when *_unlock fail
2008-08-06 15:55:57 +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
8f3ee46325 Harmonize error messages and add the prototypes for whoami(), members(), and usage(). 2008-07-27 01:47:56 +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
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
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
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
eb18ee624f Re-indent. 2008-06-17 22:00:36 +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
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
4f12c31e3b * src/chsh.c: <signal.h> is not needed. 2008-06-14 15:03:58 +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
73d36f5ece Fix typo. 2008-06-13 21:02:26 +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
ef32209fd7 * libmisc/console.c, libmisc/hushed.c, libmisc/yesno.c,
libmisc/loginprompt.c, libmisc/ttytype.c, libmisc/tz.c,
	src/login_nopam.c, src/chpasswd.c, src/chgpasswd.c, lib/port.c:
	The size argument of fgets is an int, not a size_t.
	* libmisc/loginprompt.c: Ignore the return value from signal()
	when the signal handlers are restored.
	* src/chpasswd.c: Cast the return value of time() to a long
	integer.
	* src/chpasswd.c: Use the SCALE macro instead of (24L * 3600L)
	for the values to be set in /etc/shadow.
2008-06-13 18:11:09 +00:00
nekral-guest
55b2e44814 Avoid implicit conversion of pointers to booleans. 2008-06-10 22:10:47 +00:00
nekral-guest
6bb86709ee Add brackets. 2008-06-10 22:10:21 +00:00
nekral-guest
ce6dca81bc * src/pwck.c: Use a bool when possible instead of int integers.
* src/pwck.c: Avoid implicit conversion of integers to booleans.
2008-06-10 22:09:12 +00:00
nekral-guest
d7ffaf94b1 * src/su.c: Use a bool when possible instead of int integers.
* src/su.c: Add brackets and parenthesis.
	* src/su.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/su.c: Ignore the return value of pam_end() before
	exiting.
	* src/su.c: Avoid assignments in comparisons.
	* src/su.c: Avoid multi-statements lines.
2008-06-10 22:07:51 +00:00
nekral-guest
7cb33ba636 Avoid implicit conversion of integer to boolean. 2008-06-10 20:34:25 +00:00
nekral-guest
91c8e1bf0d * src/id.c: Ignore the return value of fputs(), puts(), putchar(),
and printf().
	* src/id.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/id.c: Add brackets and parenthesis.
	* src/id.c: Avoid implicit conversion of pointers / integers
	to booleans.
2008-06-10 19:45:06 +00:00
nekral-guest
c8626c09af * src/chsh.c: Use a bool when possible instead of int integers.
* src/chsh.c: restricted_shell() renamed is_restricted_shell().
	check_shell() renamed shell_is_listed().
	* src/chsh.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/chsh.c: Avoid implicit conversion of pointers / integers
	to booleans.
	* src/chsh.c: Ignore the return value of pam_end() before
	exiting.
2008-06-10 19:42:22 +00:00
nekral-guest
cac7d1a495 * src/grpunconv.c: Use a bool when possible instead of int
integers.
	* src/grpunconv.c: Add brackets and parenthesis.
	* src/grpunconv.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/grpunconv.c: Avoid implicit conversion of pointers / integers
	to booleans.
2008-06-10 19:39:18 +00:00
nekral-guest
3cbda4157b * src/sulogin.c: Ignore return value of setlocale(),
bindtextdomain(), and textdomain().
	* src/sulogin.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/sulogin.c: Avoid assignments in comparisons.
	* src/sulogin.c: Ignore the return value of alarm().
2008-06-10 19:36:05 +00:00
nekral-guest
46ce06791a * src/groups.c: Use a bool when possible instead of int integers.
* src/groups.c: Add brackets and parenthesis.
	* src/groups.c: Avoid implicit conversion of pointers / integers
	to booleans.
	* src/groups.c: Avoid assignments in comparisons.
	* src/groups.c: Ignore the return value of putchar(), printf()
	* src/groups.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-10 19:29:54 +00:00
nekral-guest
462e8a3d90 re-indent. 2008-06-10 19:18:44 +00:00
nekral-guest
cd9e4d1b2b * src/grpconv.c: Use a bool when possible instead of int integers.
* src/grpconv.c: Add brackets and parenthesis.
	* src/grpconv.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/grpconv.c: Avoid implicit conversion of pointers / integers
	to booleans.
2008-06-10 19:18:34 +00:00
nekral-guest
e31af5f255 * src/faillog.c: Use a bool when possible instead of int integers.
* src/faillog.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/faillog.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/faillog.c: Add brackets and parenthesis.
2008-06-10 19:16:02 +00:00
nekral-guest
a0dae7557c * src/login.c: Avoid multi-statements lines.
* src/login.c: Ignore the return value of pam_end() before
	exiting.
	* src/login.c: Use a bool when possible instead of int integers.
	* src/login.c: Add brackets and parenthesis.
	* src/login.c: Ignore the return values of fflush(), putchar(), puts().
	* src/login.c: Ignore the return value of fclose() for read-only
	files.
	* src/login.c: Avoid assignments in comparisons.
	* src/login.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-10 18:56:23 +00:00
nekral-guest
836bf643b0 * src/chage.c: Use a bool when possible instead of int integers.
* src/chage.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-10 17:56:53 +00:00
nekral-guest
f9e4c7ca02 * src/groupadd.c: Use a bool when possible instead of int
integers.
	* src/groupadd.c: Add brackets and parenthesis.
	* src/groupadd.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/groupadd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/groupadd.c: Ignore the return value of pam_end() before
	exiting.
2008-06-10 17:53:35 +00:00
nekral-guest
a31782497c * src/pwck.c: Use a bool when possible instead of int integers.
* src/pwck.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-10 17:51:30 +00:00
nekral-guest
47f937ac13 * src/passwd.c: Use a bool when possible instead of int integers.
* src/passwd.c: Avoid assignments in comparisons.
	* src/passwd.c: Add brackets and parenthesis.
	* src/passwd.c: Avoid implicit conversion of pointers / integers /
	chars to booleans.
	* src/passwd.c: Move the "context_t c" declaration at the
	beginning check_selinux_access.
	* src/passwd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-10 17:50:21 +00:00
nekral-guest
be8d08fda6 * src/groupmod.c: Use a bool when possible instead of int
integers.
	* src/groupmod.c: Avoid assignments in comparisons.
	* src/groupmod.c: Add brackets and parenthesis.
	* src/groupmod.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/groupmod.c: Use a %lu format to print GIDs, and cast the GID
	to (unsigned long int).
	* src/groupmod.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/groupmod.c: Ignore the return value of pam_end() before
	exiting.
2008-06-10 17:45:08 +00:00
nekral-guest
7dea133b55 * src/su.c: Ignore return value of setlocale(),
bindtextdomain(), and textdomain().
2008-06-09 22:28:16 +00:00
nekral-guest
63f0e5e2c0 * src/useradd.c: Use a bool when possible instead of int integers.
* src/useradd.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/useradd.c: Add brackets and parenthesis.
	* src/useradd.c: Avoid assignments in comparisons.
	* src/useradd.c: Ignore the return value of fclose() for read-only
	files.
	* src/useradd.c: Ignore the return value of fflush() before
	closing the files.
	* src/useradd.c: Avoid multi-statements lines.
	* src/useradd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/useradd.c: Ignore the return value of pam_end() before
	exiting.
2008-06-09 22:08:08 +00:00
nekral-guest
fdb577e0a0 * src/vipw.c: Use a bool when possible instead of int integers.
* src/vipw.c: Ignore the return value of umask(), when the mask is
	set again to the old value.
	* src/vipw.c: Avoid implicit conversion of pointers / integers to
	booleans.
	* src/vipw.c: Add brackets and parenthesis.
	* src/vipw.c: Avoid assignments in comparisons.
	* src/vipw.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/vipw.c: Add missing termination of the longopts parameter
	for getopt_long().
2008-06-09 21:18:28 +00:00
nekral-guest
45544f42b9 * src/chgpasswd.c: Use a bool when possible instead of int
integers.
	* src/chgpasswd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/chgpasswd.c: Avoid implicit conversion of integers to
	booleans.
2008-06-09 20:56:03 +00:00
nekral-guest
0452fa2458 * src/groupdel.c: Use a bool when possible instead of int
integers.
	* src/groupdel.c: Avoid implicit conversion of pointers / integers to
	booleans.
	* src/groupdel.c: Avoid assignments in comparisons.
	* src/groupdel.c: Ignore the return value of pam_end() before
	exiting.
	* src/groupdel.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-09 20:54:04 +00:00
nekral-guest
2b92b0f305 * src/expiry.c: Ignore return value of setlocale(),
bindtextdomain(), and textdomain().
	* src/expiry.c: Add brackets and parenthesis.
	* src/expiry.c: Avoid assignments in comparisons.
	* src/expiry.c: Avoid implicit conversion of pointers to booleans.
2008-06-09 20:36:24 +00:00
nekral-guest
e43c3aed67 Add brackets and parenthesis. 2008-06-09 20:32:17 +00:00
nekral-guest
6aa98c17bd * src/pwunconv.c: Use a bool when possible instead of int
integers.
	* src/pwunconv.c: Add brackets and parenthesis.
	* src/pwunconv.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/pwunconv.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/pwunconv.c: Avoid assignments in comparisons.
2008-06-09 20:30:34 +00:00
nekral-guest
a9f1ce0db1 * src/usermod.c: Use a bool when possible instead of int integers.
* src/usermod.c: Add brackets and parenthesis.
	* src/usermod.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/usermod.c: Avoid assignments in comparisons.
	* src/usermod.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/usermod.c: Ignore the return value of pam_end() before
	exiting.
2008-06-09 20:17:48 +00:00
nekral-guest
d48973bbc8 * src/groupmems.c: Move the declaration of option_index and
long_options before the blocks of code.
	* src/groupmems.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/groupmems.c: Ignore the return value of pam_end() before
	exiting.
2008-06-09 20:09:38 +00:00
nekral-guest
3879f07fa8 * src/chfn.c: Use a bool when possible instead of int integers.
* src/chfn.c: Avoid implicit conversion of integers / chars to
	booleans.
	* src/chfn.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-09 20:05:13 +00:00
nekral-guest
3ea7f76c17 * src/logoutd.c: Use a bool when possible instead of int integers.
* src/logoutd.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/logoutd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/logoutd.c: Add brackets and parenthesis.
2008-06-09 20:02:46 +00:00
nekral-guest
827f8882bc * src/chpasswd.c: Use a bool when possible instead of int
integers.
	* src/chpasswd.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/chpasswd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-09 19:46:11 +00:00
nekral-guest
24a7015f64 * src/pwconv.c: Use a bool when possible instead of int integers.
* src/pwconv.c: Add brackets and parenthesis.
	* src/pwconv.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/pwconv.c: Avoid implicit conversion of pointers / integers /
	chars to booleans.
2008-06-09 19:43:22 +00:00
nekral-guest
2a267ca05f * NEWS, src/newusers.c: Implement the -r, --system option.
* src/newusers.c: Use a bool when possible instead of int
	integers.
	* src/newusers.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/newusers.c: Ignore the return value of pam_end() before
	exiting.
	* src/newusers.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/newusers.c: Avoid multi-statements lines.
	* src/newusers.c: Add brackets and parenthesis.
2008-06-09 19:36:08 +00:00
nekral-guest
e41460cae5 * src/gpasswd.c: Use a bool when possible instead of int integers.
* src/gpasswd.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/gpasswd.c: Ignore the return value of putchar() and fflush()
	before exiting.
	* src/gpasswd.c: check_list() renamed is_valid_user_list(), and
	return a bool.
	* src/gpasswd.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-09 19:26:19 +00:00
nekral-guest
5e2b49dad4 * src/grpck.c: Use a bool when possible instead of int integers.
* src/grpck.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-09 19:20:00 +00:00
nekral-guest
5038f6687b * src/lastlog.c: Use a bool when possible instead of int integers.
* src/lastlog.c: Avoid implicit conversion of pointers / integers
	/ chars to booleans.
	* src/lastlog.c: Add brackets and parenthesis.
	* src/lastlog.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
2008-06-09 19:15:27 +00:00
nekral-guest
8b98a2e829 * src/userdel.c: Use a bool for the is_shadow_pwd, is_shadow_grp,
deleted_user_group, was_member, was_admin, and the
	options' flags.
	* src/userdel.c: Change path_prefix() prototype to return a bool.
	* src/userdel.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/userdel.c: Ignore the return value from pam_end() since we
	are exiting anyway just afterwards.
	* src/userdel.c: Avoid implicit conversion of pointers /
	integers / chars to booleans.
	* src/userdel.c: Add brackets and parenthesis.
	* src/userdel.c: Avoid assignments in comparisons.
	* src/userdel.c: Do not ignore the return value of the *_unlock()
	functions.
2008-06-09 19:10:44 +00:00
nekral-guest
46466a8fcc * src/login_nopam.c: Do not use the YES and NO macros. Use the
booleans true and false instead. Change the prototypes of
	list_match(), user_match(), from_match(), and string_match()
	accordingly. Also use booleans internally.
	* src/login_nopam.c: Add brackets and parenthesis.
	* src/login_nopam.c: Avoid implicit conversion of pointers /
	integers / chars to booleans.
	* src/login_nopam.c: Avoid assignments in comparisons.
2008-06-09 18:35:32 +00:00
nekral-guest
4e0d734598 * src/newgrp.c: Use a bool for is_newgrp, notfound, needspasswd,
initflag, and cflag.
	* src/newgrp.c: Add brackets and parenthesis.
	* src/newgrp.c: Avoid implicit conversion of pointers / integers /
	chars to booleans.
	* src/newgrp.c: Avoid multi-statements lines.
	* src/newgrp.c: Ignore return value of setlocale(),
	bindtextdomain(), and textdomain().
	* src/newgrp.c: Avoid assignments in comparisons.
2008-06-09 18:23:23 +00:00
nekral-guest
623d9e2ab3 * libmisc/chkname.h, libmisc/chkname.c: check_group_name (resp.
check_user_name) renamed to is_valid_user_name (resp.
	is_valid_group_name). is_valid_user_name and is_valid_group_name
	return a bool.
	* src/grpck.c, src/newusers.c, src/usermod.c, src/useradd.c,
	src/groupmod.c, src/pwck.c, src/groupadd.c: Use is_valid_user_name
	and is_valid_group_name, following above change.
	* libmisc/chkname.c: Avoid implicit conversion of chars to
	booleans. Add brackets and parenthesis.
2008-05-25 20:58:16 +00:00
nekral-guest
6124b59aff * libmisc/copydir.c (remove_tree): As we always use remove_tree
followed by rmdir to remove the directory itself, delete also the
	root directory in remove_tree.
	* src/userdel.c, src/usermod.c: Do not call rmdir after
	remove_tree.
2008-05-24 15:35:15 +00:00
nekral-guest
d99423405c Fix compiler warnings:
* libmisc/audit_help.c: Include prototypes.h to get the prototype
	of audit_help_open.
	* libmisc/salt.c: Use booleans instead of negating integers.
	* src/passwd.c: Declare the check_selinux_access prototype and
	avoid name clashes (change_user -> changed_user; change_uid ->
	changed_uid; access -> requested_access)
2008-05-24 13:08:58 +00:00
nekral-guest
537496c019 Fix formatting. 2008-05-19 20:31:48 +00:00
nekral-guest
243809af3a Fix typo. 2008-05-18 16:38:13 +00:00
nekral-guest
fb4271bdf9 Import Debian patch 434_login_stop_checking_args_after--
* NEWS, src/login.c (check_flags): Stop checking the arguments
	after --. The later options will be sent to the shell, and do not
	need to be checked.
2008-05-18 14:54:35 +00:00
nekral-guest
6a17c2b27f * src/vipw.c, src/su.c, src/newgrp.c: Harmonize the children's
SIGSTOP handling. Raise the signal which stopped the child instead
	of always SIGSTOP.

	Import Debian patch 406_vipw_resume_properly.
	Thanks to Dean Gaudet.
	* NEWS, src/vipw.c: Resume properly after ^Z.
2008-05-18 13:41:56 +00:00
nekral-guest
c7302b61ef Make sure every source files are distributed with a copyright and license.
Files with no license use the default 3-clauses BSD license. The copyright
were mostly not recorded; they were updated according to the Changelog.
"Julianne Frances Haugh and contributors" changed to "copyright holders
and contributors".
2008-04-27 00:40:09 +00:00
nekral-guest
4196525702 Allow non-US-ASCII characters in the GECOS fields ("name", "room number",
and "other info" fields).
2008-04-27 00:24:49 +00:00
nekral-guest
4d7d6a1a9f Fix build failure when configured with audit support. Thanks to Mike
Frysinger for reporting it.
2008-04-16 22:04:46 +00:00
nekral-guest
7baffa5e74 Ensure that getpwent() is used in setpwent(), getpwent(),
endpwend() sequences (ditto for getgrent(), getspent(), and
getsgent()). The only real (minor) issue was in login, which kept
the passwd file open.
* libmisc/entry.c: Remove unneeded setspent() and endspent() (only
  getspnam is called in the middle).
* libmisc/find_new_ids.c: Make sure to close the password and
  group files with endpwent() and endgrent().
* libmisc/pwdcheck.c: Remove unneeded endspent() (only getspnam()
  is called before).
* src/lastlog.c, src/passwd.c, src/groupmod.c, src/faillog.c,
  src/groups.c: Make sure to close
  the password file with endpwent().
* src/login.c: Remove unneeded setpwent() (only xgetpwnam is
  called before).
* src/login.c, src/newgrp.c: Fix typos in comments.
2008-04-16 21:52:46 +00:00
nekral-guest
f7a256fc19 * src/passwd.c, NEWS: Make SE Linux tests more strict, when the
real UID is 0 SE Linux checks will be performed. Thanks to
 Russell Coker  <russell@coker.com.au>
* TODO: Added entries regarding SE Linux.
2008-03-26 22:00:50 +00:00
nekral-guest
32b424e507 Fix minor compilation warning (assignment used as a comparison). 2008-03-17 23:05:59 +00:00
nekral-guest
d94602add8 login_access() is used in src/login.c, and defined in src/login_nopam.c
(which lacks a prototype). Move its prototype from src/login.c to
lib/prototypes.h.
2008-03-17 23:04:46 +00:00
nekral-guest
e33e2b7d79 Compilation fix. gshadow_locked should only be used if SHADOWGRP is defined. 2008-03-17 23:02:23 +00:00
nekral-guest
78c59b7261 Fix some warnings. compare_members_lists() is only used if SHADOWGRP is defined. 2008-03-17 23:00:49 +00:00
nekral-guest
8377303981 Remove unused global variable. 2008-03-08 23:52:50 +00:00
nekral-guest
a8a614c515 * NEWS, src/groupmod.c: Make sure the passwd, group, and gshadow
files are unlocked on exit. Unlock locked files in fail_exit().
  Prefer fail_exit() over exit().
* NEWS, src/groupmod.c: When the GID of a group is changed, update
  also the GID of the passwd entries of the users whose primary
  group is the group being modified.
2008-03-08 23:01:49 +00:00
nekral-guest
1b808e62df Make sure the passwd, group, shadow, and gshadow files are unlocked on
exit. Unlock locked files in fail_exit(). Prefer fail_exit() over exit().
2008-03-08 22:44:53 +00:00
nekral-guest
5af8a5d74d * NEWS, src/groupdel.c: Make sure the group, and gshadow files are
unlocked on exit. Add function fail_exit(). Use fail_exit()
	instead of exit().
	* src/groupdel.c: Fail immediately instead of increasing errors.
	Better handling of error cases, like locked group or gshadow file.
2008-03-08 21:13:54 +00:00
nekral-guest
d1290c0d5d Make sure the passwd, group, shadow, and gshadow files are unlocked on
exit. Add function fail_exit(). Use fail_exit() instead of exit().
2008-03-08 21:04:31 +00:00
nekral-guest
bded00fd11 Make sure the group and gshadow files are unlocked on exit. Add function fail_exit(). 2008-03-08 20:54:54 +00:00
nekral-guest
a2242f6f1b Do not rewrite the group and gshadow file in case of error. 2008-03-08 16:23:22 +00:00
nekral-guest
9e07fec6ba Do not log that the group was deleted if an error occurred. 2008-03-08 16:20:55 +00:00
nekral-guest
d44f1dfeca Do not raise an error if the group does not exist in the gshadow file. 2008-03-08 16:17:07 +00:00
nekral-guest
1b2618d688 * src/newgrp.c: Add missing end of line in message.
* src/newgrp.c: Add audit events for the authentication
  (AUDIT_GRP_AUTH). Thansk to Peter Vrabec.
2008-03-07 20:21:15 +00:00
nekral-guest
6ea65c8992 Only reset the entries of existing users with faillog -r (not all numeric
IDs starting from 0). Thanks to Peter Vrabec.
2008-03-05 00:10:25 +00:00
nekral-guest
52cfc3372b Fix typo. One "can't open" message is a "can't lock". 2008-03-04 23:53:00 +00:00
nekral-guest
528346cb3b When a password is moved to the gshadow file, use "x" instead of "x"
to indicate that the password is shadowed (consistency with grpconv).
2008-02-26 20:09:56 +00:00
nekral-guest
f43a4659c6 Re-indent. 2008-02-26 19:17:20 +00:00
nekral-guest
2a2b2b3aa4 * NEWS: Fix failures when the gshadow file is not present. Thanks
to Christian Henz (http://bugs.debian.org/467488)
 * src/gpasswd.c (get_group): Do not fail if gshadow is not present. Just use
   the group file and set the grent structure
 * src/gpasswd.c (check_perms): The permissions should be checked
   using both the gshadow and group file. Add a <struct group *>
   parameter, and check if the gshadow file exists (is_shadowgrp).
 * src/gpasswd.c (main): Do not use sgent.sg_mem or sgent.sg_adm if
   the gshadow file is not present (sgent is not initialized in that
   case). The fields of sgent can be set, but not used.
2008-02-26 19:09:10 +00:00
nekral-guest
db479122f3 * Fix typo in comment.
* Move comment regarding FIRST_MEMBER_IS_ADMIN to
   where it belongs.
 * Indicate the end of the #ifdef FIRST_MEMBER_IS_ADMIN
   section.
2008-02-26 18:59:28 +00:00
nekral-guest
93e2f66a60 * NEWS, src/useradd.c, man/useradd.8.xml: Added options
-user-group (-U, Uflg) and --no-user-group (-N, Nflg) to replace
  nflg.
* man/login.defs.d/USERGROUPS_ENAB.xml: useradd now also uses
  USERGROUPS_ENAB.
2008-02-25 21:03:46 +00:00
nekral-guest
2a5c015cd1 Add missing 'p' to the getopt_long's optstring. 2008-02-19 21:26:04 +00:00
nekral-guest
dc641054a1 Add missing -p, --password description to the Usage message. 2008-02-19 21:21:52 +00:00
nekral-guest
23ac189d48 Add missing space in comment. 2008-02-19 21:18:04 +00:00
nekral-guest
29e71bf1b3 Fix --non-unique's has_arg field to no_argument instead of required_argument. 2008-02-19 21:16:28 +00:00