Deleted Added
full compact
tftp-transfer.c (207614) tftp-transfer.c (224536)
1/*
2 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*
2 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-transfer.c 207614 2010-05-04 13:07:40Z imp $");
27__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-transfer.c 224536 2011-07-31 03:12:20Z rodrigc $");
28
29#include <sys/types.h>
30#include <sys/param.h>
31#include <sys/ioctl.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
34
35#include <netinet/in.h>

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

124 }
125 }
126
127 }
128 oldblock = *block;
129 (*block)++;
130 if (oldblock > *block) {
131 if (options[OPT_ROLLOVER].o_request == NULL) {
28
29#include <sys/types.h>
30#include <sys/param.h>
31#include <sys/ioctl.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
34
35#include <netinet/in.h>

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

124 }
125 }
126
127 }
128 oldblock = *block;
129 (*block)++;
130 if (oldblock > *block) {
131 if (options[OPT_ROLLOVER].o_request == NULL) {
132 tftp_log(LOG_ERR,
133 "Block rollover but not allowed.");
134 send_error(peer, EBADOP);
135 gettimeofday(&(ts->tstop), NULL);
136 return;
132 /*
133 * "rollover" option not specified in
134 * tftp client. Default to rolling block
135 * counter to 0.
136 */
137 *block = 0;
138 } else {
139 *block = atoi(options[OPT_ROLLOVER].o_request);
137 }
138
140 }
141
139 *block = atoi(options[OPT_ROLLOVER].o_request);
140 ts->rollovers++;
141 }
142 gettimeofday(&(ts->tstop), NULL);
143 } while (size == segsize);
144abort:
145 return;
146}
147

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

191 }
192
193 rp = (struct tftphdr *)recvbuffer;
194 do {
195 oldblock = *block;
196 (*block)++;
197 if (oldblock > *block) {
198 if (options[OPT_ROLLOVER].o_request == NULL) {
142 ts->rollovers++;
143 }
144 gettimeofday(&(ts->tstop), NULL);
145 } while (size == segsize);
146abort:
147 return;
148}
149

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

193 }
194
195 rp = (struct tftphdr *)recvbuffer;
196 do {
197 oldblock = *block;
198 (*block)++;
199 if (oldblock > *block) {
200 if (options[OPT_ROLLOVER].o_request == NULL) {
199 tftp_log(LOG_ERR,
200 "Block rollover but not allowed.");
201 send_error(peer, EBADOP);
202 gettimeofday(&(ts->tstop), NULL);
203 return;
201 /*
202 * "rollover" option not specified in
203 * tftp client. Default to rolling block
204 * counter to 0.
205 */
206 *block = 0;
207 } else {
208 *block = atoi(options[OPT_ROLLOVER].o_request);
204 }
205
209 }
210
206 *block = atoi(options[OPT_ROLLOVER].o_request);
207 ts->rollovers++;
208 }
209
210 for (retry = 0; ; retry++) {
211 if (debug&DEBUG_SIMPLE)
212 tftp_log(LOG_DEBUG,
213 "Receiving DATA block %d", *block);
214

--- 104 unchanged lines hidden ---
211 ts->rollovers++;
212 }
213
214 for (retry = 0; ; retry++) {
215 if (debug&DEBUG_SIMPLE)
216 tftp_log(LOG_DEBUG,
217 "Receiving DATA block %d", *block);
218

--- 104 unchanged lines hidden ---