summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-25 09:47:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-25 09:47:47 +0000
commit3e2c122d296356cb57d66fd4862a2af5f7fe3eae (patch)
tree3094a6a31b0b101478c02a7e87798d7cd2f858a7
parent662855b98ccc9e0318cc42f958d3281668ed4b17 (diff)
only report SS_CONNECTOUT sockets
-rw-r--r--libexec/identd/openbsd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libexec/identd/openbsd.c b/libexec/identd/openbsd.c
index acd4b212e9c..b90682a224e 100644
--- a/libexec/identd/openbsd.c
+++ b/libexec/identd/openbsd.c
@@ -1,5 +1,5 @@
/*
-** $Id: openbsd.c,v 1.1 1996/07/25 09:47:22 deraadt Exp $
+** $Id: openbsd.c,v 1.2 1996/07/25 09:47:46 deraadt Exp $
**
** netbsd.c Low level kernel access functions for NetBSD
**
@@ -176,7 +176,7 @@ int k_getuid(faddr, fport, laddr, lport, uid)
int *uid;
{
long addr;
- struct socket *sockp;
+ struct socket *sockp, sock;
int i, mib[2];
struct ucred ucb;
@@ -219,6 +219,12 @@ int k_getuid(faddr, fport, laddr, lport, uid)
if (!sockp)
return -1;
+ if (!getbuf(sockp, &sock, sizeof sock, "socket"))
+ return -1;
+
+ if ((sock.so_state & SS_CONNECTOUT) == 0)
+ return -1;
+
/*
** Locate the file descriptor that has the socket in question
** open so that we can get the 'ucred' information