5ef61b8
--- a/tftpd/tftpd.c	2016-03-02 11:32:30.710775130 +0100
5ef61b8
+++ b/tftpd/tftpd.c	2016-03-02 11:36:24.086541019 +0100
5ef61b8
@@ -1056,14 +1056,14 @@ int main(int argc, char **argv)
5ef61b8
 
5ef61b8
 static char *rewrite_access(char *, int, const char **);
5ef61b8
 static int validate_access(char *, int, const struct formats *, const char **);
5ef61b8
-static void tftp_sendfile(const struct formats *, struct tftphdr *, int);
5ef61b8
+static void tftp_sendfile(const struct formats *, struct tftphdr *, int, char *);
5ef61b8
 static void tftp_recvfile(const struct formats *, struct tftphdr *, int);
5ef61b8
 
5ef61b8
 struct formats {
5ef61b8
     const char *f_mode;
5ef61b8
     char *(*f_rewrite) (char *, int, const char **);
5ef61b8
     int (*f_validate) (char *, int, const struct formats *, const char **);
5ef61b8
-    void (*f_send) (const struct formats *, struct tftphdr *, int);
5ef61b8
+    void (*f_send) (const struct formats *, struct tftphdr *, int, char *);
5ef61b8
     void (*f_recv) (const struct formats *, struct tftphdr *, int);
5ef61b8
     int f_convert;
5ef61b8
 };
5ef61b8
@@ -1129,6 +1129,9 @@ int tftp(struct tftphdr *tp, int size)
5ef61b8
                 nak(EACCESS, errmsgptr);        /* File denied by mapping rule */
5ef61b8
                 exit(0);
5ef61b8
             }
5ef61b8
+	    ecode =
5ef61b8
+                (*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr);
5ef61b8
+
5ef61b8
             if (verbosity >= 1) {
5ef61b8
                 tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
5ef61b8
                                           tmpbuf, INET6_ADDRSTRLEN);
5ef61b8
@@ -1147,9 +1150,14 @@ int tftp(struct tftphdr *tp, int size)
5ef61b8
                            tp_opcode == WRQ ? "WRQ" : "RRQ",
5ef61b8
                            tmp_p, origfilename,
5ef61b8
                            filename);
5ef61b8
+
5ef61b8
+                if (ecode == 1) {
5ef61b8
+                    syslog(LOG_NOTICE, "Client %s File not found %s\n",
5ef61b8
+                    tmp_p,filename);
5ef61b8
+                }
5ef61b8
+
5ef61b8
             }
5ef61b8
-            ecode =
5ef61b8
-                (*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr);
5ef61b8
+
5ef61b8
             if (ecode) {
5ef61b8
                 nak(ecode, errmsgptr);
5ef61b8
                 exit(0);
5ef61b8
@@ -1172,12 +1180,12 @@ int tftp(struct tftphdr *tp, int size)
5ef61b8
         if (tp_opcode == WRQ)
5ef61b8
             (*pf->f_recv) (pf, (struct tftphdr *)ackbuf, ap - ackbuf);
5ef61b8
         else
5ef61b8
-            (*pf->f_send) (pf, (struct tftphdr *)ackbuf, ap - ackbuf);
5ef61b8
+            (*pf->f_send) (pf, (struct tftphdr *)ackbuf, ap - ackbuf, origfilename);
5ef61b8
     } else {
5ef61b8
         if (tp_opcode == WRQ)
5ef61b8
             (*pf->f_recv) (pf, NULL, 0);
5ef61b8
         else
5ef61b8
-            (*pf->f_send) (pf, NULL, 0);
5ef61b8
+            (*pf->f_send) (pf, NULL, 0, origfilename);
5ef61b8
     }
5ef61b8
     exit(0);                    /* Request completed */
5ef61b8
 }
5ef61b8
@@ -1557,7 +1565,7 @@ static int validate_access(char *filenam
5ef61b8
 /*
5ef61b8
  * Send the requested file.
5ef61b8
  */
5ef61b8
-static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oacklen)
5ef61b8
+static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oacklen, char *filename)
5ef61b8
 {
5ef61b8
     struct tftphdr *dp;
5ef61b8
     struct tftphdr *ap;         /* ack packet */
5ef61b8
@@ -1648,6 +1656,13 @@ static void tftp_sendfile(const struct f
5ef61b8
 	if (!++block)
5ef61b8
 	  block = rollover_val;
5ef61b8
     } while (size == segsize);
5ef61b8
+    tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
5ef61b8
+                                          tmpbuf, INET6_ADDRSTRLEN);
5ef61b8
+    if (!tmp_p) {
5ef61b8
+            tmp_p = tmpbuf;
5ef61b8
+            strcpy(tmpbuf, "???");
5ef61b8
+    }
5ef61b8
+    syslog(LOG_NOTICE, "Client %s finished %s",tmp_p,filename);
5ef61b8
   abort:
5ef61b8
     (void)fclose(file);
5ef61b8
 }