]> granicus.if.org Git - shadow/log
shadow
8 years agoMerge pull request #11 from taizo/typo_in_japanese_usage_desc
Serge Hallyn [Tue, 12 Jan 2016 01:20:57 +0000 (17:20 -0800)]
Merge pull request #11 from taizo/typo_in_japanese_usage_desc

typo in japanese usage description of useradd.

8 years agotypo in japanese usage description of useradd.
Taizo Ito [Mon, 4 Jan 2016 04:27:31 +0000 (13:27 +0900)]
typo in japanese usage description of useradd.

8 years agoFix user busy errors at userdel
Bastian Blank [Tue, 17 Nov 2015 16:52:24 +0000 (10:52 -0600)]
Fix user busy errors at userdel

From: Bastian Blank <bastian.blank@credativ.de>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
8 years agoMerge pull request #4 from xnox/master
Serge Hallyn [Fri, 13 Nov 2015 05:07:29 +0000 (23:07 -0600)]
Merge pull request #4 from xnox/master

Make shadow more robust in hostile environments

8 years agoMerge pull request #9 from shadow-maint/idmapleak
Serge Hallyn [Fri, 13 Nov 2015 05:03:09 +0000 (23:03 -0600)]
Merge pull request #9 from shadow-maint/idmapleak

Idmapleak

8 years agoMerge pull request #8 from shadow-maint/newgrpleak
Serge Hallyn [Fri, 13 Nov 2015 05:02:13 +0000 (23:02 -0600)]
Merge pull request #8 from shadow-maint/newgrpleak

Fix a resource leak in syslog_sg

9 years agoMerge pull request #6 from stoeckmann/master
Serge Hallyn [Mon, 10 Aug 2015 00:57:38 +0000 (19:57 -0500)]
Merge pull request #6 from stoeckmann/master

Clear passwords on __gr_dup/__pw_dup errors and fix memory leak

9 years agoMerge pull request #5 from vapier/master
Serge Hallyn [Mon, 10 Aug 2015 00:51:54 +0000 (19:51 -0500)]
Merge pull request #5 from vapier/master

misc autoool fixes

9 years agoget_map_ranges: initialize argidx to 0 at top of loop
Serge Hallyn [Thu, 6 Aug 2015 05:34:17 +0000 (00:34 -0500)]
get_map_ranges: initialize argidx to 0 at top of loop

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix a resource leak in syslog_sg
Serge Hallyn [Thu, 6 Aug 2015 05:11:06 +0000 (00:11 -0500)]
Fix a resource leak in syslog_sg

Reported at https://alioth.debian.org/tracker/?func=detail&atid=411478&aid=315135&group_id=30580
by Alejandro Joya (afjoyacr-guest)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoFix a resource leak in libmis/idmapping.c
Serge Hallyn [Thu, 6 Aug 2015 05:10:13 +0000 (00:10 -0500)]
Fix a resource leak in libmis/idmapping.c

Reported at https://alioth.debian.org/tracker/?func=detail&atid=411478&aid=315136&group_id=30580
by Alejandro Joya.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoMerge pull request #7 from shadow-maint/2015-07-20/vflg
Serge Hallyn [Thu, 23 Jul 2015 15:11:46 +0000 (10:11 -0500)]
Merge pull request #7 from shadow-maint/2015-07-20/vflg

Don't limit subuid/subgid support to local users

9 years agoDon't limit subuid/subgid support to local users
Serge Hallyn [Mon, 20 Jul 2015 17:14:26 +0000 (12:14 -0500)]
Don't limit subuid/subgid support to local users

The current implementation of subuid/subgid support in usermod requires the
user to be a local user present in /etc/passwd.  There doesn't seem to be a
good reason for this; subuids should work equally well for users whose
records are in other NSS databases.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1475749

Author: Steve Langasek <steve.langasek@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoFree memory on error path
Tobias Stoeckmann [Sun, 12 Jul 2015 12:30:32 +0000 (14:30 +0200)]
Free memory on error path

When multiple entries with the same name are encountered, nentry is
not properly freed, which results in a memory leak.

9 years agoClear passwords on __gr_dup/__pw_dup errors.
Tobias Stoeckmann [Sat, 11 Jul 2015 11:00:13 +0000 (13:00 +0200)]
Clear passwords on __gr_dup/__pw_dup errors.

