2008-02-25 Nicolas François * lib/getdef.c: Added missing SYS_GID_MAX, SYS_GID_MIN, SYS_UID_MAX, and SYS_UID_MIN. 2008-02-25 Nicolas François * 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-19 Nicolas François * src/groupmod.c: Add missing 'p' to the getopt_long's optstring. 2008-02-19 Nicolas François * src/groupadd.c: Add missing 'p' to the getopt_long's optstring. * src/groupadd.c: Fix --non-unique's has_arg field to no_argument instead of required_argument. * src/groupadd.c: Add missing -p, --password description to the Usage message. 2008-02-19 Nicolas François * NEWS, etc/login.defs: Set GID_MIN to the same value as UID_MIN by default (1000). * NEWS, etc/login.defs: Added variables SYS_UID_MIN (100), SYS_UID_MAX (999), SYS_GID_MIN (100), SYS_GID_MAX (999) for system accounts. * libmisc/find_new_ids.c: Added support for system accounts in find_new_uid() and find_new_gid(). * NEWS, src/newusers.c, src/useradd.c, src/groupadd.c: Added new option -r, --system for system accounts in useradd, groupadd, and newusers. 2008-02-18 Nicolas François * NEWS, src/groupmems.c: Fix buffer overflow when adding an user to a group. Thanks to Peter Vrabec. 2008-02-14 Nicolas François * NEWS, etc/useradd: Change the default HOME directory in /etc/default/useradd according FHS (/home instead of /home/users). This fixes Alioth's bug #310559. Thanks to Dale E. Edmons. 2008-02-14 Nicolas François * NEWS, src/newgrp.c: Use the correct AUDIT_CHGRP_ID event instead of AUDIT_USER_START, when changing the user space group ID with newgrp or sg. Thanks to sgrubb@redhat.com for the patch. 2008-02-10 Nicolas François * src/usermod.c: Reset oflg with uflg if the new UID is equal to the old one. * src/usermod.c: Reset mflg with dflg if the new home directory is the same as the old one. 2008-02-10 Nicolas François * NEWS, src/usermod.c: Fix the handling of -a when a user is being renamed (with -l). The new name of the user was used for the new supplementary groups, but not in the existing ones. 2008-02-10 Nicolas François * src/newusers.c: Set the shadow's password instead of the passwd's password. Fix wrong cut&paste. 2008-02-03 Nicolas François * src/usermod.c: Use a function to convert the dates from /etc/shadow to human readable dates. * src/usermod.c: Really log the expiration date change as human readable strings instead of integers. * src/usermod.c: No need to check audit_fd, audit_logger() will take care of this. 2008-02-03 Nicolas François * src/login.c: Do not translate the fromhost variable. It is always used for syslog messages. 2008-02-03 Nicolas François * NEWS, lib/defines.h: Switch to the C locale before sending messages to syslog. The messages sent by shadow were not translated, but error messages from PAM returned by pam_strerror() were translated in the users's locale. 2008-02-03 Nicolas François * NEWS: newusers will behave more like useradd. * src/newusers.c: The user's ID must be found before the group ID to mimic useradd's behavior choices of UID and GID. * src/newusers.c: Reuse the generic find_new_uid() and find_new_gid() functions. This permits to respect the UID_MIN/UID_MAX and GID_MIN/GID_MAX variables, should * src/newusers.c: Check if the user or group exist using the external databases (with the libc getpwnam/getgrnam functions). Refuse to update an user which exist in an external database but does not exist in the local database. * src/newusers.c: Check the usernames and groupnames with check_user_name() and check_group_name() * src/newusers.c: Use isdigit() for readability. * src/newusers.c: Check if numerical IDs are valid (no remaining chars). 2008-02-03 Nicolas François * NEWS, src/newusers.c: Fix the support for the NONE crypt method. 2008-02-03 Nicolas François * src/newusers.c: Fix shadow group support (the list of admins was not defined; it is now set to an empty list). 2008-02-03 Nicolas François * NEWS, libmisc/salt.c: Do not seed the random number generator each time, and use the time in microseconds to avoid having the same salt for different passwords generated in the same second. This permits to avoid using the same salt for different passwords in newusers. 2008-02-03 Nicolas François * lib/pwio.c, lib/pwio.h: New function to find an user by its UID on the local database. * lib/groupio.c, lib/groupio.h: New function to find a group by its GID on the local database. * libmisc/find_new_ids.c, lib/prototypes.h: Add new generic functions to find the next user or group ID available: find_new_uid() and find_new_gid(). They work the same way as the functions with the same name of useradd or groupadd, except that they check in the local database to make sure an ID was not reserved in an uncommitted change (this is needed to be used in newusers), they report a status instead of calling exit(), and they can receive a preferred ID. They should later support system IDs. This should be a little bit slower, but not too much (if the database is not open the checks against the local database will exit immediately, and if it is already open, all the checks will be done regarding the data in memory). * po/POTFILES.in: The new libmisc/find_new_ids.c file contains translatable strings. * libmisc/Makefile.am: Add libmisc/find_new_ids.c to the sources of the libmisc library. * src/useradd.c, src/groupadd.c: Use the find_new_uid() and find_new_gid() from the library instead of the local functions. 2008-02-02 Nicolas François * po/*.po: Updated PO files. * libmisc/age.c, libmisc/yesno.c, src/lastlog.c, src/grpck.c, src/chfn.c, src/passwd.c, src/chage.c, src/login.c, src/sulogin.c, src/chsh.c: Fix call to puts (remove end of line, or use fputs). * po/*.po: Unfuzzy PO files according to above change. 2008-01-26 Nicolas François Fix build failures with --disable-shadowgrp. Thanks to Jürgen Daubert for the patch. * libmisc/salt.c: Include , needed for stderr and printf functions. * lib/encrypt.c: Include , needed for perror, stderr and printf functions * src/usermod.c: sgr_locked exists only if SHADOWGRP is defined. * src/chgpasswd.c: Only check is the gshadow file exists if SHADOWGRP is defined. 2008-01-24 Nicolas François * src/gpasswd.c, src/chfn.c, src/chage.c, src/chsh.c, src/grpck.c, src/vipw.c, src/pwck.c, src/sulogin.c, src/newgrp.c, src/userdel.c, src/lastlog.c, src/groupmems.c, src/usermod.c, src/expiry.c, src/groupdel.c, src/useradd.c, src/su.c, src/groupmod.c, src/passwd.c, src/groupadd.c, src/login.c, src/suauth.c, src/faillog.c, src/id.c, libmisc/limits.c, libmisc/addgrps.c, libmisc/env.c, libmisc/age.c, libmisc/yesno.c, lib/getdef.c: Replace printf by puts for fixed strings. This would avoid issues caused by formats introduced in translated strings. 2008-01-23 Nicolas François * src/useradd.c: Strings improvement s/can't get unique/no more available/. 2008-01-23 Nicolas François * NEWS, src/usermod.c: Check that the new fields set with -u, -s, -l, -g, -f, -e, -d, and -c differ from the old ones. If a requested new value is equal to the old one, no changes will be performed for that field. If no fields are changed, usermod will exist successfully with a warning. This avoids logging changes to syslog when there are actually no changes. 2008-01-23 Nicolas François * src/usermod.c: Always define user_newcomment, user_newshell, user_newexpire, and user_newinactive. It is more simple to always have user_ as the old field, and user_new as the new field (even if the field did not change) instead of changing the algorithm depending on WITH_AUDIT. 2008-01-23 Nicolas François * src/usermod.c: user_newname can only be used in WITH_AUDIT code or when lflg is set. This issue was introduced in the code refactoring of usermod. 2008-01-22 Nicolas François * src/groupadd.c: Fix typo in comment: s/find_new_uid/find_new_gid/ 2008-01-22 Nicolas François * src/useradd.c: s/gid/GID/ in message string. * src/useradd.c: Set this string for translation. 2008-01-22 Nicolas François * man/grpck.8.xml: Fix typo. Remove "the" from "All entries in the are checked [...]" * man/grpck.8.xml: Conditionally include the parts mentioning the gshadow file (based on SHADOWGRP). * man/grpck.8.xml: Add reference to the gshadow(5) manpage (conditionally included). 2008-01-22 Nicolas François * man/grpck.8.xml, man/pwck.8.xml: Indicate that the shadow parameter is optional (i.e. a passwd file can be specified without a shadow file, and the group file can be specified without the gshadow file). 2008-01-22 Nicolas François * man/grpck.8.xml: Document the options with a list of options, as in the pwck(8) manpage. 2008-01-22 Nicolas François * NEWS, src/newgrp.c: Fix segfault when an user returns to an unknown GID (either the user was deleted during the user's newgrp session or the user's passwd entry referenced an invalid group). Add a syslog warning in that case. * src/newgrp.c: Add an end of line when reporting an invalid password. 2008-01-12 Nicolas François * NEWS, src/useradd.c: Fix the handling of the --defaults option (it required an argument, but should behave as -D) * NEWS, man/useradd.8.xml: Document the --defaults option, which was already described in the useradd's Usage information. 2008-01-06 Nicolas François * src/passwd.c: Avoid setting the password to a const empty string, but set the first char to \0. This avoids a warning. 2008-01-06 Nicolas François * libmisc/salt.c: Add prototype for l64a(), gensalt(), SHA_salt_size(), and SHA_salt_rounds(). * libmisc/salt.c: l64a() and gensalt() are static. * libmisc/salt.c: The `meth' parameter of crypt_make_salt() is a const. (ditto for the method variable). * libmisc/salt.c: SHA_salt_rounds returns a const string. * libmisc/salt.c: Avoid warnings with cast of random() to double. * libmisc/salt.c: Replace rand() by random(). 2008-01-06 Nicolas François * lib/Makefile.am: Do not link libshadow.la with the intl, crypt, skey and md libraries... * src/Makefile.am: ...Specify for each binary which library is required. skey and md are required for the binaries with authentication of the user (chfn, chsh, login, passwd, su). intl is required for all. mcrypt is required for user (chfn, chsh, login, passwd, su, sulogin) and group (newgrp, gpasswd) authentication and for the creation of passwords (chpasswd, chgpasswd, gpasswd, newusers, passwd). 2008-01-06 Nicolas François * lib/nscd.c, lib/nscd.h: Set the service parameter of nscd_flush_cache() to const. This avoids a lot of warnings. * lib/nscd.c: Include "nscd.h" to avoid inconsistent prototypes. 2008-01-06 Nicolas François * lib/encrypt.c: Set the method string as a constant string. 2008-01-06 Nicolas François * lib/port.c: Assume declares errno. 2008-01-06 Nicolas François * man/po/fr.po: Fix typo: s/rend compte indiqué/rend le compte indiqué/ 2008-01-06 Nicolas François * src/suauth.c: Remove prototype of check_su_auth(). It is redundant with prototypes.h. * src/suauth.c: isgrp() is static. 2008-01-06 Nicolas François * libmisc/obscure.c: Tag the `old' parameter of palindrome(), similar(), and simple() as unused. * libmisc/loginprompt.c: Tag the `sig' parameter of login_exit() as unused. * src/expiry.c: Tag the `sig' parameter of catch_signals() as unused. * src/su.c: Tag the `sig' parameter of catch_signals() as unused. * src/su.c: Add int parameter to the prototype of oldsig(). * src/login.c: Tag the `sig' parameter of alarm_handler() as unused. * src/sulogin.c: Tag the `sig' parameter of catch_signals() as unused. * libmisc/getdate.y: Tag the `string' parameter of yyerror() as unused. * libmisc/getdate.y: The string provided to yyerror() is const. * libmisc/getdate.y: Fix the prototypes of yylex() and yyerror(). 2008-01-06 Nicolas François * lib/defines.h: Remove teh macro definition of SETXXENT_TYPE, SETXXENT_RET, and SETXXENT_TEST. They were used by the now removed pwent.c and grent.c. * lib/defines.h: Remove the definition of PASSWD_PAG_FILE, GROUP_PAG_FILE, SHADOW_PAG_FILE, and SGROUP_PAG_FILE. They are never used. * lib/defines.h: Don't include "snprintf.h". The file does not exist in shadow. * lib/defines.h: Add new macro unused to tag unused parameters. 2008-01-06 Nicolas François * src/useradd.c, src/groupmems.c: Assume optarg and optind are declared in . 2008-01-06 Nicolas François * src/usermod.c: Remove the pw_name argument of new_pw_passwd. Use the user_newname global variable instead. This avoid using a parameter with the same name as a function. 2008-01-06 Nicolas François * src/newgrp.c: Removed unused gid parameter of syslog_sg(). * src/newgrp.c: The loginname and tty buffers are never changed. Add the const qualifier. 2008-01-06 Nicolas François * src/chpasswd.c, src/chgpasswd.c: The crypt_method string always points to a constant string. Add the const qualifier. 2008-01-06 Nicolas François * src/pwunconv.c: Remove prototype of l64a() (not used in pwunconv). 2008-01-06 Nicolas François * src/login_nopam.c: Use an ANSI prototype for resolve_hostname() instead of K&R prototype. * src/login_nopam.c: Fix the prototypes of list_match(), user_match(), from_match(), string_match(). There were no parameters in the prototypes. * src/login_nopam.c: Fix the prototypes of the function parameter match_fn of list_match(). 2008-01-06 Nicolas François * libmisc/copydir.c: Remove the src parameter of copy_special(). The entry's information are taken from the stat structure. 2008-01-06 Nicolas François * libmisc/console.c, libmisc/ulimit.c, lib/sgetgrent.c, lib/sgetpwent.c: Include "prototypes.h" to make sure the exported prototypes are the ones used for the definition of functions. * lib/prototypes.h: Added prototypes for __gr_del_entry(), __gr_get_db(), __gr_get_head(), __gr_set_changed(), __gr_dup(), __pw_del_entry(), __pw_get_db(), __pw_get_head(), __pw_dup(), sgetgrent(), sgetpwent(), __sgr_del_entry(), __sgr_dup(), __sgr_get_head(), __sgr_set_changed(), __spw_get_head(), __spw_del_entry(), __spw_dup(). * lib/prototypes.h: Removed prototype for is_listed(). * lib/prototypes.h: Added name of the check_su_auth()'s parameters. * lib/groupio.h: Removed prototypes for __gr_dup() and __gr_set_changed(). * lib/sgroupio.c: Removed prototypes for putsgent(), sgetsgent(), and __gr_get_db(). * lib/sgroupio.h: Removed prototypes for __sgr_dup() and __sgr_set_changed(). * lib/shadowio.c: Removed prototype for __pw_get_db(). * lib/pwio.c: Removed prototype for sgetpwent() and putpwent(). * lib/shadowio.h: Removed prototypes for __spw_dup() and __spw_set_changed(). * lib/pwio.h: Removed prototypes for __pw_dup() and __pw_set_changed(). * lib/commonio.h: Add protection against multiple inclusions. * lib/prototypes.h: Include commonio.h (needed for the __xx_del_entry() functions). * src/grpck.c: Remove prototypes for __gr_del_entry(), __gr_get_head(), __sgr_del_entry(), and __sgr_get_head(). * src/pwck.c: Remove prototypes for __pw_del_entry(), __pw_get_head(), __spw_del_entry(), and __spw_get_head(). * lib/groupio.c: Remove prototype for sgetgrent(). * lib/groupio.c: Add the name of the parameters for merge_group_entries() and split_groups(). * lib/groupio.h: Remove prototypes for __gr_dup() and __gr_set_changed(). 2008-01-05 Nicolas François * man/groupadd.8.xml, man/groupmod.8.xml: Add documentation for the new --password options. 2008-01-05 Nicolas François * src/useradd.c: Fix find_new_gid() prototype. Add a void parameter. 2008-01-05 Nicolas François * lib/prototypes.h: Add the dolastlog() prototype. * lib/prototypes.h: Typo: login.c -> loginprompt.c * src/login.c: Remove declaration of dolastlog(). * lib/prototypes.h: Include for the declaration of struct lastlog. * lib/prototypes.h: Remove old comments in the header. 2008-01-05 Nicolas François * libmisc/pwdcheck.c: Do not include . Include and "pwauth.h" only when compiled without PAM support. * src/chfn.c, src/chsh.c: Do not include * lib/commonio.c: Do not include . Do not include . Include "nscd.h" instead of . 2008-01-05 Nicolas François * configure.in: Do not check if shadow.h exist, but make sure it exists. * libmisc/pwdcheck.c, src/chfn.c, src/chsh.c, lib/defines.h, lib/shadowmem.c, lib/shadowio.c, lib/commonio.c: HAVE_SHADOW_H is no more needed (shadow.h should always exist). 2008-01-05 Nicolas François * lib/groupio.c: Remove prototype of putgrent(), add parameter's name of sgetgrent(). * lib/prototypes.h: Fix the do_pam_passwd() prototype (it returns void). 2008-01-05 Nicolas François * NEWS, src/groupmod.c, src/groupadd.c: Add option --password to groupadd and groupmod (similar to useradd and usermod). 2008-01-05 Nicolas François * lib/prototypes.h: grent.c does not exist anymore. Remove the putgrent prototype. * lib/prototypes.h: "shadowio.h" was included for the definition of the spwd structure. Replace this include by * libmisc/xmalloc.c, libmisc/utmp.c, libmisc/strtoday.c, libmisc/pwd_init.c, libmisc/tz.c, lib/port.c, lib/fputsx.c, libmisc/pam_pass.c, libmisc/log.c: Include "prototypes.h" to make sure the exported prototypes are the ones used for the definition of functions. * libmisc/console.c: Define is_listed() as static and add its prototype. * libmisc/xgetXXbyYY.c, libmisc/yesno.c: Include config.h as a system include, as recommended by the autoconf documentation. * src/chage.c: Define isnum() as static and add its prototype. * libmisc/xgetspnam.c: Add missing include "shadowio.h". (This was OK as long as prototypes.h included this file.) * src/nologin.c: Make a proper prototype for the main() function declaration. (add void) * src/login.c: login_prompt is the name of a function, use loginprompt for the internal variable. * src/chsh.c: loginsh is a global variable, use newshell for the update_shell()'s parameter. * lib/gshadow.c: The prototypes of fgetsx() and fputsx() are already defined in prototypes.h. Remove the declaration of these functions. * lib/gshdow.c: list() is an external function. DO not shadow it with a static function. The internal list() was renamed build_list(). * lib/commonio.c: stat shadows another stat variable. Remove this variable, and directly check the result of getfscreatecon(). * libmisc/utmp.c: Remove the declaration of getutent(), getutline(), setutent(), and endutent() which are declared in 2008-01-01 Nicolas François * src/newgrp.c: Remove duplicate logging to syslog. 2008-01-01 Nicolas François * src/newgrp.c: Avoid assignments in conditionals. * src/newgrp.c: Split check_perms(), syslog_sg() out of main(). 2008-01-01 Nicolas François * lib/shadow.c: Avoid assignments in conditionals. 2008-01-01 Nicolas François * lib/groupio.c (split_groups): Test the pointer returned by malloc. 2008-01-01 Nicolas François * lib/commonio.c: Document add_one_entry_nis(), write_all(), commonio_remove(), commonio_locate(), and commonio_rewind(). 2008-01-01 Nicolas François * src/pwck.c: Avoid implicit brackets. * src/pwck.c: Avoid implicit conversions to booleans. 2008-01-01 Nicolas François * src/grpck.c: Avoid implicit brackets. * src/grpck.c: Avoid implicit conversions to booleans. 2008-01-01 Nicolas François * NEWS: No functional changes were introduced by the previous pwck and grpck changes, except for the following bug fix: no syslog logging if a passwd or group file was specified on the command line without a shadowed database file, even if the system shadowed database was changed). 2008-01-01 Nicolas François * src/pwck.c: Fix typos in comments (gshadow/shadow). 2008-01-01 Nicolas François * src/pwck.c: Split process_flags(), open_files(), close_files() check_pw_file(), and check_spw_file() out of main(). New global variables is_shadow, sort_mode, use_system_pw_file, and use_system_spw_file. 2008-01-01 Nicolas François * libmisc/xgetXXbyYY.c: De-comment code (duplicate the entry when the _R function is not present on the system). 2008-01-01 Nicolas François * src/lastlog.c: Remove statbuf, not used. * src/lastlog.c: Fix types, cast umin and umax to uid_t. * src/lastlog.c: (option -u) user needs to be a signed long, not uid_t (to accept rangees like - 2008-01-01 Nicolas François * src/useradd.c: Avoid ?: construct without the middle term. 2008-01-01 Nicolas François * libmisc/copydir.c, src/usermod.c, lib/prototypes.h: The uid and gid parameters can be set to -1 to indicate that the original owners must be kept. Change the types from uid_t/gid_t to a long int (signed). * libmisc/copydir.c: Change the copy_entry(), copy_dir(), copy_symlink(), copy_special(), and copy_file() prototypes accordingly. * lib/prototypes.h: Add the parameters' name for the libmisc/copydir.c functions. 2008-01-01 Nicolas François * libmisc/limits.c, libmisc/obscure.c, src/login_nopam.c, lib/pwauth.c: Avoid empty file when USE_PAM is set. * libmisc/audit_help.c: Avoid empty file when WITH_AUDIT is not set. * src/login_nopam.c: Fix warnings: resolve_hostname takes and returns a constant string. 2008-01-01 Nicolas François * src/grpck.c: Split process_flags(), open_files(), and close_files() out of main(). New global variables is_shadow, sort_mode, use_system_grp_file, and use_system_sgr_file. * src/grpck.c: Split check_grp_file() and check_sgr_file() out of main(). * src/grpck.c: Split check_members() and compare_members_lists() out of check_grp_file() and check_sgr_file(). 2007-12-31 Nicolas François * man/po/Makefile.in.in: If remove-potcdate.sin does not exist, use the one from teh po directory (it is not installed automatically by autopoint. 2007-12-31 Nicolas François * lib/commonio.h: Fix the type of the bitfields in the commonio_entry and commonio_db structures to unsigned int (instead of int). 2007-12-31 Nicolas François * src/chsh.c: Split process_flags(), check_perms(), and update_shell() out of main(). * src/chsh.c: Before pam_end(), the return value of the previous pam API was already checked. No need to validate it again. * src/chsh.c: Avoid implicit brackets. * src/chsh.c: Avoid assignments in comparisons. 2007-12-31 Nicolas François * src/chfn.c: New function: process_flags() split out of main(). The flags variables are now global. * src/chfn.c: New functions: check_perms(), update_gecos(), get_old_fields(), and check_fields() split out of main(). * src/chfn.c: Before pam_end(), the return value of the previous pam API was already checked. No need to validate it again. * src/chfn.c: Avoid implicit brackets. * src/chfn.c: Document may_change_field(). * src/chfn.c: Avoid implicit conversions to booleans. * src/chfn.c: Avoid assignments in comparisons. 2007-12-31 Nicolas François * src/newusers.c: Compilation fix for PAM support (pamh needs to be global since the function split). * src/chpasswd.c: Likewise. * src/chgpasswd.c: Likewise. * src/chpasswd.c: Avoid implicit conversions to booleans. 2007-12-31 Nicolas François * src/chage.c: Fix typo: s/maximim/maximum/ * src/chage.c: New function: fail_exit(). Change most of the exit() to a fail_exit, which makes sure the files are unlocked (new global variables: pw_locked, spw_locked), the PAM transaction is ended, and the failure is logged to libaudit (use a global user_name and user_uid for logging). * src/chage.c: Compilation fix for PAM support (pamh needs to be global since the function split). * src/chage.c: Document process_flags(), check_flags(), check_perms(), open_files(), and close_files(). * src/chage.c: Split update_age() and get_defaults() out of main() * src/chage.c: Drop the privileges just after opening the files. * src/chage.c: Do not log to audit only if the user has an entry in the shadow file. * NEWS, src/chage.c (open_files): Also open the password file for writing. This fix chage when the user only has a password entry (and no shadow entries). * src/chage.c (get_defaults): Use default values that don't change the behavior of the account for the fields that are not specified when the user has no shadow entry. 2007-12-30 Nicolas François * src/groupadd.c: Compilation fix for PAM support (pamh needs to be global since the function split). * src/groupadd.c: End the PAM transaction in fail_exit(). * src/groupadd.c: Document check_flags(). 2007-12-30 Nicolas François * src/vipw.c: Compilation fix for non-gshadow support. 2007-12-29 Nicolas François * NEWS, src/newusers.c: Added support for gshadow. 2007-12-29 Nicolas François * NEWS, src/newusers.c: Do not add the new user to the group's members, because the group is already the primary group of the new user. 2007-12-29 Nicolas François newusers cleanups * src/newusers.c: main() split in new functions: process_flags(), check_flags(), check_perms(), open_files(), and close_files(). * src/newusers.c: Before pam_end(), the return value of the previous pam API was already checked. No need to validate it again. * src/newusers.c: Avoid implicit brackets. * src/newusers.c: Avoid assignments in comparisons. * src/newusers.c: Avoid variables with the name of a type. 2007-12-29 Nicolas François chage cleanups * src/chage.c: Before pam_end(), the return value of the previous pam API was already checked. No need to validate it again. * src/chage.c: main() split in new functions: process_flags(), check_flags(), check_perms(), open_files(), and close_files(). * src/chage.c: Avoid using a variable with the same name as a type. * src/chage.c: Remove dead code. It was probably put here to add more information to the audit_logger. * src/chage.c: Avoid implicit brackets. * src/chage.c: Avoid implicit conversion to booleans. * src/chage.c: Avoid assignments in comparisons. 2007-12-28 Nicolas François Same changes for chgpasswd: * src/chgpasswd.c: Before pam_end(), the return value of the previous pam API was already checked. No need to validate it again. * src/chgpasswd.c: main() split in process_flags(), check_flags(), check_perms(), open_files(), and close_files(). * src/chgpasswd.c: Avoid assignments in comparisons. * src/chgpasswd.c: Avoid implicit brackets. * src/chgpasswd.c: Fix comments to match chgpasswd (group instead of user's passwords are changed). 2007-12-28 Nicolas François * src/chpasswd.c: Before pam_end(), the return value of the previous pam API was already checked. No need to validate it again. * src/chpasswd.c: New functions: process_flags(), check_flags(), check_perms(). Split out of main(). * src/chpasswd.c: Other new functions: open_files(), close_files(). This force flushing the password database after the password file is unlocked. * src/chpasswd.c: Avoid assignments in comparisons. * src/chpasswd.c: Avoid implicit brackets. 2007-12-28 Nicolas François * src/groupadd.c (find_new_gid): A group with the specified name cannot exist at that time. Remove the check. * src/groupadd.c (find_new_gid): If oflg is set, gflg is also set. Use (!gflg), which is clearer than (!gflg || !oflg). * src/groupadd.c (find_new_gid): find_new_gid is never called when an GID is specified with -g. Simplify find_new_gid accordingly. * src/groupadd.c (process_flags): prefer fail_exit to exit. This avoid an explicit call to audit_logger(). * src/groupadd.c (main): Before pam_end(), the return value of the previous pam API was already checked. No need to validate it again. * src/groupadd.c (main, check_perms): New function check_perms(). Split the validation of the user's permissions out of main() 2007-12-28 Nicolas François src/groupadd.c cleanup * src/groupadd.c (fail_exit): When compiled without AUDIT support, if the return code was E_SUCCESS, fail_exit() wouldn't have exited. Fix the scope of #idef WITH_AUDIT. * src/groupadd.c: Avoid implicit brackets. * src/groupadd.c: Split the processing and checking of options out of main() (process_flags). * src/groupadd.c: New function check_flags(). Split the validation of options and arguments out of process_flags. * src/groupadd.c: Add the parameters' names in the prototypes. 2007-12-27 Nicolas François libmisc/copydir.c cleanup * libmisc/copydir.c: Split copy_tree() in more maintainable functions: copy_entry(), copy_dir(), copy_symlink(), copy_hardlink(), copy_special(), and copy_file(). * libmisc/copydir.c: -1 is used to indicate an error, directly set err to -1, instead of incrementing it, and checking if not nul at the end. * libmisc/copydir.c: Avoid assignments in comparisons. * libmisc/copydir.c: Document selinux_file_context. * libmisc/copydir.c: Avoid implicit brackets. * libmisc/copydir.c: Avoid implicit conversions to booleans. 2007-12-27 Nicolas François gpasswd cleanup * src/gpasswd.c: Add argument name to the internal function prototypes. * src/gpasswd.c: Document global variables. * src/gpasswd.c: New function: process_flags(). Split the processing of options out of main(). * src/gpasswd.c: New functions: open_files(), close_files(), update_group(). Split out from main() to simplify this (too) big function. * src/gpasswd.c: New functions: check_perms(), get_group(), change_passwd(), check_flags(). Split out of main() to simplify main(). * src/gpasswd.c: Avoid implicit brackets. * src/gpasswd.c: Avoid assignments in comparisons. * src/gpasswd.c: Avoid implicit conversions to booleans. 2007-12-27 Nicolas François Merge Debian's patch 462_warn_to_edit_shadow * NEW, src/vipw.c: Recommend editing the shadowed (resp. regular) file if the regular (resp. shadowed) file was edited. 2007-12-26 Nicolas François Merge Debian's patch 451_login_PATH * NEWS, libmisc/setupenv.c: Export PATH according to ENV_PATH and ENV_SUPATH, as for su. This impacts login. * man/login.1.xml: PATH and SUPATH are now used both when PAM support is disabled and enabled. 2007-12-26 Nicolas François Merge Debian's patch 496_login_init_session * src/login.c, src/sulogin.c: If started as init, start a new session. 2007-12-26 Nicolas François Merge Debian's patch 408_passwd_check_arguments * NEWS, src/passwd.c: Make sure that no more than one username argument was provided. 2007-12-26 Nicolas François Merge Debian's patch 412_lastlog_-u_numerical_range * NEWS, src/lastlog.c, man/lastlog.8.xml: Accept numerical user, or ranges with the -u option. 2007-12-26 Nicolas François Merge Debian's patch 466_fflush-prompt * libmisc/Makefile.am, lib/prototypes.h, libmisc/yesno.c, src/grpck.c, src/pwck.c: move yes_or_no() from grpck/pwck to a separate libmisc/yesno.c (with a read_only argument). * libmisc/fields.c, libmisc/yesno.c: Make sure stdout is flushed before reading the user's answer. 2007-12-26 Nicolas François Merge Debian's patch 480_getopt_args_reorder * NEWS, src/su.c: su's arguments are now reordered. 2007-12-26 Nicolas François Merge RedHat's patch shadow-4.0.18.1-mtime.patch: * NEWS: Document that usermod will now preserve user's file modification and access time. * libmisc/copydir.c: Preserve the access and modification time of copied files. This is important for usermod. This will also impact useradd, for the skeleton files, but this is not important. * libmisc/copydir.c: Stop and return an error if a file could not be closed after during a copy. 2007-12-26 Nicolas François Cleanups: * src/useradd.c (find_new_gid): Check that gflg is not set (assert). * src/useradd.c (find_new_gid): Do not check the group name uniqueness (already checked in main). * src/useradd.c (find_new_gid): Avoid a "continue" in the loop. * src/useradd.c (find_new_gid): Remove irrelevant comments. * src/useradd.c (find_new_gid): Fix the function definition's comment. 2007-12-26 Nicolas François Merge RedHat's patch shadow-4.0.18.1-findNewUidOnce.patch: * src/useradd.c (usr_update): Do not call find_new_uid(). The UID was already either specified or found by another call to find_new_uid(). * src/useradd.c (find_new_uid): Always start with uid_min (find_new_uid() is never called when user_id was already specified). * src/useradd.c (find_new_uid): Fix the comments (find_new_uid() is not called when the UID is specified (uflg)). * src/useradd.c (main): Only call find_new_uid() if (!oflg) and (!uflg). If uflg is set (but not oflg), check the UID uniqueness. * src/useradd.c (find_new_uid): Don't check the uid and user name uniqueness in find_new_uid(). The user name uniqueness is already checked during the parameter validation. UID uniqueness is also checked (see above). * src/useradd.c (find_new_uid): Don't check uflg in find_new_uid(). * src/useradd.c (find_new_uid): Make sure that find_new_uid() is not called when uflg is set (assert). 2007-12-26 Nicolas François Merge RedHat's patch shadow-4.1.0-lOption.patch * NEWS, src/useradd.c, man/useradd.8.xml: Add option -l to avoid adding the user to the lastlog and faillog databases. 2007-12-26 Nicolas François * src/useradd.c, src/groupadd.c: NO_GETPWENT is no more supported. Remove associated chunks of code. 2007-12-26 Nicolas François * man/groupadd.8.xml: Document the long options (--force, --gid, --key, --non-unique). 2007-12-26 Nicolas François Merge RedHat's patch shadow-4.0.3-noinst.patch * NEWS, lib/Makefile.am: Do not install the shadow library per default. lib_LTLIBRARIES changed to noinst_LTLIBRARIES. 2007-12-09 Nicolas François * NEWS, configure.in: Prepare the 4.1.0 release. 2007-12-09 Nicolas François * NEWS, src/chgpasswd.c: Use chgpasswd PAM policy file instead of chpasswd's one. 2007-12-09 Nicolas François * man/pwconv.8.xml: Fix typos. * man/chpasswd.8.xml, man/chgpasswd.8.xml: Document the NONE crypt method. * man/login.defs.d/MAIL_DIR.xml: Add comment regarding useradd not using MAIL_FILE. * man/login.defs.d/ERASECHAR.xml, man/login.defs.d/KILLCHAR.xml, man/login.defs.d/CONSOLE_GROUPS.xml, man/login.defs.d/ENV_HZ.xml, man/login.defs.d/ENV_PATH.xml, man/login.defs.d/ENV_SUPATH.xml: These variables are also used by some tools when compiled with PAM support. * man/login.defs.d/ENV_HZ.xml: Add note that it is only used by sulogin when compiled with PAM support. * man/login.defs.d/ENV_SUPATH.xml: Typos: ENV_PATH -> ENV_SUPATH, and mention sbin in the path. * man/login.defs.d/LOGIN_STRING.xml: Fix typo: confition -> condition. * man/sg.1.xml: Add CONFIGURATION section (SYSLOG_SG_ENAB). * man/su.1.xml: ENV_HZ, LOGIN_STRING, MAIL_DIR, USERGROUPS_ENAB are only used when su is compiled without PAM support. * man/login.defs.5.xml: Added variables: OBSCURE_CHECKS_ENAB PASS_ALWAYS_WARN PASS_CHANGE_TRIES SULOG_FILE SU_NAME SU_WHEEL_ONLY SYSLOG_SG_ENAB SYSLOG_SU_ENAB. * man/login.defs.5.xml: ENVIRON_FILE is only used when compiled without PAM support. * man/login.defs.5.xml: sulogin uses variables even when compiled with PAM support. * man/login.1.xml: ENV_HZ ENV_PATH ENV_SUPATH MAIL_DIR UMASK are only used when login is not compiled with PAM support. 2007-12-09 Nicolas François * src/login.c: Make sure is_console is only defined when USE_PAM is not defined. 2007-12-09 Nicolas François * libmisc/pwd2spwd.c: Fix time() prototype. 2007-12-08 Nicolas François * man/login.defs.d/CONSOLE_GROUPS.xml, man/login.defs.d/CONSOLE.xml, man/login.defs.d/DEFAULT_HOME.xml, man/login.defs.d/ENV_HZ.xml, man/login.defs.d/ENVIRON_FILE.xml, man/login.defs.d/ENV_PATH.xml, man/login.defs.d/ENV_SUPATH.xml, man/login.defs.d/ENV_TZ.xml, man/login.defs.d/ERASECHAR.xml, man/login.defs.d/FAIL_DELAY.xml, man/login.defs.d/FAILLOG_ENAB.xml, man/login.defs.d/FAKE_SHELL.xml, man/login.defs.d/FTMP_FILE.xml, man/login.defs.d/HUSHLOGIN_FILE.xml, man/login.defs.d/ISSUE_FILE.xml, man/login.defs.d/KILLCHAR.xml, man/login.defs.d/LASTLOG_ENAB.xml, man/login.defs.d/LOGIN_RETRIES.xml, man/login.defs.d/LOGIN_TIMEOUT.xml, man/login.defs.d/LOG_OK_LOGINS.xml, man/login.defs.d/LOG_UNKFAIL_ENAB.xml, man/login.defs.d/MAIL_CHECK_ENAB.xml, man/login.defs.d/MOTD_FILE.xml, man/login.defs.d/NOLOGINS_FILE.xml, man/login.defs.d/OBSCURE_CHECKS_ENAB.xml, man/login.defs.d/PASS_ALWAYS_WARN.xml, man/login.defs.d/PASS_CHANGE_TRIES.xml, man/login.defs.d/PASS_MAX_LEN.xml, man/login.defs.d/PORTTIME_CHECKS_ENAB.xml, man/login.defs.d/QUOTAS_ENAB.xml, man/login.defs.d/SULOG_FILE.xml, man/login.defs.d/SU_NAME.xml, man/login.defs.d/SU_WHEEL_ONLY.xml, man/login.defs.d/SYSLOG_SG_ENAB.xml, man/login.defs.d/SYSLOG_SU_ENAB.xml, man/login.defs.d/TTYGROUP.xml, man/login.defs.d/TTYTYPE_FILE.xml, man/login.defs.d/ULIMIT.xml, man/login.defs.d/USERGROUPS_ENAB.xml: New documentation of login.defs variables. * man/login.defs.d/MAIL_DIR.xml: Updated. It now contains the MAIL_FILE documentation. * man/login.defs.d/LOGIN_STRING.xml: Updated. Mentions %s. * man/pwconv.8.xml, man/groupmems.8.xml, man/groupdel.8.xml, man/useradd.8.xml, man/pwck.8.xml, man/groupadd.8.xml, man/sulogin.8.xml, man/newgrp.1.xml, man/usermod.8.xml, man/su.1.xml, man/vipw.8.xml, man/passwd.1.xml, man/groupmod.8.xml, man/login.1.xml, man/userdel.8.xml, man/grpck.8.xml: Added CONFIGURATION section. * man/generate_mans.mak: The generations of manpages depends on the variables from the Makefiles. Add the dependency on Makefile. * man/login.defs.5.xml: New login.defs variable documented. * man/Makefile.am: Added XML variable documentation to the distributed files. 2007-12-05 Nicolas François * man/gshadow.5.xml: Fix the newgrp section in the gshadow.5 manpage. Thanks to Andre Majorel . 2007-11-27 Nicolas François * man/Makefile.am: Added the login.defs variables description to the man's EXTRA_DIST. 2007-11-27 Nicolas François * man/chfn.1.xml: Uses CHFN_AUTH, CHFN_RESTRICT, LOGIN_STRING. * man/chgpasswd.8.xml: Uses ENCRYPT_METHOD, MAX_MEMBERS_PER_GROUP, MD5_CRYPT_ENAB, SHA_CRYPT_MIN_ROUNDS (SHA_CRYPT_MAX_ROUNDS). * man/chpasswd.8.xml: Switch to using entities for ENCRYPT_METHOD, MD5_CRYPT_ENAB, SHA_CRYPT_MIN_ROUNDS (SHA_CRYPT_MAX_ROUNDS). * man/chsh.1.xml: Uses CHSH_AUTH, LOGIN_STRING. * man/expiry.1.xml: Does not use any login.defs parameter. * man/gpasswd.1.xml: Uses ENCRYPT_METHOD, MAX_MEMBERS_PER_GROUP, MD5_CRYPT_ENAB, SHA_CRYPT_MIN_ROUNDS. * man/login.defs.5.xml: Added CHSH_AUTH. * man/login.defs.5.xml: Cross reference -> cross references. * man/login.defs.5.xml: chfn only uses CHFN_AUTH when no_pam. * man/login.defs.5.xml: chsh uses CHSH_AUTH, not CHFN_AUTH. * man/login.defs.d/CHSH_AUTH.xml: Added. * man/login.defs.5.xml: chsh uses parameters only when no_pam. * man/login.defs.5.xml: expiry does not use CONSOLE_GROUPS, even if linked in the binary. * man/newusers.8.xml: Uses ENCRYPT_METHOD, MAX_MEMBERS_PER_GROUP, MD5_CRYPT_ENAB, PASS_MAX_DAYS, PASS_MIN_DAYS, PASS_WARN_AGE, SHA_CRYPT_MIN_ROUNDS, UMASK. 2007-11-26 Nicolas François * man/generate_translations.mak, man/po/Makefile.in.in: Add --expand-all-entities to the call to xml2po to avoid translating the external entities separately. 2007-11-26 Nicolas François * man/login.defs.d/, man/login.defs.d/CHFN_RESTRICT.xml, man/login.defs.d/MAIL_DIR.xml, man/login.defs.d/PASS_MAX_DAYS.xml, man/login.defs.d/SHA_CRYPT_MIN_ROUNDS.xml, man/login.defs.d/CHFN_AUTH.xml, man/login.defs.d/MD5_CRYPT_ENAB.xml, man/login.defs.d/PASS_WARN_AGE.xml, ·man/login.defs.d/UMASK.xml, man/login.defs.d/PASS_MIN_DAYS.xml, man/login.defs.d/UID_MAX.xml, man/login.defs.d/LOGIN_STRING.xml, man/login.defs.d/GID_MAX.xml, man/login.defs.d/ENCRYPT_METHOD.xml, man/login.defs.d/USERDEL_CMD.xml, man/login.defs.d/MAX_MEMBERS_PER_GROUP.xml, man/login.defs.5.xml: Put each variable description in an external entities. This will permit to reference them in the various utils manpages. * man/login.defs.5.xml: Describe the usage of variables by each tools when compiled without PAM support. 2007-11-26 Nicolas François * po/stats: Do not generate gmo files. 2007-11-25 Nicolas François * man/po/LINGUAS: Added missing LINGUAS. * man/po/de.po, man/po/fr.po, man/po/it.po, man/po/pl.po, man/po/ru.po, man/po/sv.po: Updated. 2007-11-25 Nicolas François * configure.in, man/po/Makefile.in.in, man/po/Makevars, man/po/POTFILES.in, man/Makefile.am: Generate the PO files for the manpages in the man/po directory (instead of man/). Use a Makefile.in.in based on gettext's one. This ensure that the PO are generated before being used in the directories. * man/generate_mans.mak, man/generate_translations.mak, man/Makefile.am: New makefile for the generation of manpages from XML (generate_mans.mak). This avoid duplicate chunks in generate_translations.mak and Makefile.am * man/de/de.po, man/fr/fr.po, man/it/it.po, man/pl/pl.po, man/ru/ru.po, man/sv/sv.po: Moved to... * man/po/de.po, man/po/fr.po, man/po/it.po, man/po/pl.po, man/po/ru.po, man/po/sv.po: ... here. 2007-11-24 Nicolas François * src/userdel.c, src/lastlog.c, src/newusers.c, src/chpasswd.c, src/usermod.c, src/chgpasswd.c, src/vipw.c, src/useradd.c, src/su.c, src/groupmod.c, src/passwd.c, src/groupadd.c, src/chage.c, src/faillog.c, src/chsh.c: Do not use tabulations in Usage strings. * po/ca.po, po/cs.po, po/da.po, po/de.po, po/el.po, po/es.po, po/eu.po, po/fi.po, po/fr.po, po/gl.po, po/hu.po, po/id.po, po/it.po, po/ja.po, po/nb.po, po/pl.po, po/pt_BR.po, po/pt.po, po/ro.po, po/ru.po, po/sk.po, po/sv.po, po/tl.po, po/tr.po, po/uk.po, po/vi.po: Unfuzzy previous changes. * po/bs.po, po/he.po, po/nn.po, po/sq.po: No Usage string translated. Just updated PO. * po/dz.po, po/km.po, po/ko.po, po/ne.po, po/nl.po, po/zh_CN.po, po/zh_TW.po: It would be too error prone for me to unfuzzy these ones. Updated PO. (km and ne should be reviewed: options are translated). 2007-11-24 Nicolas François * po/ne.po, po/bs.po, po/cs.po, po/pt_BR.po, po/km.po, po/es.po, po/eu.po, po/ko.po, po/hu.po, po/sk.po, po/vi.po, po/uk.po, po/ro.po, po/sq.po, po/ru.po, po/id.po, po/nb.po, po/el.po, po/gl.po, po/fr.po, po/nl.po, po/pl.po, po/nn.po, po/it.po, po/dz.po, po/tl.po, po/pt.po, po/ca.po, po/da.po, po/tr.po, po/sv.po, po/de.po, po/ja.po, po/zh_TW.po, po/he.po, po/fi.po, po/zh_CN.po: Run "make update-po" in the po directory. 2007-11-24 Nicolas François * configure.in: New configure option: --with-sha-crypt enabled by default. Keeping the feature enabled is safe. Disabling it permits to disable the references to the SHA256 and SHA512 password encryption algorithms from the usage help and manuals (in addition to the support for these algorithms in the code). * libmisc/obscure.c, libmisc/salt.c, src/newusers.c, src/chpasswd.c, src/chgpasswd.c, src/passwd.c: ENCRYPT_METHOD is always supported in login.defs. Remove the ENCRYPTMETHOD_SELECT preprocessor condition. * libmisc/obscure.c, libmisc/salt.c, src/newusers.c, src/chpasswd.c, src/chgpasswd.c, src/passwd.c: Disable SHA256 and SHA512 if USE_SHA_CRYPT is not defined (this corresponds to a subset of the ENCRYPTMETHOD_SELECT sections). 2007-11-24 Nicolas François * lib/encrypt.c: If we requested a non DES encryption, make sure crypt returned a encrypted password longer than 13 chars. This protects against the GNU crypt() which does not return NULL if the algorithm is not supported, and return a DES encrypted password. 2007-11-24 Nicolas François * lib/groupio.c: Add missing #include "getdef.h" 2007-11-24 Nicolas François * src/newusers.c: Provide the crypt method to all the crypt_make_salt invocations. * src/newusers.c: Tag the ENCRYPTMETHOD_SELECT dependent code accordingly. 2007-11-24 Nicolas François * libmisc/salt.c: Make sure method is not NULL, defaulting to DES. Thanks to Dan Kopecek . * src/chpasswd.c, src/chgpasswd.c: Do not use DES by default, but the system default define in /Etc/login.defs. Thanks to Dan Kopecek . * NEWS, man/chpasswd.8.xml, man/chgpasswd.8.xml: Do not mention DES as the default algorithm. * src/chpasswd.c, src/chgpasswd.c: Tag the ENCRYPTMETHOD_SELECT dependent code accordingly. 2007-11-23 Nicolas François * libmisc/salt.c: Move the srandom call to gensalt. * libmisc/salt.c (gensalt): Replace the test on salt_size by an assert. 2007-11-23 Nicolas François Patch contributed by Dan Kopecek * src/chpasswd.c, src/chgpasswd.c, src/newusers.c: Fix compilation when ENCRYPTMETHOD_SELECT is not defined. * libmisc/salt.c (MAGNUM): The nul char was put on (array)[2] instead of (array)[3]. * libmisc/salt.c: MAGNUM should be defined even if ENCRYPTMETHOD_SELECT is not defined. * libmisc/salt.c: Use random instead of rand. * libmisc/salt.c (gensalt): New function to generate a salt (instead of using gettimeofday). 2007-11-23 Nicolas François * NEWS, src/newusers.c: New options -c/--crypt-method -s/--sha-rounds. 2007-11-23 Nicolas François * src/chpasswd.c: Added crypt method: NONE. * src/chpasswd.c: Added --sha-rounds to the usage(). * libmisc/Makefile.am, libmisc/getlong.c, src/chgpasswd.c, src/chpasswd.c, lib/prototypes.h: New getlong function. Replace chpasswd's and chgpasswd's getnumber. 2007-11-23 Nicolas François * lib/groupio.c: Removed unused variable 'member'. 2007-11-23 Nicolas François * man/chpasswd.8.xml: Document the variables used by chpasswd. The definitions are copied from login.defs. I should try to use a less error prone process for this. 2007-11-23 Nicolas François * man/login.defs.5.xml: Use for the values set by users. (was sometimes ) * man/login.defs.5.xml: Use