Do not use setreuid()/setregid() under OpenBSD,

use seteuid()/setegid() to set eff uid/gid,
use setuid()/setgid() to drop privs instead.
This commit is contained in:
form 1998-12-20 12:09:47 +00:00
parent 4636ef9863
commit bb05206d57
2 changed files with 74 additions and 30 deletions

View File

@ -1,30 +1,31 @@
*** config.h.orig Sat Nov 1 01:48:00 1997
--- config.h Fri Dec 18 14:49:44 1998
***************
*** 58,64 ****
#ifdef __FreeBSD__
# define DFL_PORT "/dev/modem"
! # define DEF_BAUD "19200"
# define CALLOUT ""
# define CALLIN ""
#endif
--- 58,75 ----
#ifdef __FreeBSD__
# define DFL_PORT "/dev/modem"
! # define DEF_BAUD "38400"
! # define CALLOUT ""
! # define CALLIN ""
! #endif
!
! #ifdef __OpenBSD__
! # ifdef sparc
! # define DFL_PORT "/dev/ttya"
! # else
! # define DFL_PORT "/dev/tty00"
! # endif
! # define DEF_BAUD "38400"
# define CALLOUT ""
# define CALLIN ""
#endif
--- config.h.orig Sat Nov 1 01:48:00 1997
+++ config.h Mon Dec 21 00:04:30 1998
@@ -20,7 +20,7 @@
/* Operating system INdependant parameters. (Usually the same everywhere) */
#define KERMIT "/usr/local/bin/kermit -l %l -b %b" /* How to call kermit */
-#define UUCPLOCK "/var/spool/uucp" /* Lock file directory */
+#define UUCPLOCK "/var/spool/lock" /* Lock file directory */
#define LOGFILE "minicom.log" /* Not defined = not used */
/* Operating system dependant parameters, per OS. A few samples are given. */
@@ -58,7 +58,18 @@
#ifdef __FreeBSD__
# define DFL_PORT "/dev/modem"
-# define DEF_BAUD "19200"
+# define DEF_BAUD "38400"
+# define CALLOUT ""
+# define CALLIN ""
+#endif
+
+#ifdef __OpenBSD__
+# ifdef sparc
+# define DFL_PORT "/dev/ttya"
+# else
+# define DFL_PORT "/dev/tty00"
+# endif
+# define DEF_BAUD "38400"
# define CALLOUT ""
# define CALLIN ""
#endif

View File

@ -0,0 +1,43 @@
--- util.c.orig Sat May 16 14:13:12 1998
+++ util.c Mon Dec 21 00:20:31 1998
@@ -165,7 +165,7 @@
/* Drop all priviliges (irreversable). */
void drop_all_privs()
{
-#ifdef HAS_REUID
+#if defined(HAS_REUID) && !defined(__OpenBSD__)
/* Regain privs needed to drop privs :) */
setregid(real_gid, eff_gid);
setreuid(real_uid, eff_uid);
@@ -183,9 +183,15 @@
void drop_privs()
{
#ifdef HAS_REUID
+# ifndef __OpenBSD__
setregid(eff_gid, real_gid);
if (setreuid(eff_uid, real_uid) < 0)
fprintf(stderr, "minicom: cannot setreuid(%d, %d)\n", eff_uid, real_uid);
+# else
+ setegid(real_gid);
+ if (seteuid(real_uid) < 0)
+ fprintf(stderr, "minicom: cannot seteuid(%d)\n", real_uid);
+# endif
not_suid = 1;
#endif
}
@@ -194,9 +200,15 @@
void set_privs()
{
#ifdef HAS_REUID
+# ifndef __OpenBSD__
setregid(real_gid, eff_gid);
if (setreuid(real_uid, eff_uid) < 0)
fprintf(stderr, "minicom: cannot setreuid(%d, %d)\n", real_uid, eff_uid);
+# else
+ setegid(eff_gid);
+ if (seteuid(eff_uid) < 0)
+ fprintf(stderr, "minicom: cannot setreuid(%d)\n", eff_uid);
+# endif
not_suid = 0;
#endif
}