The functions __gr_dup and __pw_dup do not explicitly zero the
memory which hold the passwords after free. The gr_free and pw_free
functions do this explicitly.

To guarantee same behaviour, it's possible to call these *_free
functions directly from __*_dup, because the memory is initialized
with zeros at the beginning. Calling free(NULL) has no negative
effect and can be considered safe these days.

9 years agoAllow deleting the group even if it is the primary group of a user
Jesse W. Hathaway [Fri, 12 Jun 2015 22:32:50 +0000 (17:32 -0500)]
Allow deleting the group even if it is the primary group of a user

This is helpful when using configuration management tools such as
Puppet, where you are managing the groups in a central location and you
don't need this safeguard.

Signed-off-by: "Jesse W. Hathaway" <jesse@mbuki-mvuki.org>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agonewgidmap manpage: remove wrongly added extra pid arg
Serge Hallyn [Fri, 5 Jun 2015 04:45:58 +0000 (23:45 -0500)]
newgidmap manpage: remove wrongly added extra pid arg

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoignore the compile file
Mike Frysinger [Thu, 30 Apr 2015 06:45:41 +0000 (02:45 -0400)]
ignore the compile file

Newer autotools installs this file.

9 years agorename configure.in
Mike Frysinger [Thu, 30 Apr 2015 06:43:08 +0000 (02:43 -0400)]
rename configure.in

Newer autotools complains when the file is named configure.in.

9 years agoExpand the error message when newuidmap / newgidmap do not like the user/group owners...
Hank Leininger [Mon, 6 Apr 2015 13:22:48 +0000 (08:22 -0500)]
Expand the error message when newuidmap / newgidmap do not like the user/group ownership of their target process.

Currently the error is just:

newuidmap: Target [pid] is owned by a different user

With this patch it will be like:

newuidmap: Target [pid] is owned by a different user: uid:0 pw_uid:0 st_uid:0, gid:0 pw_gid:0 st_gid:99

Why is this useful?  Well, in my case...

The grsecurity kernel-hardening patch includes an option to make parts
of /proc unreadable, such as /proc/pid/ dirs for processes not owned by
the current uid.  This comes with an option to make /proc/pid/
directories readable by a specific gid; sysadmins and the like are then
put into that group so they can see a full 'ps'.

This means that the check in new[ug]idmap fails, as in the above quoted
error - /proc/[targetpid] is owned by root, but the group is 99 so that
users in group 99 can see the process.

Some Googling finds dozens of people hitting this problem, but not
*knowing* that they have hit this problem, because the errors and
circumstances are non-obvious.

Some graceful way of handling this and not failing, will be next ;)  But
in the meantime it'd be nice to have new[ug]idmap emit a more useful
error, so that it's easier to troubleshoot.

Thanks!

Signed-off-by: Hank Leininger <hlein@korelogic.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoMerge pull request #3 from vapier/master
Serge Hallyn [Mon, 16 Mar 2015 17:08:55 +0000 (17:08 +0000)]
Merge pull request #3 from vapier/master

man: useradd(8): fix typo in German translation

9 years agoCreate dbs with correct permissions.
Dimitri John Ledkov [Fri, 27 Feb 2015 16:26:57 +0000 (16:26 +0000)]
Create dbs with correct permissions.

9 years agoForce use shadow, even if missing.
Dimitri John Ledkov [Fri, 27 Feb 2015 14:18:56 +0000 (14:18 +0000)]
Force use shadow, even if missing.

9 years agoDo not fail on missing files in /etc/, create them instead.
Dimitri John Ledkov [Fri, 27 Feb 2015 13:17:25 +0000 (13:17 +0000)]
Do not fail on missing files in /etc/, create them instead.

passwd, shadow, group, gshadow etc. can be managed via nss -
e.g. system default accounts can be specified using nss_altfiles,
rather than in /etc/. Thus despite having default accounts, these
files can be missing on disk and thus should be opened with O_CREATE
whenever they are attempted to be opened in O_RDWR modes.

9 years agoDo not report unknown settings, when compiled with PAM.
Dimitri John Ledkov [Fri, 27 Feb 2015 12:39:44 +0000 (12:39 +0000)]
Do not report unknown settings, when compiled with PAM.

When compiled with PAM certain settings are not used, however they are
still defined in the stock login.defs file. Thus every command reports
them as "unknown setting contact administrator".

Alternative would be to parse stock login.defs and comment out/remove
settings that are not applied, when compiled with PAM.

