summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/test
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2002-02-17 21:56:45 +0000
committergshapiro <gshapiro@FreeBSD.org>2002-02-17 21:56:45 +0000
commit8449595fe97f4474b9b9a7e4edee1ef35dcff393 (patch)
treee7a33b132264d449a512ddf4a8685df097669c1d /contrib/sendmail/test
parent289b381b31415647269c7520d881017e2dcb27f1 (diff)
downloadFreeBSD-src-8449595fe97f4474b9b9a7e4edee1ef35dcff393.zip
FreeBSD-src-8449595fe97f4474b9b9a7e4edee1ef35dcff393.tar.gz
Import sendmail 8.12.2
Diffstat (limited to 'contrib/sendmail/test')
-rw-r--r--contrib/sendmail/test/Makefile17
-rw-r--r--contrib/sendmail/test/Makefile.m418
-rw-r--r--contrib/sendmail/test/README27
-rw-r--r--contrib/sendmail/test/Results40
-rw-r--r--contrib/sendmail/test/t_dropgid.c154
-rw-r--r--contrib/sendmail/test/t_exclopen.c12
-rw-r--r--contrib/sendmail/test/t_pathconf.c12
-rw-r--r--contrib/sendmail/test/t_seteuid.c24
-rw-r--r--contrib/sendmail/test/t_setgid.c119
-rw-r--r--contrib/sendmail/test/t_setreuid.c40
-rw-r--r--contrib/sendmail/test/t_setuid.c24
-rw-r--r--contrib/sendmail/test/t_snprintf.c14
12 files changed, 475 insertions, 26 deletions
diff --git a/contrib/sendmail/test/Makefile b/contrib/sendmail/test/Makefile
new file mode 100644
index 0000000..7ca1b40
--- /dev/null
+++ b/contrib/sendmail/test/Makefile
@@ -0,0 +1,17 @@
+# $Id: Makefile,v 1.1 2001/09/23 22:39:24 ca Exp $
+
+SHELL= /bin/sh
+BUILD= ./Build
+OPTIONS= $(CONFIG) $(FLAGS)
+
+all: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) $@
+clean: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) $@
+install: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) $@
+
+fresh: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) -c
+
+FRC:
diff --git a/contrib/sendmail/test/Makefile.m4 b/contrib/sendmail/test/Makefile.m4
new file mode 100644
index 0000000..14868a9
--- /dev/null
+++ b/contrib/sendmail/test/Makefile.m4
@@ -0,0 +1,18 @@
+include(confBUILDTOOLSDIR`/M4/switch.m4')
+
+bldPRODUCT_START(`executable', `test')
+define(`bldSOURCES', `t_dropgid.c ')
+bldPRODUCT_END
+
+include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/sm-test.m4')
+dnl smtest(`getipnode')
+smtest(`t_dropgid')
+smtest(`t_exclopen')
+smtest(`t_pathconf')
+smtest(`t_seteuid')
+smtest(`t_setgid')
+smtest(`t_setreuid')
+smtest(`t_setuid')
+dnl smtest(`t_snprintf')
+
+bldFINISH
diff --git a/contrib/sendmail/test/README b/contrib/sendmail/test/README
new file mode 100644
index 0000000..d715bbb
--- /dev/null
+++ b/contrib/sendmail/test/README
@@ -0,0 +1,27 @@
+# Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set
+# forth in the LICENSE file which can be found at the top level of
+# the sendmail distribution.
+#
+# $Id: README,v 1.2 2001/09/28 16:36:28 ca Exp $
+#
+
+This directory contains several programs to test various OS calls.
+If your OS is not listed in the Results file, you should run those
+test programs. Most of them have instructions at the begin of source
+code, at least those which are important.
+
+Notice: most of these programs require set-user-ID or set-group-ID
+installation. Hence they are not tested automatically.
+
+t_dropgid.c test how to drop saved-gid for a set-group-ID program
+t_exclopen.c test for security-defeating semantics that an open with
+ O_CREAT|O_EXCL set will successfully open a file named
+ by a symbolic link that to a non-existent file
+t_seteuid.c test whether seteuid works
+t_setgid.c test whether setgid works
+t_setreuid.c test whether setreuid works
+t_setuid.c test whether setuid works
+
diff --git a/contrib/sendmail/test/Results b/contrib/sendmail/test/Results
index 192f778..934f9a1 100644
--- a/contrib/sendmail/test/Results
+++ b/contrib/sendmail/test/Results
@@ -1,3 +1,7 @@
++------------+
+| t_setreuid |
++------------+
+
The following are results of running t_setreuid on various architectures.
OPSYS VERSION STATUS DATE TESTER/NOTES
@@ -69,6 +73,9 @@ DELL 2.2 OK 93.11.15 Peter Wemm (using -DSETEUID)
Pyramid 5.0d OK 95.01.14 David Miller <davem@nadzieja.rutgers.edu>
++-----------+
+| t_seteuid |
++-----------+
The following are results of running t_seteuid on various architectures.
@@ -101,6 +108,10 @@ OSF/1 4.0 OK 96.09.18 Gregory Neil Shapiro <gshapiro@wpi.edu>
CxOS 11.5 FAIL 96.07.08 Eric Schnoebelen <eric@cirr.com>
++------------+
+| t_pathconf |
++------------+
+
The following are the results of running t_pathconf.c. Safe means that
the underlying filesystem (in NFS, the filesystem on the server) does not
permit regular (non-root) users to chown their files to another user.
@@ -157,4 +168,31 @@ NCR MP-RAS 3 -1/0
Linux 2.0.27 1/0 1/0
-$Revision: 8.1 $, Last updated $Date: 1999/02/06 18:44:07 $
+
++-----------+
+| t_dropgid |
++-----------+
+
+The following are results of running t_dropgid on various architectures.
+
+OPSYS VERSION STATUS DATE TESTER/NOTES
+===== ======= ====== ==== ============
+AIX 4.3.3 FAILS 2001-09-22 Valdis Kletnieks
+BSD/OS 4.2 OK 2001-09-22 Vernon Schryver
+FreeBSD 3.2 OK 2001-09-22 ca
+FreeBSD 4.4 OK 2001-09-29 ca
+HP-UX 11.00 HASSETRESGID 2001-09-22 ca
+IRIX 6.5 FAILS 2001-09-22 Mark D. Roth
+Linux 2.0.35 HASSETREGID 2001-09-22 Neil W Rickert
+Linux 2.2.12 HASSETREGID 2001-09-22 ca
+Linux 2.2.16 HASSETREGID 2001-09-22 Neil W Rickert
+Linux 2.4.9 HASSETREGID 2001-09-22 Derek Balling
+NetBSD 1.5 OK 2001-09-22 Kimmo Suominen
+OpenBSD 2.8 HASSETEGID 2001-09-22 ca
+SCO 5.0.5 FAILS 2001-09-22 Phillip Porch
+SunOS 5.7 HASSETREGID 2001-09-22 Neil W Rickert
+SunOS 5.8 HASSETREGID 2001-09-22 ca
+SunOS 5.9 HASSETREGID 2001-09-22 Neil W Rickert
+
+
+$Revision: 8.3 $, Last updated $Date: 2001/09/30 01:32:33 $
diff --git a/contrib/sendmail/test/t_dropgid.c b/contrib/sendmail/test/t_dropgid.c
new file mode 100644
index 0000000..cb166d0
--- /dev/null
+++ b/contrib/sendmail/test/t_dropgid.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+/*
+** This program checks to see if your version of setgid works.
+** Compile it, make it set-group-ID guest, and run it as yourself (NOT as
+** root and not as member of the group guest).
+**
+** Compilation is trivial -- just "cc t_dropgid.c". Make it set-group-ID
+** guest and then execute it as a non-root user.
+*/
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#ifndef lint
+static char id[] = "@(#)$Id: t_dropgid.c,v 1.6 2001/09/28 16:36:28 ca Exp $";
+#endif /* ! lint */
+
+static void
+printgids(str, r, e)
+ char *str;
+ gid_t r, e;
+{
+ printf("%s (should be %d/%d): r/egid=%d/%d\n", str, (int) r, (int) e,
+ (int) getgid(), (int) getegid());
+}
+
+/* define only one of these */
+#if HASSETEGID
+# define SETGIDCALL "setegid"
+#endif /* HASSETEGID */
+#if HASSETREGID
+# define SETGIDCALL "setregid"
+#endif /* HASSETREGID */
+#if HASSETRESGID
+# define SETGIDCALL "setresgid"
+#endif /* HASSETRESGID */
+
+#ifndef SETGIDCALL
+# define SETGIDCALL "setgid"
+#endif /* ! SETGIDCALL */
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ int fail = 0;
+ int res;
+ gid_t realgid = getgid();
+ gid_t effgid = getegid();
+ char *prg = argv[0];
+
+ printgids("initial gids", realgid, effgid);
+
+ if (effgid == realgid)
+ {
+ printf("SETUP ERROR: re-run set-group-ID guest\n");
+ printf("Use chgrp(1) and chmod(1)\n");
+ printf("For example, do this as root ");
+ printf("(nobody is the name of a group in this example):\n");
+ printf("# chgrp nobody %s\n", prg);
+ printf("# chmod g+s nobody %s\n", prg);
+ exit(1);
+ }
+
+#if HASSETREGID
+ res = setregid(realgid, realgid);
+ printf("setregid(%d)=%d %s\n", (int) realgid, res,
+ res < 0 ? "failure" : "ok");
+ printgids("after setregid()", realgid, realgid);
+#endif /* HASSETREGID */
+#if HASSETRESGID
+ res = setresgid(realgid, realgid, realgid);
+ printf("setresgid(%d)=%d %s\n", (int) realgid, res,
+ res < 0 ? "failure" : "ok");
+ printgids("after setresgid()", realgid, realgid);
+#endif /* HASSETRESGID */
+#if HASSETEGID
+ res = setegid(realgid);
+ printf("setegid(%d)=%d %s\n", (int) realgid, res,
+ res < 0 ? "failure" : "ok");
+ printgids("after setegid()", realgid, realgid);
+#endif /* HASSETEGID */
+ res = setgid(realgid);
+ printf("setgid(%d)=%d %s\n", (int) realgid, res,
+ res < 0 ? "failure" : "ok");
+ printgids("after setgid()", realgid, realgid);
+
+ if (getegid() != realgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong effective gid\n");
+ }
+
+ if (getgid() != realgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong real gid\n");
+ }
+
+ /* do activity here */
+ if (setgid(effgid) == 0)
+ {
+ fail++;
+ printf("MAYDAY! setgid(%d) succeeded (should have failed)\n",
+ effgid);
+ }
+ else
+ {
+ printf("setgid(%d) failed (this is correct)\n", effgid);
+ }
+ printgids("after setgid() to egid", realgid, realgid);
+
+ if (getegid() != realgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong effective gid\n");
+ }
+ if (getgid() != realgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong real gid\n");
+ }
+ printf("\n");
+
+ if (fail > 0)
+ {
+ printf("\nThis system cannot use %s to give up set-group-ID rights\n",
+ SETGIDCALL);
+#if !HASSETEGID
+ printf("Maybe compile with -DHASSETEGID and try again\n");
+#endif /* !HASSETEGID */
+#if !HASSETREGID
+ printf("Maybe compile with -DHASSETREGID and try again\n");
+#endif /* !HASSETREGID */
+#if !HASSETRESGID
+ printf("Maybe compile with -DHASSETRESGID and try again\n");
+#endif /* !HASSETRESGID */
+ exit(1);
+ }
+
+ printf("\nIt is possible to use %s on this system\n", SETGIDCALL);
+ exit(0);
+}
diff --git a/contrib/sendmail/test/t_exclopen.c b/contrib/sendmail/test/t_exclopen.c
index 22ef693..f1bde72 100644
--- a/contrib/sendmail/test/t_exclopen.c
+++ b/contrib/sendmail/test/t_exclopen.c
@@ -1,4 +1,14 @@
/*
+ * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+/*
** This program tests your system to see if you have the lovely
** security-defeating semantics that an open with O_CREAT|O_EXCL
** set will successfully open a file named by a symbolic link that
@@ -36,7 +46,7 @@
#include <unistd.h>
#ifndef lint
-static char id[] = "@(#)$Id: t_exclopen.c,v 8.5 1999/08/28 00:25:28 gshapiro Exp $";
+static char id[] = "@(#)$Id: t_exclopen.c,v 8.6 2001/09/23 03:35:41 ca Exp $";
#endif /* ! lint */
static char Attacker[128];
diff --git a/contrib/sendmail/test/t_pathconf.c b/contrib/sendmail/test/t_pathconf.c
index 5355fd6..2baaaa6 100644
--- a/contrib/sendmail/test/t_pathconf.c
+++ b/contrib/sendmail/test/t_pathconf.c
@@ -1,4 +1,14 @@
/*
+ * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+/*
** The following test program tries the pathconf(2) routine. It should
** be run in a non-NFS-mounted directory (e.g., /tmp) and on remote (NFS)
** mounted directories running both NFS-v2 and NFS-v3 from systems that
@@ -16,7 +26,7 @@
#include <sysexits.h>
#ifndef lint
-static char id[] = "@(#)$Id: t_pathconf.c,v 8.5 1999/08/28 00:25:28 gshapiro Exp $";
+static char id[] = "@(#)$Id: t_pathconf.c,v 8.6 2001/09/23 03:35:41 ca Exp $";
#endif /* ! lint */
int
diff --git a/contrib/sendmail/test/t_seteuid.c b/contrib/sendmail/test/t_seteuid.c
index b912b60..9fab898 100644
--- a/contrib/sendmail/test/t_seteuid.c
+++ b/contrib/sendmail/test/t_seteuid.c
@@ -1,13 +1,23 @@
/*
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+/*
** This program checks to see if your version of seteuid works.
-** Compile it, make it setuid root, and run it as yourself (NOT as
+** Compile it, make it set-user-ID root, and run it as yourself (NOT as
** root). If it won't compile or outputs any MAYDAY messages, don't
** define USESETEUID in conf.h.
**
** NOTE: It is not sufficient to have seteuid in your library.
** You must also have saved uids that function properly.
**
-** Compilation is trivial -- just "cc t_seteuid.c". Make it setuid,
+** Compilation is trivial -- just "cc t_seteuid.c". Make it set-user-ID
** root and then execute it as a non-root user.
*/
@@ -16,7 +26,7 @@
#include <stdio.h>
#ifndef lint
-static char id[] = "@(#)$Id: t_seteuid.c,v 8.4 1999/08/28 00:25:28 gshapiro Exp $";
+static char id[] = "@(#)$Id: t_seteuid.c,v 8.8 2001/09/23 03:35:41 ca Exp $";
#endif /* ! lint */
#ifdef __hpux
@@ -26,10 +36,10 @@ static char id[] = "@(#)$Id: t_seteuid.c,v 8.4 1999/08/28 00:25:28 gshapiro Exp
static void
printuids(str, r, e)
char *str;
- int r, e;
+ uid_t r, e;
{
- printf("%s (should be %d/%d): r/euid=%d/%d\n", str, r, e,
- getuid(), geteuid());
+ printf("%s (should be %d/%d): r/euid=%d/%d\n", str, (int) r, (int) e,
+ (int) getuid(), (int) geteuid());
}
int
@@ -44,7 +54,7 @@ main(argc, argv)
if (geteuid() != 0)
{
- printf("SETUP ERROR: re-run setuid root\n");
+ printf("SETUP ERROR: re-run set-user-ID root\n");
exit(1);
}
diff --git a/contrib/sendmail/test/t_setgid.c b/contrib/sendmail/test/t_setgid.c
new file mode 100644
index 0000000..dfe1805
--- /dev/null
+++ b/contrib/sendmail/test/t_setgid.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+/*
+** This program checks to see if your version of setgid works.
+** Compile it, make it set-group-ID guest, and run it as yourself (NOT as
+** root and not as member of the group guest).
+**
+** Compilation is trivial -- just "cc t_setgid.c". Make it set-group-ID,
+** guest and then execute it as a non-root user.
+*/
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#ifndef lint
+static char id[] = "@(#)$Id: t_setgid.c,v 1.6 2001/09/23 03:35:41 ca Exp $";
+#endif /* ! lint */
+
+static void
+printgids(str, r, e)
+ char *str;
+ gid_t r, e;
+{
+ printf("%s (should be %d/%d): r/egid=%d/%d\n", str, (int) r, (int) e,
+ (int) getgid(), (int) getegid());
+}
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ int fail = 0;
+ int res;
+ gid_t realgid = getgid();
+ gid_t effgid = getegid();
+
+ printgids("initial gids", realgid, effgid);
+
+ if (effgid == realgid)
+ {
+ printf("SETUP ERROR: re-run set-group-ID guest\n");
+ exit(1);
+ }
+
+#if SM_CONF_SETREGID
+ res = setregid(effgid, effgid);
+#else /* SM_CONF_SETREGID */
+ res = setgid(effgid);
+#endif /* SM_CONF_SETREGID */
+
+ printf("setgid(%d)=%d %s\n", (int) effgid, res,
+ res < 0 ? "failure" : "ok");
+#if SM_CONF_SETREGID
+ printgids("after setregid()", effgid, effgid);
+#else /* SM_CONF_SETREGID */
+ printgids("after setgid()", effgid, effgid);
+#endif /* SM_CONF_SETREGID */
+
+ if (getegid() != effgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong effective gid\n");
+ }
+
+ if (getgid() != effgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong real gid\n");
+ }
+
+ /* do activity here */
+ if (setgid(0) == 0)
+ {
+ fail++;
+ printf("MAYDAY! setgid(0) succeeded (should have failed)\n");
+ }
+ else
+ {
+ printf("setgid(0) failed (this is correct)\n");
+ }
+ printgids("after setgid(0)", effgid, effgid);
+
+ if (getegid() != effgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong effective gid\n");
+ }
+ if (getgid() != effgid)
+ {
+ fail++;
+ printf("MAYDAY! Wrong real gid\n");
+ }
+ printf("\n");
+
+ if (fail > 0)
+ {
+ printf("\nThis system cannot use %s to set the real gid to the effective gid\nand clear the saved gid.\n",
+#if SM_CONF_SETREGID
+ "setregid"
+#else /* SM_CONF_SETREGID */
+ "setgid"
+#endif /* SM_CONF_SETREGID */
+ );
+ exit(1);
+ }
+
+ printf("\nIt is possible to use setgid on this system\n");
+ exit(0);
+}
diff --git a/contrib/sendmail/test/t_setreuid.c b/contrib/sendmail/test/t_setreuid.c
index 1b6eff6..b307b08 100644
--- a/contrib/sendmail/test/t_setreuid.c
+++ b/contrib/sendmail/test/t_setreuid.c
@@ -1,10 +1,20 @@
/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+/*
** This program checks to see if your version of setreuid works.
-** Compile it, make it setuid root, and run it as yourself (NOT as
+** Compile it, make it set-user-ID 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". Make it setuid,
+** Compilation is trivial -- just "cc t_setreuid.c". Make it set-user-ID,
** root and then execute it as a non-root user.
*/
@@ -13,7 +23,7 @@
#include <stdio.h>
#ifndef lint
-static char id[] = "@(#)$Id: t_setreuid.c,v 8.4 1999/08/28 00:25:28 gshapiro Exp $";
+static char id[] = "@(#)$Id: t_setreuid.c,v 8.9 2001/10/12 03:04:46 gshapiro Exp $";
#endif /* ! lint */
#ifdef __hpux
@@ -23,10 +33,10 @@ static char id[] = "@(#)$Id: t_setreuid.c,v 8.4 1999/08/28 00:25:28 gshapiro Exp
static void
printuids(str, r, e)
char *str;
- int r, e;
+ uid_t r, e;
{
- printf("%s (should be %d/%d): r/euid=%d/%d\n", str, r, e,
- getuid(), geteuid());
+ printf("%s (should be %d/%d): r/euid=%d/%d\n", str, (int) r, (int) e,
+ (int) getuid(), (int) geteuid());
}
int
@@ -41,7 +51,7 @@ main(argc, argv)
if (geteuid() != 0)
{
- printf("SETUP ERROR: re-run setuid root\n");
+ printf("SETUP ERROR: re-run set-user-ID root\n");
exit(1);
}
@@ -58,6 +68,12 @@ main(argc, argv)
}
printuids("after setreuid(0, 1)", 0, 1);
+ if (getuid() != 0)
+ {
+ fail++;
+ printf("MAYDAY! Wrong real uid\n");
+ }
+
if (geteuid() != 1)
{
fail++;
@@ -75,7 +91,7 @@ main(argc, argv)
if (setreuid(realuid, 0) < 0)
{
fail++;
- printf("setreuid(%d, 0) failure\n", realuid);
+ printf("setreuid(%d, 0) failure\n", (int) realuid);
}
printuids("after setreuid(realuid, 0)", realuid, 0);
@@ -104,6 +120,12 @@ main(argc, argv)
printf("MAYDAY! Wrong effective uid\n");
}
+ if (getuid() != 0)
+ {
+ fail++;
+ printf("MAYDAY! Wrong real uid\n");
+ }
+
/* do activity here */
if (setreuid(-1, 0) < 0)
@@ -115,7 +137,7 @@ main(argc, argv)
if (setreuid(realuid, 0) < 0)
{
fail++;
- printf("setreuid(%d, 0) failure\n", realuid);
+ printf("setreuid(%d, 0) failure\n", (int) realuid);
}
printuids("after setreuid(realuid, 0)", realuid, 0);
diff --git a/contrib/sendmail/test/t_setuid.c b/contrib/sendmail/test/t_setuid.c
index 7487579..6533339 100644
--- a/contrib/sendmail/test/t_setuid.c
+++ b/contrib/sendmail/test/t_setuid.c
@@ -1,12 +1,22 @@
/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
+/*
** This program checks to see if your version of setuid works.
-** Compile it, make it setuid root, and run it as yourself (NOT as
+** Compile it, make it set-user-ID root, and run it as yourself (NOT as
** root).
**
** NOTE: This should work everywhere, but Linux has the ability
** to use the undocumented setcap() call to make this break.
**
-** Compilation is trivial -- just "cc t_setuid.c". Make it setuid,
+** Compilation is trivial -- just "cc t_setuid.c". Make it set-user-ID,
** root and then execute it as a non-root user.
*/
@@ -15,16 +25,16 @@
#include <stdio.h>
#ifndef lint
-static char id[] = "@(#)$Id: t_setuid.c,v 8.2.2.1 2000/05/31 00:29:47 gshapiro Exp $";
+static char id[] = "@(#)$Id: t_setuid.c,v 8.7 2001/09/23 03:35:41 ca Exp $";
#endif /* ! lint */
static void
printuids(str, r, e)
char *str;
- int r, e;
+ uid_t r, e;
{
- printf("%s (should be %d/%d): r/euid=%d/%d\n", str, r, e,
- getuid(), geteuid());
+ printf("%s (should be %d/%d): r/euid=%d/%d\n", str, (int) r, (int) e,
+ (int) getuid(), (int) geteuid());
}
int
@@ -39,7 +49,7 @@ main(argc, argv)
if (geteuid() != 0)
{
- printf("SETUP ERROR: re-run setuid root\n");
+ printf("SETUP ERROR: re-run set-user-ID root\n");
exit(1);
}
diff --git a/contrib/sendmail/test/t_snprintf.c b/contrib/sendmail/test/t_snprintf.c
index 3117af5..8a0378f 100644
--- a/contrib/sendmail/test/t_snprintf.c
+++ b/contrib/sendmail/test/t_snprintf.c
@@ -1,6 +1,20 @@
+/*
+ * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ */
+
#include <stdio.h>
#include <sysexits.h>
+#ifndef lint
+static char id[] = "@(#)$Id: t_snprintf.c,v 8.4 2001/09/23 03:35:41 ca Exp $";
+#endif /* ! lint */
+
#define TEST_STRING "1234567890"
int
OpenPOWER on IntegriCloud