tftpd.c (302408) | tftpd.c (313231) |
---|---|
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 --- 25 unchanged lines hidden (view full) --- 34#endif /* not lint */ 35 36#ifndef lint 37#if 0 38static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93"; 39#endif 40#endif /* not lint */ 41#include <sys/cdefs.h> | 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 --- 25 unchanged lines hidden (view full) --- 34#endif /* not lint */ 35 36#ifndef lint 37#if 0 38static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93"; 39#endif 40#endif /* not lint */ 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: stable/11/libexec/tftpd/tftpd.c 262136 2014-02-17 22:27:32Z brueffer $"); | 42__FBSDID("$FreeBSD: stable/11/libexec/tftpd/tftpd.c 313231 2017-02-04 16:55:46Z ngie $"); |
43 44/* 45 * Trivial file transfer protocol server. 46 * 47 * This version includes many modifications by Jim Guyton 48 * <guyton@rand-unix>. 49 */ 50 --- 10 unchanged lines hidden (view full) --- 61#include <fcntl.h> 62#include <netdb.h> 63#include <pwd.h> 64#include <stdint.h> 65#include <stdio.h> 66#include <stdlib.h> 67#include <string.h> 68#include <syslog.h> | 43 44/* 45 * Trivial file transfer protocol server. 46 * 47 * This version includes many modifications by Jim Guyton 48 * <guyton@rand-unix>. 49 */ 50 --- 10 unchanged lines hidden (view full) --- 61#include <fcntl.h> 62#include <netdb.h> 63#include <pwd.h> 64#include <stdint.h> 65#include <stdio.h> 66#include <stdlib.h> 67#include <string.h> 68#include <syslog.h> |
69#include <tcpd.h> | |
70#include <unistd.h> 71 72#include "tftp-file.h" 73#include "tftp-io.h" 74#include "tftp-utils.h" 75#include "tftp-transfer.h" 76#include "tftp-options.h" 77 | 69#include <unistd.h> 70 71#include "tftp-file.h" 72#include "tftp-io.h" 73#include "tftp-utils.h" 74#include "tftp-transfer.h" 75#include "tftp-options.h" 76 |
77#ifdef LIBWRAP 78#include <tcpd.h> 79#endif 80 |
|
78static void tftp_wrq(int peer, char *, ssize_t); 79static void tftp_rrq(int peer, char *, ssize_t); 80 81/* 82 * Null-terminated directory prefix list for absolute pathname requests and 83 * search list for relative pathname requests. 84 * 85 * MAXDIRS should be at least as large as the number of arguments that --- 190 unchanged lines hidden (view full) --- 276 if (pid < 0) { 277 tftp_log(LOG_ERR, "fork: %s", strerror(errno)); 278 exit(1); 279 } else if (pid != 0) { 280 exit(0); 281 } 282 } 283 | 81static void tftp_wrq(int peer, char *, ssize_t); 82static void tftp_rrq(int peer, char *, ssize_t); 83 84/* 85 * Null-terminated directory prefix list for absolute pathname requests and 86 * search list for relative pathname requests. 87 * 88 * MAXDIRS should be at least as large as the number of arguments that --- 190 unchanged lines hidden (view full) --- 279 if (pid < 0) { 280 tftp_log(LOG_ERR, "fork: %s", strerror(errno)); 281 exit(1); 282 } else if (pid != 0) { 283 exit(0); 284 } 285 } 286 |
287#ifdef LIBWRAP |
|
284 /* 285 * See if the client is allowed to talk to me. 286 * (This needs to be done before the chroot()) 287 */ 288 { 289 struct request_info req; 290 291 request_init(&req, RQ_CLIENT_ADDR, peername, 0); --- 32 unchanged lines hidden (view full) --- 324 "via 'tftpd-wo' entry"); 325 } 326 } else 327 if (debug&DEBUG_ACCESS) 328 tftp_log(LOG_WARNING, 329 "Full access allowed" 330 "in /etc/hosts.allow"); 331 } | 288 /* 289 * See if the client is allowed to talk to me. 290 * (This needs to be done before the chroot()) 291 */ 292 { 293 struct request_info req; 294 295 request_init(&req, RQ_CLIENT_ADDR, peername, 0); --- 32 unchanged lines hidden (view full) --- 328 "via 'tftpd-wo' entry"); 329 } 330 } else 331 if (debug&DEBUG_ACCESS) 332 tftp_log(LOG_WARNING, 333 "Full access allowed" 334 "in /etc/hosts.allow"); 335 } |
336#endif |
|
332 333 /* 334 * Since we exit here, we should do that only after the above 335 * recvfrom to keep inetd from constantly forking should there 336 * be a problem. See the above comment about system clogging. 337 */ 338 if (chroot_dir) { 339 if (ipchroot > 0) { --- 498 unchanged lines hidden --- | 337 338 /* 339 * Since we exit here, we should do that only after the above 340 * recvfrom to keep inetd from constantly forking should there 341 * be a problem. See the above comment about system clogging. 342 */ 343 if (chroot_dir) { 344 if (ipchroot > 0) { --- 498 unchanged lines hidden --- |