Comment 11 for bug 314657

Revision history for this message
Paul Dufresne (paulduf) wrote :

Well, at first glace it does seems my guess is right.
I have downloaded samba 3.0.28aorig.tar.gz (need to learn the command to extract sources and apply ubuntu patches) and found this in util_sec.c:
void set_effective_gid(gid_t gid)
{
#if USE_SETRESUID
 setresgid(-1,gid,-1);
#endif

#if USE_SETREUID
 setregid(-1,gid);
#endif

#if USE_SETEUID
 setegid(gid);
#endif

#if USE_SETUIDX
 setgidx(ID_EFFECTIVE, gid);
#endif

 assert_gid(-1, gid);
}

There is also:
void set_effective_uid(uid_t uid)
{
#if USE_SETRESUID
        /* Set the effective as well as the real uid. */
 if (setresuid(uid,uid,-1) == -1) {
  if (errno == EAGAIN) {
   DEBUG(0, ("setresuid failed with EAGAIN. uid(%d) "
      "might be over its NPROC limit\n",
      (int)uid));
  }
 }
#endif

#if USE_SETREUID
 setreuid(-1,uid);
#endif

#if USE_SETEUID
 seteuid(uid);
#endif

#if USE_SETUIDX
 setuidx(ID_EFFECTIVE, uid);
#endif

 assert_uid(-1, uid);
}

Looks like to me these -1 need to be casted to uid_t or gid_t for 64 bits machine to work.
But I am really not a true programmer, so I might be wrong... still, it looks bad to me.

I'll take a look at jaunty version to see if it is done the same way.