$OpenBSD: patch-src_util_c,v 1.1 2002/03/22 05:31:37 form Exp $ --- src/util.c.orig Fri Mar 22 09:05:52 2002 +++ src/util.c Fri Mar 22 09:13:15 2002 @@ -172,11 +172,16 @@ char *cmd, *in, *out, *err; /* Drop all priviliges (irreversable). */ void drop_all_privs() { +#ifdef HAS_EUID + setegid(real_gid); + seteuid(real_uid); +#else #ifdef HAS_REUID /* Regain privs needed to drop privs :) */ setregid(real_gid, eff_gid); setreuid(real_uid, eff_uid); #endif +#endif /* Drop it. */ setgid(real_gid); @@ -189,22 +194,36 @@ void drop_all_privs() /* Drop priviliges (swap uid's) */ void drop_privs() { +#ifdef HAS_EUID + setegid(real_gid); + if (seteuid(real_uid) < 0) + fprintf(stderr, _("minicom: cannot seteuid(%d)\n"), real_uid); + not_suid = 1; +#else #ifdef HAS_REUID setregid(eff_gid, real_gid); if (setreuid(eff_uid, real_uid) < 0) fprintf(stderr, _("minicom: cannot setreuid(%d, %d)\n"), eff_uid, real_uid); not_suid = 1; #endif +#endif } /* Set priviliges (swap uid's) */ void set_privs() { +#ifdef HAS_EUID + setegid(eff_gid); + if (seteuid(eff_uid) < 0) + fprintf(stderr, _("minicom: cannot seteuid(%d)\n"), eff_uid); + not_suid = 0; +#else #ifdef HAS_REUID setregid(real_gid, eff_gid); if (setreuid(real_uid, eff_uid) < 0) fprintf(stderr, _("minicom: cannot setreuid(%d, %d)\n"), real_uid, eff_uid); not_suid = 0; +#endif #endif }