Newer
Older
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
Daniel Stenberg
committed
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
***************************************************************************/
/* This file is for lib internal stuff */
#include "setup.h"
#define PORT_FTP 21
#define PORT_FTPS 990
#define PORT_TELNET 23
#define PORT_HTTP 80
#define PORT_HTTPS 443
#define PORT_DICT 2628
#define PORT_LDAP 389
#define PORT_TFTP 69
#define DICT_MATCH "/MATCH:"
#define DICT_MATCH2 "/M:"
#define DICT_MATCH3 "/FIND:"
#define DICT_DEFINE "/DEFINE:"
#define DICT_DEFINE2 "/D:"
#define DICT_DEFINE3 "/LOOKUP:"
#define CURL_DEFAULT_USER "anonymous"
Daniel Stenberg
committed
#define CURL_DEFAULT_PASSWORD "ftp@example.com"
#ifdef USE_SSLEAY
#ifdef USE_OPENSSL
#include "openssl/rsa.h"
#include "openssl/crypto.h"
#include "openssl/x509.h"
#include "openssl/pem.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
#ifdef HAVE_OPENSSL_ENGINE_H
#include <openssl/engine.h>
#endif
Daniel Stenberg
committed
#ifdef HAVE_OPENSSL_PKCS12_H
#include <openssl/pkcs12.h>
#endif
Daniel Stenberg
committed
#else /* SSLeay-style includes */
#include "rsa.h"
#include "crypto.h"
#include "x509.h"
#include "pem.h"
#include "ssl.h"
#include "err.h"
Daniel Stenberg
committed
#endif /* USE_OPENSSL */
#endif /* USE_SSLEAY */
#ifdef USE_GNUTLS
#include <gnutls/gnutls.h>
#ifdef USE_NSS
#include <nspr.h>
#endif
#ifdef USE_QSOSSL
#include <qsossl.h>
#endif
#include <zlib.h> /* for content-encoding */
#ifdef USE_ARES
#include <ares.h>
#endif
#include <curl/curl.h>
#include "http_chunks.h" /* for the structs and enum stuff */
#include "hostip.h"
#include "hash.h"
Daniel Stenberg
committed
#include "splay.h"
#ifdef HAVE_GSSAPI
# ifdef HAVE_GSSGNU
# include <gss.h>
# elif defined HAVE_GSSMIT
# include <gssapi/gssapi.h>
# include <gssapi/gssapi_generic.h>
# else
# include <gssapi.h>
# endif
#endif
#ifdef HAVE_LIBSSH2_H
#include <libssh2.h>
#include <libssh2_sftp.h>
#endif /* HAVE_LIBSSH2_H */
/* Download buffer size, keep it fairly big for speed reasons */
#undef BUFSIZE
Daniel Stenberg
committed
#define BUFSIZE CURL_MAX_WRITE_SIZE
/* Initial size of the buffer to store headers in, it'll be enlarged in case
of need. */
#define HEADERSIZE 256
#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
/* Just a convenience macro to get the larger value out of two given.
We prefix with CURL to prevent name collisions. */
#define CURLMAX(x,y) ((x)>(y)?(x):(y))
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
/* Types needed for krb4/5-ftp connections */
struct krb4buffer {
void *data;
size_t size;
size_t index;
int eof_flag;
};
Daniel Stenberg
committed
prot_clear,
prot_safe,
prot_confidential,
prot_private,
prot_cmd
Daniel Stenberg
committed
/* enum for the nonblocking SSL connection state machine */
typedef enum {
ssl_connect_1,
ssl_connect_2,
ssl_connect_2_reading,
ssl_connect_2_writing,
ssl_connect_3,
ssl_connect_done
} ssl_connect_state;
Daniel Stenberg
committed
/* struct for data related to each SSL connection */
Daniel Stenberg
committed
bool use; /* use ssl encrypted communications TRUE/FALSE, not
necessarily using it atm but at least asked to or
meaning to use it */
#ifdef USE_SSLEAY
/* these ones requires specific SSL-types */
SSL_CTX* ctx;
SSL* handle;
X509* server_cert;
Daniel Stenberg
committed
ssl_connect_state connecting_state;
Daniel Stenberg
committed
#ifdef USE_GNUTLS
gnutls_session session;
Daniel Stenberg
committed
gnutls_certificate_credentials cred;
Daniel Stenberg
committed
#endif /* USE_GNUTLS */
#ifdef USE_NSS
PRFileDesc *handle;
char *client_nickname;
#endif /* USE_NSS */
#ifdef USE_QSOSSL
SSLHandle *handle;
#endif /* USE_QSOSSL */
};
struct ssl_config_data {
long version; /* what version the client wants to use */
long certverifyresult; /* result from the certificate verification */
long verifypeer; /* set TRUE if this is desired */
long verifyhost; /* 0: no verify
1: check that CN exists
2: CN must match hostname */
Daniel Stenberg
committed
char *CApath; /* certificate dir (doesn't work on windows) */
Loading
Loading full blame...