~ubuntu-branches/ubuntu/warty/curl/warty-security

« back to all changes in this revision

Viewing changes to lib/dict.c

  • Committer: Bazaar Package Importer
  • Author(s): Domenico Andreoli
  • Date: 2004-06-04 19:09:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040604190925-wy048bp31320r2z6
Tags: 7.12.0.is.7.11.2-1
* Reverted to version 7.11.2 (closes: #252348).
* Disabled support for libidn (closes: #252367). This is to leave
  curl in unstable as much similar as possible to the one in testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
 
1
/***************************************************************************
2
2
 *                                  _   _ ____  _     
3
3
 *  Project                     ___| | | |  _ \| |    
4
4
 *                             / __| | | | |_) | |    
5
5
 *                            | (__| |_| |  _ <| |___ 
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
9
 
 *
10
 
 * In order to be useful for every potential user, curl and libcurl are
11
 
 * dual-licensed under the MPL and the MIT/X-derivate licenses.
12
 
 *
 
8
 * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
 
9
 *
 
10
 * This software is licensed as described in the file COPYING, which
 
11
 * you should have received as part of this distribution. The terms
 
12
 * are also available at http://curl.haxx.se/docs/copyright.html.
 
13
 * 
13
14
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
14
15
 * copies of the Software, and permit persons to whom the Software is
15
 
 * furnished to do so, under the terms of the MPL or the MIT/X-derivate
16
 
 * licenses. You may pick one of these licenses.
 
16
 * furnished to do so, under the terms of the COPYING file.
17
17
 *
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: dict.c,v 1.20 2001/12/11 13:13:01 bagder Exp $
22
 
 *****************************************************************************/
 
21
 * $Id: dict.c,v 1.34 2004/03/09 22:52:50 bagder Exp $
 
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
25
25
 
35
35
#include <errno.h>
36
36
 
37
37
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
38
 
#include <winsock.h>
39
38
#include <time.h>
40
39
#include <io.h>
41
40
#else
44
43
#endif
45
44
#include <netinet/in.h>
46
45
#include <sys/time.h>
47
 
#include <sys/resource.h>
48
46
#ifdef HAVE_UNISTD_H
49
47
#include <unistd.h>
50
48
#endif
76
74
 
77
75
#include "progress.h"
78
76
#include "strequal.h"
 
77
#include "dict.h"
79
78
 
80
79
#define _MPRINTF_REPLACE /* use our functions only */
81
80
#include <curl/mprintf.h>
82
81
 
83
82
CURLcode Curl_dict(struct connectdata *conn)
84
83
{
85
 
  int nth;
86
84
  char *word;
87
85
  char *ppath;
88
86
  char *database = NULL;
91
89
                          by RFC 2229 */
92
90
  CURLcode result=CURLE_OK;
93
91
  struct SessionHandle *data=conn->data;
 
92
  curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
94
93
 
95
94
  char *path = conn->path;
96
 
  long *bytecount = &conn->bytecount;
 
95
  curl_off_t *bytecount = &conn->bytecount;
97
96
 
98
97
  if(conn->bits.user_passwd) {
99
98
    /* AUTH is missing */
129
128
    if ((strategy == NULL) || (*strategy == (char)0)) {
130
129
      strategy = (char *)".";
131
130
    }
132
 
    if ((nthdef == NULL) || (*nthdef == (char)0)) {
133
 
      nth = 0;
134
 
    }
135
 
    else {
136
 
      nth = atoi(nthdef);
137
 
    }
138
131
      
139
 
    result = Curl_sendf(conn->firstsocket, conn,
 
132
    result = Curl_sendf(sockfd, conn,
140
133
                        "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
141
134
                        "MATCH "
142
135
                        "%s "    /* database */
151
144
    if(result)
152
145
      failf(data, "Failed sending DICT request");
153
146
    else
154
 
      result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount,
 
147
      result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
155
148
                             -1, NULL); /* no upload */      
156
149
    if(result)
157
150
      return result;
179
172
    if ((database == NULL) || (*database == (char)0)) {
180
173
      database = (char *)"!";
181
174
    }
182
 
    if ((nthdef == NULL) || (*nthdef == (char)0)) {
183
 
      nth = 0;
184
 
    }
185
 
    else {
186
 
      nth = atoi(nthdef);
187
 
    }
188
175
      
189
 
    result = Curl_sendf(conn->firstsocket, conn,
 
176
    result = Curl_sendf(sockfd, conn,
190
177
                        "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
191
178
                        "DEFINE "
192
179
                        "%s "     /* database */
197
184
    if(result)
198
185
      failf(data, "Failed sending DICT request");
199
186
    else
200
 
      result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount,
 
187
      result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
201
188
                             -1, NULL); /* no upload */
202
189
    
203
190
    if(result)
215
202
        if (ppath[i] == ':')
216
203
          ppath[i] = ' ';
217
204
      }
218
 
      result = Curl_sendf(conn->firstsocket, conn,
 
205
      result = Curl_sendf(sockfd, conn,
219
206
                          "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
220
207
                          "%s\n"
221
208
                          "QUIT\n", ppath);
222
209
      if(result)
223
210
        failf(data, "Failed sending DICT request");
224
211
      else
225
 
        result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount,
 
212
        result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
226
213
                               -1, NULL);
227
214
      if(result)
228
215
        return result;
231
218
 
232
219
  return CURLE_OK;
233
220
}
234
 
 
235
 
/*
236
 
 * local variables:
237
 
 * eval: (load-file "../curl-mode.el")
238
 
 * end:
239
 
 * vim600: fdm=marker
240
 
 * vim: et sw=2 ts=2 sts=2 tw=78
241
 
 */