~ubuntu-branches/ubuntu/saucy/curl/saucy-security

« back to all changes in this revision

Viewing changes to lib/tftp.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2011-11-25 17:30:45 UTC
  • mfrom: (3.4.23 sid)
  • Revision ID: package-import@ubuntu.com-20111125173045-2l3ni88jv16kath0
Tags: 7.22.0-3ubuntu1
* Merge from Debian unstable, remaining changes:
  - Drop dependencies not in main:
    + Build-Depends: Drop stunnel4 and libssh2-1-dev.
    + Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.
  - Add new libcurl3-udeb package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "setup.h"
24
24
 
25
25
#ifndef CURL_DISABLE_TFTP
26
 
/* -- WIN32 approved -- */
27
 
#include <stdio.h>
28
 
#include <stdarg.h>
29
 
#include <stdlib.h>
30
 
#include <ctype.h>
31
26
 
32
 
#if defined(WIN32)
33
 
#include <time.h>
34
 
#include <io.h>
35
 
#else
36
27
#ifdef HAVE_SYS_SOCKET_H
37
28
#include <sys/socket.h>
38
29
#endif
 
30
#ifdef HAVE_NETINET_IN_H
39
31
#include <netinet/in.h>
40
 
#ifdef HAVE_SYS_TIME_H
41
 
#include <sys/time.h>
42
32
#endif
43
33
#ifdef HAVE_UNISTD_H
44
34
#include <unistd.h>
45
35
#endif
 
36
#ifdef HAVE_NETDB_H
46
37
#include <netdb.h>
 
38
#endif
47
39
#ifdef HAVE_ARPA_INET_H
48
40
#include <arpa/inet.h>
49
41
#endif
58
50
#include <sys/param.h>
59
51
#endif
60
52
 
61
 
#endif /* WIN32 */
62
 
 
63
53
#include "urldata.h"
64
54
#include <curl/curl.h>
65
55
#include "transfer.h"
216
206
{
217
207
  time_t maxtime, timeout;
218
208
  long timeout_ms;
219
 
  bool start = (bool)(state->state == TFTP_STATE_START);
 
209
  bool start = (state->state == TFTP_STATE_START) ? TRUE : FALSE;
220
210
 
221
211
  time(&state->start_time);
222
212
 
627
617
    }
628
618
 
629
619
    /* Check if completed (That is, a less than full packet is received) */
630
 
    if(state->rbytes < (ssize_t)state->blksize+4){
 
620
    if(state->rbytes < (ssize_t)state->blksize+4) {
631
621
      state->state = TFTP_STATE_FIN;
632
622
    }
633
623
    else {
1344
1334
    result = tftp_state_machine(state, event);
1345
1335
    if(result != CURLE_OK)
1346
1336
      return(result);
1347
 
    *done = (bool)(state->state == TFTP_STATE_FIN);
 
1337
    *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
1348
1338
    if(*done)
1349
1339
      /* Tell curl we're done */
1350
1340
      Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
1366
1356
      result = tftp_state_machine(state, state->event);
1367
1357
      if(result != CURLE_OK)
1368
1358
        return(result);
1369
 
      *done = (bool)(state->state == TFTP_STATE_FIN);
 
1359
      *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
1370
1360
      if(*done)
1371
1361
        /* Tell curl we're done */
1372
1362
        Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);