-t      Only honour a request if the server (the host that rarpd is
             running on) can "boot" the target; that is, if a file or
             directory called /tftpboot/ipaddr exists, where ipaddr is the
             target IP address expressed in uppercase hexadecimal (only the
             first 8 characters of filenames are checked).

Unless -t is used, this directory is not accessed in any way;  TFTP_DIR
is used once in rarp_bootable() which gets called once:

        if (tflag == 0 || rarp_bootable(htonl(target_ipaddr)))
                rarp_reply(ii, ia, ep, target_ipaddr, hp);  

Feedback? OK?

Index: rarpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/rarpd/rarpd.c,v
retrieving revision 1.79
diff -u -p -r1.79 rarpd.c
--- rarpd.c     15 Nov 2021 15:14:24 -0000      1.79
+++ rarpd.c     1 Oct 2022 20:05:52 -0000
@@ -339,8 +339,9 @@ rarp_loop(void)
 
        arptab_init();
 
-       if (unveil(TFTP_DIR, "r") == -1)
-               error("unveil %s", TFTP_DIR);
+       if (tflag)
+               if (unveil(TFTP_DIR, "r") == -1)
+                       error("unveil %s", TFTP_DIR);
        if (unveil("/etc/ethers", "r") == -1)
                error("unveil /etc/ethers");
        if (pledge("stdio rpath dns", NULL) == -1)

Reply via email to