9 years agoDo not bail out on missing login.defs.
Dimitri John Ledkov [Fri, 27 Feb 2015 11:23:58 +0000 (11:23 +0000)]
Do not bail out on missing login.defs.

For most operations tools have compiled-in defaults, and thus can
operate without login.defs present.

9 years agoSuppress pwconv passwd- chmod failure message
Duncan Eastoe [Mon, 9 Feb 2015 14:39:31 +0000 (14:39 +0000)]
Suppress pwconv passwd- chmod failure message

Prevent chmod failure message from displaying if the failure
was due to the backup file not existing.

If there is no backup file present and if no changes have been
made, then this error would always appear since the backup
file isn't created in this situation.

Signed-off-by: Duncan Eastoe <deastoe@Brocade.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
9 years agoman: useradd(8): fix typo in German translation
Mike Frysinger [Mon, 16 Jun 2014 05:48:27 +0000 (01:48 -0400)]
man: useradd(8): fix typo in German translation

When referring to USERGROUPS_ENAB, the German mentions /etc/default/useradd
when it should be /etc/login.defs (like the original English does).

Reported-by: Stefan Kiesler <heavymetal@gmx.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agoTest userdel/usermod when homedir is a symlink
Nicolas François [Sat, 20 Sep 2014 22:33:02 +0000 (00:33 +0200)]
Test userdel/usermod when homedir is a symlink

10 years agoExtend checks for changing U/GID in home directory
Nicolas François [Sat, 20 Sep 2014 21:59:46 +0000 (23:59 +0200)]
Extend checks for changing U/GID in home directory

Add files with user or group owner different from the user.

10 years agoExtend checks for moving home directory
Nicolas François [Sat, 20 Sep 2014 21:56:25 +0000 (23:56 +0200)]
Extend checks for moving home directory

Add hard link to files inside or outside the home directory)
Add files with user or group owner different from the user.

10 years agosubids options added to usermod's usage
Nicolas François [Sat, 20 Sep 2014 21:18:52 +0000 (23:18 +0200)]
subids options added to usermod's usage

10 years agoProvides coverage with traceability to test cases
Nicolas François [Sat, 20 Sep 2014 20:49:41 +0000 (22:49 +0200)]
Provides coverage with traceability to test cases

10 years agoAdd missing configuration files
Nicolas François [Sat, 20 Sep 2014 20:39:27 +0000 (22:39 +0200)]
Add missing configuration files

10 years agouseradd now uses link rather than rename
Nicolas François [Sat, 20 Sep 2014 20:35:21 +0000 (22:35 +0200)]
useradd now uses link rather than rename

10 years agoAdd support for syscall failure tests
Nicolas François [Sat, 20 Sep 2014 14:15:32 +0000 (16:15 +0200)]
Add support for syscall failure tests

10 years agoAdd cleanup script
Nicolas François [Sat, 20 Sep 2014 14:14:33 +0000 (16:14 +0200)]
Add cleanup script

10 years agoAdd config to disable execution of failure tests
Nicolas François [Sat, 20 Sep 2014 14:10:57 +0000 (16:10 +0200)]
Add config to disable execution of failure tests

10 years agoAdd tests for subids handling
Nicolas François [Sat, 20 Sep 2014 13:49:41 +0000 (15:49 +0200)]
Add tests for subids handling

10 years agoUse build_path from common/config.sh
Nicolas François [Sat, 20 Sep 2014 13:46:14 +0000 (15:46 +0200)]
Use build_path from common/config.sh

10 years agoForce removal of files when restoring system config
Nicolas François [Sat, 20 Sep 2014 13:40:46 +0000 (15:40 +0200)]
Force removal of files when restoring system config

10 years agoUpdate list of files in login and passwd packages
Nicolas François [Sat, 20 Sep 2014 13:39:32 +0000 (15:39 +0200)]
Update list of files in login and passwd packages

10 years agosub[ug]id: compare range before comparing username/UID, to avoid unnecessary syscalls subuigid-numeric
Bostjan Skufca [Sat, 6 Sep 2014 18:47:55 +0000 (18:47 +0000)]
sub[ug]id: compare range before comparing username/UID, to avoid unnecessary syscalls

