Call rrdp_data_handler() for any kind of poll event that has happened.
authorclaudio <claudio@openbsd.org>
Thu, 15 Apr 2021 13:31:30 +0000 (13:31 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 15 Apr 2021 13:31:30 +0000 (13:31 +0000)
On OpenBSD closing a connection will result in a read even (POLLIN) while
on Linux POLLHUP is returned. rrdp_data_handler()'s read() call returns
in both cases 0 and finishes the XML parsing.
Found and fix tested by job@, OK deraadt@

usr.sbin/rpki-client/rrdp.c

index 7f8b2d0..4ac925c 100644 (file)
@@ -1,4 +1,4 @@
-/*      $OpenBSD: rrdp.c,v 1.4 2021/04/12 17:23:30 claudio Exp $ */
+/*      $OpenBSD: rrdp.c,v 1.5 2021/04/15 13:31:30 claudio Exp $ */
 /*
  * Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
  * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
@@ -579,7 +579,7 @@ proc_rrdp(int fd)
                TAILQ_FOREACH_SAFE(s, &states, entry, ns) {
                        if (s->pfd == NULL)
                                continue;
-                       if (s->pfd->revents & POLLIN)
+                       if (s->pfd->revents != 0)
                                rrdp_data_handler(s);
                }
        }