Module Name: src
Committed By: christos
Date: Fri Feb 16 19:24:16 UTC 2018
Modified Files:
src/tests/net/net: t_tcp.c
Log Message:
ensure that getpeereid does not succeed on tcp sockets.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/net/t_tcp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/net/net/t_tcp.c
diff -u src/tests/net/net/t_tcp.c:1.8 src/tests/net/net/t_tcp.c:1.9
--- src/tests/net/net/t_tcp.c:1.8 Fri Feb 16 11:30:20 2018
+++ src/tests/net/net/t_tcp.c Fri Feb 16 14:24:16 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $ */
+/* $NetBSD: t_tcp.c,v 1.9 2018/02/16 19:24:16 christos Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$Id: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $");
+__RCSID("$Id: t_tcp.c,v 1.9 2018/02/16 19:24:16 christos Exp $");
#endif
/* Example code. Should block; does with accept not paccept. */
@@ -183,17 +183,11 @@ again:
#endif
/* This is supposed to only work on Unix sockets but returns garbage */
- if (getpeereid(clnt, &euid, &egid) == -1)
+ if (getpeereid(clnt, &euid, &egid) != -1)
FAIL("getpeereid(clnt)");
- CHECK_EQUAL(euid, geteuid(), "client");
- CHECK_EQUAL(egid, getegid(), "client");
-
/* This is supposed to only work on Unix sockets but returns garbage */
- if (getpeereid(srvr, &euid, &egid) == -1)
+ if (getpeereid(srvr, &euid, &egid) != -1)
FAIL("getpeereid(srvr)");
- CHECK_EQUAL(euid, geteuid(), "server");
- CHECK_EQUAL(egid, getegid(), "server");
-
if (as == -1) { /* not true under NetBSD */
as = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);