summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorKevin Steves <stevesk@pobox.com>2001-04-09 14:50:52 +0000
committerKevin Steves <stevesk@pobox.com>2001-04-09 14:50:52 +0000
commitcb17e99faeea6823a630b9769a1c8906ea0766b3 (patch)
treedca63d3267b9b24cfb7f2f18d65aec6fb8808044 /openbsd-compat
parent393d2f782d4137873c7d5e96bb8a439767a9ac74 (diff)
- (stevesk) use setresgid() for setegid() if needed
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/bsd-misc.c9
-rw-r--r--openbsd-compat/bsd-misc.h6
2 files changed, 13 insertions, 2 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 6f92e064..eb3a5407 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -26,7 +26,7 @@
#include "xmalloc.h"
#include "ssh.h"
-RCSID("$Id: bsd-misc.c,v 1.3 2001/03/13 23:38:20 mouring Exp $");
+RCSID("$Id: bsd-misc.c,v 1.4 2001/04/09 14:50:56 stevesk Exp $");
char *get_progname(char *argv0)
{
@@ -70,6 +70,13 @@ int seteuid(uid_t euid)
}
#endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
+#if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID)
+int setegid(uid_t egid)
+{
+ return(setresgid(-1,egid,-1));
+}
+#endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */
+
#if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR)
const char *strerror(int e)
{
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index 61443b81..2ca0f370 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: bsd-misc.h,v 1.2 2001/02/09 01:55:36 djm Exp $ */
+/* $Id: bsd-misc.h,v 1.3 2001/04/09 14:50:56 stevesk Exp $ */
#ifndef _BSD_MISC_H
#define _BSD_MISC_H
@@ -52,6 +52,10 @@ int innetgr(const char *netgroup, const char *host,
int seteuid(uid_t euid);
#endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
+#if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID)
+int setegid(uid_t egid);
+#endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */
+
#if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR)
const char *strerror(int e);
#endif