1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00
freebsd-ports/security/pidentd/files/patch-al
Brian Feldman d9b2b611dd Switch pidentd to using sysctl()s instead of libkvm. It now doesn't need
to be linked with libkvm... this should fix a lot of strange problems
people report with pidentd.

This is for -CURRENT only, at the moment.
1999-07-14 19:37:23 +00:00

36 lines
764 B
Plaintext

--- /dev/null Wed Jul 14 15:27:00 1999
+++ src/freebsd4.c Thu Jul 8 15:52:57 1999
@@ -0,0 +1,32 @@
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <sys/ucred.h>
+
+#include <netinet/in.h>
+
+int
+k_open(void) {
+
+ return 0;
+}
+
+int k_getuid(struct in_addr *faddr, int fport, struct in_addr *laddr,
+ int lport, int *uid) {
+ struct sockaddr_in sin[2];
+ struct ucred uc;
+ size_t oldlen = sizeof(uc);
+
+ sin[0].sin_addr.s_addr = laddr->s_addr;
+ sin[1].sin_addr.s_addr = faddr->s_addr;
+ sin[0].sin_port = (u_short)lport;
+ sin[1].sin_port = (u_short)fport;
+
+ if (sysctlbyname("net.inet.tcp.getcred", &uc, &oldlen, sin,
+ sizeof(sin)))
+ return -1;
+
+ *uid = uc.cr_uid;
+ return 0;
+}