getpwnam/uid for group with ID_TYPE_BOTH

Christof Schmitt cs at samba.org
Wed Sep 25 19:09:35 UTC 2019


On Wed, Sep 25, 2019 at 09:14:12PM +0300, Uri Simchoni via samba-technical wrote:
> On 9/24/19 12:45 AM, Stefan Metzmacher via samba-technical wrote:
> >Hi Rowland,
> >
> >No, it did with 4.5 and that's how it's supposed to be.
> >That's exactly what ID_TYPE_BOTH is all about.
> >
> >metze
> >
> 
> Hi metze,
> 
> Can you elaborate on that sentence, and what is the use case for
> generating passwd for a group? Is it related to a file being owned
> by a group SID (administrators)?

The case i was looking at is that a file is owned by a group. This works
as ID_TYPE_BOTH provides botha uid and a gid with the same value, and
the uid can be used as the unix file owner.

Now the usecase for generating a passwd entry is that 'ls -l' issues a
getpwuid call to query the passwd in order to display the name. Without
that, only the uid displayed.

> I'm not sure I ever understood this ID_TYPE_BOTH thing - I seem to
> remember that my understanding has been that it simplifies the code
> - that some rid backends don't know and don't care if a SID is a
> group or a user, but they sure can convert it to a unix ID, hence
> the "both", but that explanation doesn't mandate ability to generate
> passwd for a group, so hearing that this is actually what
> ID_TYPE_BOTH is all about was surprising to me.

The only requirement i see is the one from above: Having the ability to
map through the normal NSS calls between names and uids. I think this
would also enable a 'chown'  from the shall with a group, as chown
issues a getpwnam call to get the uid from the name.

Christof



More information about the samba-technical mailing list