explain what's going on before we fix it.

This commit is contained in:
christos 2018-02-16 16:30:20 +00:00
parent 474def7698
commit e34e5e3adb
2 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_tcp.c,v 1.7 2018/02/16 16:23:15 christos Exp $ */ /* $NetBSD: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $ */
/*- /*-
* Copyright (c) 2013 The NetBSD Foundation, Inc. * Copyright (c) 2013 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __RCSID #ifdef __RCSID
__RCSID("$Id: t_tcp.c,v 1.7 2018/02/16 16:23:15 christos Exp $"); __RCSID("$Id: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $");
#endif #endif
/* Example code. Should block; does with accept not paccept. */ /* Example code. Should block; does with accept not paccept. */
@ -182,12 +182,13 @@ again:
FAIL("fnctl setfl"); FAIL("fnctl setfl");
#endif #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)"); FAIL("getpeereid(clnt)");
CHECK_EQUAL(euid, geteuid(), "client"); CHECK_EQUAL(euid, geteuid(), "client");
CHECK_EQUAL(egid, getegid(), "client"); CHECK_EQUAL(egid, getegid(), "client");
/* This is not symmetric? */ /* 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)"); FAIL("getpeereid(srvr)");
CHECK_EQUAL(euid, geteuid(), "server"); CHECK_EQUAL(euid, geteuid(), "server");

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_unix.c,v 1.13 2018/02/16 16:23:15 christos Exp $ */ /* $NetBSD: t_unix.c,v 1.14 2018/02/16 16:30:20 christos Exp $ */
/*- /*-
* Copyright (c) 2011 The NetBSD Foundation, Inc. * Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __RCSID #ifdef __RCSID
__RCSID("$Id: t_unix.c,v 1.13 2018/02/16 16:23:15 christos Exp $"); __RCSID("$Id: t_unix.c,v 1.14 2018/02/16 16:30:20 christos Exp $");
#else #else
#define getprogname() argv[0] #define getprogname() argv[0]
#endif #endif
@ -183,7 +183,7 @@ test(bool closeit, size_t len)
CHECK_EQUAL(egid, getegid(), "client"); CHECK_EQUAL(egid, getegid(), "client");
#if 0 #if 0
/* This is not symmetric? */ /* This is not symmetric? It is supposed to work! */
if (getpeereid(srvr, &euid, &egid) == -1) if (getpeereid(srvr, &euid, &egid) == -1)
FAIL("getpeereid(srvr)"); FAIL("getpeereid(srvr)");
CHECK_EQUAL(euid, geteuid(), "server"); CHECK_EQUAL(euid, geteuid(), "server");