/
githubmirror
/
libuser
Обзор
Документация
Войти
/
githubmirror
/
libuser
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ChangeLog
3 787 строк
132 KB
Miloslav Trmač
Release 0.62
23 июл 2015, 22:15
23 июл 2015, 22:15
6cbc3a9
Код
Авторство
О чём код?
2015-07-23 Miloslav Trmač <mitr@redhat.com> * configure.ac: Release 0.62. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. 2015-06-26 Miloslav Trmač <mitr@redhat.com> * modules/files.c (open_and_copy_file): Replace and heavily modify ... (lu_files_create_backup): ... this. (lock_file_handle_existing, lock_file_create, lock_file_remove) (struct editing, editing_open, replace_file_or_symlink) (editing_close): New functions. (generic_lookup, generic_is_locked, lu_files_enumerate) (lu_files_users_enumerate_by_group, lu_files_groups_enumerate_by_user) (lu_files_enumerate_full): Remove locking on read-only operations. (generic_add, generic_mod, generic_del, generic_lock) (generic_setpass): Use struct editing instead of dealing with locking, backups, SELinux individually. * lib/user_private.h (lu_util_lock_obtain, lu_util_lock_free): Mark as deprecated. * lib/util.c (lu_util_field_write): Fail on an incomplete write(). 2015-06-25 Miloslav Trmač <mitr@redhat.com> * modules/files.c (format_generic, generic_setpass): Refuse to write field values which contain \n. * tests/files_test.py (Tests.testUserAdd9, Tests.testUserMod8) (tests.testUserSetpass5, tests.testGroupAdd6, tests.testGroupMod7) (tests.testGroupSetpass4): New tests. * docs/reference/Makefile.am: Update from gtk-doc example. (AUTOMAKE_OPTIONS): Remove no longer needed workaround. (DOC_SOURCE_DIR): Follow upstream example. * docs/reference/libuser-docs.sgml: Comment out unused reference. * docs/reference/libuser-sections.txt: Add types newly recognized by gtk-doc. * lib/error.h (enum lu_status): Add docstring. (struct lu_error): Document members. Remove gtk-doc workaround. * lib/prompt.h (struct lu_prompt): Use a docstring. Remove gtk-doc workaround. * lib/user.h (enum lu_entity_type): Add docstring. 2015-06-25 Miloslav Trmač <mitr@redhat.com> * lib/user.c (lu_dispatch) * modules/ldap.c (lu_ldap_handle_lock) * samples/homedir.c (main): Silence Eclipse warnings. 2015-03-24 Miloslav Trmač <mitr@redhat.com> * configure.ac: Release 0.61. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. 2015-03-21 Miloslav Trmač <mitr@redhat.com> * po/libuser.pot: Remove autogenerated file. Unlike Transifex, Zanata does not need it. 2015-03-17 Miloslav Trmač <mitr@redhat.com> * zanata.xml: Update for changed version name on the server. 2015-03-16 Miloslav Trmač <mitr@redhat.com> * po/POTFILES.in: Remove reference to removed modules/krb5.c. * .tx/config: Remove. * zanata.xml: Add. To pull updated translations, run (zanata-cli pull). 2015-03-10 Miloslav Trmač <mitr@redhat.com> * python/libusermodule.c (PyInit_libuser): Raise NotImplementedError when running in a non-UTF-8 locale. 2015-02-24 Miloslav Trmač <mitr@redhat.com> * tests/files_test.py * tests/ldap_test.py: Replace deprecated assert_ with more specific assert* methods. * tests/files_test.py (Tests.testGroupMod4): Add a missing assertion. * python/libusermodule.c (dict_add_stolen_object) (dict_add_string): Remove. (initialize_libuser_module): Use PyModule_Add* instead of home-grown alternatives. * python/common.h (struct libuser_prompt): Move ... * python/misc.c (struct libuser_prompt): ... here. * python/common.h (Py_ssize_t): Remove, we can no longer support Python < 2.5. * python/admin.c (AdminType) * python/ent.c (EntityType) * python/misc.c (PromptType): Use the right form for tp_name. * python/common.h (PYSTRTYPE_FROMFORMAT): New macro. * python/misc.c (libuser_prompt_print): Replace with ... (libuser_prompt_str): ... this. PromptType updated. * python/ent.c (libuser_entity_setattr): Rename to ... (libuser_entity_setattro) ... this, updating the calling convention and EntityType. * python/admin.c (Admin_Check) * python/ent.c (Entity_Check): Remove unused macros. * python/ldap-script * python/prompt-script * python/test-script: Port from obsolete libuser API. * python/test-script: Stop overwriting the list() function. Don't use list(_.keys()) unnecessarily. * python/gtk_prompt_callback.py (libuser_gtk_prompt_callback, harness) * python/ldap-script * python/prompt-script * python/test-script * tests/default_pw_test.py * tests/files_test.py (Tests.testUsersEnumerate1) (Tests.testUsersEnumerateByGroup1, Tests.testUsersEnumerateByGroupFull1) (Tests.testUsersEnumerateByGroupFull2) (Tests.testUsersEnumerateByGroupFull3, Tests.testUsersEnumerateFull1) (Tests.testGroupAdd2, Tests.testGroupAdd4, Tests.testGroupMod2) (Tests.testGroupMod4, Tests.testGroupsEnumerate1) (Tests.testGroupsEnumerateByUser1, Tests.testGroupsEnumerateByUserFull1) (Tests.testGroupsEnumerateByUserFull2) (Tests.testGroupsEnumerateByUserFull3, Tests.testGroupsEnumerateFull1) (Tests.testValidateIdValue) * tests/fs_test.py (main) * tests/ldap_test.py (Tests.testUserSetpass2, Tests.testUserSetpass3) (Tests.testUserRemovepass2, Tests.testUserRemovepass3) (Tests.testUsersEnumerate, Tests.testUsersEnumerateByGroup1) (Tests.testUsersEnumerateFull, Tests.testUsersEnumerateByGroupFull1) (Tests.testUsersEnumerateByGroupFull2) (Tests.testUsersEnumerateByGroupFull3, Tests.testGroupAdd2) (Tests.testGroupMod2, Tests.testGroupSetpass2, Tests.testGroupSetpass3) (Tests.testGroupRemovepass2, Tests.testGroupRemovepass3) (Tests.testGroupsEnumerate, Tests.testGroupsEnumerateByUser1) (Tests.testGroupsEnumerateFull, Tests.testGroupsEnumerateByUserFull1) (Tests.testGroupsEnumerateByUserFull2) (Tests.testGroupsEnumerateByUserFull3) * tests/pwhash.py: Update using (2to3-3.3 -w -f all -f buffer -f idioms -f set_literal -f ws_comma), add a few line wraps. * tests/files_test.py (Tests.testGroupAdd4, Tests.testGroupMod4): Revert overzealous .has_key removal. (Tests.testValidateIdValue): Test with 500L again on Python 2. * tests/default_pw_test.py: Use sys.stderr.write instead of print() for compatibility with Python 2. * tests/fs_test.py (main): Consistently use spaces for indentation. * tests/default_pw_test (valid_password): Make compatible with Python 3. * python/common.h (AdminType, PromptType): New declarations. * python/admin.c (libuser_admin_getattr, libuser_admin_setattr): Replace by ... (libuser_admin_get_prompt, libuser_admin_set_prompt) (libuser_admin_get_prompt_args, libuser_admin_set_prompt_args) (libuser_admin_getseters): ... use of PyGetSetDef. (AdminType): Make public. Add tp_doc, use tp_methods instead of tp_getattr. (libuser_admin_methods, AdminType): Remove no longer necessary forward declarations. (libuser_admin_new): Stop using Py_FindMethod unavailable in Python 3. * python/ent.c (libuser_entity_getattr): Remove. (EntityType): Add tp_doc, use tp_methods instead of tp_getattr. (libuser_entity_mapping_methods, libuser_entity_methods): Remove no longer necessary forward declarations. * python/misc.c (libuser_prompt_getattr, libuser_prompt_setattr): Replace by ... (libuser_prompt_get_key, libuser_prompt_set_key) (libuser_prompt_get_prompt, libuser_prompt_set_prompt) (libuser_prompt_get_domain, libuser_prompt_set_domain) (libuser_prompt_get_visible, libuser_prompt_set_visible) (libuser_prompt_get_default_value, libuser_prompt_set_default_value) (libuser_prompt_get_value, libuser_prompt_set_value) (libuser_prompt_getseters): ... use of PyGetSetDef. (PromptType): Make public. Add tp_doc. (PromptType): Remove no longer necessary forward declaration. * python/libusermodule.c (initialize_libuser_module): Initialize types as required to make tp_getseters and tp_methods work. Add a return value. All users updated. 2015-02-20 Miloslav Trmač <mitr@redhat.com> * python/libusermodule.c (libuser_module_doc): Move out of the Python 3 conditional. (initlibuser): Use libuser_module_doc. * python/libusermodule.c (initlibuser): Use PyMODINIT_FUNC as Python documents. * python/libusermodule.c (initialize_libuser_module): Split from initlibuser(). (libuser_module_doc, libuser_module, PyInit_libuser): New definitions to support loading as a Python 3 module. * python/common.h (PYINTTYPE_FROMLONG): New macro to abstract away returning integers in Python 2 and 3. * python/admin.c (libuser_admin_do_wrap, libuser_admin_wrap_boolean) (libuser_admin_setpass, libuser_admin_create_home) (libuser_admin_remove_home, libuser_admin_remove_home_if_owned) (libuser_admin_move_home, libuser_admin_create_remove_mail) (libuser_admin_add_user, libuser_admin_delete_user) * python/ent.c (libuser_entity_has_key) * python/libusermodule (initlibuser) * python/misc.c (libuser_prompt_getattr): Use PYINTTYPE_FROMLONG. * python/common.h (PYSTRTYPE_FROMSTRING): New macro to abstract away returning strings to Python 2 and 3. * python/ent.c (convert_value_array_pylist): Document that it may now return NULL. * python/ent.c (convert_value_array_pylist, libuser_entity_getattrlist) * python/libusermodule.c (libuser_get_user_shells, dict_add_string) * python/misc.c (libuser_prompt_getattr): Use PYSTRTYPE_FROMSTRING. * python/ent.c (libuser_convert_to_value): Remove two more direct uses of PyString_AsString in debug output (converting one, fixing the other). * python/ent.c (libuser_convert_to_value): Fix a type mismatch in debug output. * python/common.h (PYSTRTYPE_ASSTRING, PYSTRTYPE_CHECK): New macros to abstract away accepting strings from Python 2 and 3. * python/ent.c (libuser_convert_to_value, libuser_entity_setattr) (libuser_entity_get_item, libuser_entity_set_item) * python/misc.c (libuser_prompt_setattr): Use PYSTRTYPE_ASSTRING and PYSTRTYPE_CHECK. * Makefile.am (AM_TESTS_ENVIRONMENT): Define PYTHON in tests. * tests/config_test.sh: * tests/default_pw_test: * tests/files_test: * tests/fs_test: * tests/ldap_test: * tests/pwhash_test: Use $PYTHON to run tests. * Makefile.am (pyexec_LTLIBRARIES): Rename from libusermodule.so to libuser.so so that Python 3 can find it. Dependency data updated. 2015-02-18 Miloslav Trmač <mitr@redhat.com> * configure.ac: Define PYINCLUDEDIR. * Makefile.am (PYTHON_CPPFLAGS): Use PYINCLUDEDIR instead of hard-coding the path. This is necessary for Python 3. 2014-01-23 Miloslav Trmač <mitr@redhat.com> * python/admin.c (libuser_admin_user_methods) (libuser_admin_group_methods) * python/ent.c (libuser_methods): Remove unused definitions. * Makefile.am (noinst_HEADERS): Move ... (python_libusermodule_la_SOURCES): ... here, to use ordinary linking instead of #including .c files. * python/admin.c (libuser_admin_new) * python/ent.c (convert_value_array_pylist, convert_ent_array_pylist) (libuser_wrap_ent, EntityType) * python/libusermodule.c (libuser_get_user_shells) * python/misc.c (libuser_admin_python_prompter) (libuser_admin_prompt_console, libuser_admin_prompt_console_quiet) (libuser_prompt_new): Make non-static, module-internal. * python/common.h: Use G_GNUC_INTERNAL declarations instead of static declarations for all of the above symbols. * python/common.h (AdminType, PromptType): Remove declarations that would result in redundant static definitions. * python/debug.h (indent, getindent): Replace by declarations. * python/libusermodule.c (indent, getindent): Move the definitions here to keep the indent a shared value. * modules/krb5.c: Remove, there's no point distributing the non-working code. It can always be resurrected from the VCS. * configure.ac (KRB5): Remove hardcoded-false conditional. * Makefile.am (pkglib_LTLIBRARIES): Remove support for the KRB5 conditional. Related configuration removed. * docs/libuser.conf.5.in, docs/sgml/libuser.sgml, TODO: Remove references to the krb5 module. * docs/Makefile.am (sgml/libuser.txt, sgml/libuser.html): Fix build if $(srcdir) is an absolute path. 2014-01-02 Miloslav Trmač <mitr@redhat.com> * tests/default_pw_test.py: Remove an unused import. * lib/util.c (lu_util_field_write): Remove redundant assignments. * lib/util.c (lu_util_field_write): Fix a memory leak. 2013-11-21 Miloslav Trmač <mitr@redhat.com> * tests/fs_test: New function filtered_ls. Use it in all tests, reformat some of the expected results to match. * tests/fs_test: Make files setuid after setting the owner, not before; this doesn't matter with fakeroot but does matter without it. * tests/fs_test: Make it possible to run tests as real root, without fakeroot. * tests/fs_test: Use a shell function instead of (cp -a) to prepare source directories for tests, to avoid yet another fakeroot bug. Update the expected test results. 2013-10-18 Miloslav Trmač <mitr@redhat.com> * docs/Makefile.am (SGML_OUTPUTS): New variable. (CLEANFILES): Use SGML_OUTPUTS. (EXTRA_DIST): Add SGML_OUTPUTS so that sgml2txt is not required when building from a release tarball. 2013-10-16 Miloslav Trmač <mitr@redhat.com> * python/ent.c (libuser_entity_set_item): Fix a missing parameter in debug output. * modules/krb5.c (lu_krb5_user_setpass): Fix a missing initialization. 2013-10-12 Miloslav Trmač <mitr@redhat.com> * configure.ac: Release 0.60. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * apps/luserdel.c (main) * python/admin.c (libuser_admin_remove_home): Use lu_homedir_remove_for_user() instead of looking up LU_HOMEDIRECTORY manually. * lib/error.h (lu_status): New value lu_error_homedir_not_owned. * lib/error.c (lu_strerror, lu_error_is_error): Support lu_error_homedir_not_owned. * lib/fs.c (remove_subdirectory): New parameter required_toplevel_uid. All users updated. (homedir_remove_for_user, lu_homedir_remove_for_user) (lu_homedir_remove_for_user_if_owned): New functions. * lib/fs.h (lu_homedir_remove_for_user) (lu_homedir_remove_for_user_if_owned): New declarations. * docs/reference/libuser-sections.txt: Add lu_homedir_remove_for_user and lu_homedir_remove_for_user_if_owned. * python/admin.c (libuser_admin_remove_home_if_owned): New function. (libuser_admin_methods): New entry for removeHomeIfOwned. * tests/fs_test.py (main): New option --remove-if-owned. * tests/fs_test: Test lu_homedir_remove_for_user_if_owned(). * python/modules.txt: Document createHome, moveHome, removeHome, removeHomeIfOwned, createMail, removeMail. Based on a smaller patch by Robin Hack <rhack@redhat.com>. * lib/user.c (lu_default_int): Precompute the replacement strings instead of computing it for each key. This is a little faster, and more importantly, we can be sure that the %d replacement value will be the same for all keys. * lib/util.c (lu_util_shadow_current_date): Rename to... * lib/util.c (lu_util_shadow_current_date_or_minus_1): ... this. Return -1 if the time is not available, or if the time would result in special-cased LU_SHADOW* values. All users updated. 2013-09-20 Miloslav Trmač <mitr@redhat.com> * libuser.pc.in: Use Libs.private for @CRYPT_LIBS@, Requires.private for gmodule-no-export-2.0. glib-2.0 and gobject-2.0 stay in Requires: because applications usually need both of them, and there are known cases of applications that don't ask pkg-config for them explicitly. (We might consider removing gobject-2.0 if all users use the non-GValueArray helpers; removing glib-2.0 is pointless.) 2013-07-08 Miloslav Trmač <mitr@redhat.com> * docs/reference/Makefile.am (AUTOMAKE_OPTIONS): Workaround a bug in automake-1.13-4. * configure.ac: Update gettext version, which avoids autoconf warnings. * configure.ac: Use AM_PROG_AR to shut up automake. This required moving AC_USE_SYSTEM_EXTENSIONS up. 2013-06-28 Miloslav Trmač <mitr@redhat.com> * tests/fs_test: Skip the test if fakeroot is not available. * .tx/config: Update configuration for hosted Transifex changes. 2013-03-28 Miloslav Trmač <mitr@redhat.com> * configure.ac: Release 0.59. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. (EXTRA_DIST): Fix a typo that broke (make distcheck). * lib/user_private.h (lu_util_fscreate_from_fd): Fix the non-SELinux macro. * tests/fs_test: Create temporary files only in a temporary directory. 2013-03-26 Miloslav Trmač <mitr@redhat.com> * lib/fs.c (lu_homedir_populate): Fix typo in docstring. Noticed by Viktor Hercinger <vhercing@redhat.com>. 2013-03-22 Miloslav Trmač <mitr@redhat.com> * tests/fs_test: Set umask because it affects test output. Patch by Viktor Hercinger <vhercing@redhat.com>. 2013-02-20 Miloslav Trmač <mitr@redhat.com> * configure.ac: Enable large file support, in particular to enable working with 64-bit inode numbers. 2013-02-09 Miloslav Trmač <mitr@redhat.com> * lib/fs.c (struct copy_access_options): Remove member ignore_eexist. (copy_symlink, copy_regular_file, lu_copy_dir_and_close): Remove the possibility to ignore EEXIST, always fail on pre-existing contents. (lu_homedir_populate): Incompatible change: Refuse to populate pre-existing directories. (lu_homedir_move): Stop setting access_options.ignore_eexist. * tests/fs_test.py (main): Beautify output on createHome failure to help checking the output. * tests/fs_test: Fix mv2_output check. Test that attempts to populate a pre-existing home directory are refused. 2013-02-08 Miloslav Trmač <mitr@redhat.com> * lib/fs.c (copy_regular_file): Rename from... (copy_regular_file_and_close): ... this, and stop closing src_fd; we don't really need to use this irregular model here. (copy_dir_entry): Update. * lib/fs.c (lu_homedir_populate, lu_homedir_move) (lu_nscd_flush_cache, lu_mail_spool_create) (lu_mail_spool_remove): These functions are public API, add g_return_*_if_fail() checks for input parameters. * lib/fs.c (copy_symlink): Fix comments. * lib/fs.c (copy_symlink, copy_regular_file_and_close) (copy_dir_entry, lu_homedir_copy, lu_homedir_populate) (mail_spool_path, lu_mail_spool_remove): Add LU_ERROR_CHECK calls. * lib/fs.c (copy_symlink, copy_regular_file_and_close): Use simpler parameter names. * lib/fs.c (copy_dir_entry): Split from ... (lu_copy_dir_and_close): ... to simplify handling of src_path_buf and dest_path_buf. * lib/fs.c (lu_copy_dir_and_close, lu_homedir_copy): Use GString buffers to build paths, removing the PATH_MAX limit and reducing O(N^2) memory use to O(N). * lib/fs.c (remove_subdirectory, lu_homedir_remove): Use a single GString to build all paths, removing the PATH_MAX limit and reducing O(N^2) memory use to O(N). * lib/fs.c (lu_copy_dir_and_close): Simplify the control flow a little. * lib/fs.c (copy_symlink, copy_regular_file_and_close): Split from ... (lu_copy_dir_and_close): ... this. 2013-02-04 Miloslav Trmač <mitr@redhat.com> * configure.ac: Define GLIB_VERSION_MIN_REQUIRED to shut up warnings about GValueArray being deprecated. * lib/common.c: #include <config.h> first, to let the GLIB_VERSION_MIN_REQUIRED take effect. * configure.ac: Rename from ... * configure.in: ... the obsolete name. * configure.in: Enable system extensions, in particular the secure_getenv() declaration. Check for secure_getenv() in addition to __secure_getenv(). * lib/config.c: Use secure_getenv() if __secure_getenv() is not available, abort build if neither is available. Patch by Viktor Hercinger <vhercing@redhat.com>. 2012-12-20 Miloslav Trmač <mitr@redhat.com> * apps/lnewusers.c (main) * apps/luseradd.c (main): Only set the user's password after the home directory is created. * lib/fs.c (struct copy_access_options): New member ignore_eexist. (lu_copy_dir_and_close): Use access_options->ignore_eexist. (lu_homedir_populate, lu_homedir_move): Set access_options.ignore_eexist. * tests/fs_test.py (main): Don't output a full traceback if moveHome fails. * tests/fs_test: Test that moving onto an existing directory is prohibited. * lib/fs.c (lu_copy_dir_and_close): Only set the ownership and mode of newly created files after the content is copied. This is better because 1) write(3) is allowed to reset the S_ISUID and S_ISGID bits, and 2) if write() didn't reset the bits, having a set-uid/set-gid executable with partial content might be a security risk. 2012-12-13 Miloslav Trmač <mitr@redhat.com> * tests/fs_test: Add tests for lu_homedir_populate() and lu_homedir_move(). Make sure even inaccessible files are removed on exit. Actually test code from the current build instead of the system installation. Make the existing tests locale-independent. * tests/fs_test.py: New modes --move and --populate. * tests/fs_test: Check the final situation more thoroughly. * tests/fs.conf.in * tests/fs_test * tests/fs_test.py: New files. * Makefile.am (TESTS): Add tests/fs_test. (EXTRA_DIST): Add tests/fs_test and dependencies. 2012-12-11 Miloslav Trmač <mitr@redhat.com> * lib/fs.c (lu_copy_dir_and_close): Don't unnecessarily ftruncate() a file we just created. * lib/fs.c (lu_copy_dir_and_close): Only make the directory accessible to the target user after all work in it is done. Still doesn't handle pre-existing directories. 2012-12-08 Miloslav Trmač <mitr@redhat.com> * lib/fs.c (lu_homedir_copy): Allow src_dir to be a symlink again. This fixes an API incompatibility. * lib/fs.c (lu_copy_dir_and_close): Rename again from... (lu_homedir_copy_and_close): ... this. (lu_homedir_copy): New helper function. (lu_homedir_populate, lu_homedir_move): Simplify by using the new lu_homedir_copy(). Better document security assumptios. * lib/fs.c (copy_access_options): Rename member preserve_contexts to preserve_source. Document that other fields apply only if !preserve_source. (uid_for_copy): Implement preserve_source. Fix a spectacular typo. (gid_for_copy, mode_for_copy): Implement preserve_srouce. (lu_homedir_copy_and_close, (lu_homedir_populate): Update for renamed field preserve_source. (lu_homedir_move): Update for renamed field preserve source. This also means that while moving the directory we do not override the original owner in the copy, fixing a security hole (the user could have a had hardlink to a file they couldn't read, and we would helpfully create a copy owned by them). * lib/fs.c (copy_access_options): Fix description of member umask. (mode_for_copy): New helper function. (lu_homedir_copy_and_close): Use mode_for_copy(). * lib/fs.c (lu_homedir_copy_and_close): Rename from ... (lu_homedir_copy) ... this. When scanning a directory, open() each entry and then fstat() instead of fstatat() + possible openat(), which is racy. (lu_homedir_populate, lu_homedir_move): Update for lu_homedir_copy_and_close(). * lib/user_private.h (lu_util_fscreate_from_fd) (lu_util_fscreate_from_lfile): New declarations and fallback macros. * lib/util.c (lu_util_fscreate_from_fd, lu_util_fscreate_from_lfile): New functions. * lib/fs.c (lu_homedir_copy): Set SELinux context immediately before creating a new file, based on the file descriptor we will be using, removing another path lookup race and avoiding the top-level-directory special case. Use lu_util_fscreate_from_lfile() for symbolic links, fixing a bug. (lu_homedir_populate, lu_homedir_move): Stop setting SELinux contexts manually. * lib/fs.c (lu_homedir_copy): Modify file times through existing descriptors if possible. * lib/fs.c (lu_homedir_copy): When creating copies, start with minimal permissions, set owner, then set the desired permissions. Thus, start preserving S_IS[UG]ID flags on copied regular files, and make sure they aren't even momentarily undesirably acessible. * lib/fs.c (copy_access_options): Drop member is_toplevel again. (gid_for_copy): Don't use options->is_toplevel. (lu_homedir_populate): Don't make a special case for the top-level directory: just use the mode of the source directory for the copy, and the same rules for the group. All users updated. (lu_homedir_populate): Manually set ownership and group to handle the special case of a new home directory. * lib/fs.c (copy_access_options): New members is_toplevel, uid and gid. (uid_for_copy, gid_for_copy): New functions. (lu_homedir_copy): Use access_options to pass around ownership information. All users updated, no change in semantics. * lib/fs.c (copy_access_options): New structure. (lu_homedir_copy): Use struct copy_access_options for keep_contexts and umask. All users updated, no change in semantics. * lib/fs.c (lu_homedir_copy): Use a (parent FD, entry name) pair when creating the existing directory to start avoiding symlink races. Start preserving nanosecond timestamp in the process. * lib/fs.c (lu_homedir_copy): Rename path to dest_ent_path for consistency. * lib/fs.c (lu_homedir_copy): Use a (parent FD, entry name) pair when reading the existing directory to avoid symlink races. * lib/fs.c (lu_homedir_copy): Rename srcpath to src_ent_path to avoid confusion with names added in the future. * lib/fs.c (remove_subdirectory): Split from lu_homedir_remove(). Use openat(), fstatat(), and unlinkat() to avoid symlink races. 2012-11-29 Miloslav Trmač <mitr@redhat.com> * lib/util.c (fill_urandom): Don't use g_return_val_if_fail(), glib can be configured so that it does nothing. * lib/user.c (lu_dispatch): Add a comment about unreachable code. 2012-11-21 Miloslav Trmač <mitr@redhat.com> * tests/default_pw_test: * tests/ldap_test: Use 1024-bit RSA keys instead of 512-bit, to run correctly in FIPS mode. 2012-11-08 Miloslav Trmač <mitr@redhat.com> * lib/entity.h (LU_SHADOWLASTCHANGE, LU_SHADOWMIN, LU_SHADOWMAX) (LU_SHADOWWARNING): Document that -1 should be treated the same as a missing value. * modules/files.c (format_shadow): Treat most missing fields as default value "-1", and suppress it on output, to stop deviating from shadow(5). * apps/lchage.c (read_ndays): Move lu_ent_get() call from the callers. Handle missing value and value -1 equivalently. All callers updated. (main): Always print all fields, even if the account attributes are missing. Output missing minimum password age, and missing passwod warning period, as 0. Output missing maximum password age as "None". Output missing password inactivity period as "Never". Output missing last password change and missing account expiration date as "Never". Consistently report "Must change password on next login" in all fields affected by this setting, and "Never" if the respective password expiration feature is disabled. * apps/lchage.1 (--date): Document values 0 and -1. (--inactive): Document value -1. (--mindays): Document value -1, and interaction with --maxdays. (--maxdays): Document value -1, don't recommend 99999 to disable password expiration. (--warndays): Document values 0 and -1. (NOTES): New section. * tests/files_test: Test also empty sp_lstchg. * tests/files_test.py (Tests.testUserLookupName2) (Tests.testUserMod4): Update expected values to follow lib/entity.h and shadow(5), and for updated empty_user contents. * tests/utils_test (lchage): Test handling of -d 0, and handling of -1 for all fields. * tests/utils_shadow: Verify that -1 values are correctly suppressed on output. * tests/utils_group * tests/utils_gshadow * tests/utils_passwd: Add user4_2 added by tests/utils_test. * configure.in: Release 0.58. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. 2012-11-01 Miloslav Trmač <mitr@redhat.com> * lib/entity.h (LU_USERPASSWORD, LU_GROUPPASSWORD, LU_SHADOWPASSWORD): Document that users shouldn't modify these values directly. 2012-10-25 Miloslav Trmač <mitr@redhat.com> * lib/user.c (lu_default_int): Simplify. We don't need to clear previous values because the entity is completely wiped at the beginning of the function. * lib/entity.c (lu_ent_set_long_int, lu_ent_set_long) (lu_ent_set_long_current): New functions. * lib/entity.h (lu_ent_set_long, lu_ent_set_long_current): New declarations. * docs/reference/libuser-sections.txt: Add lu_ent_set_long and and lu_ent_set_long_current. * apps/lchage.c (main) * lib/common.c (lu_common_suser_default) * lib/util.c (lu_util_update_shadow_last_change): Use lu_ent_set_long(). * apps/lgroupmod.c (main): Drop unnecessary variable. * modules/ldap.c (lu_ldap_lookup, lu_ldap_user_default): Use the new interfaces instead of manipulating GValues manually. * lib/entity.c (lu_ent_set_id_int, lu_ent_set_id) (lu_ent_set_id_current): New functions. * lib/entity.h (lu_ent_set_id, lu_ent_set_id_current): New declarations. * docs/reference/libuser-sections.txt: Add lu_ent_set_id and and lu_ent_set_id_current. * apps/lgroupadd.c (main) * apps/lgroupmod.c (main) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main) * lib/user.c (lu_default_int): Use lu_ent_set_id(). * lib/entity.c (lu_ent_set_string_int, lu_ent_set_string) (lu_ent_set_string_current): New functions. * lib/entity.h (lu_ent_set_string, lu_ent_set_string_current): New declarations. * docs/reference/libuser-sections.txt: Add lu_ent_set_string and and lu_ent_set_string_current. * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lgroupmod.c (main) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main) * lib/common.c (lu_common_user_default, lu_common_group_default) (lu_common_suser_default) * lib/user.c (lu_default_int) * modules/files.c (lu_shadow_user_add_prep) (lu_shadow_group_add_prep): Use lu_ent_set_string(). * lib/entity.c (lu_ent_set_prepare): Split from lu_ent_set_int(). * modules/files.c (module_filename): New function. (generic_lookup, generic_add, generic_mod, generic_del) (generic_lock, generic_is_locked, generic_setpass) (lu_files_enumerate, lu_files_users_enumerate_by_group) (lu_files_groups_enumerate_by_user, lu_files_enumerate_full) (lu_files_uses_elevated_privileges) (lu_shadow_uses_elevated_privileges): Use module_filename(). * modules/files.c (generic_lock, generic_is_locked) (generic_setpass): Use `name' instead of `namestring' for better readability. * modules/ldap.c (lu_ldap_del, lu_ldap_handle_lock) (lu_ldap_is_locked, lu_ldap_setpass): Use `name' instead of `name_string' for better readability. * lib/entity.c (lu_ent_get_first_value_strdup_int) (lu_ent_get_first_value_strdup) (lu_ent_get_first_value_strdup_current): New functions. * lib/entity.h (lu_ent_get_first_value_strdup) (lu_ent_get_first_value_strdup_current): New declarations. * docs/reference/libuser-sections.txt: Add lu_ent_get_first_value_strdup and lu_ent_get_first_value_strdup_current. * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lusermod.c (main) * lib/fs.c (mail_spool_path) * lib/user.c (merge_ent_array_duplicates) * modules/files.c (lu_shadow_user_lookup_id) (lu_shadow_group_lookup_id, generic_mod, generic_del) (generic_lock, generic_is_locked, generic_setpass) * modules/ldap.c (get_ent_adds, lu_ldap_del) (lu_ldap_handle_lock, lu_ldap_is_locked, lu_ldap_setpass) * modules/sasldb.c (lu_sasldb_user_is_locked): Use lu_ent_get_first_value_strdup() and lu_ent_get_first_value_strdup_current(). * apps/luserdel.c (main): Don't use the same entity for groups and users (potentially looking up LU_HOMEDIR_COPY in the group data). * lib/entity.c (lu_ent_get_first_id) (lu_ent_get_first_id_current): Fix value returned on invalid arguments. * lib/entity.c (lu_ent_get_first_current_string): Rename to ... (lu_ent_get_first_string_current): ... this. All references updated. (lu_ent_get_first_current_id): Rename to ... (lu_ent_get_first_id_current): ... this. All references updated. 2012-10-24 Miloslav Trmač <mitr@redhat.com> * lib/entity.c (lu_ent_get_first_id_int, lu_ent_get_first_id) (lu_ent_get_first_current_id): New functions. Fix some comments. * lib/entity.h (lu_ent_get_first_id, lu_ent_get_first_current_id): New declarations. * docs/reference/libuser-sections.txt: Add lu_ent_get_first_id and lu_ent_get_first_current_id. * apps/lgroupmod.c (main) * apps/lid.c (do_full) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/luserdel.c (main) * lib/fs.c (lu_mail_spool_create) * lib/user.c (extract_id) * python/admin.c (libuser_admin_create_home): Use lu_ent_get_first_id(). * lib/entity.c (lu_ent_get_first_string_int) (lu_ent_get_first_string, lu_ent_get_first_current_string): New functions. * lib/entity.h (lu_ent_get_first_string) (lu_ent_get_first_current_string): New declarations. * docs/reference/libuser-sections.txt: Add lu_ent_get_first_string and lu_ent_get_first_current_string. * apps/lid.c (do_full) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/luserdel.c (main) * apps/lusermod.c (main) * lib/user.c (extract_name, lu_dispatch, lu_user_add) * python/admin.c (libuser_admin_create_home) (libuser_admin_remove_home, libuser_admin_move_home): Use lu_ent_get_first_string() and lu_ent_get_first_current_string(). * lib/fs.h (LU_NSCD_CACHE_PASSWD, LU_NSCD_CACHE_GROUP): New macros. * docs/reference/libuser-sections.txt: Add LU_NSCD_CACHE_GROUP and LU_NSCD_CACHE_PASSWD. * apps/lchage.c (main) * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lgroupadd.c (main) * apps/lgroupdel.c (main) * apps/lgroupmod.c (main) * apps/lnewusers.c (main) * apps/lpasswd.c (main) * apps/luseradd.c (main) * apps/luserdel.c (main) * apps/lusermod.c (main): Use the LU_NSCD_CACHE_GROUP and LU_NSCD_CACHE_PASSWD macros. * apps/lusermod.c (main): Don't mark data to be freed as "const". * apps/apputil.c (current_umask, lu_homedir_copy, lu_homedir_populate) (lu_homedir_remove, lu_homedir_move, lu_nscd_flush_cache) (mail_spool_path, lu_mail_spool_create, lu_mail_spool_remove): Move... * lib/fs.c (current_umask, lu_homedir_copy, lu_homedir_populate) (lu_homedir_remove, lu_homedir_move, lu_nscd_flush_cache) (mail_spool_path, lu_mail_spool_create, lu_mail_spool_remove): ... into this new file. Add documentation. * apps/apputil.h (lu_homedir_populate, lu_homedir_move) (lu_homedir_remove, lu_nscd_flush_cache, lu_mail_spool_create) (lu_mail_spool_remove): Move declarations... * lib/fs.h (lu_homedir_populate, lu_homedir_move, lu_homedir_remove) (lu_nscd_flush_cache, lu_mail_spool_create, lu_mail_spool_remove): ... into this new file. * lib/user.h: Include lib/fs.h. * Makefile.am (pkginclude_HEADERS): Add lib/fs.h. (lib_libuser_la_SOURCES): Add lib/fs.c. (apps_libapputil_la_CPPFLAGS): Move NSCD definition.... (lib_libuser_la_CPPFLAGS): ... here. (apps_lchage_LDADD, apps_lgroupadd_LDADD, apps_lgroupdel_LDADD) (apps_lgroupmod_LDADD, apps_lnewusers_LDADD) (apps_luseradd_LDADD, apps_luserdel_LDADD, apps_lusermod_LDADD) (python_libusermodule_la_LIBADD) (samples_homedir_LDADD): Don't link to apps/libapputil.la any more. * docs/reference/libuser-sections.txt: Add a section for lib/fs.c. * docs/reference/libuser-docs.sgml: Include fs documentation. * apps/apputil.c (mail_spool_path, lu_mail_spool_create) (lu_mail_spool_remove): Add error reporting using struct lu_error. All users updated. * apps/apputil.h (lu_mail_spool_create, lu_mail_spool_remove): Update declarations. * apps/apputil.c (lu_mail_spool_create, lu_mail_spool_remove): Split... (lu_mailspool_create_remove): ... this. All users updated. * apps/apputil.h (lu_mail_spool_create, lu_mail_spool_remove): New declarations. (lu_mailspool_create_remove): Remove declaration. * python/admin.c (libuser_admin_delete_user): Instead of creating a mail spool, remove it. * apps/apputil.c (mail_spool_path): Split from ... (lu_mailspool_create_remove): ... here. * tests/valgrind.supp: Add popt suppressions. * apps/lnewusers.c (main) * apps/lusermod.c (main): Fix some memory leaks. * tests/valgrind.supp: Add popt suppressions. * tests/utils_test: Refer to utilities using a full path to allow libtool --mode=execute (and hence valgrind) to work. * apps/lgroupmod.c (main) * apps/lusermod.c (main): Fix a memory leak. * apps/lchage.c (main): * apps/lchfn.c (main): * apps/lchsh.c (main): * apps/lgroupadd.c (main): * apps/lgroupdel.c (main): * apps/lgroupmod.c (main): * apps/lid.c (main): * apps/lnewusers.c (main): * apps/lpasswd.c (main): * apps/luseradd.c (main): * apps/luserdel.c (main): * apps/lusermod.c (main): * apps/luseradd.c (main): Free popt context after use. * tests/valgrind.supp: One more glibc suppression. * modules/ldap.c (get_ent_adds): Fix a memory leak. * Makefile.am (VG_EXECUTION): Use a more practical valgrind configuration. * tests/valgrind.supp: Add generic NSS initialization suppression. * tests/valgrind.supp: Also cover SHA-256 in glibc suppression. * python/ent.c (libuser_entity_getattrlist) (libuser_entity_length): Fix memory leaks. * modules/files.c (lu_files_groups_enumerate_by_user): Fix two memory leaks. Simplify error handling a little. * python/libusermodule.c (dict_add_stolen_object) (dict_add_string): New functions. (initlibuser): Use dict_add_stolen_object() and dict_add_string() to avoid leaking references. * modules/ldap.c (lu_ldap_setpass): Fix a memory leak. * tests/valgrind.supp: Add librpm and glibc suppressions. * tests/config_test.c (start, verify_var, main): Fix memory leaks. * tests/valgrind.supp: Simplify and generalize g_type_init suppression. * tests/config_test.sh: * tests/default_pw_test: * tests/files_test: * tests/ldap_test: * tests/pwhash_test: * tests/utils_test: Support $VALGRIND. * Makefile.am (VG_EXECUTION, VG_ENVIRONMENT): New variables. (EXTRA_DIST): Ship tests/valgrind.supp. (valgrind): New target. 2012-10-23 Miloslav Trmač <mitr@redhat.com> * apps/lid.c (do_nameonly, do_full): Specialize from do_id. Caller updated. (do_full): Use lu_*_enumerate_by_*_full(). * apps/lid.c (do_id): Remove entity existence verification. Removed parameter lookup_name. (main): Do entity existence verification here. * apps/lgroupmod.c (main): Use lu_users_enumerate_by_group_full() instead of looking up the full data manually. * apps/lusermod.c (main): Use lu_groups_enumerate_by_user_full() instead of looking up the full data manually. * lib/user_private.h (LU_MODULE_VERSION): Increase. (lu_module): Remove members users_enumerate_by_group_full and groups_enumerate_by_user_full. * lib/modules.c (load_one_module): Don't require members users_enumerate_by_group_full and groups_enumerate_by_user_full. * lib/user.c (lu_dispatch_id): Remove values users_enumerate_by_group_full and groups_enumerate_by_user_full. (run_single, run_list): Remove no longer used handling of users_enumerate_by_group_full and groups_enumerate_by_user_full. * modules/files.c (lu_files_users_enumerate_by_group_full) (lu_files_groups_enumerate_by_user_full) (lu_shadow_users_enumerate_by_group_full) (lu_shadow_groups_enumerate_by_user_full): Remove placeholders. (libuser_files_init, libuser_shadow_init): Don't initialize members users_enumerate_by_group_full and groups_enumerate_by_user_full. * modules/ldap.c (lu_ldap_users_enumerate_by_group_full) (lu_ldap_groups_enumerate_by_user_full): Remove functions. (libuser_ldap_init): Don't initialize members users_enumerate_by_group_full and groups_enumerate_by_user_full. * modules/sasldb.c (lu_sasldb_users_enumerate_by_group_full) (lu_sasldb_groups_enumerate_by_user_full): Remove placeholders. (libuser_sasldb_init): Don't initialize members users_enumerate_by_group_full and groups_enumerate_by_user_full. * tests/files_test.py (Tests.testUsersEnumerateByGroupFull1) (Tests.testUsersEnumerateByGroupFull2) (Tests.testUsersEnumerateByGroupFull3) (Tests.testGroupsEnumerateByUserFull1) (Tests.testGroupsEnumerateByUserFull2) (Tests.testGroupsEnumerateByUserFull3): New tests. * lib/user.c (lu_users_enumerate_by_group_full) (lu_groups_enumerate_by_user_full): Instead of dispatching into the modules to get full data, only gather names and look up by these names in all modules. 2012-10-19 Miloslav Trmač <mitr@redhat.com> * lib/user_private.h (lu_util_append_values): New declaration. * lib/util.c (lu_util_append_values): New function. * lib/entity.c (lu_ent_set_int) * lib/user.c (merge_ent_array_duplicates, run_list) * modules/ldap.c (lu_ldap_users_enumerate_by_group) (lu_ldap_groups_enumerate_by_user): Use lu_util_append_values(). 2012-10-18 Miloslav Trmač <mitr@redhat.com> * modules/ldap.c (lu_ldap_users_enumerate_by_group) (lu_ldap_groups_enumerate_by_user): Remove an unnecessary condition. * modules/ldap.c (lu_ldap_users_enumerate_by_group_full): Silently ignore errors when looking up group members, instead of returning a non-error return value with error indication set. * modules/ldap.c (lu_ldap_users_enumerate_by_group) (lu_ldap_users_enumerate_by_group_full) (lu_ldap_groups_enumerate_by_user): Use `ret' instead of `primaries' as the variable name, it contains both primary and secondary values. * modules/ldap.c (lu_ldap_groups_enumerate_by_user_full): Implement. * tests/ldap_test.py (Tests.testGroupsEnumerateByUserFull1) (Tests.testGroupsEnumerateByUserFull2) (Tests.testGroupsEnumerateByUserFull3): New tests. 2012-10-08 Miloslav Trmač <mitr@redhat.com> * docs/libuser.conf.5.in ([ldap]): Warn against storing a password in the system-wide file. 2012-09-24 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.57.7. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * modules/ldap.c (lu_ldap_users_enumerate_by_group_full): Implement. * tests/ldap_test.py (Tests.testUsersEnumerateByGroupFull1) (Tests.testUsersEnumerateByGroupFull2) (Tests.testUsersEnumerateByGroupFull3): New tests. * python/common.h: Declare convert_ent_array_pylist. * python/ent.c (convert_ent_array_pylist): New function. * python/admin.c (libuser_admin_enumerate_users_full) (libuser_admin_enumerate_groups_full) (libuser_admin_enumerate_users_by_group_full) (libuser_admin_enumerate_groups_by_user_full): Use convert_ent_array_pylist (also fixes a crash on error). (libuser_admin_enumerate_groups_by_user_full): Remove a duplicated line. * lib/user.c (convert_user_name_to_id, convert_group_name_to_id): Set *error if the entity was not found. (lu_user_lookup_name, lu_group_lookup_name, lu_user_lookup_id) (lu_group_lookup_id): Document that error is not set if the entity was not found. 2012-09-04 Miloslav Trmač <mitr@redhat.com> * apps/luseradd.c (main): Free groupEnt. 2012-07-30 Miloslav Trmač <mitr@redhat.com> * lib/user.h (lu_users_enumerate_by_group_full) (lu_groups_enumerate_by_user_full): New declarations. * lib/user.c (lu_users_enumerate_by_group_full) (lu_groups_enumerate_by_user_full): Uncomment functions. Use a simple group or user name instead of a pattern. Add documentation. * docs/reference/libuser-sections.txt: Add lu_users_enumerate_by_group_full and lu_groups_enumerate_by_user_full. * python/admin.c (libuser_admin_enumerate_users_by_group_full) (libuser_admin_enumerate_groups_by_user_full): Uncomment and fix functions. (libuser_admin_methods): Uncomment enumerateUsersByGroupFull and enumerateGroupsByUserFull. * python/modules.txt: Document enumerateUsersByGroupFull and enumerateGroupsByUserFull. 2012-06-03 Miloslav Trmač <mitr@redhat.com> * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Rename from DISTCHECK_CONFIGURE_FLAGS to follow automake-1.11.3. 2012-03-22 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.57.6. * NEWS: Update. * po/*: Update. * po/libuser.pot: Update for Transifex. * apps/lchage.c (main) * apps/lgroupadd.c (main) * apps/lgroupmod.c (main) * apps/lnewusers.c (main) * apps/lpasswd.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main): Improve --help messages. * apps/lchage.c (main) * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lgroupadd.c (main) * apps/lgroupdel.c (main) * apps/lgroupmod.c (main) * apps/lid.c (main) * apps/lnewusers.c (main) * apps/lpasswd.c (main) * apps/luseradd.c (main) * apps/luserdel.c (main) * apps/lusermod.c (main): Mark --help messages for translation. * modules/ldap.c (connect_server): Don't try to use STARTTLS for ldapi: URLs. Based on a patch by <davide.principi@nethesis.it>. * docs/libuser.conf.5.in: Document that TLS is never used for ldapi:. * tests/ldap_test: Wait for slapd exit before returning from the test. * tests/wait_for_slapd_exit.c * tests/wait_for_slapd_start.c: New files. * tests/default_pw_test * tests/ldap_test: Use tests/wait_for_slapd_exit and tests/wait_for_slapd_start, making the waiting both shorter and more precise. * tests/test_utils.sh: Remove. * Makefile.am (check_PROGRAMS): Add tests/wait_for_slapd_exit and tests/wait_for_slapd_start. (tests_wait_for_slapd_exit_LDFLAGS) (tests_wait_for_slapd_start_LDFLAGS): New definitions. (EXTRA_DIST): Don't ship tests/test_utils.sh any more. * Makefile.am (noinst_PROGRAMS): Move tests/alloc_port ... (check_PROGRAMS): ... here. There's no benefit in building it when the tests are not run. 2012-03-03 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.57.5. * NEWS: Update. * po/*: Update. 2012-02-10 Miloslav Trmač <mitr@redhat.com> * Makefile.am (EXTRA_DIST): Add tests/test_utils.sh. * configure.in: Release 0.57.4. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * po/libuser.pot: Update for Transifex. 2012-02-08 Miloslav Trmač <mitr@redhat.com> * lib/util.c (lu_util_line_get_matchingx): Fix field search to not continue into the following line. * lib/util.c (lu_util_field_write): Cleanup field search. * lib/util.c (lu_util_field_write): Report an error when the entry is not found early to simplify the code. * lib/util.c (lu_util_field_read): Cleanup field search. * lib/util.c (lu_util_field_read): Simplify search for the matching entry. * lib/util.c (lu_util_field_read): Report an error when the entry is not found. * lib/util.c (lu_util_field_write): Fix a memory leak. * lib/util.c (lu_util_field_read): Simplify testing for end of file. * lib/util.c (lu_util_field_read): Simplify redundant error handling. * lib/util.c (lu_util_line_get_matchingx): Cleanup transition between lines. * lib/util.c (lu_util_line_get_matchingx): Cleanup field search. * lib/util.c (lu_util_line_get_matchingx): Cleanup return value handling. * lib/util.c (lu_util_line_get_matchingx): Simplify testing for end of file. * lib/util.c (lu_util_line_get_matchingx): Cleanup end of line handling. * lib/util.c (lu_util_line_get_matchingx): Cleanup field testing. * lib/util.c (lu_util_line_get_matchingx): Rename a confusing variable `buf' to `line'. * lib/util.c (lu_util_line_get_matchingx): Don't access memory after the mmap()ed area. * lib/util.c (lu_util_field_read): Don't access memory after the mmap()ed area if the file doesn't end with a newline. 2012-02-06 Miloslav Trmač <mitr@redhat.com> * python/admin.c (libuser_admin_wrap_boolean): Fix error handling. * lib/user.c (run_single): Replace an unreachable return with a g_assert_not_reached (). * lib/error.c (lu_error_is_success, lu_error_is_warning) (lu_error_is_error): Remove unreachable code. * lib/config.c (process_line): Remove redundant code. * lib/util.c (lu_util_lock_obtain): Don't corrupt errno before using it, simplify. * modules/files.c (lu_files_create_backup): Handle a fchmod () failure. * lib/config.c (handle_default_useradd_key): Fix a check for invalid GID number. * apps/lpasswd.c (main): Handle strdup () allocation failure. * python/misc.c (libuser_admin_python_prompter): Handle an allocation failure. * lib/util.c (lu_util_field_read): Simplify code. * lib/util.c (lu_util_field_write): Simplify a condition. * lib/util.c (lu_util_field_write): Add FIXME. * modules/files.c (lu_files_create_backup): Drop some code with unclear purpose (probably supposed to check for a symlink, but not really), avoid using uinitiazed data. * lib/util.c (lu_util_fscreate_save): Make sure *ctx is initialized so that lu_util_fscreate_restore() callers don't handle an undefined value. * lib/getdate.y (LookupWord): Correctly cast an argument to tolower (). 2011-10-06 Miloslav Trmač <mitr@redhat.com> * COPYING * apps/apputil.c * apps/apputil.h * apps/lchage.1 * apps/lchage.c * apps/lchfn.1 * apps/lchfn.c * apps/lchsh.1 * apps/lchsh.c * apps/lgroupadd.1 * apps/lgroupadd.c * apps/lgroupdel.1 * apps/lgroupdel.c * apps/lgroupmod.1 * apps/lgroupmod.c * apps/lid.1 * apps/lid.c * apps/lnewusers.1 * apps/lnewusers.c * apps/lpasswd.1 * apps/lpasswd.c * apps/luseradd.1 * apps/luseradd.c * apps/luserdel.1 * apps/luserdel.c * apps/lusermod.1 * apps/lusermod.c * docs/libuser.conf.5.in * lib/common.c * lib/config.c * lib/config.h * lib/entity.c * lib/entity.h * lib/error.c * lib/error.h * lib/internal.h * lib/misc.c * lib/modules.c * lib/prompt.c * lib/prompt.h * lib/scache.c * lib/user.c * lib/user.h * lib/user_private.h * lib/util.c * modules/files.c * modules/krb5.c * modules/ldap.c * modules/sasldb.c * python/admin.c * python/ent.c * python/libusermodule.c * python/misc.c * samples/enum.c * samples/field.c * samples/homedir.c * samples/lookup.c * samples/prompt.c * samples/testuser.c * tests/alloc_port.c * tests/config_test.c * tests/config_test.sh * tests/default_pw_test * tests/files_test * tests/ldap_test * tests/pwhash_test * tests/test_utils.sh * tests/utils_test: Update FSF address. 2011-10-04 Miloslav Trmač <mitr@redhat.com> * tests/test_utils.sh: New file. * tests/default_pw_test * tests/ldap_test: Use common wait_for_slapd, also increasing the timeout to 30 seconds. * po/*.po (many): Mark an invalid translation as fuzzy. * configure.in: Release 0.57.3. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * apps/apputil.c (current_umask): New function. (lu_homedir_copy): Preserve S_ISGID and other bits for directories. New parameter umask_value. All users updated. * python/admin.c (libuser_admin_get_first_unused_id_type): Read default start value from configuration. * tests/config_test.py: New file. * tests/config_test.sh (workdir): Run tests/config_test.py. * Makefile.am (EXTRA_DIST): Add tests/config_test.py * apps/lgroupadd.1: * apps/luseradd.1: Fix documentation of start of non-system ID values. * libuser.conf: Comment hard-coded "500" values. 2011-08-26 Miloslav Trmač <mitr@redhat.com> * docs/reference/tmpl/config.sgml * docs/reference/tmpl/entity.sgml * docs/reference/tmpl/error.sgml * docs/reference/tmpl/libuser-unused.sgml * docs/reference/tmpl/prompt.sgml * docs/reference/tmpl/user.sgml * docs/reference/tmpl/value.sgml: Remove, all information is now stored in *.[ch]. * docs/reference/Makefile.am (setup-build-workaround.stamp, setup.stamp) (dist-hook): Remove workarounds necessary for tmpl in $(srcdir). * docs/reference/Makefile.am (HFILE_GLOB, CFILE_GLOB): Fill in. * docs/reference/tmpl/user.sgml: Move contents... * lib/misc.c: ... here and ... * lib/user.c: ... here. * docs/reference/tmpl/entity.sgml: Move contents... * lib/entity.c: ... here and ... * lib/entity.h: ... here. * docs/reference/tmpl/error.sgml: Move contents... * lib/error.c: ... here and ... * lib/error.h: ... here. * docs/reference/tmpl/value.sgml: Move contents... * lib/misc.c: ... here and ... * lib/user.h: ... here. * docs/reference/tmpl/config.sgml: Move contents... * lib/config.c: ... here, and update somewhat. * lib/config.h: Drop redundant documentation. * docs/reference/libuser-decl-list.txt * docs/reference/libuser-decl.txt * docs/reference/libuser.args * docs/reference/libuser.hierarchy * docs/reference/libuser.signals: Stop tracking generated files. * docs/reference/tmpl/prompt.sgml: Move contents... * lib/prompt.c: ... here. * lib/entity.h (lu_ent_t) * lib/error.h (lu_status_t, lu_error_t) * lib/user.h (lu_context_t, lu_entity_type_t): Mark with #ifndef LU_DISABLE_DEPRECATED. * docs/reference/Makefile.am (SCAN_OPTIONS): Recognize LU_DISABLE_DEPRECATED. * docs/reference/Makefile.am (TESTS): Uncomment to enable gtk-doc tests. * lib/user.h (struct lu_context): Document. (lu_context_t): Document, mark as deprecated. All users changed. * docs/reference/tmpl/user.sgml: Regenerate. * docs/reference/libuser-sections.txt: Add lu_context and lu_context_t. * lib/error.h (struct lu_error): Add a redundant declaration to let gtk-doc recognize existence of the type. * lib/error.h (lu_status_t): Split; should be marked as deprecated, but gtk-doc can't handle an enum typedef. All users changed. (struct lu_error): Add minimal documentation (fields not documented because gtk-doc doesn't find them). (lu_error_t): Document, mark as deprecated. All users changed. * docs/reference/tmpl/error.sgml: Regenerate. * docs/reference/libuser-sections.txt: Add lu_error and lu_error_t. * docs/reference/tmpl/entity.sgml (SECTION Long_Description): Move struct lu_ent documentation ... * lib/entity.h (struct lu_ent): ... here. (lu_ent_t): Document, mark as deprecated. All users changed. * docs/reference/libuser-sections.txt: Add lu_ent and lu_ent_t. * lib/prompt.h (lu_prompt): Workaround a gtk-doc parser bug, treating free_value as an external symbol. 2011-08-25 Miloslav Trmač <mitr@redhat.com> * docs/reference/libuser-docs.sgml: Regenerate with gtk-doc 1.17. * docs/reference/Makefile.am: Update from gtk-doc 1.17. * docs/reference/Makefile.am (setup-build-workaround.stamp) (setup.stamp): Workaround incorrect gtk-doc handling of tmpl when $(builddir) != $(srcdir). (DOC_SOURCE_DIR): Workaround incorrect gtk-doc handling of sources when $(builddir) != $(srcdir). (dist-hook): Workaround references to $(build) instead of $(builddir). 2011-05-03 Miloslav Trmač <mitr@redhat.com> * lib/user.c (run_list): Remove dead code. * lib/user.c (run_list): Use a better assertion. 2011-03-31 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.57.2. * NEWS: Update. * po/*: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. 2011-03-19 Miloslav Trmač <mitr@redhat.com> * tests/alloc_port.c: New file. * Makefile.am (noinst_PROGRAMS): Add tests/alloc_port. (tests_alloc_port_LDFLAGS): New definition. * tests/default_pw_test: * tests/default_pw.conf.in (ldap/server) * tests/ldap_test: * tests/ldap.conf.in (ldap/server): Use a dynamically allocated port for the LDAP server. * tests/default_pw_test: * tests/ldap_test: Don't set up port 6360 for ldaps, it is not used. 2011-03-17 Miloslav Trmač <mitr@redhat.com> * tests/config_test.c (verify_var): Call va_end(). * lib/config.c (process_line): Only search for '=' once. * modules/files.c (lu_files_create_backup): Handle lseek() failure. * lib/util.c (lu_util_line_get_matchingx): Handle lseek() failures. Only restore file position if we have actually altered it. * apps/lpasswd.c (main): Handle errors when reading the password from a supplied file descriptor. * apps/apputil.c (lu_homedir_copy): Don't leak a file descriptor on error. * modules/ldap.c (arrays_equal): Drop unnecessary checks. * lib/util.c (lu_util_field_write): Simplify: unless we return lu_error_search, we know line != NULL, and ret == TRUE a little below. This could be simplified further - the current function both reject lines which match but don't contain the specified field, and supports adding the field. * lib/user.c (lu_dispatch): Fix a pasto. 2011-03-04 Miloslav Trmač <mitr@redhat.com> * .tx/config: New file. * po/libuser.pot: Add to prepare for Transifex. 2011-02-04 Miloslav Trmač <mitr@redhat.com> * modules/files.c (line_read): Remove an unused variable. * modules/ldap.c (lu_ldap_fudge_objectclasses): Silence a warning. 2011-02-01 Miloslav Trmač <mitr@redhat.com> * lib/misc.c (lu_value_get_id): Explicitly return LU_VALUE_INVALID_ID for LU_VALUE_INVALID_ID :) (with a warning, from now on). (lu_value_init_set_attr_from_string): Reject LU_VALUE_INVALID_ID as an id_t value. * modules/ldap.c (lu_ldap_setpass): Don't use "!!" (password missing) as an algorithm indicator to be preserved. Skip over '!' (account locked) when looking for the algorithm indicator. * tests/files_test.py (Tests.testUserSetpass1) (Tests.testUserSetpass2, Tests.testUserSetpass3) (Tests.testUserSetpass4, Tests.testGroupSetpass1) (Tests.testGroupSetpass2, Tests.testGroupSetpass3) (Tests.testGroupSetpass4): Verify that crypt_style is honored. * tests/ldap_test.py (Tests.testUserSetpass1) (Tests.testUserSetpass2, Tests.testGroupSetpass1) (Tests.testGroupSetpass2): Verify that the existing algorithm is preserved. (Tests.testUserSetpass3, Tests.testGroupSetpass3): Verify that crypt_style is honored. (Tests.testUserSetpass4, Tests.testUserSetpass5) (Tests.testGroupSetpass4, Tests.testGroupSetpass5): New tests. * tests/files_test.py (Tests.testUserSetpass4, Tests.testGroupSetpass4): Verify that the encrypted password value does not contain ':'. 2011-01-20 Miloslav Trmač <mitr@redhat.com> * modules/ldap.c (get_ent_adds): Don't use empty gecos as a commonName value. * tests/ldap_test.py (Tests.testUserAdd7): New test. 2011-01-14 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.57.1. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * lib/modules.c (lu_modules_load): Fix handling of modules that report non-fatal errors. 2011-01-10 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.57. * NEWS: Update. * po/LINGUAS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. 2011-01-03 Miloslav Trmač <mitr@redhat.com> * tests/default_pw_test * tests/default_pw_test.py * tests/default_pw.conf.in: New test. * Makefile.am (TESTS) (EXTRA_DIST): Add tests/default_pw.conf.in, tests/default_pw_test and tests/default_pw_test.py. * tests/ldap_test.py (Tests.testUserAdd1, Tests.testGroupAdd1): Verify default password value of newly created entries. * modules/ldap.c (lu_ldap_user_default): Use an LDAP-specific default for LU_USERPASSWORD. (lu_ldap_group_default): Comment absence of default password. * lib/user_private.h (struct lu_module): New member valid_module_combination. * lib/error.h (lu_status_t): Add lu_error_invalid_module_combination. * lib/error.c (lu_strerror, lu_error_is_error): Handle lu_error_invalid_module_combination. * lib/modules.c (load_one_module): Verify `valid_module_combination' is provided. (lu_modules_load): After loading modules, let each one verify the module combination. * modules/files.c (lu_files_shadow_valid_module_combination): New function. (libuser_files_init, libuser_shadow_init): Provide `valid_module_combination'. * modules/ldap.c (lu_ldap_valid_module_combination): New function. (libuser_ldap_init): Provide `valid_module_combination'. * modules/sasldb.c (lu_sasldb_valid_module_combination): New function. (libuser_sasldb_init): Provide `valid_module_combination'. * lib/user_private.h (LU_MODULE_NAME_FILES, LU_MODULE_NAME_LDAP) (LU_MODULE_NAME_SHADOW): New definitions. * modules/files.c (SHADOW_MODULE_NAME): Remove, replaced by LU_MODULE_NAME_SHADOW. All users updated. (libuser_files_init): Use LU_MODULE_NAME_FILES. * modules/ldap.c (libuser_ldap_init): Use LU_MODULE_NAME_LDAP. * lib/user_private.h (LU_MODULE_VERSION): Increase. * lib/error.c (lu_strerror, lu_error_is_error): Handle lu_error_invalid_attribute_value. 2010-12-14 Miloslav Trmač <mitr@redhat.com> * tests/ldap_test: Don't run (openssl req) in batch mode so that we can specify a host name. Use "127.0.0.1" as host name to fix CN mismatches, "localhost" when connecting is apparently replaced by the actual host name. * Makefile.am (tests_config_test_LDADD): Fix a typo. 2010-09-29 Miloslav Trmač <mitr@redhat.com> * lib/util.c (lu_util_fscreate_for_path): Don't pass NULL to %s. * lib/util.c (lu_util_fscreate_for_path): Handle cases when a path is not in the matchpathcon database. 2010-09-07 Miloslav Trmač <mitr@redhat.com> * apps/apputil.c (lu_authenticate_unprivileged): New parameter ctx. All users changed. Don't authenticate the user if the application is not set*id and elevated privileges are not necessary. * apps/apputil.h (lu_authenticate_unprivileged): Update prototype. * lib/misc.c (lu_value_get_id): Don't abort the program if the value is not a valid ID. * modules/ldap.c (lu_ldap_groups_enumerate_by_user) * apps/lid.c (do_id): Handle invalid ID values, for completeness. 2010-09-01 Miloslav Trmač <mitr@redhat.com> * libuser.conf (crypt_style): Change default to sha512. 2010-09-14 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.56.18. * NEWS: Update. 2010-08-26 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.56.17. * NEWS: Update. * autogen.sh: Fix running autogen on an old checkout. * tests/slapd.conf.in: Make the tests run with current openldap again. 2010-07-07 Miloslav Trmač <mitr@redhat.com> * tests/files_test.py (Tests.testValidateIdValue): Fix comment. 2010-07-02 Miloslav Trmač <mitr@redhat.com> * python/libusermodule.c (libuser_validate_id_value): New function. (libuser_methods): Add validateIdValue. * python/modules.txt (libuser): Document validateIdValue. * tests/files_test.py (Tests.testValidateIdValue): New test. * python/libusermodule.c (initlibuser): Provide VALUE_INVALID_ID. * python/modules.txt (libuser): Document VALUE_INVALID_ID. 2010-06-14 Miloslav Trmač <mitr@redhat.com> * modules/ldap.c (lu_ldap_needed_objectclasses, get_ent_adds) (get_ent_mods, libuser_ldap_init) * python/misc.c (libuser_admin_prompt): Use g_malloc*_n (). 2010-06-12 Miloslav Trmač <mitr@redhat.com> * configure.in: Define PACKAGE_BUGREPORT and PACKAGE_URL. * autogen.sh: Run aclocal with -Wall. 2010-03-25 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.56.16. * NEWS: Update. 2010-03-04 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.56.15. * NEWS: Update. * po/LINGUAS: Sort. * Makefile.am (archive) * configure.in: Use xz for compressing the distribution tarball. 2010-02-08 Miloslav Trmač <mitr@redhat.com> * configure.in: Release 0.56.14. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * docs/libuser.conf.5.in ([ldap]): Document the "password" option. 2010-02-08 Rob Myers <rob.myers@gtri.gatech.edu> * modules/ldap.c (libuser_ldap_init): Allow specifying the LDAP password in a config file. 2010-02-08 Miloslav Trmač <mitr@redhat.com> * lib/prompt.c (lu_prompt_console): Don't try to modify TTY attributes if stdin is not a TTY. 2010-02-03 Thierry Vignaud <tvignaud@mandriva.com> * po/fr.po: Update. 2010-02-03 Miloslav Trmač <mitr@redhat.com> * lib/user_private.h (_): Use dcgettext (). Based on patch by Thierry Vignaud <tvignaud@mandriva.com>. 2010-01-26 Miloslav Trmač <mitr@redhat.com> * tests/ldap.conf.in (ldap/password): Remove, the value is not used. 2009-12-11 Miloslav Trmač <mitr@redhat.com> * configure.in: Release version 0.56.13. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. 2009-12-11 Miloslav Trmač <mitr@redhat.com> * apps/luseradd.c (main): New arguments --commonname, --givenname, --surname, --roomnumber, --telephonenumber, --homephone. * apps/luseradd.1: Document new arguments. * apps/lusermod.c (main): New arguments --commonname, --givenname, --surname, --roomnumber, --telephonenumber, --homephone. * apps/lusermod.1: Document new arguments. * modules/ldap.c (interact, lu_ldap_needed_objectclasses) (lu_ldap_is_locked): Fix debug print parameters. 2009-12-08 Miloslav Trmač <mitr@redhat.com> * modules/files.c (entry_name_conflicts): Split from generic_add (). (generic_mod): Refuse to rename to an existing name. * tests/files_test.py (Tests.testUserAdd8, Tests.testUserMod7) (Tests.testGroupAdd5, Tests.testGroupMod6) * tests/ldap_test.py (Tests.testUserAdd6, Tests.testUserMod5) (Tests.testGroupAdd4, Tests.testGroupMod4): New test cases. * apps/lnewusers.c (main): Refuse using dubious home directories unless specified explicitly. * tests/utils_test: Test handling of dubious default home directories in lnewusers. * lib/internal.h (LU_DUBIOUS_HOMEDIRECTORY): New definition. * lib/user.c (lu_user_add): Refuse to create an user with a dubious home directory unless specified explicitly. (replace_all): New parameter "key". Recognize dubious home directory value created by the substitution. Caller updated. * lib/user_private.h (lu_common_user_add_check): Remove declaration. * lib/common.c (LU_INVALID_HOMEDIRECTORY): Remove. (lu_common_user_default): Set LU_DUBIOUS_HOMEDIRECTORY instead of LU_INVALID_HOMEDIRECTORY, and only if LU_DUBIOUS_HOMEDIRECTORY is not already set. (lu_common_user_add_check): Remove. * modules/files.c (lu_files_user_add) * modules/ldap.c (lu_ldap_user_add): Remove call to lu_common_user_add_check (). 2009-12-07 Miloslav Trmač <mitr@redhat.com> * lib/common.c (lu_common_user_add_check): Capitalize error message. * lib/user_private.h (lu_common_user_add_check): New declaration. * lib/common.c (LU_INVALID_HOMEDIRECTORY): New definition. (lu_common_user_default): Don't set home directory to /home/. or /home/.. by default. (lu_common_user_add_check): New function. * modules/files.c (lu_files_user_add) * modules/ldap.c (lu_ldap_user_add): Call lu_common_user_add_check (). * po/POTFILES.in: Add lib/common.c. * tests/files_test.py (Tests.testUserAdd7) * tests/ldap_test.py (Tests.testUserAdd5): New tests. 2009-10-26 Miloslav Trmač <mitr@redhat.com> * apps/lid.c (do_id): Report error when the name does not exist (as opposed to the case when a group exists but does not have any members). Caller updated. 2009-10-02 Miloslav Trmač <mitr@redhat.com> * configure.in: Release version 0.56.12. * NEWS: Update. 2009-09-14 Miloslav Trmač <mitr@redhat.com> * configure.in: Release version 0.56.11. * NEWS: Update. * po/LINGUAS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * autogen.sh: Fix (make archive). * apps/luserdel.c (main): Fix comment. 2009-06-23 Miloslav Trmač <mitr@redhat.com> * apps/lgroupmod.c (main): Remove unnecessary nscd refreshes. Refresh the "passwd" nscd cache only once after modifying all affected users. * apps/lnewusers.c (main): Refresh the "group" nscd cache after adding a group. Refresh the "passwd" nscd cache only after changing the user's password. * apps/lpasswd.c (main): Refresh the relevant nscd cache after changing the password. * apps/luseradd.c (main): Refresh the "passwd" nscd cache only after changing the user's password. * apps/luserdel.c (main): Only refresh the "group" cache if a group was deleted. * Makefile.am (apps_libapputil_la_CPPFLAGS): New variable. * apps/apputil.c (lu_nscd_flush_cache): New function. (lu_signal_nscd, lu_hup_nscd): Remove. * apps/apputil.h: Update prototypes. * apps/lchage.c (main) * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lgroupadd.c (main) * apps/lgroupdel.c (main) * apps/lgroupmod.c (main): * apps/lnewusers.c (main): * apps/luseradd.c (main) * apps/luserdel.c (main): Use lu_nscd_flush_cache () instead of lu_hup_nscd (). Based on a patch by Masahiro Matsuya <mmatsuya@redhat.com>. 2009-06-14 Miloslav Trmač <mitr@redhat.com> * configure.in: Add AC_CONFIG_MACRO_DIR. Drop AC_ISC_POSIX. Update for libtool 2. * lib/getdate.y: Update for bison 2.4. * configure.in: Update gettext version to 0.17. 2009-05-22 Miloslav Trmač <mitr@redhat.com> * apps/luserdel.c (main): Remove user's mail spool as well. * apps/luserdel.1: Update. * lib/user.c (run_single): Prohibit renaming entities to an invalid name. * tests/files_test.py (Tests.testUserMod6, Tests.testGroupMod5): New tests. * modules/files.c (generic_add): Remove unnecessary "line != NULL" conditions. * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main): Refuse GID and UID (id_t)-1. * apps/lgroupadd.c (main) * apps/lgroupmod.c (main): Refuse GID (gid_t)-1. * lib/user.c (extract_name, extract_id): Only check pending values, nothing else falls back on current values like these functions did. (lu_default_int): Don't default LU_GIDNUMBER to -1 if the "users" group does not exist. Don't set ID to 0 or -1 if a new ID can't be allocated. Don't replace %u in default values by 0 or -1 if a new ID can't be allocated. * python/admin.c (libuser_admin_create_home): Dont populate home directory if UID or GID is (id_t)-1. * python/ent.c (libuser_convert_to_value): Try to refuse GID and UID (id_t)-1. 2009-04-14 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.10. * NEWS: Update. * po/LINGUAS: Update. 2009-03-12 Miloslav Trmač <mitr@redhat.com> * tests/ldap_test.py (Tests.testUserLock3) (Tests.testUserUnlock4, Tests.testUserUnlockNonempty4) (Tests.testGroupLock3, Tests.testGroupUnlock4) (Tests.testGroupUnlockNonempty4): Test handling of unsupported encryption schemes when locking or unlocking passwords. * modules/ldap.c (userPassword_has_scheme): New function. (lu_ldap_handle_lock): Don't re-encrypt (corrupt) passwords that use a different encryption scheme than {crypt}. 2009-02-19 Miloslav Trmač <mitr@redhat.com> * tests/utils_test * tests/utils_group * tests/utils_gshadow * tests/utils_passwd * tests/utils_shadow: Test useradd with a numerical user name. * apps/luseradd.c (main): When the user name is used as a group name, never interpret it as a number. 2008-10-13 Miloslav Trmač <mitr@redhat.com> * po/POTFILES.skip: New file (used by transifex at translate.fedora.redhat.com). 2008-07-19 Miloslav Trmač <mitr@redhat.com> * tests/files_test.py (Tests.testUserAdd6, Tests.testUserMod5) (Tests.testUserSetpass4, Tests.testGroupAdd4) (Tests.testGroupMod4, Tests.testGroupSetpass4): New tests. * modules/files.c (format_generic): New parameter error. Reject fields contaning a ':' that would be interpreted as a field separator. (format_fn): Remove. (generic_add): New parameters formats, format_count instead of formatter. All users changed. Format the new line first, and refuse to use it if it is invalid. (lu_files_format_user, lu_files_format_group, lu_shadow_format_user) (lu_shadow_format_group): Fold into generic_add callers. (generic_mod): Format the new line first, and refuse to use it if it is invalid. Modify the file one line at a time instead of one field at a time. (generic_setpass): Refuse to use the new password if it contains a literal ':'. 2008-07-18 Miloslav Trmač <mitr@redhat.com> * tests/config_test.sh (workdir): * tests/pwhash_test (workdir): * tests/utils_test (workdir): Use a work directory distinct from tests/files_test. * tests/slapd.conf.in: Use the "bdb" database backend, ldbm was removed in openldap-2.4. 2008-07-13 Miloslav Trmač <mitr@redhat.com> * apps/lnewusers.1: Fix .IP argument quoting. Use sentence capitalization for field names. Fix a typo. 2008-04-09 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.9. * NEWS: Update. * po/LINGUAS: Add as. 2008-03-25 Miloslav Trmač <mitr@redhat.com> * apps/lpasswd.1 (DESCRIPTION): Fix another pasto. 2008-02-27 Miloslav Trmač <mitr@redhat.com> * apps/lusermod.c (main): Warn if the new GID does not refer to an existing group. * apps/lusermod.1: Document that --gid may output a warning if the group does not exist. Resolves libuser #1. * tests/utils_group * tests/utils_gshadow * tests/utils_passwd * tests/utils_shadow * tests/utils_test: Test usermod -g outputs a warning if the specified group does not exist. 2008-02-26 Miloslav Trmač <mitr@redhat.com> * apps/lpasswd.1 (SYNOPSIS): Fix a pasto. * apps/luseradd.1 (NAME): Fix. Bugs reported by Miloš Malík <mmalik@redhat.com>. 2008-02-23 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.8. * NEWS: Update. * Makefile.am (EXTRA_DIST): Add tests/config_import2.conf.in, tests/config_login2.defs, tests/pwhash.conf.in, tests/pwhash.py and tests/pwhash_test. * All relevant source files: Use <> for #including config.h, in particular do not use "../config.h", which can refer to a file outside the build directory. Remove #ifdef HAVE_CONFIG_H, we know that is true. * Makefile.am (HGTAG): Replace CVSTAG. (force-tag, tag, archive): Update to use Mercurial. * all files: Remove CVS keywords. * README: Point to the home page hosted at fedoraproject.org. 2008-02-16 Miloslav Trmač <mitr@redhat.com> * po/POTFILES.in: Add missing lib/misc.c. * docs/libuser.conf.5.in: Fix a typo. 2008-01-11 Miloslav Trmač <mitr@redhat.com> * tests/pwhash_test: Fix description. 2008-01-09 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.7. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update version info. * lib/common.c: New file, moving most code from modules/default.-c. (lu_common_user_default, lu_common_group_default) (lu_common_suser_default, lu_common_sgroup_default): Make public. * lib/user_private.h (LU_COMMON_DEFAULT_PASSWORD) (LU_COMMON_DEFAULT_SHADOW_PASSWORD, LU_COMMON_DEFAULT_SHELL): New definitions, moved from modules/default.-c. (lu_common_user_default, lu_common_group_default) (lu_common_suser_default, lu_common_sgroup_default) (lu_util_default_salt_specifier): New declarations. * lib/util.c (HASH_ROUNDS_MIN, HASH_ROUNDS_MAX) (parse_hash_rounds, select_hash_rounds): Move from modules/default.-c. (lu_util_default_salt_specifier): Move from modules/default.-c. Use a lu_context * instead of lu_module *. All users changed. (lu_make_crypted): Use HASH_ROUNDS_MAX. * modules/default.-c: Remove. All users changed. * Makefile.am (pkginclude_HEADERS): Remove modules/default.-c. (lib_libuser_la_SOURCES): Add lib/common.c. (modules_libuser_files_la_CPPFLAGS) (modules_libuser_shadow_la_CPPFLAGS) (modules_libuser_krb5_la_CPPFLAGS) (modules_libuser_ldap_la_CPPFLAGS) (modules_libuser_sasldb_la_CPPFLAGS): Remove. 2008-01-08 Miloslav Trmač <mitr@redhat.com> * po/sr@latin.po: Rename from po/sr@Latn.po * po/LINGUAS: Update. * docs/libuser.conf.5.in: Document SHA support. * tests/pwhash.conf.in * tests/pwhash.py: New files * tests/pwhash_test: New test. * Makefile.am (TESTS): Add tests/pwhash_test. * tests/config_import2.conf.in * tests/config_login2.defs: New files. * tests/config_login.defs: Add SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS. * tests/config_override.conf.in: Add hash_rounds_min and hash_rounds_max. * tests/config_test.sh: Create libuser_import2.conf. * tests/config_test.c (main): Add tests for hash_rounds_min and hash_rounds_max. Test ENCRYPT_METHOD and MD5_CRYPT_ENAB interaction. * lib/config.c (struct handle_login_defs_key_data): New definition. (handle_login_defs_key): Expect struct handle_login_defs_key_data * instead of struct config_config *. Handle ENCRYPT_METHOD, SHA_CRYPT_MIN_ROUNDS, SHA_CRYPT_MAX_ROUNDS. Only use MD5_CRYPT_ENAB if ENCRYPT_METHOD is not defined. (import_login_defs): Pass struct handle_login_defs_key_data * to handle_login_defs_key(). * lib/util.c (salt_type_info): New member sha_rounds. Add SHA256 and SHA512 entries. (lu_make_crypted): Add support for SHA rounds specification. * modules/default.-c (HASH_ROUNDS_MIN, HASH_ROUNDS_MAX): New macros. (lu_common_parse_hash_rounds, lu_common_select_hash_rounds): New functions. (lu_common_default_salt_specifier): Add support for sha256 and sha512. Add support for configurable number of hashing rounds. Return a newly allocated string. All callers changed. 2008-01-07 Miloslav Trmač <mitr@redhat.com> * tests/files_test.py (Tests.testUserSetpass1) (Tests.testUserSetpass2, Tests.testUserSetpass3) (Tests.testGroupSetpass1, Tests.testGroupSetpass2) (Tests.testGroupSetpass3): Don't assume the password salt is 11 characters long. 2007-12-06 Miloslav Trmač <mitr@redhat.com> * apps/lid.1: Fix grammar. 2007-11-14 Miloslav Trmač <mitr@redhat.com> * lib/util.c (lu_util_lock_obtain): Fix setting l_type. 2007-10-30 Miloslav Trmač <mitr@redhat.com> * lib/util.c (lu_util_fscreate_restore) [WITH_SELINUX]: Fix use of uninitialized data when SELinux is disabled. 2007-10-25 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.6. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * docs/Makefile.am (CLEANFILES): Add sgml/libuser-1.html and sgml/libuser-2.html. * Makefile.am (modules_libuser_files_la_LDFLAGS) (modules_libuser_shadow_la_LDFLAGS) (modules_libuser_krb5_la_LDFLAGS) (modules_libuser_ldap_la_LDFLAGS) (modules_libuser_sasldb_la_LDFLAGS) (python_libusermodule_la_LDFLAGS): Don't use -export-dynamic, that option is defined only for executables. * apps/apputil.c (lu_homedir_copy, lu_homedir_populate) (lu_homedir_move): Set up / preserve SELinux file contexts when creating / copying home directories. * lib/user_private.h (lu_security_context_t, lu_util_fscreate_save) (lu_util_fscreate_restore, lu_util_fscreate_from_file) (lu_util_fscreate_for_path): New declarations. * lib/util.c (lu_util_fscreate_save, lu_util_fscreate_restore) (lu_util_fscreate_from_file, lu_util_fscreate_for_path): New functions. * modules/files.c (set_default_context, reset_default_context): Remove. (generic_add, generic_mod, generic_del, generic_lock) (generic_setpass): Use lu_util_fscreate_save(), lu_util_fscreate_from_file() and lu_util_fscreate_restore() instead of set_default_context() and reset_default_context(). (This fixes a possible leak of prev_context). * apps/apputil.c (setup_default_context): Remove. (lu_authenticate_unprivileged): Use lu_util_fscreate_from_file() instead of setup_default_context(). * Makefile.am (lib_libuser_la_LDFLAGS): Link to SELINUX_LIBS. (modules_libuser_files_la_LDFLAGS) (modules_libuser_shadow_la_LDFLAGS): Don't link to SELINUX_LIBS directly. * docs/Makefile.am (CLEANFILES): Add sgml/libuser.html and sgml/libuser.txt. (clean-local): Remove. 2007-10-11 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.5. * NEWS: Update. * po/LINGUAS: Add kn, ro, te. * tests/files_test.py (workdir): New variable. (Tests.testUserAdd4, Tests.testUserAdd5): New tests. * tests/files_test: Pass workdir to files_test.py. * apps/apputil.c (lu_homedir_copy): Report an error if the destination (home directory) is a relative path. * python/admin.c (libuser_admin_add_user): Don't ignore a raised exception before creating a mail spool. Create an exception object if creating a mail spool fails. Beautify. (libuser_admin_delete_user): Create an exception object if removing a mail spool fails. Beautify. 2007-09-25 Miloslav Trmač <mitr@redhat.com> * tests/ldap_test.py (Tests.testUserMod4): Test empty modifications. * modules/ldap.c (dump_mods): Handle NULL mods. (lu_ldap_set): Do not call ldap_modify_ext_s() when no attributes need to be modified, to avoid spurious errors on Fedora Directory Server. Beautify. 2007-09-10 Miloslav Trmač <mitr@redhat.com> * lib/modules.c (load_one_module): Use G_MODULE_BIND_LOCAL. 2007-06-15 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.4. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * tests/files_test.py (Tests.testUserSetpass1) (Tests.testUserRemovepass) * tests/ldap_test.py (Tests.testUserSetpass1) (Tests.testUserRemovepass1): Test LU_SHADOWLASTCHANGE is updated. * modules/files.c (lu_shadow_user_setpass) (lu_shadow_group_setpass, lu_shadow_user_removepass) (lu_shadow_group_removepass): Remove redundant lu_util_update_shadow_last_change() calls. * lib/user.c (lu_user_setpass, lu_user_removepass): Save the modified LU_SHADOWLASTCHANGE value. (lu_group_setpass, lu_group_removepass): Don't update LU_SHADOWLASTCHANGE, the field is valid only for user entities. 2007-06-09 Miloslav Trmač <mitr@redhat.com> * configure.in: Version 0.56.3. * NEWS: Update. * modules/ldap.c (struct lu_ldap_context): New member sasl_mechanism. (interact): Return "" to SASL_CB_GETREALM. Shorten variable names for better formating, simplify a bit. (bind_server): Use context->sasl_mechanism. Replace contradictory LDAP_SASL_INTERACTIVE | LDAP_SASL_QUIET by LDAP_SASL_AUTOMATIC. (lu_ldap_close_module): Free sasl_mechanism. (libuser_ldap_init): Default ldap/user to "". Allow specifying SASL bind mechanism as "sasl/MECHANISM". * docs/libuser.conf.5.in: Update bindtype documentation. Original patch by Simo Sorce <ssorce@redhat.com>. 2007-04-28 Miloslav Trmač <mitr@volny.cz> * configure.in * Makefile.am: Use features available in autoconf 2.61. 2007-04-19 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.56.2. * NEWS: Update. * po/LINGUAS: Add bs. Remove languages with no translated strings. 2007-03-16 Miloslav Trmac <mitr@redhat.com> * libuser.conf: Remove all krb5 module references to avoid the slightest possibility of giving an impression that the krb5 module might work. 2007-03-02 Miloslav Trmac <mitr@redhat.com> * po/no.po: Remove, obsoleted by nb.po. * po/LINGUAS: Remove no. 2007-02-23 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.56.1. * NEWS: Update. * tests/files_test.py (Tests.testUserSetpass3) (Tests.testGroupLookupName2, Tests.testGroupSetpass3): Simplify the lambda expression. * modules/files.c (suffix_passwd, suffix_shadow, suffix_group) (suffix_gshadow): New variables. (generic_lookup, generic_add, generic_mod, generic_del, generic_lock) (generic_is_locked, generic_setpass, lu_files_enumerate) (lu_files_users_enumerate_by_group, lu_files_groups_enumerate_by_user) (lu_files_enumerate_full, lu_files_uses_elevated_privileges) (lu_shadow_uses_elevated_privileges, libuser_shadow_init): Use suffix_* instead of separate "/" and copy&pasted basenames. All users changed. * modules/files.c (lu_files_uses_elevated_privileges) (lu_shadow_uses_elevated_privileges): Fix incorrect conversion from g_strdup_printf (). * modules/files.c (SHADOW_MODULE_NAME): New macro. (ent_has_shadow): New function. (generic_setpass): Only silently ignore known shadow markers, and replace invalid shadow markers by "x"; both only if a shadow entry exists. (libuser_shadow_init): Use SHADOW_MODULE_NAME. * tests/files_test.py (Tests.testUserSetpass1): Rename from testUserSetpass. (Tests.testGroupSetpass1): Rename from testGroupSetpass. (Tests.testUserSetpass2, tests.testUserSetpass3) (Tests.testGroupSetpass2, tests.testGroupSetpass3): New tests. * tests/files_test: Update file contents. 2007-02-17 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.56. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * NEWS: Update. * configure.in (AM_INIT_AUTOMAKE): Use dist-bzip2. * Makefile (archive): Use the bzip2 tarball. * tests/files_test.py (Tests.testUserLookupName3) (Tests.testUserDefault, Tests.testGroupLookupName3) (Tests.testGroupDefault): New tests. * tests/files_test: Update file contents. * apps/apputil.c (lu_mailspool_create_remove) * apps/lnewusers.c (main) * lib/user.c (lu_default_int) * modules/files.c (lu_files_user_lookup_id) (lu_shadow_user_lookup_id, lu_files_group_lookup_id) (lu_shadow_group_lookup_id, generic_del) * modules/ldap.c (lu_ldap_base, lu_ldap_user_lookup_id) (lu_ldap_group_lookup_id, lu_ldap_handle_lock) (lu_ldap_users_enumerate_by_group): Don't use g_strdup_printf () when a simpler alternative can be used. * lib/error.c (lu_error_new): Don't use lu_strerror () result as a format string. Beautify. * apps/lchage.c (read_ndays): Assume the value is a G_TYPE_LONG. Return a g_type_long. All callers updated. (date_to_string): Use glong for n_days. * lib/user.c (lu_default_int) * modules/ldap.c (lu_ldap_lookup): Use lu_value_init_set_attr_from_string (). Report invalid values. * tests/ldap_test.py (Tests.testUserAdd2): Use correct value types. * docs/reference/tmpl/entity.sgml: Document the value types used for entities. * lib/config.c (handle_default_useradd_key): Try harder to eliminate the possibility of date overflow. 2007-02-16 Miloslav Trmac <mitr@redhat.com> * apps/lid.c (do_id): Avoid an unnecessary lu_value_strdup (). * lib/util.c (salt_type_info): Use char[] instead of char * and reorder fields within the structure to eliminate run-time relocations and save some space. * docs/reference/tmpl/error.sgml: Add missing parameter documentation. * lib/user.c (lu_user_setpass, lu_user_removepass) (lu_group_setpass, lu_group_removepass, lu_default_int): Use lu_util_update_shadow_last_change (). * lib/util.c (lu_util_shadow_current_date): Return the number of days as an integer. Clean up. (lu_util_update_shadow_last_change): Move from ... * modules/files.c (set_shadow_last_change): ... here. All callers updated. * lib/internal.h (lu_util_shadow_current_date): Update prototype. Move declaration from... * lib/user_private.h (lu_util_shadow_current_date): ... here. (lu_util_update_shadow_last_change): New declaration. (LU_MODULE_VERSION): Bump. * lib/user.c (replace_all): New function, based on a part of lu_default_int (). (lu_default_int): Perform substitutions one by one instead of precomputing a list of them. 2007-02-15 Miloslav Trmac <mitr@redhat.com> * lib/user.c (run_list): Avoid unnecessary g_value_dup_string (). * lib/entity.c (lu_ent_dump): Remove output of value types that are not expected to appear. (lu_ent_add_module): Only copy the module name if it is not already present in ent->modules. * modules/files.c (line_read): Simplify and clean up. (generic_del): Use memmove for copying strings that overlap. Clean up the code a bit. * apps/lnewusers.c (main) * lib/prompt.c (lu_prompt_console): Eliminate duplicate strchr () calls. * lib/entity.c (lu_ent_del_int): Use lu_values_equal () instead of g_strdup_value_contents (), which is intended for human-readable debugging dumps. * lib/entity.c (lu_ent_dump_attributes): Split from lu_ent_dump_attributes (). Show something for unsupported value types. 2007-01-06 Jeremy Katz <katzj@redhat.com> * python/misc.c (libuser_prompt_destroy): Use PyObject_DEL since we allocated with PyObject_NEW (#220679) * python/ent.c (libuser_entity_destroy): Likewise. * python/admin.c (libuser_admin_destroy): Likewise. 2006-12-14 Miloslav Trmac <mitr@redhat.com> * python/admin.c (AdminType) * python/ent.c (libuser_entity_mapping_methods, EntityType) * python/misc.c (PromptType): Remove casts, use comments to indicate struct members. * python/admin.c (libuser_admin_setattr) (libuser_admin_get_first_unused_id, libuser_admin_get_first_unused_gid) (libuser_admin_new): Add manual casts to conform to PyCFunctionWithKeywords. (libuser_admin_get_first_unused_id_type): Remove unnecessary variable. (libuser_admin_methods) [getUserShells]: Use METH_NOARGS. * python/common.h (lenfunc): Remove definition. (libuser_admin_new, libuser_prompt_new, libuser_get_user_shells): Update prototypes. * python/ent.c (libuser_entity_destroy, libuser_entity_getattr) (libuser_entity_setattr, libuser_entity_length) (libuser_entity_get_item, libuser_entity_set_item): Add manual casts to conform to method types. (libuser_entity_getattrlist, libuser_entity_module) (libuser_entity_clear_all, libuser_entity_revert): Use METH_NOARGS. (libuser_entity_get, libuser_entity_add, libuser_entity_set) (libuser_entity_clear) (libuser_entity_has_key): Add manual casts to conform to PyCFunction. (libuser_entity_methods) [getattrlist, keys, clear_all, revert] [modules]: Use METH_NOARGS. [has_key, get, clear, set, add]: Remove casts. * python/libusermodule.c (libuser_get_user_shells): Use METH_NOARGS. (libuser_methods) [prompt, get_user_shells, PROMPT, getUserShells]: Use METH_NOARGS. * python/misc.c (libuser_prompt_destroy, libuser_prompt_getattr) (libuser_prompt_setattr, libuser_prompt_print): Add manual casts to conform to method types. (libuser_prompt_new): Use METH_NOARGS. * python/admin.c (libuser_admin_new) * python/misc.c (libuser_prompt_new): Remove redundant declarations. 2006-12-10 Miloslav Trmac <mitr@redhat.com> * configure.in (AM_GNU_GETTEXT_VERSION): Use gettext-0.14.6. * configure.in: Version 0.55. * NEWS: Update. * autogen.sh * Makefile.am (EXTRA_MANS, pkginclude_HEADERS, dist_noinst_SCRIPTS) [QUOTA] (noinst_PROGRAMS, lib_LTLIBRARIES, pyexec_LTLIBRARIES) * configure.in * docs/reference/libuser-docs.sgml * docs/reference/libuser-sections.txt * python/modules.txt: Remove the quota library and Python module. * docs/reference/tmpl/quota.sgml * lib/userquota.3 * lib/userquota.c * lib/userquota.h * python/quota-script * python/quotamodule.c * samples/quotaq.c: Removed files. * python/admin.c (libuser_admin_setattr) (libuser_admin_lookup_user_name, libuser_admin_lookup_user_id) (libuser_admin_lookup_group_name, libuser_admin_lookup_group_id) (libuser_admin_do_wrap, libuser_admin_wrap_boolean) (libuser_admin_setpass, libuser_admin_create_home) (libuser_admin_remove_home, libuser_admin_move_home) (libuser_admin_create_remove_mail, libuser_admin_add_user) (libuser_admin_delete_user) (libuser_admin_get_first_unused_id_type, libuser_admin_new) * python/ent.c (libuser_entity_add, libuser_entity_set) (libuser_entity_clear, libuser_entity_clear_all) (libuser_entity_revert, libuser_entity_has_key) * python/misc.c (libuser_admin_prompt, libuser_prompt_getattr): * python/quotamodule.c (quotamodule_set, quotamodule_on) (quotamodule_off): Replace all trivial uses of Py_BuildValue (). * python/misc.c (libuser_admin_prompt, libuser_prompt_setattr): Remove an unnecessary use of typeof. * apps/apputil.c (lu_converse): Use calloc () instead of malloc () and memset (). * python/common.h (Py_ssize_t, lenfunc): New definitions. * python/ent.c (libuser_entity_setattr, libuser_entity_set) (libuser_entity_length, libuser_entity_set_item): Use Py_ssize_t. (libuser_entity_mapping_methods): Use lenfunc. * python/misc.c (libuser_admin_python_prompter, libuser_admin_prompt): Use Py_ssize_t. * python/quotamodule.c (Py_ssize_t): New definition. (quotamodule_set): Use Py_ssize_t. 2006-11-02 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.54.8. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * NEWS: Update. * lib/config.c (handle_default_useradd_key): Import HOME. * docs/libuser.conf.5.in: Document HOME is imported from default/useradd. * tests/config_default_useradd * tests/config_override.conf.in * tests/config_test.c (main): Test import of HOME. 2006-09-25 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.54.7. * NEWS: Update. * po/LINGUAS: Add el, ml and or. 2006-05-01 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.54.6. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * NEWS: Update. * apps/lchsh.c (main): Provide a more verbose error message. * apps/apputil.c (lu_homedir_copy): Split from lu_homedir_populate. Reformat a bit. (lu_homedir_populate): New parameter ctx. Default skeleton to defaults/skeleton. All users updated to pass NULL instead of reading the config value. * apps/apputil.h (lu_homedir_populate): Update prototype. * python/admin.c (libuser_admin_add_user): New keyword parameter "skeleton". * python/modules.txt: Document new addUser parameter. 2006-03-12 Miloslav Trmac <mitr@redhat.com> * modules/ldap.c (get_ent_mods): Remove unused parameter module. * lib/getdate.y: Quiesce some warnings. * lib/config.c (read_file): Make type conversion explicit, assuming sizeof (off_t) >= sizeof (size_t). 2006-03-06 Miloslav Trmac <mitr@redhat.com> * python/admin.c (libuser_admin_enumerate_users) (libuser_admin_enumerate_groups) (libuser_admin_enumerate_users_by_group) (libuser_admin_enumerate_groups_by_user): Don't attempt to g_value_array_free(NULL). * lib/user.c (extract_id, extract_name): Don't warn if the attribute has no value, leave it to the caller. (lu_refresh_int): Don't unnecessarily call extract_id(). Don't attempt to refresh an entity without name. (convert_user_name_to_id, convert_group_name_to_id): Report errors when the entity can't be found or has no ID. (ent_has_name_and_id): New function. (lu_dispatch): Report more detailed errors on insufficiently filled entities, also fixing a memory leak. Use constants for unused sdata, ldata parameters. * lib/user.c (lu_dispatch): Use g_assert_not_reached(). * apps/lid.c (do_id): Report lookup error. Exit with status 1 on error. * apps/lchsh.c (main): Report error on prompting. Exit with status 1 on error. * apps/lchfn.c (main): Exit with status 1 on error. * apps/apputil.c (lu_mailspool_create_remove): Fix memory leak. 2006-03-05 Miloslav Trmac <mitr@redhat.com> * modules/files.c (parse_generic): Fix crash if the last field is empty. (lu_files_enumerate_full): Don't return empty data if the input line is invalid. Match only the user name against the supplied pattern. * tests/files_test.py (Tests.testUsersEnumerateFull3) (Tests.testGroupsEnumerateFull3): New tests. 2006-02-21 Miloslav Trmac <mitr@redhat.com> * lib/getdate.y: Add missing #include. Define YYENABLE_NLS to avoid -Wundef. * configure.in: Version 0.54.5. * NEWS: Update. * configure.in: Use newer gettext. * docs/libuser.conf.5.in: Remove @pkglibdir@ references to avoid multilib conflicts. * docs/Makefile.am (libuser.conf.5): Stop replacing @pkglibdir@. * modules/sasldb.c (lu_sasldb_close_module): Fix invalid aliasing. 2006-02-13 Miloslav Trmac <mitr@redhat.com> * po/LINGUAS: Add my. * configure.in: Version 0.54.4. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. 2006-01-31 Miloslav Trmac <mitr@redhat.com> * configure.in (WITH_PYTHON): New conditional. * Makefile.am (pyexec_LTLIBRARIES, pyexec_LTLIBRARIES): Only use if WITH_PYTHON. Based on a patch by Dan Yefimov <dan@ns15.lightwave.net.ru>. * lib/scache.c (get_keys): Fix C99-ism, patch by Dan Yefimov <dan@ns15.lightwave.net.ru>. 2005-12-20 Miloslav Trmac <mitr@redhat.com> * po/LINGUAS: Add hy, sr and sr@Latn. 2005-12-02 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.54.3. * NEWS: Update. * apps/lpasswd.c (main): Determine user name before attempting to autenticate a NULL user. 2005-11-12 Miloslav Trmac <mitr@redhat.com> * modules/krb5.c (lu_krb5_user_add) * modules/ldap.c (lu_ldap_handle_lock, lu_ldap_setpass): Use g_str_has_prefix () where appropriate. 2005-11-11 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.54.2. * NEWS: Update. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * modules/ldap.c (close_server, connect_server, bind_server) (lu_ldap_ent_to_dn, lu_ldap_lookup, lu_ldap_fudge_objectclasses) (lu_ldap_is_locked, lu_ldap_setpass, lu_ldap_user_enumerate): Avoid functions deprecated by openldap. (objectclass_present, lu_ldap_needed_objectclasses): Use BerValue's instead of strings. All callers updated. (free_needed_objectclasses): New function. * configure.in: Remove checks for no longer used deprecated openldap functions. (lu_ldap_close_module): Use close_server (). (lu_ldap_set, lu_ldap_del, lu_ldap_handle_lock, lu_ldap_is_locked) (lu_ldap_setpass, connect_server, bind_server): Replace empty LDAP control vectors by NULL. 2005-10-11 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.54.1. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * libuser.pc.in (Requires) * configure.in: Use gmodule-no-export-2.0. * libuser.conf: Rename from libuser.conf.in, hardcode @sysconfdir@ to /etc. * Makefile.am: Ship libuser.conf instead of libuser.conf.in. * libuser.conf.in: Update to import values from shadow where possible. * NEWS: Update. 2005-10-10 Miloslav Trmac <mitr@redhat.com> * tests/config_default_useradd, testes/config_import.conf.in, tests/config_login.defs, tests/config_override.conf.in: New files. * tests/config_test.sh: Generate three config files, pass $workdir to config_test instead of setting LIBUSER_CONF. * tests/config_test.c (start): Split from main (). Set LIBUSER_CONF. (verify_var): Abstract from main (). (main): Test configuration import from shadow. * Makefile.am (EXTRA_DIST): Distribute the new test components. * lib/config.c (handle_login_defs_key): Fix pasto. Don't use the first member of conv[] over and over. 2005-10-09 Miloslav Trmac <mitr@redhat.com> * Most functions: Move variables to inntermost scope, remove unnecessary initializers. * modules/ldap.c (struct lu_ldap_context): New members user_branch, group_branch. (libuser_ldap_init): Initialize user_branch, group_branch. (lu_ldap_base, lu_ldap_ent_to_dn, lu_ldap_lookup, lu_ldap_set) (lu_ldap_del, lu_ldap_handle_lock, lu_ldap_is_locked, lu_ldap_setpass) (lu_ldap_enumerate): Replace the configKey and def parameters by branch. All callers changed to use struct lu_ldap_context members. (lu_ldap_ent_to_dn): Rename variable branch to base. (lu_ldap_base): Don't access module before asserting it is non-NULL. Fix checking of empty branch. (lu_ldap_ent_to_dn): Remove unused variable base. Map namingAttr to LDAP only once. (libuser_ldap_init): Fix memory leak. * modules/ldap.c (LU_LDAP_USER, LU_LDAP_GROUP, LU_LDAP_SHADOW): Remove. (ldap_attribute_map): Replace applicability by type. (lu_ldap_lookup): Replace applicability by type. All callers changed. * modules/ldap.c (lu_ldap_base, lu_ldap_lookup, lu_ldap_set) (lu_ldap_del, lu_ldap_handle_lock, lu_ldap_is_locked, lu_ldap_setpass): Remove handling of NULL which can't ever trigger. * modules/ldap.c (lu_ldap_user_lookup_name, lu_ldap_user_lookup_id) (lu_ldap_group_lookup_name, lu_ldap_group_looup_id, getn_ent_adds) (lu_ldap_is_locked, lu_ldap_setpass, lu_ldap_users_enumerate) (lu_ldap_users_enumerate_full, lu_ldap_groups_enumerate) (lu_ldap_groups_enumerate_full, lu_ldap_users_enumerate_by_group) (lu_ldap_gropus_enumerate_by_user): Hardcode constant results of map_to_ldap (). * docs/libuser.conf.5.in: New file. * docs/Makefile.am: Ship and install libuser.conf.5. 2005-10-07 Miloslav Trmac <mitr@redhat.com> * lib/config.c (destroy_section): Split from lu_cfg_done(). (gather_values): Removed function. (lu_cfg_done): Don't build a temporary list of sections to free. (lu_cfg_read_single): Don't unnecessarily cache the default value. * config.c (key_add_cached): Split from lu_cfg_init (). (key_defined, key_add, handle_login_defs_key, import_login_defs) (handle_default_useradd_key, import_default_useradd): New functions. (lu_cfg_init): Handle import/login_defs and import/default_useradd. * configure.in (YACC): New check. * Makefile.am (lib_libuser_la_SOURCES): Add lib/getdate.y. * lib/getdate.y: New file, copied from shadow and made reentrant. * lib/internal.h: Declare lu_get_date (). Remove dependencies on other headers. * lib/modules.c (load_one_module): Split from lu_modules_load. Fix leaks. (lu_modules_load): Keep the *modules unchanged on failure. (lu_module_unload): Simplify. * lib/user.c (lu_start): Allocate ctx->scache before lu_cfg_init (). Fix leaks. (lu_end): Remove unnecessary NULL checks. * tests/ldap_test: Allow more time for slapd initialization. 2005-10-01 Miloslav Trmac <mitr@redhat.com> * lib/config.c (process_line): Cast arguments of isspace () to unsigned char. * apps/apputil.c: Remove unnecessary #include <ctype.h>. * lib/config.c (process_line): Split from lu_cfg_init (). Handle very large files and EINTR from read (). Fix FD leak on fstat () failure. Don't prezero the buffer. * lib/config.c (process_line): Fix accesses before the allocated array. Add some microoptimizations. 2005-09-30 Miloslav Trmac <mitr@redhat.com> * modules/default.-c (salt_initializer_des, salt_initializer_md5) (salt_initializer_blowfish): Remove unnecessary variables, fold values in lu_common_default_salt_specifier (). 2005-09-29 Miloslav Trmac <mitr@redhat.com> * modules/files.c (libuser_shadow_init): Avoid useless runtime computation. * modules/files.c (lu_files_uses_elevated_privileges): Hardcode "/etc" as default, like other functions. * Makefile.am (modules_libuser_files_la_CPPFLAGS) (modules_libuser_shadow_la_CPPFLAGS): Don't define SYSCONFDIR. (modules_libuser_files_la_CPPFLAGS): Define SYSCONFDIR directly. (SYSCONFDIR): Remove definition. 2005-09-14 Miloslav Trmac <mitr@redhat.com> * apps/apputil.c (lu_authenticate_unprivileged): Correctly handle pam_get_item () failures. 2005-09-13 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.54. * Makefile.am (lib_libuser_la_LDFLAGS): Update revision. * NEWS: Update. * apps/apputil.h * lib/internal.h: Add G_GNUC_INTERNAL to all declarations. * lib/util.c (lu_strv_len): Remove. * lib/user_private.h (lu_strv_len): Remove declaration. * lib/user.c (lu_default_int): Replace lu_str_case_equal () with its contents. * lib/util.c (lu_str_case_equal, lu_str_equal) (lu_account_name_is_valid): Remove unused functions (not exported in public header files). * lib/internal.h (lu-str_case_equal, lu_str_equal) (lu_account_name_is_valid: Remove declarations. * apps/apputil.c (lu_strconcat): Comment out like its only user. * apps/apputil.h (lu_strconcat): Remove declaration. * lib/internal.h: Merge lib/modules.h and lib/util.h. * lib/user_private.h: Move internal interfaces to internal.h. * Makefile.am (lib_libuser_la_SOURCES) * docs/reference/Makefile.am (IGNORE_HFILES) * lib/config.c * lib/entity.c * lib/misc.c * lib/modules.c * lib/scache.c * lib/user.c * modules/krb5.c: Update. 2005-09-12 Miloslav Trmac <mitr@redhat.com> * apps/apputil.c (lu_converse) * apps/lnewusers.c (main) * lib/error.c (lu_error_free) * python/misc.c (libuser_prompt_setattr): Remove conditionals around g_free () or g_strfreev (). * apps/lchfn.c (main) * apps/lnewusers.c (main) * lib/util.c (lu_strv_len) * modules/files.c (parse_generic): Use g_strv_length (). * lib/user_private.h (lu_strv_len): Mark as deprecated. * apps/apputil.c (lu_converse): Actually use the "pending" messages. * lib/entity.c (quark_from_attribute): Use g_ascii_strdown (). * modules/files.c (struct format_specifier): Remove member position, assume position == index + 1. (format_passwd, format_group, format_shadow, format_gshadow) (parse_generic, format_generic, generic_mod): Update. * lib/entity.c (lu_ent_add_int) * modules.files.c (format_generic, generic_mod): Beautify. * modules/files.c (generic_mod): Simplify name extraction. * modules/files.c (format_field): New function. (format_generic, generic_mod): Use format_field (). * lib/entity.c (quark_from_attribute): New function. (lu_ent_get_int, lu_ent_clear_int, lu_ent_set_int, lu_ent_add_int): Use quark_from_attribute (). * modules/files.c (generic_mod): Fix crash when attribute is missing. * tests/files_test.py (Tests.testUserMod4): New test. * modules/files.c (parse_generic): Use size_t for field index. * apps/lchage.c (read_ndays): Assume array != NULL && array->n_values > 0. Beautify. * lib/user.c (merge_ent_array_duplicates) * modules/files.c (generic_is_locked) * modules/ldap.c (lu_ldap_lookup, get_ent_adds): Beautify. * apps/lchage.c (main) * apps/lchsh.c (main) * apps/luserdel.c (main) * lib/user.c (lu_dispatch) * modules/files.c (lu_shadow_user_lookup_id, lu_shadow_group_lookup_id) (format_generic): Simplify conditions based on the guarantee below. * docs/reference/tmpl/entity.sgml: Document that attribute values have always at least one value. * lib/entity.c (lu_ent_set_int, lu_ent_del_int): Remove the attribute if there are no values. 2005-06-08 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53.8. * NEWS: Update. * tests/ldap_test: Remove temporary debugging modification. * lib/user.c (lu_name_allowed, INVALID_NAME_CHARS): Permit "portable" user and group names as defined by SUSv3, plus trailing $. * tests/files_test.py (Tests.testUserAddPrep): New test. * lib/error.h: Use G_GNUC_PRINTF. * python/debug.h (FIXME): Remove unused definition. 2005-06-04 Miloslav Trmac <mitr@redhat.com> * autogen.sh: Don't set CFLAGS, we don't run configure any more. * configure.in: Use gettext 0.14.3. * tests/ldap_test: Really use tests/ldaprc. 2005-05-20 Miloslav Trmac <mitr@redhat.com> * autogen.sh: Document the full set of testing flags. Remove hardcoded paths (used to be necessary to workaround parsing paths in configure). * configure.in, Makefile.am: Don't attempt to parse paths in configure, let (make) expand the variables. * libuser.conf.in: Don't use both @scdir@ and @sysconfdir@. * tests/config_test.sh: New file. * tests/config.conf: Rename from tests/config.conf.in. Define defaults/moduledir to point to the build directory. * tests/config_test.c: Don't define LIBUSER_CONF, it is defined by the wrapper script now. * configure.in: Remove many unnecessary tests, simplify others. Fix checking for __secure_getenv(). * Makefile.am: Hardcode variables with only a single possible value * configure.in: Disable building of static libraries. * Makefile.am: Don't remove *.{a,la} of plugins. 2005-04-30 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53.7. * NEWS: Update. * configure.in: Remove unused GETTEXT_PACKAGE definition. * po/LINGUAS: New file, moved from ALL_LINGUAS in configure.in. Add missing languages (bn_IN, en_GB, et, fi, gu, he, id, ka, ku, lo, mr, si, sq, ur). 2005-04-24 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53.6. * NEWS: Update. * Makefile.am: Don't ship test/config_test in distribution tarball. * autogen.sh: Don't automatically run configure. * Makefile.am: Update. * tests/config_test.c, tests/config.conf: New files. * Makefile.am: Add tests/config_test.c and tests/config.conf. * lib/config.c (lu_cfg_init): Don't ignore keys with empty values. * lib/config.c (struct config_config): Store the configuration in parsed form, not only the text of the config file. (lu_cfg_init): Parse the configuration only at initialization time. (lu_cfg_done): Update. (lu_cfg_read, lu_cfg_read_keys): Use the paresd configuration. (compare_section_names, compare_key_string, gather_values): New functions. 2005-04-15 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53.5. * NEWS: Update. * tests/files_test.py (Tests.testUserEnumerate1): Rename from testUserEnumerate. (Tests.testGroupsEnumerate1): Rename from testGroupsEnumerate. (Tests.testUsersEnumerateFull1): Rename from testUsersEnumerateFull. Simplify. (Tests.testGroupsEnumerateFull1): Rename from testGroupsEnumerateFull. Simplify. (Tests.testUsersEnumerateByGroup3): Simplify. (Tests.testUserEnumerate2, Tests.testUsersEnumerateByGroup4) (Tests.testUsersEnumerateFull2, Tests.testGroupsEnumerate2) (Tests.testGroupsEnumerateByUser4, Tests.testGroupsEnumerateFull2): New tests. * modules/files.c (lu_files_enumerate) (lu_files_users_enumerate_by_group) (lu_files_groups_enumerate_by_user, lu_files_enumerate_full): Skip nss_compat lines (starting with '+' or '-'). * tests/files_test: Update initial file contents. * apps/apputil.c: Remove unnecessary include. * configure.in: Use AM_PATH_PYTHON instead of --with-python-version. * Makefile.am (pythonexecdir): Replace by pyexecdir. (DISTCHECK_CONFIGURE_FLAGS): Remove --with-python-version. (PYTHON_CPPFLAGS): New definition. 2005-04-06 Miloslav Trmac <mitr@volny.cz> * configure.in: Version 0.53.4. * NEWS: Update. 2005-04-06 Miloslav Trmac <mitr@redhat.com> * modules/ldap.c (ldap_attribute_map): Fix "cn" objectclass. (lu_ldap_needed_objectclasses): Don't add "account" objectclass if it is already present. (lu_ldap_fudge_objectclasses): Add debugging output. 2005-03-05 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53.3. * NEWS: Update. 2005-03-04 Miloslav Trmac <mitr@redhat.com> * apps/apputil.c (lu_homedir_populate, lu_signal_nscd) (lu_mailspool_create_remove) * modules/files.c (lu_files_create_backup, generic_add, generic_del): Add more error checking. * modules/ldap.c: Include Cyrus SASL v2 header file. * modules/krb5.c (lu_krb5_user_add, lu_krb5_user_mod) (lu_krb5_user_del, lu_krb5_user_do_lock, lu_krb5_user_islocked) (lu_krb5_user_setpass): Fix checking of lu_ent magic. * docs/reference/libuser-sections.txt: Add lu_values_equal. * docs/reference/tmpl/value.sgml: Document lu_values_equal (). 2005-01-17 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53.2. * NEWS: Update. * tests/utils_test * tests/utils.conf.in * tests/utils_group * tests/utils_gshadow * tests/utils_passwd * tests/utils_shadow: New files. * Makefile.am: Add tests/utils_test. * apps/lgroupmod.c (main): Fix ignoring of other changes when one of -p, -P, -L, -U is used. Fix group ID changes (look up group members in the original group, and only after applying other member list modifications; don't change primary group ID for users that have a different primary group). * apps/lgroupmod.1: Fix typo. * apps/lnewusers.c (main): Don't use "users" if the input specifies a nonexistent group name. Use the specified user ID. * apps/lnewusers.1: Update. * apps/luseradd.c (main): Actually implement -p and -P. * apps/lusermod.c (main): Fix ignoring of other changes when one of -p, -P, -L, -U is used. 2005-01-15 Miloslav Trmac <mitr@redhat.com> * apps/lchage.1 * apps/lgroupadd.1 * apps/lgroupdel.1 * apps/lgroupmod.1 * apps/lid.1 * apps/lnewusers.1 * apps/lpasswd.1 * apps/luseradd.1 * apps/luserdel.1 * apps/lusermod.1: New files. * Makefile.am: Add new man pages. * apps/lchage.c (main): Fix cut-and-paste error in -E and -W. * apps/lpasswd.c (main): Make sure the password is always '\0'-terminated. * apps/luseradd.c (main): Exit if a new group can't be created. 2004-12-13 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53.1. * NEWS: Update. * python/libusermodule.c (initlibuser): Export UT_NAMESIZE from <utmp.h>. * pythone/modules.txt: Document UT_NAMESIZE. 2004-11-14 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.53. * NEWS: Update. * docs/reference/libuser-sections.txt * docs/reference/tmpl/user.sgml: Document lu_user_unlock_nonempty () and lu_group_unlock_nonempty (). * tests/files_test.py (Tests.testUserUnlockNonempty1) (Tests.testUserUnlockNonempty2, Tests.testUserUnlockNonempty3) (Tests.testGroupUnlockNonempty1, Tests.testGroupUnlockNonempty2) (Tests.testGroupUnlockNonempty3) * tests/ldap_test.py (Tests.testUserUnlockNonempty1) (Tests.testUserUnlockNonempty2, Tests.testUserUnlockNonempty3) (Tests.testGroupUnlockNonempty1, Tests.testGroupUnlockNonempty2) (Tests.testGroupUnlockNonempty3): Add tests for lu_user_unlock_nonempty () * modules/files.c (reset_default_context): Don't report error in restoring default context, there is no way to handle them anyway. * python/admin.c (libuser_admin_unlock_user) (libuser_admin_unlock_group): Allow calling lu_user_unlock_nonempty () and lu_group_unlock_nonempty (). * python/modules.txt: Document unlockUser nad unlockGroup changes. * tests/files_test.py (Tests.testUserUnlock3) (Tests.testGroupUnlock3) * tests/ldap_test.py (Tests.testUserUnlock3) (Tests.testGroupUnlock2): Test that empty password fields can be unlocked. * modules/ldap.c (enum lock_op): New definition. (lu_ldap_handle_lock): Use enum lock_op. All callers changed. (lu_ldap_user_unlock_nonempty, lu_ldap_group_unlock_nonempty) (libuser_ldap_init): Handle user_unlock_nonempty and group_unlock_nonempty. * modules/files.c (enum lock_op): New definition. (lock_process): Use enum lock_op, return error status. (generic_lock): Use enum lock_op. All callers changed. (lu_files_user_unlock_nonempty, lu_files_group_unlock_nonempty) (lu_shadow_user_unlock_nonempty, lu_shadow_group_unlock_nonempty) (libuser_files_init, libuser_shadow_init): Handle user_unlock_nonempty and group_unlock_nonempty. * modules/sasldb.c (lu_sasldb_user_unlock_nonempty) (lu_sasldb_group_unlock_nonempty, libuser_sasldb_init): Define user_unlock_nonempty and group_unlock_nonempty stubs. * lib/error.h (lu_error_unlock_empty): New definition. * lib/error.c (lu_strerror, lu_error_is_error): Handle lu_error_unlock_empty. * lib/user_private.h (LU_MODULE_VERSION): Bump. (struct lu_module): New members user_unlock_nonempty, group_unlock_nonempty. * lib/modules.c (lu_modules_load): Handle new struct lu_module members. * lib/user.c (lu_user_unlock_nonempty, lu_group_unlock_nonempty): New functions. (lu_dispatch_id): New values user_unlock_nonempty, group_unlock_nonempty. (run_single, run_list, lu_dispatch): Handle new lu_dispatch_id values. * lib/user.h: Add declarations. * NEWS: Update. * tests/files_test.py (Tests.testUserLock1, Tests.testUserLock2) (Tests.testUserUnlock1, Tests.testUserUnlock2) (Tests.testUserIslocked1, Tests.testUserIslocked2) (Tests.testUserSetpass, Tests.testUserRemovepass) (Tests.testGroupLock1, Tests.testGroupLock2) (Tests.testGroupUnlock1, Tests.testGroupUnlock2) (Tests.testGroupIsLocked1, Tests.testGroupIsLocked2) (Tests.testGroupSetpass, Tests.testGroupRemovepass): Test the functions don't change the non-shadow password fields. * modules/files.c (generic_setpass): Allow setting a shadow password even if the current shadow password is invalid. All callers updated. * apps/luseradd.c (main): Don't attempt to create a user group if --gid specifies a numerical ID of a non-existing group. * apps/lnewusers.c (main): Fix handling of empty home directory field. * apps/lusermod.c (main): Make copies of entity values that get destroyed by lu_user_modify (). Get a list of groups an user is in before renaming the user. Don't reuse 'ent' for group entitites. * NEWS: Update. 2004-11-13 Miloslav Trmac <mitr@redhat.com> * modules/files.c (struct format specifier): New member def_if_empty. (format_passwd, format_group, format_shadow, format_gshadow): Update. (parse_generic): Check for def_if_empty. * apps/lgroupadd.c (main) * apps/lgroupmod.c (main) * apps/lchage.c (read_ndays) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main) * lib/misc.c (lu_value_get_id) * lib/user.c (lu_default_int) * modules/files.c (parse_field) * modules/ldap.c (lu_ldap_lookup) * samples/lookup.c (main): Check strto* () for error yet more properly. * tests/files.conf.in, tests/files_test, tests/files_test.py: New files. * Makefile.am: Add tests/files_test. (EXTRA_DIST): Don't change values depending on whether LDAP is used. * modules/files.c (libuser_files_init, libuser_shadow_init): Allow using the modules as non-root if explicitly requested. 2004-11-09 Miloslav Trmac <mitr@redhat.com> * tests/ldap_test.py (Tests.testUserLookupId) (Tests.testGroupLookupId): Test large ID values. (Tests.testUserAdd4, Tests.testUserMod3, Tests.testGroupAdd3) (Tests.testGroupMod3): New tests. * apps/lusermod.c (main): Fix user renaming in groups where the user is a member or administrator. * python/ent.c (libuser_convert_to_value): Handle whole id_t range. * python/ent.c (libuser_convert_to_value): Report Python exception instead of aborting. Return success/failure status. (libuser_entity_setattr, libuser_entity_add, libuser_entity_set) (libuser_entity_set_item): Handle errors reported by libuser_convert_to_value(). * python/ent.c (convert_value_array_pylist): Handle G_TYPE_INT64. * python/admin.c (lubser_admin_lookup_user_id) (libuser_admin_lookup_group_id, libuser_admin_create_home) (libuser_admin_get_first_unused_id_type): Handle whole uid_t/gid_t range. 2004-11-08 Miloslav Trmac <mitr@redhat.com> * lib/user.c (lu_default_int): Use id_t. * lib/user.c (lu_get_first_unused_id): Change the interface to use id_t. Don't allow (id_t)-1. * lib/user_private.h: Update prototype. * modules/files.c (format_passwd, format_group): Use G_TYPE_INVALID for id_t. (parse_field): Handle G_TYPE_INVALID. * modules/files.c (parse_field): New function, split from parse_generic (). Don't interpret input as octal or hexadecimal numbers. (parse_generic): Use parse_field (). * modules/ldap.c (lu_ldap_lookup): Convert id_t values to numbers, not strings. Don't interpret input as octal or hexadecimal numbers. * samples/lookup.c (main): Handle whole id_t range. * lib/user.c (lu_default_int): Convert id_t values to numbers, not strings. Don't interpret input as octal or hexadecimal numbers. * lub/user.c (lu_default_int): Handle whole range of uid_t/gid_t in '%u' substitution. * lib/user.c (lu_default_int): Remove copy-and-pasted usage of idkeystring as a generic fallback. * lib/user.c (lu_default_int): Handle whole ID range. * lib/user.c (compare_strings): Replace compare_ints (). (merge_ent_array_duplicates): Use lu_value_strdup () instead of poking in GValues. * modules/ldap.c (value_compare): Removed function. * lib/entity.c (lu_ent_add_int) * lib/user.c (remove_duplicate_values) * modules/ldap.c (arrays_equal, get_ent_mods): Use lu_values_equal (). * lib/misc.c (lu_values_equal): New function. * lib/user.h: Add declaration. * apps/lgroupmod.c (main) * apps/lgroupadd.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main): Handle whole gid_t/uid_t range for '--gid' and '--uid', respectively. 2004-11-07 Miloslav Trmac <mitr@redhat.com> * apps/apputil.h (INVALID): Removed definition. * apps/apputil.c (lu_mailspool_create_remove) * apps/lgroupadd.c (main) * apps/lgroupmod.c (main) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main): Use LU_VALUE_INVALID_ID to indicate unknown value. * lib/user.c (INVALID): Removed definition. (extract_id, convert_user_name_to_id, convert_group_name_to_id): Return LU_VALUE_INVALID_ID on failure. All callers changed. (lu_dispatch): Use LU_VALUE_INVALID_ID to indicate unknown value. All callers changed. * samples/testuser.c (dump_attribute): Handle G_TYPE_INT64. * modules/ldap.c (lu_ldap_user_lookup_id): Handle whole uid_t range. (lu_ldap_group_lookup_id, lu_ldap_users_enumerate_by_group): Handle whole gid_t range. * modules/files.c (lu_files_user_lookup_id) (lu_shadow_user_lookup_id): Handle whole uid_t range. (lu_files_group_lookup_id, lu_shadow_group_lookup_id) (lu_files_users_enumerate_by_group): Handle whole gid_t range. * lib/user.c (run_single, run_list): Use id_t for ldata. All callers changed. (convert_user_name_to_id): Return uid_t. (convert_group_name_to_id): Return gid_t. * lib/entity.c (lu_ent_dump): Handle G_TYPE_INT64. * apps/luserdel.c (main): Handle whole gid_t range. * apps/luseradd.c (main): Handle whole gid_t range. * apps/lnewusers.c (main): Handle whole uid_t/gid_t range, don't ignore invalid values. * apps/lchage.c (read_ndays): Handle G_TYPE_INT64. * apps/apputil.c (lu_mailspool_create_remove) * apps/lgroupmod.c (main) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/luserdel.c (main) * modules/ldap.c (lu_ldap_groups_enumerate_by_user): Use lu_value_get_id (). * docs/reference/tmpl/value.sgml: New file. * lib/misc.c (lu_value_get_id): New function. * lib/user.h: Add declaration. (LU_VALUE_INVALID_ID): New macro. * apps/lgroupadd.c (main) * apps/lgroupmod.c (main) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/lusermod.c (main) * lib/user.c (lu_default_int): Use lu_value_init_set_id (). * lib/misc.c (lu_value_init_set_id): New function. * lib/user.h: Add declaration. * lib/misc.c (lu_value_strdup): Handle G_TYPE_INT64. * lib/misc.c (lu_strdup_value): Rename to lu_value_strdup (). All callers changed. * lib/user.h: Rename declaration. * apps/lchage.c (read_ndays) * apps/lnewusers.c (main) * apps/luseradd.c (main) * lib/user.c (lu_default_int) * modules/files.c (parse_generic) * modules/ldap.c (lu_ldap_lookup) (lu_ldap_groups_enumerate_by_user): Properly check strtol () for error. 2004-11-05 Miloslav Trmac <mitr@redhat.com> * modules/files.c (generic_lock, generic_is_locked, generic_setpass) * apps/lchfn.c (main): Use lu_strdup_value (). * modules/files.c (generic_is_locked): Fix memory leak. 2004-11-04 Miloslav Trmac <mitr@redhat.com> * modules/ldap.c (get_ent_adds, get_ent_mods, lu_ldap_set) (lu_ldap_del, lu_ldap_handle_lock, lu_ldap_is_locked) (lu_ldap_setpass): Use lu_strdup_value () instead of value_as_string (). (value_as_string): Removed function. * modules/sasldb.c (lu_sasldb_user_munge, lu_sasldb_user_is_locked): Use lu_strdup_value (). 2004-11-03 Miloslav Trmac <mitr@redhat.com> * apps/apputil.c (lu_mailspool_create_remove) * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lid.c (main) * modules/files.c (lu_shadow_user_lookup_id, lu_shadow_group_lookup_id) (format_generic, generic_mod, generic_del): Use lu_strdup_value (). * lib/misc.c (lu_strdup_value): New function. * lib/user.h: Add declaration. * docs/reference/tmpl/entity.sgml * docs/reference/libuser-sections.txt: Document lu_strdup_value (). 2004-11-02 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.52.6. * NEWS: Update. 2004-11-01 Miloslav Trmac <mitr@redhat.com> * modules/sasldb.c (lu_sasldb_user_lookup_name, lu_sasldb_user_munge) (lu_sasldb_user_is_locked): Remove assertions on possible error codes, undocumented codes happen too. * modules/sasldb.c (libuser_sasldb_init): Fix self-describing module name. * modules/sasldb.c (lu_sasldb_user_removepass) (lu_sasldb_group_removepass): New functions (libuser_sasldb_init): Set the user_removepass and group_removepass handlers. * lib/modules.c (lu_modules_load): Don't close a NULL handle. * modules/sasldb.c (lu_sasldb_user_add): Return TRUE on success. * configure.in * modules/sasldb.c (lu_sasldb_user_lookup_name, lu_sasldb_user_munge) (libuser_sasldb_init): Use Cyrus SASL v2. * modules/ldap.c (bind_server): Don't attempt to bind using NULL bind DN. * modules/ldap.c (bind_server): Report at least the first encountered bind error. 2004-10-30 Miloslav Trmac <mitr@redhat.com> * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lnewusers.c (main) * samples/enum.c (main) * samples/testuser.c (main): Output error messages on stderr. * apps/lchfn.c (main): Exit if specified user does not exist. * apps/lnewusers.c (main): Don't attempt to act on improperly formatted lines. * po/POTFILES.in: Add missing files. * modules/ldap.c (lu_ldap_set, lu_ldap_del): Remove superfluous '\n' and '.\n' at message ends. * apps/lgroupadd.c (main) * apps/lgroupdel.c (main) * apps/lgroupmod.c (main) * apps/lchage.c (main) * apps/lchfn.c (main) * apps/lchsh.c (main) * apps/lid.c (main) * apps/lnewusers.c (main) * apps/luseradd.c (main) * apps/luserdel.c (main) * apps/lusermod.c (main) * python/admin.c (libuser_admin_do_wrap, libuser_admin_setpass): * samples/enum.c (main): * samples/homedir.c (main): * samples/lookup.c (main): * samples/testuser.c (main): Use lu_strerror () instead of (error ? error->string : _("unknown error")). Report error cause in more error messages. * apps/lchsh.c (main): Report error if shell was not changed. * modules/ldap.c (lu_ldap_set, lu_ldap_handle_lock) (lu_ldap_setpass) * modules/files.c (set_default_context, reset_default_context) (generic_setpass) * lib/config.c (lu_cfg_init) * apps/apputil.c (lu_authenticate_unprivileged): Mark strings for translation. * lib/util.c (lu_util_line_get_matchingx): Fix memory leak. 2004-10-14 Miloslav Trmac <mitr@redhat.com> * lib/error.h (LU_ERROR_CHECK): Add missing '\n'. 2004-10-11 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.52.5. * NEWS: Update. * python/admin.c (libuser_admin_add_user) (libuser_admin_modify_user) (libuser_admin_delete_user): Fix memory leak. * python/admin.c (libuser_admin_add_user) (libuser_admin_delete_user): Fix reference counting. * python/modules.txt: Fix modifyUser documentation about not creating home directory by default. * python/admin.c (libuser_admin_modify_user): Pass original entity to libuser_admin_move_home(). 2004-10-10 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.52.4. * NEWS: Update. * python/misc.c (libuser_prompt_destroy): Fix memory leak. (libuser_admin_python_prompter): Properly copy struct libuser_prompt to avoid double free(). * python/admin.c (libuser_admin_enumerate_users) (libuser_admin_enumerate_groups) (libuser_admin_enumerate_users_by_group) (libuser_admin_enumerate_groups_by_user): Fix memory leaks. * python/admin.c (libuser_admin_enumerate_users_full) (libuser_admin_enumerate_groups_full) (libuser_admin_enumerate_users_by_group_full) (libuser_admin_enumerate_groups_by_user_full) * python/ent.c (convert_value_array_pylist) (libuser_entity_getattrlist): * python/libusermodule.c (libuser_get_user_shells): * python/misc.c (libuser_admin_python_prompter): Fix memory leaks. 2004-10-09 Miloslav Trmac <mitr@redhat.com> * lib/entity.c (lu_ent_free): Fix memory leak. * modules/files.c (generic_add): Fix memory leak. * lib/user.c (merge_ent_array_duplicates): Remove fflush (from debugging?). * modules/files.c (lu_files_enumerate_full): Fix memory leak. 2004-09-29 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.52.3. * NEWS: Update. * Makefile.am: Readd -D_LIBUSER_MODULE for modules. 2004-09-28 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.52.2. * NEWS: Update. * modules/ldap.c (lu_ldap_set): Beautify debug messages. * modules/ldap.c (connect_server): Allow ldap URIs, don't require TLS for servers specified by URIs. * docs/sgml/libuser.sgml: Document URI support. 2004-09-27 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.52.1. * NEWS: Update. * modules/files.c (set_default_context): Make sure *prev_context is always initialized. 2004-09-27 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.52. * autogen.sh: Create the `admin' subdirectory if needed. * Makefile.am (CVSTAG): Fix definition. * Makefile.am (archive): Ship with formatted documentation. * configure.in: Define AC_CONFIG_AUX_DIR. * configure.in: Remove various unneeded parts. * configure.in, Makefile.am: Use automake conditionals instead of MODULES. * Makefile.am (TESTS): Define only if LDAP. * Makefile.am: Use AM_CPPFLAGS to eliminate the most redundant lines. * Makefile.am (uninstall-local): Fix typo. * Makefile.am: Link exactly with needed libraries. * docs/sgml/Makefile.am: Merge with docs/Makefile.am. * Makefile.am (CVSTAG): Define portably. * configure.in: Use new-style AC_INIT and AM_INIT_AUTOMAKE. Set automake options `subdir-objects' and `-Wall'. * modules/ldap.c (lu_ldap_lookup): Silence gcc warning. * apps/Makefile.am, lib/Makefile.am, modules/Makefile.am, samples/Makefile.am: Merge with top-level Makefile.am. * apps/lchage.c, apps/lchfn.c, apps/lgroupadd.c, apps/lgroupdel.c, apps/lgroupmod.c, apps/lid.c, apps/lnewusers.c, apps/lpasswd.c, apps/luseradd.c, apps/luserdel.c, apps/lusermod.c, samples/enum.c, python/admin.c, python/ent.c, python/misc.c, python/libusermodule.c, python/quotamodule.c, samples/field.c, samples/homedir.c, samples/lookup.c, samples/quotaq.c, samples/prompt.c, samples/testuser.c: Change path of config.h. * NEWS: Update. * tests/ldap_test.py (Tests.testUserDel, Tests.testUserLock1) (Tests.testUserLock2, Tests.testUserUnlock1) (Tests.testUserUnlock2, Tests.testUserIslocked1) (Tests.testUserIslocked2, Tests.testUserSetpass1) (Tests.testUserSetpass2, Tests.testUserSetpass3) (Tests.testUserRemovepass1, Tests.testUserRemovepass2) (Tests.testUserRemovepass3, Tests.testUsersEnumerate) (Tests.testUsersEnumerateByGroup1) (Tests.testUsersEnumerateByGroup2) (Tests.testUsersEnumerateByGroup3, Tests.testUsersEnumerateFull) (Tests.testGroupLookupName, Tests.testGroupLookupId) (Tests.testGroupAdd1, Tests.testGroupAdd2, Tests.testGroupMod1) (Tests.testGroupMod2, Tests.testGroupDel, Tests.testGroupLock1) (Tests.testGroupLock2, Tests.testGroupUnlock1) (Tests.testGroupUnlock2, Tests.testGroupIsLocked1) (Tests.testGroupIsLocked2, Tests.testGroupSetpass1) (Tests.testGroupSetpass2, Tests.testGroupSetpass3) (Tests.testGroupRemovepass1, Tests.testGroupRemovepass2) (Tests.testGroupRemovepass3, Tests.testGroupsEnumerate) (Tests.testGroupsEnumerateByUser1) (Tests.testGroupsEnumerateByUser2) (Tests.testGroupsEnumerateByUser3, Tests.testGroupsEnumerateFull): New tests. * tests/ldap_test.py (Tests.testUserAdd2, Tests.testUserMod2): Update for final password entity model. * modules/ldap.c (lu_ldap_is_locked): Remove unneeded parameter `type'. All callers changed. * tests/ldap_test: Clean up after running the tests. * tests/ldap_test.py: Workaround openssl's inability to handle repeated library loading and unloading. * modules/ldap.c (lu_ldap_groups_enumerate_by_user): Don't consider all string representations of numbers invalid. (lu_ldap_groups_enumerate_by_user): Don't free data owned by the entity. * lib/user.c (run_single): Don't run user_removepass when group_removepass is wanted. * modules/ldap.c (lu_ldap_group_removepass): Implement. * modules/ldap.c (lu_ldap_is_locked): Use LU_GROUPPASSWORD and POSIXGROUP for groups. * modules/ldap.c (lu_ldap_setpass): Don't attempt to remove the attribute if it does not exist. (lu_ldap_setpass): Use LU_GROUPPASSWORD for groups. * modules/ldap.c (lu_ldap_handle_lock): Use LU_GROUPPASSWORD for groups. * modules/ldap.c (ldap_attribute_map): Remove LU_SHADOWPASSWORD. (get_ent_adds): Skip LU_SHADOWPASSWORD. It should be completely ignored now. * python/libusermodule.c (initlibuser): Fix libuser.GROUPPASSWORD. 2004-09-26 Miloslav Trmac <mitr@redhat.com> * lib/user.c (lu_end): Fix memory leak. * modules/ldap.c (lu_ldap_ent_to_dn): Remove parameter `applicability'. All callers changed. * modules/ldap.c (lu_ldap_fudge_objectclasses): Use the mod_values macro. (ldap_attribute_map): Make members point to constant strings. Casts added to users where needed. (lu_ldap_user_attributes, lu_ldap_group_attributes): Make it a constant array of constant strings. (libuser_ldap_init): Store converted pointers to data that will be eventually freed as part of the context. (lu_ldap_lookup): Use mapped_user_attributes, mapped_group_attributes. (map_from_ldap): Remove. (lu_ldap_close_module): Free mapped_user_attributes, mapped_group_attributes. 2004-09-25 Miloslav Trmac <mitr@redhat.com> * modules/ldap.c (lu_ldap_needed_objectclasses): s/User/Entity/g (lu_ldap_needed_objectclasses): Fix debugging printout. (lu_ldap_needed_objectclasses): Ignore attributes not applicable to given entity type. * modules/ldap.c (ldap_attribute_map): Remove mapping for LU_ADMINISTRATORNAME. (SHADOWGROUP): Remove. * python/admin.c (libuser_admin_removepass_user) (libuser_admin_removepass_group): Throw exception on error. * modules/ldap.c (lu_ldap_user_removepass): Implement. * modules/ldap.c (lu_ldap_is_locked): Fix memory leak. (lu_ldap_is_locked): Map libuser attribute names to LDAP names. * modules/ldap.c (lu_ldap_setpass): Initialize addvalues[0] and rmvalues[0] even if the original password is already encrypted. (lu_ldap_setpass): Map libuser attribute names to LDAP names. (lu_ldap_setpass): Remove (maybe all) values before adding new values. (lu_ldap_setpass): Fix memory leak. * modules/ldap.c (lu_ldap_handle_lock): Don't skip LU_CRYPTED twice. (lu_ldap_handle_lock): Fix memory leaks. (lu_ldap_handle_lock): Don't remove and add the same value. (lu_ldap_handle_lock): Avoid unnecessary g_malloc0()/g_free() pair. (lu_ldap_handle_lock): Don't drop LU_CRYPTED when unlocking unlocked account. (lu_ldap_handle_lock): Don't lock locked accounts again. * modules/ldap.c (lu_ldap_user_attributes): Drop LU_SHADOWPASSWORD. (get_ent_adds): Drop LU_SHADOWPASSWORD, not LU_USERPASSWORD. * modules/ldap.c (lu_ldap_set): Remove parameter `attributes'. All callers changed. 2004-09-24 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.51.12. * Makefile.am: Remove the spec file and "release" tagging from CVS, rework the spec file a bit. * configure.in: Don't create libuser.spec. * NEWS: Move data from libuser.spec.in. * libuser.spec.in: Remove. * tests/ldap.conf.in, tests/ldaprc, tests/ldap_skel.ldif, tests/ldap_test.py, tests/slapd.conf.in: New files * Makefile.am (TESTS, EXTRA_DIST): Use and distribute tests. * python/ent.c (libuser_entity_set): Don't both return success and indicate error at the same time. * python/ent.c (libuser_entity_set_item): Don't clear the entity if the new value has invalid type. * modules/files.c (generic_lookup): Fix memory leak. * python/ent.c (libuser_convert_to_value): Fix memory leak. * modules/ldap.c (get_ent_mods, lu_ldap_set): Special-case entry renaming. (lu_ldap_set): Fix desired RDN computation in rename. * modules/ldap.c (lu_ldap_set): Use the original name when looking up the DN of an entry that is being renamed. 2004-09-23 Miloslav Trmac <mitr@redhat.com> * configure.in: Version 0.51.11. * libuser.conf.in: Avoid mentioning /usr/lib* in config file. 2004-09-21 Miloslav Trmac <mitr@redhat.com> * modules/ldap.c (lu_ldap_set): New parameter `add'. All callers changed. * modules/ldap.c (get_ent_mods): Simplify somewhat. * modules/ldap.c (objectclass_present, lu_ldap_needed_objectclasses) (get_ent_adds): Split and customize/fix from lu_ldap_fudge_objectclasses (). (lu_ldap_fudge_objectclasses): Use lu_ldap_needed_objectclasses (). * modules/ldap.c (ACCOUNT): New macro. (SHADOWACCOUNT): Define as "shadowAccount" again. * modules/ldap.c (ldap_attribute_map): Remove unused member `ldap_attribute_key'. * modules/ldap.c (lu_ldap_user_lookup_name, lu_ldap_user_lookup_id): Add LU_LDAP_SHADOW to `applicability' argument. * python/libusermodule.c (initlibuser): Add missing attribute names. 2004-09-19 Miloslav Trmac <mitr@redhat.com> * python/admin.c (libuser_admin_setattr): Fix reference counting. 2004-09-18 Miloslav Trmac <mitr@redhat.com> * python/misc.c (libuser_admin_python_prompter, libuser_admin_prompt): Fix reference counting. * modules/ldap.c (libuser_ldap_init): Don't set error when it was already set. 2004-09-17 Miloslav Trmac <mitr@redhat.com> * modules/ldap.c (value_compare): Make sense of comparison same for longs and strings. * modules/ldap.c (lu_ldap_ent_to_dn, libuser_ldap_init): Fix memory leaks. * modules/ldap.c (libuser_ldap_init, bind_server): Respect bind_simple and bind_sasl. 2004-09-20 Miloslav Trmac <mitr@redhat.com> * apps/lchfn.1, apps/lchsh.1: New files. * apps/Makefile.am (dist_man_MANS): Distribute new man pages.