diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /usr.sbin/sendmail/test |
initial import of NetBSD tree
Diffstat (limited to 'usr.sbin/sendmail/test')
-rw-r--r-- | usr.sbin/sendmail/test/Results | 53 | ||||
-rw-r--r-- | usr.sbin/sendmail/test/t_setreuid.c | 82 |
2 files changed, 135 insertions, 0 deletions
diff --git a/usr.sbin/sendmail/test/Results b/usr.sbin/sendmail/test/Results new file mode 100644 index 00000000000..37a1bb2c363 --- /dev/null +++ b/usr.sbin/sendmail/test/Results @@ -0,0 +1,53 @@ +The following are results of running t_setreuid on various architectures. + +OPSYS VERSION STATUS DATE TESTER/NOTES +===== ======= ====== ==== ============ + +SunOS 4.1 OK 93.07.19 eric +SunOS 4.1.2 OK 93.07.19 eric +SunOS 4.1.3 OK 93.09.25 Robert Elz + +BSD 4.4 OK 93.07.19 eric (wierd results, but functional) +BSD 4.3Utah OK 93.07.19 eric + +Ultrix 4.2A OK 93.07.19 eric +Ultrix 4.3A OK 93.07.19 Allan Johannesen + +HP-UX 8.07 OK 93.07.19 eric (on 7xx series) +HP-UX 8.02 OK 93.07.19 Michael Corrigan (on 8xx series) +HP-UX 8.00 OK 93.07.21 Michael Corrigan (on 3xx/4xx series) +HP-UX 9.01 OK 93.11.19 Cassidy (on 7xx series) + +Solaris 2.1 +Solaris 2.2 FAIL 93.07.19 Bill Wisner + +OSF/1 T1.3-4 OK 93.07.19 eric (on DEC Alpha) +OSF/1 1.3 OK 94.12.10 Jeff A. Earickson (on Intel Paragon) + +CxOS 11.0 OK 93.01.21 Eric Schnoebelen (CxOS 11.0 beta 1) +CxOS 10.x OK 93.01.21 Eric Schnoebelen + +AIX 3.1.5 FAIL 93.08.07 David J. N. Begley +AIX 3.2.3e FAIL 93.07.26 Steve Bauer <sbauer@silver.sdsmt.edu> +AIX 3.2.4 FAIL 93.10.07 David J. N. Begley +AIX 3.2.5 FAIL 94.05.17 Steve Bauer <sbauer@hpcmmib.hpc.sdsmt.edu> + +IRIX 4.0.4 OK 93.09.25 Robert Elz +IRIX 5.2 OK 94.12.06 Mark Andrews <mandrews@alias.com> +IRIX 5.3 OK 94.12.06 Mark Andrews <mandrews@alias.com> + +SCO 3.2v4.0 OK 93.10.02 Peter Wemm (with -lsocket from 3.2v4 devsys) + +NeXT 2.1 OK 93.07.28 eric +NeXT 3.0 OK 34.05.05 Kevin John Wang <kwang@lore.acs.calpoly.edu> + +Linux 0.99p10 OK 93.08.08 Karl London +Linux 0.99p13 OK 93.09.27 Christian Kuhtz +Linux 0.99p14 OK 93.11.30 Christian Kuhtz <chk@data-hh.Hanse.DE> +Linux 1.0 OK 94.03.19 Shayne Smith <snsmith@rastus.brisnet.org.au> + +BSD/386 1.0 OK 93.11.13 Tony Sanders + +DELL 2.2 OK 93.11.15 Peter Wemm (using -DSETEUID) + +Pyramid 5.0d OK 95.01.14 David Miller <davem@nadzieja.rutgers.edu> diff --git a/usr.sbin/sendmail/test/t_setreuid.c b/usr.sbin/sendmail/test/t_setreuid.c new file mode 100644 index 00000000000..2d087c3c36e --- /dev/null +++ b/usr.sbin/sendmail/test/t_setreuid.c @@ -0,0 +1,82 @@ +/* +** This program checks to see if your version of setreuid works. +** Compile it, make it setuid root, and run it as yourself (NOT as +** root). If it won't compile or outputs any MAYDAY messages, don't +** define HASSETREUID in conf.h. +** +** Compilation is trivial -- just "cc t_setreuid.c". +*/ + +#include <sys/types.h> +#include <unistd.h> +#include <stdio.h> + +#ifdef __hpux +#define setreuid(r, e) setresuid(r, e, -1) +#endif + +main() +{ + uid_t realuid = getuid(); + + printuids("initial uids", realuid, 0); + + if (geteuid() != 0) + { + printf("re-run setuid root\n"); + exit(1); + } + + if (setreuid(0, 1) < 0) + printf("setreuid(0, 1) failure\n"); + printuids("after setreuid(0, 1)", 0, 1); + + if (geteuid() != 1) + printf("MAYDAY! Wrong effective uid\n"); + + /* do activity here */ + + if (setreuid(-1, 0) < 0) + printf("setreuid(-1, 0) failure\n"); + printuids("after setreuid(-1, 0)", 0, 0); + if (setreuid(realuid, 0) < 0) + printf("setreuid(%d, 0) failure\n", realuid); + printuids("after setreuid(realuid, 0)", realuid, 0); + + if (geteuid() != 0) + printf("MAYDAY! Wrong effective uid\n"); + if (getuid() != realuid) + printf("MAYDAY! Wrong real uid\n"); + printf("\n"); + + if (setreuid(0, 2) < 0) + printf("setreuid(0, 2) failure\n"); + printuids("after setreuid(0, 2)", 0, 2); + + if (geteuid() != 2) + printf("MAYDAY! Wrong effective uid\n"); + + /* do activity here */ + + if (setreuid(-1, 0) < 0) + printf("setreuid(-1, 0) failure\n"); + printuids("after setreuid(-1, 0)", 0, 0); + if (setreuid(realuid, 0) < 0) + printf("setreuid(%d, 0) failure\n", realuid); + printuids("after setreuid(realuid, 0)", realuid, 0); + + if (geteuid() != 0) + printf("MAYDAY! Wrong effective uid\n"); + if (getuid() != realuid) + printf("MAYDAY! Wrong real uid\n"); + + exit(0); +} + +printuids(str, r, e) + char *str; + int r, e; +{ + printf("%s (should be %d/%d): r/euid=%d/%d\n", str, r, e, + getuid(), geteuid()); +} |