66 lines
1.8 KiB
Text
66 lines
1.8 KiB
Text
$NetBSD: patch-af,v 1.1 2006/03/05 08:17:49 christos Exp $
|
|
|
|
--- net.c 2005-07-04 19:33:38.000000000 -0400
|
|
+++ net.c 2006-03-04 19:12:24.000000000 -0500
|
|
@@ -43,12 +43,16 @@
|
|
#endif
|
|
|
|
#include <netinet/in.h>
|
|
-#ifdef HAVE_NETINET_TCP_H
|
|
+#if defined(HAVE_NETINET_TCP_H) || defined(NETBSD)
|
|
#include <netinet/tcp.h>
|
|
#endif
|
|
-#ifdef HAVE_NETINET_UDP_H
|
|
+#if defined(HAVE_NETINET_UDP_H) || defined(NETBSD)
|
|
#include <netinet/udp.h>
|
|
#endif
|
|
+#ifdef NETBSD
|
|
+#include <sys/param.h>
|
|
+#include <sys/ucred.h>
|
|
+#endif
|
|
#include <arpa/inet.h>
|
|
#include <net/if.h>
|
|
#if defined(LINUX)
|
|
@@ -1125,12 +1129,21 @@
|
|
free(cmsg);
|
|
return;
|
|
}
|
|
+#if !defined(SCM_CREDENTIALS) && defined(SCM_CREDS)
|
|
+#define SCM_CREDENTIALS SCM_CREDS
|
|
+#endif
|
|
+
|
|
if (cmsg->cmsg_type == SCM_CREDENTIALS
|
|
&& CMSG_LEN(sizeof(struct ucred)) <= cmsg_len) {
|
|
struct ucred *uc = (struct ucred *) CMSG_DATA (cmsg);
|
|
|
|
+#ifdef NETBSD
|
|
+ tprintf("{uid=%ld, gid=%ld}}",
|
|
+ (long)uc->cr_uid, (long)uc->cr_gid);
|
|
+#else
|
|
tprintf("{pid=%ld, uid=%ld, gid=%ld}}",
|
|
(long)uc->pid, (long)uc->uid, (long)uc->gid);
|
|
+#endif
|
|
free(cmsg);
|
|
return;
|
|
}
|
|
@@ -1470,7 +1483,7 @@
|
|
else
|
|
tprintf("[%u, %u]", fds[0], fds[1]);
|
|
}
|
|
-#elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(FREEBSD) || defined(IA64)
|
|
+#elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(ALLBSD) || defined(IA64)
|
|
if (exiting(tcp))
|
|
tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
|
|
#endif
|
|
@@ -1517,9 +1530,9 @@
|
|
else
|
|
tprintf(", [%u, %u]", fds[0], fds[1]);
|
|
#endif /* LINUX */
|
|
-#if defined(SUNOS4) || defined(SVR4) || defined(FREEBSD)
|
|
+#if defined(SUNOS4) || defined(SVR4) || defined(ALLBSD)
|
|
tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp));
|
|
-#endif /* SUNOS4 || SVR4 || FREEBSD */
|
|
+#endif /* SUNOS4 || SVR4 || ALLBSD */
|
|
}
|
|
return 0;
|
|
}
|