Package: pidentd
Version: 3.0.18-3
Severity: serious
Tags: patch

Since version 2.6.16.20-1 of linux-kernel-headers, tcp_diag.h was
renamed as inet_diag.h.

Aníbal Monsalve Salazar
-- 
http://v7w.com/anibal


diff -u pidentd-3.0.18/src/k_linux.c pidentd-3.0.19.ds1/src/k_linux.c
--- pidentd-3.0.18/src/k_linux.c
+++ pidentd-3.0.19.ds1/src/k_linux.c
@@ -28,7 +28,7 @@
 
 #include <linux/types.h>
 #include <linux/netlink.h>
-#include <linux/tcp_diag.h>
+#include <linux/inet_diag.h>
 
 #include "pidentd.h"
 
@@ -57,7 +57,7 @@
     kp = s_malloc(sizeof(*kp));
 
     kp->seq = 0;
-    kp->nlfd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_TCPDIAG);
+    kp->nlfd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_INET_DIAG);
     if (kp->nlfd >= 0)
        goto out;
     
@@ -83,8 +83,8 @@
     struct {
        struct nlmsghdr nlh;
        union {
-               struct tcpdiagreq req;
-               struct tcpdiagmsg rsp;
+               struct inet_diag_req req;
+               struct inet_diag_msg rsp;
        } u;
     } buf;
     struct sockaddr_nl addr;
@@ -94,14 +94,14 @@
     buf.nlh.nlmsg_type = TCPDIAG_GETSOCK;
     buf.nlh.nlmsg_flags = NLM_F_REQUEST;
     buf.nlh.nlmsg_seq = ++kip->seq;
-    buf.u.req.tcpdiag_family = AF_INET;
+    buf.u.req.idiag_family = AF_INET;
 
-    buf.u.req.id.tcpdiag_dport = kp->remote.sin_port;
-    buf.u.req.id.tcpdiag_sport = kp->local.sin_port;
-    buf.u.req.id.tcpdiag_dst[0] = kp->remote.sin_addr.s_addr;
-    buf.u.req.id.tcpdiag_src[0] = kp->local.sin_addr.s_addr;
-    buf.u.req.id.tcpdiag_cookie[0] = TCPDIAG_NOCOOKIE;
-    buf.u.req.id.tcpdiag_cookie[1] = TCPDIAG_NOCOOKIE;
+    buf.u.req.id.idiag_dport = kp->remote.sin_port;
+    buf.u.req.id.idiag_sport = kp->local.sin_port;
+    buf.u.req.id.idiag_dst[0] = kp->remote.sin_addr.s_addr;
+    buf.u.req.id.idiag_src[0] = kp->local.sin_addr.s_addr;
+    buf.u.req.id.idiag_cookie[0] = INET_DIAG_NOCOOKIE;
+    buf.u.req.id.idiag_cookie[1] = INET_DIAG_NOCOOKIE;
 
     status = write(kip->nlfd, &buf, buf.nlh.nlmsg_len);
     if (status < 0) {
@@ -123,10 +123,10 @@
 
     if (buf.nlh.nlmsg_type != TCPDIAG_GETSOCK)
        return 0;
-    if (buf.u.rsp.tcpdiag_state != TCP_ESTABLISHED)
+    if (buf.u.rsp.idiag_state != TCP_ESTABLISHED)
        return 0;
 
-    kp->euid = buf.u.rsp.tcpdiag_uid;
+    kp->euid = buf.u.rsp.idiag_uid;
     return 1;
 }
 

Attachment: signature.asc
Description: Digital signature

Reply via email to