setuid()/setreuid() in mcserv.c

Mon Feb  1 01:45:08 1999  Timur I. Bakeyev <mc@bat.ru>

	* mcserv.c: If setuid() is avaliable, use it, even, streuid() also
	present. (BTW, bsdi uses it's own auth system..)
This commit is contained in:
Timur Bakeyev 1999-02-01 00:21:43 +00:00
parent 351aa95e12
commit 4dce2ac60a
2 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Mon Feb 1 01:45:08 1999 Timur I. Bakeyev <mc@bat.ru>
* mcserv.c: If setuid() is avaliable, use it, even, streuid() also
present. (BTW, bsdi uses it's own auth system..)
Sun Jan 31 20:51:17 1999 Alexander Savelyev <fano@vcom.kiev.ua>
* mcserv.c (do_auth): mcserv never auth properly on bsdi.

View File

@ -912,12 +912,13 @@ do_auth (char *username, char *password)
#endif
#endif
#if !defined(BSD) || defined(__bsdi__)
#if defined (HAVE_SETUID)
if (setuid (this->pw_uid))
#else
if (setreuid (this->pw_uid, this->pw_uid))
#endif
return 0;
#elif defined (HAVE_SETREUID)
if (setreuid (this->pw_uid, this->pw_uid))
return 0;
#endif
/* If the setuid call failed, then deny access */
/* This should fix the problem on those machines with strange setups */