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>
This commit is contained in:
Bostjan Skufca
2014-09-05 21:21:03 +00:00
committed by Serge Hallyn
parent b999d48941
commit a113b87c45
3 changed files with 81 additions and 2 deletions

View File

@@ -57,7 +57,7 @@
</para>
<itemizedlist mark='bullet'>
<listitem>
<para>login name</para>
<para>login name or UID</para>
</listitem>
<listitem>
<para>numerical subordinate group ID</para>

View File

@@ -57,7 +57,7 @@
</para>
<itemizedlist mark='bullet'>
<listitem>
<para>login name</para>
<para>login name or UID</para>
</listitem>
<listitem>
<para>numerical subordinate user ID</para>