Change suggested by Nicolas François as performance optimization.
Performance penalty would be really noticeable when usernames are
stored in remote databases (ldap).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agosub[ug]id manpages: add note about performance when using login names versus UIDs
Bostjan Skufca [Fri, 5 Sep 2014 22:34:40 +0000 (22:34 +0000)]
sub[ug]id manpages: add note about performance when using login names versus UIDs

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agonewuidmap/newgidmap: added support for user matching by UID in /etc/sub[ug]id
Bostjan Skufca [Fri, 5 Sep 2014 21:21:03 +0000 (21:21 +0000)]
newuidmap/newgidmap: added support for user matching by UID in /etc/sub[ug]id

Until now only exact username specification in /etc/sub[ug]id file allowed the
mapping. This prevented normal use for those users who use multiple usernames
with the same UID, as it rejected mapping even though it was allowed for
another username with the same UID.

This patch initially retains the old behaviour, for performance's sake. In the
first pass, new[ug]idmap only searches for exact username match.
If that yields no valid results, it continues into another loop, which does UID
resolution and comparison. If either definition (numeric UID mapping
specification or mapping specification for another username with the same UID as
current username) is found, it is used.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd tests from the old svn tree
Serge Hallyn [Wed, 17 Sep 2014 19:42:55 +0000 (14:42 -0500)]
Add tests from the old svn tree

We're losing the svn history (which we could probably keep if we tried
hard enough) but don't consider that worthwhile.

Note these tests are destructive, so run them only in a throwaway
environment like a chroot, container, or vm.

The tests/run.all script should be the one which launches all the tests.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoCheck size of uid_t and gid_t using AC_CHECK_SIZEOF
James Le Cuirot [Sat, 23 Aug 2014 08:46:39 +0000 (09:46 +0100)]
Check size of uid_t and gid_t using AC_CHECK_SIZEOF

This built-in check is simpler than the previous method and, most
importantly, works when cross-compiling.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix building without subordinate IDs support
James Le Cuirot [Sat, 23 Aug 2014 08:46:38 +0000 (09:46 +0100)]
Fix building without subordinate IDs support

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoFrom: Svante Signell <svante.signell@gmail.com>
Serge Hallyn [Thu, 26 Jun 2014 21:48:56 +0000 (16:48 -0500)]
From: Svante Signell <svante.signell@gmail.com>

Currently shadow fails to build from source and is flagged as
out-of-date. This is due to a usage of PATH_MAX, which is not defined
on GNU/Hurd. The attached patch solves this problem by allocating a
fixed number of 32 bytes for the string proc_dir_name in files
src/procuidmap.c and src/procgidmap.c. (In fact only 18 bytes are
needed)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoman: newuid and newgid: point out that root must be allocated subuids
Serge Hallyn [Mon, 9 Jun 2014 22:37:16 +0000 (17:37 -0500)]
man: newuid and newgid: point out that root must be allocated subuids

Users may otherwise be confused and think that because the kernel
does not restrict uid mappings to the root user (within his
current uid mappings), newuidmap will ignore /etc/subuid for the
root user.  It will not.

Reported-by: Philippe Grégoire <gregoirep@hotmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agonewuidmap,newgidmap: Correct the range size sanity check in get_map_ranges 4.2.1
Eric W. Biederman [Sun, 8 Sep 2013 09:49:52 +0000 (02:49 -0700)]
newuidmap,newgidmap: Correct the range size sanity check in get_map_ranges

The number of ranges should be the ceiling of the number of arguments divided
by three.

Without this fix newuidmap and newgidmap always report and error and fail,
which is very much not what we want.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoImprove vipw error report when editor fails
Nicolas François [Sun, 25 Aug 2013 14:27:58 +0000 (16:27 +0200)]
Improve vipw error report when editor fails

* src/vipw.c: After waitpid(), use errno only if waitpid returned
-1. Debian#688260
* src/vipw.c: Likewise for system().

11 years agoDocument the subuid related functions in subordinateio.c
Serge Hallyn [Thu, 22 Aug 2013 19:21:34 +0000 (14:21 -0500)]
Document the subuid related functions in subordinateio.c

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoUpdated Japanese translation to 558t
victory [Fri, 23 Aug 2013 20:31:00 +0000 (22:31 +0200)]
Updated Japanese translation to 558t

* po/ja.po: Updated to 558t

11 years agonewuidmap.1 and newgidmap.1: note limitation
Serge Hallyn [Thu, 22 Aug 2013 18:38:59 +0000 (13:38 -0500)]
newuidmap.1 and newgidmap.1: note limitation

