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 $");
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;
137 }
138
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) {
199 tftp_log(LOG_ERR,
200 "Block rollover but not allowed.");
201 send_error(peer, EBADOP);
202 gettimeofday(&(ts->tstop), NULL);
203 return;
204 }
205
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 ---
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 $");
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;
137 }
138
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) {
199 tftp_log(LOG_ERR,
200 "Block rollover but not allowed.");
201 send_error(peer, EBADOP);
202 gettimeofday(&(ts->tstop), NULL);
203 return;
204 }
205
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 ---