Subject: AIX wu ftpd groups question

From: Nik Conwell <[email-masked]>
Date: Thu, 24 Aug 1995 13:06:37 -0400 (EDT)

Strange question: Why does the AIX code in ftpd.c do a setgroups(NULL,NULL)??
This appears to have the effect of losing my supplementary groups.

>From ftpd.c:

#ifdef AIX
    {
       /* AIX 3 lossage.  Don't ask.  It's undocumented.  */
       priv_t priv;

       priv.pv_priv[0] = 0;
       priv.pv_priv[1] = 0;
       setgroups(NULL, NULL);

       if (setpriv(PRIV_SET|PRIV_INHERITED|PRIV_EFFECTIVE|PRIV_BEQUEATH,
                   &priv, sizeof(priv_t)) < 0 ||
           setuidx(ID_REAL|ID_EFFECTIVE, (uid_t)pw->pw_uid) < 0 ||
           seteuid((uid_t)pw->pw_uid) < 0) {
               reply(550, "Can't set uid (AIX3).");
               goto bad;
       }
    }

If I add:

initgroups(pw->pw_name,pw->pw_gid);

just after the setgroups(), I get all my supplementary groups...  Is there
some reason that groups are being removed, or was the author just expecting
setpriv to do things correctly?  

I tried using the setpcred() routine, which does set all the groups correctly,
but it also sets the saved uid to the user uid.  wu-ftpd appears to need the
saved uid to be 0 for some reason (creating the priv port for talking back to
the client?)

Thanks for any insight.
-nik

Nik Conwell                 Boston University                   [email-masked]

---

From: Bill Pemberton <[email-masked]>
Date: Thu, 24 Aug 1995 13:25:20 -0400 (EDT)

> This appears to have the effect of losing my supplementary groups.

I don't know WHY it was added, but I can confirm that it does have the
effect of not setting any of your groups except for your primary.  Comment
it out and it'll work correctly.

-- 
Bill Pemberton                           [email-masked]
ITC/Unix Systems                         [email-masked]
University of Virginia                   uunet!virginia!wfp5p