Note that they may be used only once for a given process.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11 years agoUpdate translation files.
Nicolas François [Fri, 23 Aug 2013 00:02:36 +0000 (02:02 +0200)]
Update translation files.

* man/po/shadow-man-pages.pot: Regenerated.
* man/po/*.po: Updated PO files.

11 years agoFix encoding.
Nicolas François [Thu, 22 Aug 2013 23:57:01 +0000 (01:57 +0200)]
Fix encoding.

* man/newgrp.1.xml: Fix encoding.
* man/sg.1.xml: Likewise.

11 years agoUnfuzzy according to previous change.
Nicolas François [Thu, 22 Aug 2013 22:02:41 +0000 (00:02 +0200)]
Unfuzzy according to previous change.

* man/po/da.po: Unfuzzy according to previous change.
* man/po/de.po: Likewise.
* man/po/fr.po: Likewise.
* man/po/it.po: Likewise.
* man/po/pl.po: Likewise.
* man/po/ru.po: Likewise.
* man/po/sv.po: Likewise.
* man/po/zh_CN.po: Likewise.

11 years agoAvoid spaces between <option> and <replaceable>
Nicolas François [Thu, 22 Aug 2013 21:54:34 +0000 (23:54 +0200)]
Avoid spaces between <option> and <replaceable>

* man/chage.1.xml: Add a non breaking space between options and
their parameter because xml2po removes those spaces. Alioth#314401
* man/chfn.1.xml: Likewise.
* man/chgpasswd.8.xml: Likewise.
* man/chpasswd.8.xml: Likewise.
* man/chsh.1.xml: Likewise.
* man/faillog.8.xml: Likewise.
* man/gpasswd.1.xml: Likewise.
* man/groupadd.8.xml: Likewise.
* man/groupdel.8.xml: Likewise.
* man/groupmems.8.xml: Likewise.
* man/groupmod.8.xml: Likewise.
* man/grpck.8.xml: Likewise.
* man/lastlog.8.xml: Likewise.
* man/newusers.8.xml: Likewise.
* man/passwd.1.xml: Likewise.
* man/pwck.8.xml: Likewise.
* man/pwconv.8.xml: Likewise.
* man/su.1.xml: Likewise.
* man/useradd.8.xml: Likewise.
* man/userdel.8.xml: Likewise.
* man/usermod.8.xml: Likewise.
* man/vipw.8.xml: Likewise.

11 years agoCreate baseline for changing manpage options.
Nicolas François [Thu, 22 Aug 2013 21:15:26 +0000 (23:15 +0200)]
Create baseline for changing manpage options.

* man/po/shadow-man-pages.pot: Regenerated.
* man/po/*.po: Updated PO files.

11 years agoFix encoding.
Nicolas François [Thu, 22 Aug 2013 22:54:26 +0000 (00:54 +0200)]
Fix encoding.

* man/po/de.po: Fix encoding.

11 years agoFix subordinate_next() return value.
Nicolas François [Mon, 19 Aug 2013 19:29:50 +0000 (21:29 +0200)]
Fix subordinate_next() return value.

* lib/subordinateio.c (subordinate_next): Fix return value.

11 years agoInclude <stdio.h>
Nicolas François [Thu, 15 Aug 2013 23:13:20 +0000 (01:13 +0200)]
Include <stdio.h>

* libmisc/idmapping.c: Include <stdio.h> needed for fprintf() and
stderr.

11 years agoRemove debug info.
Nicolas François [Thu, 15 Aug 2013 23:11:50 +0000 (01:11 +0200)]
Remove debug info.

11 years agoImprove documentation.
Nicolas François [Thu, 15 Aug 2013 15:21:44 +0000 (17:21 +0200)]
Improve documentation.

* man/login.defs.d/SUB_GID_COUNT.xml: Document newusers behavior
when the user already have subordinate group IDs.
* man/login.defs.d/SUB_UID_COUNT.xml: Likewise.
* man/login.defs.d/SUB_GID_COUNT.xml: Fix typo (MAX<->MIN).
* man/login.defs.d/SUB_UID_COUNT.xml: Likewise.

11 years agoImprove diagnostic.
Nicolas François [Thu, 15 Aug 2013 15:09:38 +0000 (17:09 +0200)]
Improve diagnostic.

* src/usermod.c: Check early if /etc/subuid (/etc/subgid) exists
when option -v/-V (-w/-W) are provided.

11 years agoFix parse of ranges.
Nicolas François [Thu, 15 Aug 2013 15:07:04 +0000 (17:07 +0200)]
Fix parse of ranges.

* src/usermod.c: Fix parse of ranges. The hyphen might be followed
by a negative integer.

11 years agoFix boundary conditions.
Nicolas François [Thu, 15 Aug 2013 15:03:18 +0000 (17:03 +0200)]
Fix boundary conditions.

* lib/subordinateio.c (find_free_range): max is allowed for new
ranges.

11 years agoRemove dead code.
Nicolas François [Thu, 15 Aug 2013 14:46:51 +0000 (16:46 +0200)]
Remove dead code.

* libmisc/find_new_sub_gids.c: Remove dead code.
find_new_sub_gids() is always called with *range_count set to 0.
It's more difficult to keep the subordinate GIDs and UIDs
synchronized, than for the user's UID/GId because the count of
subordinate IDs may differ.
* libmisc/find_new_sub_uids.c: Likewise.
* lib/subordinateio.h, lib/subordinateio.c: Remove APIs that are
no more needed: is_sub_uid_range_free(), is_sub_gid_range_free(),
is_range_free().

11 years agoSubordinate IDs require 32bit uid_t/gid_t
Nicolas François [Wed, 14 Aug 2013 18:21:32 +0000 (20:21 +0200)]
Subordinate IDs require 32bit uid_t/gid_t

* configure.in: Check if sizeof uid_t and gid_t is larger than 32
bit to support subordinate IDs.

11 years agoAlign coding style.
Nicolas François [Tue, 13 Aug 2013 22:03:59 +0000 (00:03 +0200)]
Align coding style.

* lib/subordinateio.c: Avoid implicit conversion of pointers and
integers to booleans.
* lib/subordinateio.c: Added brackets.

11 years agoAdd schematics with ranges to help reviews.
Nicolas François [Tue, 13 Aug 2013 21:57:14 +0000 (23:57 +0200)]
Add schematics with ranges to help reviews.

* lib/subordinateio.c: Add schematics with ranges to help reviews.

11 years agoAvoid dead branches.
Nicolas François [Tue, 13 Aug 2013 21:55:48 +0000 (23:55 +0200)]
Avoid dead branches.

* lib/subordinateio.c: Avoid dead branches.

Note: code is equivalent.

11 years agoFix copyright dates.
Nicolas François [Tue, 13 Aug 2013 21:13:26 +0000 (23:13 +0200)]
Fix copyright dates.

11 years agoFail in case arguments are provided after options.
Nicolas François [Tue, 13 Aug 2013 21:13:09 +0000 (23:13 +0200)]
Fail in case arguments are provided after options.

* src/vipw.c: Fail in case arguments are provided after options.
Debian#677812

11 years agoFix count for ranges truncated in remove_range().
Nicolas François [Tue, 13 Aug 2013 20:29:16 +0000 (22:29 +0200)]
Fix count for ranges truncated in remove_range().

* lib/subordinateio.c: Fix count for ranges truncated in
remove_range().

11 years agoTerminate the child before closing the PAM session.
Nicolas François [Tue, 13 Aug 2013 17:48:53 +0000 (19:48 +0200)]
Terminate the child before closing the PAM session.

* src/su.c: Terminate the child (if needed) before closing the PAM
session. This is probably more correct, and avoid reporting
termination from signals possibly sent by PAM modules (e.g. former
versions of pam_systemd). Debian#670132

11 years agoReset caught variable when signal is handled by su.
Nicolas François [Tue, 13 Aug 2013 17:42:50 +0000 (19:42 +0200)]
Reset caught variable when signal is handled by su.

* src/su.c: When a SIGTSTP is caught, reset caught to 0. There is
no need to kill the child in such case after su is resumed. This
remove the "Session terminated, terminating shell...
...terminated." messages in such case.

11 years agoDocument checks performed by newgidmap/newuidmap
Nicolas François [Tue, 13 Aug 2013 17:38:41 +0000 (19:38 +0200)]
Document checks performed by newgidmap/newuidmap

* man/newgidmap.1.xml: Document the checks performed before
setting the mapping in /proc.
* man/newuidmap.1.xml: Likewise.

11 years agoDocument the semantic of ranges.
Nicolas François [Tue, 13 Aug 2013 17:28:07 +0000 (19:28 +0200)]
Document the semantic of ranges.

* libmisc/idmapping.h: Document what the upper and lower fields
are in struct map_range.
* man/newgidmap.1.xml: Document when the gid, gidlower and count
argument are.
* man/newuidmap.1.xml: Likewise for uid, uidlower and count.

11 years ago(shadow_random): Use long instead of size_t.
Nicolas François [Tue, 13 Aug 2013 17:16:24 +0000 (19:16 +0200)]
(shadow_random): Use long instead of size_t.

* libmisc/salt.c (shadow_random): Use long instead of size_t.
Compatibility with size_t is easier to check since it's used for
smaller numbers (salt size).

11 years agoAdd splint annotations.
Nicolas François [Tue, 13 Aug 2013 17:13:45 +0000 (19:13 +0200)]
Add splint annotations.

* lib/groupmem.c: Add splint annotations. The added memset makes
splint think data was allocated.
* lib/pwmem.c: Likewise.
* lib/sgroupio.c: Likewise.
* lib/shadowmem.c: Likewise.

11 years agoImprove documentation.
Nicolas François [Mon, 12 Aug 2013 22:21:02 +0000 (00:21 +0200)]
Improve documentation.

* man/login.defs.d/SUB_GID_COUNT.xml: Document that the behavior
of useradd and newusers depends on the existence of /etc/subgid.
* man/login.defs.d/SUB_UID_COUNT.xml: Likewise for /etc/subuid.

11 years agoImprove error reporting.
Nicolas François [Mon, 12 Aug 2013 22:13:12 +0000 (00:13 +0200)]
Improve error reporting.

* src/useradd.c: Change message in case of find_new_sub_uids /
find_new_sub_gids failure. This complements the messages already
provided by these APIs.

11 years agoFix handling of boundaries.
Nicolas François [Mon, 12 Aug 2013 22:11:24 +0000 (00:11 +0200)]
Fix handling of boundaries.

* lib/subordinateio.c: Fix handling of boundaries.
* libmisc/find_new_sub_uids.c: Likewise.
* libmisc/find_new_sub_gids.c: Likewise.

11 years agoFix removal of ranges.
Nicolas François [Mon, 12 Aug 2013 21:57:32 +0000 (23:57 +0200)]
Fix removal of ranges.

* lib/subordinateio.c: Fix removal of ranges. The database needs
to be marked as changed or commonio_close will discard any change.

11 years agoManpages improvement for subordinate IDs.
Nicolas François [Sun, 11 Aug 2013 14:05:26 +0000 (16:05 +0200)]
Manpages improvement for subordinate IDs.

* man/newusers.8.xml: Include documentation of SUB_GID_MIN,
SUB_GID_MAX, SUB_GID_COUNT, SUB_UID_MIN, SUB_UID_MAX,
SUB_UID_COUNT.
* man/useradd.8.xml: Likewise.
* man/usermod.8.xml: Likewise.
* man/newusers.8.xml: Document usage of /etc/subgid /etc/subuid.
* man/useradd.8.xml: Likewise.
* man/userdel.8.xml: Likewise.
* man/usermod.8.xml: Likewise.
* man/newusers.8.xml: Add references to subgid(5) and subuid(5).
* man/useradd.8.xml: Likewise.
* man/userdel.8.xml: Likewise.
* man/subgid.5.xml: Sort references alphabetically.
* man/subuid.5.xml: Likewise.
* man/subgid.5.xml: Add references to newusers(8), useradd(8),
userdel(8), usermod(8), user_namespaces(7).
* man/subuid.5.xml: Likewise.

11 years agoSort references alphabetically.
Nicolas François [Sun, 11 Aug 2013 13:48:57 +0000 (15:48 +0200)]
Sort references alphabetically.

* man/newgidmap.1.xml: Sort references alphabetically.
* man/newuidmap.1.xml: Likewise.

11 years agoAllow disabling of subordinate IDs.
Nicolas François [Sun, 11 Aug 2013 12:54:22 +0000 (14:54 +0200)]
Allow disabling of subordinate IDs.

* configure.in: Add configure options --enable-subordinate-ids /
--disable-subordinate-ids. Enabled by default.
* lib/prototypes.h: Include <config.h> before using its macros.
* lib/commonio.h, lib/commonio.c: Define commonio_append only when
ENABLE_SUBIDS is defined.
* lib/prototypes.h, libmisc/find_new_sub_gids.c,
libmisc/find_new_sub_uids.c: Likewise.
* lib/subordinateio.h, lib/subordinateio.c: Likewise.
* libmisc/user_busy.c: Only check if subordinate IDs are in use if
ENABLE_SUBIDS is defined.
* src/Makefile.am: Create newgidmap and newuidmap only if
ENABLE_SUBIDS is defined.
* src/newusers.c: Check for ENABLE_SUBIDS to enable support for
subordinate IDs.
* src/useradd.c: Likewise.
* src/userdel.c: Likewise.
* src/usermod.c: Likewise.
* man/Makefile.am: Install man1/newgidmap.1, man1/newuidmap.1,
man5/subgid.5, and man5/subuid.5 only if ENABLE_SUBIDS is defined.
* man/fr/Makefile.am: Install man1/newgidmap.1, man1/newuidmap.1,
man5/subgid.5, and man5/subuid.5 (not translated yet).
* man/generate_mans.mak: Add xsltproc conditionals
subids/no_subids.
* man/login.defs.d/SUB_GID_COUNT.xml: Add dependency on subids
condition.
* man/login.defs.d/SUB_UID_COUNT.xml: Likewise.
* man/usermod.8.xml: Document options for subordinate IDs and
reference subgid(5) / subuid(5) depending on the subids condition.

11 years agoIgnore generated newgidmap and newuidmap
Nicolas François [Sun, 11 Aug 2013 12:48:39 +0000 (14:48 +0200)]
Ignore generated newgidmap and newuidmap

11 years agoFix typo.
Nicolas François [Sat, 10 Aug 2013 22:53:50 +0000 (00:53 +0200)]
Fix typo.

11 years agoRemove unused variable.
Nicolas François [Fri, 9 Aug 2013 12:12:01 +0000 (14:12 +0200)]
Remove unused variable.

* libmisc/salt.c: Remove unused variable.

11 years agoFix for Alioth#314271 (musl libc)
Nicolas François [Wed, 7 Aug 2013 00:17:52 +0000 (02:17 +0200)]
Fix for Alioth#314271 (musl libc)

* libmisc/utmp.c: Add include files needed for getaddrinfo().
See Alioth#314271

11 years agocheck for ruserok existence
Mike Frysinger [Tue, 6 Aug 2013 23:44:24 +0000 (01:44 +0200)]
check for ruserok existence

rlogin support is old school code, so newer C libraries drop support for
ruserok (like uClibc, optionally).  But shadow doesn't build with that,
so have it check for ruserok to optionally enable rlogin.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoEditorial changes to usermod(8)
Nicolas François [Tue, 6 Aug 2013 23:32:56 +0000 (01:32 +0200)]
Editorial changes to usermod(8)

* man/usermod.8.xml: Fix typos and wording.
* man/usermod.8.xml: Add references to subgid(5) and subuid(5).

11 years agoFix wording: secondary -> subordinate.
Nicolas François [Tue, 6 Aug 2013 23:01:33 +0000 (01:01 +0200)]
Fix wording: secondary -> subordinate.

* libmisc/find_new_sub_gids.c: Fix wording: secondary ->
subordinate.
* libmisc/find_new_sub_uids.c: Likewise.

11 years agoRemove duplicate check.
Nicolas François [Tue, 6 Aug 2013 21:59:09 +0000 (23:59 +0200)]
Remove duplicate check.

* libmisc/find_new_sub_gids.c: Remove duplicate check (duplicate
at least in its intent).

11 years agoFix typos.
Nicolas François [Tue, 6 Aug 2013 20:29:40 +0000 (22:29 +0200)]
Fix typos.

* src/usermod.c: Fix typos.

11 years agoI find it clearer with the words in that order.
Nicolas François [Tue, 6 Aug 2013 20:25:08 +0000 (22:25 +0200)]
I find it clearer with the words in that order.

* man/subgid.5.xml: Reorder words.
* man/subuid.5.xml: Likewise.

11 years agoFix typos.
Nicolas François [Tue, 6 Aug 2013 20:11:41 +0000 (22:11 +0200)]
Fix typos.

* man/subgid.5.xml: Fix typos.
* man/subuid.5.xml: Likewise.
* man/subgid.5.xml: Fix copy-paste errors from subuid.5.xml.