Deleted Added
sdiff udiff text old ( 241848 ) new ( 246139 )
full compact
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 29 unchanged lines hidden (view full) ---

38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93";
43#endif
44#endif /* not lint */
45#include <sys/cdefs.h>
46__FBSDID("$FreeBSD: head/libexec/tftpd/tftpd.c 246139 2013-01-31 00:02:36Z marius $");
47
48/*
49 * Trivial file transfer protocol server.
50 *
51 * This version includes many modifications by Jim Guyton
52 * <guyton@rand-unix>.
53 */
54

--- 5 unchanged lines hidden (view full) ---

60#include <netinet/in.h>
61#include <arpa/tftp.h>
62
63#include <ctype.h>
64#include <errno.h>
65#include <fcntl.h>
66#include <netdb.h>
67#include <pwd.h>
68#include <stdint.h>
69#include <stdio.h>
70#include <stdlib.h>
71#include <string.h>
72#include <syslog.h>
73#include <tcpd.h>
74#include <unistd.h>
75
76#include "tftp-file.h"

--- 718 unchanged lines hidden (view full) ---

795 if (debug&DEBUG_SIMPLE)
796 tftp_log(LOG_DEBUG, "Transmitting file");
797
798 read_init(0, file, mode);
799 block = 1;
800 tftp_send(peer, &block, &ts);
801 read_close();
802 if (debug&DEBUG_SIMPLE)
803 tftp_log(LOG_INFO, "Sent %jd bytes in %jd seconds",
804 (intmax_t)ts.amount, (intmax_t)time(NULL) - now);
805}
806
807static void
808tftp_recvfile(int peer, const char *mode)
809{
810 uint16_t block;
811 struct timeval now1, now2;
812 struct tftp_stats ts;

--- 15 unchanged lines hidden (view full) ---

828 if (now1.tv_usec > now2.tv_usec) {
829 now2.tv_usec += 1000000;
830 now2.tv_sec--;
831 }
832
833 f = now2.tv_sec - now1.tv_sec +
834 (now2.tv_usec - now1.tv_usec) / 100000.0;
835 tftp_log(LOG_INFO,
836 "Download of %jd bytes in %d blocks completed after %0.1f seconds\n",
837 (intmax_t)ts.amount, block, f);
838 }
839
840 return;
841}