[Bug 314657] Re: smbd segfault in assert_uid

Paul Dufresne dufresnep at gmail.com
Fri Mar 13 21:47:57 GMT 2009


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.

-- 
smbd segfault in assert_uid 
https://bugs.launchpad.net/bugs/314657
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to samba in ubuntu.



More information about the Ubuntu-server-bugs mailing list