~ubuntu-branches/ubuntu/natty/curl/natty-security

« back to all changes in this revision

Viewing changes to tests/libtest/lib574.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-06-20 13:56:28 UTC
  • mfrom: (3.4.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100620135628-e30tp9jldq6hq985
Tags: 7.21.0-1ubuntu1
* Merge from debian unstable.  Remaining changes: LP: #596334
  - Keep build deps in main:
    - Drop build dependencies: stunnel, libssh2-1-dev
    - Add build-dependency on openssh-server
    - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 *                                  _   _ ____  _
 
3
 *  Project                     ___| | | |  _ \| |
 
4
 *                             / __| | | | |_) | |
 
5
 *                            | (__| |_| |  _ <| |___
 
6
 *                             \___|\___/|_| \_\_____|
 
7
 *
 
8
 */
 
9
 
 
10
#include "test.h"
 
11
 
 
12
#include "memdebug.h"
 
13
 
 
14
static int new_fnmatch(const char *pattern, const char *string)
 
15
{
 
16
  (void)pattern;
 
17
  (void)string;
 
18
  return CURL_FNMATCHFUNC_MATCH;
 
19
}
 
20
 
 
21
int test(char *URL)
 
22
{
 
23
  int res;
 
24
  CURL *curl;
 
25
 
 
26
  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
 
27
    fprintf(stderr, "curl_global_init() failed\n");
 
28
    return TEST_ERR_MAJOR_BAD;
 
29
  }
 
30
 
 
31
  if ((curl = curl_easy_init()) == NULL) {
 
32
    fprintf(stderr, "curl_easy_init() failed\n");
 
33
    curl_global_cleanup();
 
34
    return TEST_ERR_MAJOR_BAD;
 
35
  }
 
36
 
 
37
  test_setopt(curl, CURLOPT_URL, URL);
 
38
  test_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
 
39
  test_setopt(curl, CURLOPT_FNMATCH_FUNCTION, new_fnmatch);
 
40
 
 
41
  res = curl_easy_perform(curl);
 
42
  if(res) {
 
43
    fprintf(stderr, "curl_easy_perform() failed %d\n", res);
 
44
    goto test_cleanup;
 
45
  }
 
46
  res = curl_easy_perform(curl);
 
47
  if(res) {
 
48
    fprintf(stderr, "curl_easy_perform() failed %d\n", res);
 
49
    goto test_cleanup;
 
50
  }
 
51
 
 
52
test_cleanup:
 
53
  curl_easy_cleanup(curl);
 
54
  curl_global_cleanup();
 
55
  return res;
 
56
}