mirror of
https://github.com/curl/curl.git
synced 2024-11-21 01:16:58 +08:00
checksrc: use space after comma
This commit is contained in:
parent
a6b8fe2a5f
commit
9395999543
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -71,7 +71,7 @@ bool Curl_amiga_init()
|
||||
}
|
||||
|
||||
#ifdef __libnix__
|
||||
ADD2EXIT(Curl_amiga_cleanup,-50);
|
||||
ADD2EXIT(Curl_amiga_cleanup, -50);
|
||||
#endif
|
||||
|
||||
#endif /* __AMIGA__ && ! __ixemul__ */
|
||||
|
@ -164,7 +164,7 @@ void Curl_resolver_cleanup(void *resolver)
|
||||
int Curl_resolver_duphandle(void **to, void *from)
|
||||
{
|
||||
/* Clone the ares channel for the new handle */
|
||||
if(ARES_SUCCESS != ares_dup((ares_channel*)to,(ares_channel)from))
|
||||
if(ARES_SUCCESS != ares_dup((ares_channel*)to, (ares_channel)from))
|
||||
return CURLE_FAILED_INIT;
|
||||
return CURLE_OK;
|
||||
}
|
||||
@ -385,7 +385,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
|
||||
timeout_ms = 1000;
|
||||
|
||||
waitperform(conn, timeout_ms);
|
||||
Curl_resolver_is_resolved(conn,&temp_entry);
|
||||
Curl_resolver_is_resolved(conn, &temp_entry);
|
||||
|
||||
if(conn->async.done)
|
||||
break;
|
||||
@ -539,7 +539,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
|
||||
conn->async.done = FALSE; /* not done */
|
||||
conn->async.status = 0; /* clear */
|
||||
conn->async.dns = NULL; /* clear */
|
||||
res = calloc(sizeof(struct ResolverResults),1);
|
||||
res = calloc(sizeof(struct ResolverResults), 1);
|
||||
if(!res) {
|
||||
free(conn->async.hostname);
|
||||
conn->async.hostname = NULL;
|
||||
|
@ -195,7 +195,7 @@ void destroy_thread_sync_data(struct thread_sync_data * tsd)
|
||||
if(tsd->res)
|
||||
Curl_freeaddrinfo(tsd->res);
|
||||
|
||||
memset(tsd,0,sizeof(*tsd));
|
||||
memset(tsd, 0, sizeof(*tsd));
|
||||
}
|
||||
|
||||
/* Initialize resolver thread synchronization data */
|
||||
|
@ -154,6 +154,38 @@ sub scanfile {
|
||||
"return without space before paren");
|
||||
}
|
||||
}
|
||||
|
||||
# check for comma without space
|
||||
if($l =~ /^(.*),[^ \n]/) {
|
||||
my $pref=$1;
|
||||
my $ign=0;
|
||||
if($pref =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
$ign=1;
|
||||
}
|
||||
elsif($pref =~ /\/\*/) {
|
||||
# this is a comment
|
||||
$ign=1;
|
||||
}
|
||||
elsif($pref =~ /[\"\']/) {
|
||||
$ign = 1;
|
||||
# There is a quote here, figure out whether the comma is
|
||||
# within a string or '' or not.
|
||||
if($pref =~ /\"/) {
|
||||
# withing a string
|
||||
}
|
||||
elsif($pref =~ /\'$/) {
|
||||
# a single letter
|
||||
}
|
||||
else {
|
||||
$ign = 0;
|
||||
}
|
||||
}
|
||||
if(!$ign) {
|
||||
checkwarn($line, length($pref)+1, $file, $l,
|
||||
"comma without following space");
|
||||
}
|
||||
}
|
||||
|
||||
# check for "} else"
|
||||
if($l =~ /^(.*)\} *else/) {
|
||||
|
@ -883,7 +883,7 @@ static void tcpnodelay(struct connectdata *conn,
|
||||
infof(data, "Could not set TCP_NODELAY: %s\n",
|
||||
Curl_strerror(conn, SOCKERRNO));
|
||||
else
|
||||
infof(data,"TCP_NODELAY set\n");
|
||||
infof(data, "TCP_NODELAY set\n");
|
||||
#else
|
||||
(void)conn;
|
||||
(void)sockfd;
|
||||
@ -1111,7 +1111,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
infof(data, "Immediate connect fail for %s: %s\n",
|
||||
ipaddress, Curl_strerror(conn,error));
|
||||
ipaddress, Curl_strerror(conn, error));
|
||||
data->state.os_errno = error;
|
||||
|
||||
/* connect failed */
|
||||
|
@ -197,7 +197,7 @@ static CURLcode rtmp_setup_connection(struct connectdata *conn)
|
||||
static CURLcode rtmp_connect(struct connectdata *conn, bool *done)
|
||||
{
|
||||
RTMP *r = conn->proto.generic;
|
||||
SET_RCVTIMEO(tv,10);
|
||||
SET_RCVTIMEO(tv, 10);
|
||||
|
||||
r->m_sb.sb_socket = conn->sock[FIRSTSOCKET];
|
||||
|
||||
|
@ -1491,13 +1491,13 @@ static CURLcode ftp_state_list(struct connectdata *conn)
|
||||
The other ftp_filemethods will CWD into dir/dir/ first and
|
||||
then just do LIST (in that case: nothing to do here)
|
||||
*/
|
||||
char *cmd,*lstArg,*slashPos;
|
||||
char *cmd, *lstArg, *slashPos;
|
||||
|
||||
lstArg = NULL;
|
||||
if((data->set.ftp_filemethod == FTPFILE_NOCWD) &&
|
||||
data->state.path &&
|
||||
data->state.path[0] &&
|
||||
strchr(data->state.path,'/')) {
|
||||
strchr(data->state.path, '/')) {
|
||||
|
||||
lstArg = strdup(data->state.path);
|
||||
if(!lstArg)
|
||||
@ -1507,7 +1507,7 @@ static CURLcode ftp_state_list(struct connectdata *conn)
|
||||
if(lstArg[strlen(lstArg) - 1] != '/') {
|
||||
|
||||
/* chop off the file part if format is dir/dir/file */
|
||||
slashPos = strrchr(lstArg,'/');
|
||||
slashPos = strrchr(lstArg, '/');
|
||||
if(slashPos)
|
||||
*(slashPos+1) = '\0';
|
||||
}
|
||||
@ -3310,7 +3310,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
|
||||
/* shut down the socket to inform the server we're done */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
shutdown(conn->sock[SECONDARYSOCKET],2); /* SD_BOTH */
|
||||
shutdown(conn->sock[SECONDARYSOCKET], 2); /* SD_BOTH */
|
||||
#endif
|
||||
|
||||
if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {
|
||||
|
@ -297,7 +297,7 @@ remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)
|
||||
time(&user.now);
|
||||
user.cache_timeout = data->set.dns_cache_timeout;
|
||||
|
||||
if(!hostcache_timestamp_remove(&user,dns) )
|
||||
if(!hostcache_timestamp_remove(&user, dns) )
|
||||
return 0;
|
||||
|
||||
Curl_hash_clean_with_criterium(data->dns.hostcache,
|
||||
|
@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -31,7 +31,7 @@ char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#define Curl_inet_ntop(af,addr,buf,size) \
|
||||
inet_ntop(af,addr,buf,(curl_socklen_t)size)
|
||||
inet_ntop(af, addr, buf, (curl_socklen_t)size)
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_INET_NTOP_H */
|
||||
|
@ -246,7 +246,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
result = Curl_base64_encode(data, (char *)output_buffer.value,
|
||||
output_buffer.length, &p, &base64_sz);
|
||||
if(result) {
|
||||
Curl_infof(data,"base64-encoding: %s\n", curl_easy_strerror(result));
|
||||
Curl_infof(data, "base64-encoding: %s\n",
|
||||
curl_easy_strerror(result));
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
@ -278,7 +279,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
(unsigned char **)&_gssresp.value,
|
||||
&_gssresp.length);
|
||||
if(result) {
|
||||
Curl_failf(data,"base64-decoding: %s", curl_easy_strerror(result));
|
||||
Curl_failf(data, "base64-decoding: %s",
|
||||
curl_easy_strerror(result));
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
|
||||
size_t val_b64_sz = 0;
|
||||
curl_off_t dlsize = 0;
|
||||
#ifdef LDAP_OPT_NETWORK_TIMEOUT
|
||||
struct timeval ldap_timeout = {10,0}; /* 10 sec connection/search timeout */
|
||||
struct timeval ldap_timeout = {10, 0}; /* 10 sec connection/search timeout */
|
||||
#endif
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
TCHAR *host = NULL;
|
||||
|
@ -104,13 +104,13 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
|
||||
#endif
|
||||
|
||||
#define socket(domain,type,protocol)\
|
||||
curl_socket(domain,type,protocol,__LINE__,__FILE__)
|
||||
curl_socket(domain, type, protocol, __LINE__, __FILE__)
|
||||
#undef accept /* for those with accept as a macro */
|
||||
#define accept(sock,addr,len)\
|
||||
curl_accept(sock,addr,len,__LINE__,__FILE__)
|
||||
curl_accept(sock, addr, len, __LINE__, __FILE__)
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
#define socketpair(domain,type,protocol,socket_vector)\
|
||||
curl_socketpair(domain,type,protocol,socket_vector,__LINE__,__FILE__)
|
||||
curl_socketpair(domain, type, protocol, socket_vector, __LINE__, __FILE__)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
@ -119,25 +119,25 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
|
||||
our macro as for other platforms. Instead, we redefine the new name they
|
||||
define getaddrinfo to become! */
|
||||
#define ogetaddrinfo(host,serv,hint,res) \
|
||||
curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__)
|
||||
curl_dogetaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
|
||||
#else
|
||||
#undef getaddrinfo
|
||||
#define getaddrinfo(host,serv,hint,res) \
|
||||
curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__)
|
||||
curl_dogetaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
|
||||
#endif
|
||||
#endif /* HAVE_GETADDRINFO */
|
||||
|
||||
#ifdef HAVE_GETNAMEINFO
|
||||
#undef getnameinfo
|
||||
#define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \
|
||||
curl_dogetnameinfo(sa,salen,host,hostlen,serv,servlen,flags, __LINE__, \
|
||||
__FILE__)
|
||||
curl_dogetnameinfo(sa, salen, host, hostlen, serv, servlen, flags, \
|
||||
__LINE__, __FILE__)
|
||||
#endif /* HAVE_GETNAMEINFO */
|
||||
|
||||
#ifdef HAVE_FREEADDRINFO
|
||||
#undef freeaddrinfo
|
||||
#define freeaddrinfo(data) \
|
||||
curl_dofreeaddrinfo(data,__LINE__,__FILE__)
|
||||
curl_dofreeaddrinfo(data, __LINE__, __FILE__)
|
||||
#endif /* HAVE_FREEADDRINFO */
|
||||
|
||||
/* sclose is probably already defined, redefine it! */
|
||||
|
@ -2426,7 +2426,7 @@ CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles)
|
||||
static CURLMcode multi_timeout(struct Curl_multi *multi,
|
||||
long *timeout_ms)
|
||||
{
|
||||
static struct timeval tv_zero = {0,0};
|
||||
static struct timeval tv_zero = {0, 0};
|
||||
|
||||
if(multi->timetree) {
|
||||
/* we have a tree of expire times */
|
||||
@ -2484,7 +2484,7 @@ static int update_timer(struct Curl_multi *multi)
|
||||
return -1;
|
||||
}
|
||||
if(timeout_ms < 0) {
|
||||
static const struct timeval none={0,0};
|
||||
static const struct timeval none={0, 0};
|
||||
if(Curl_splaycomparekeys(none, multi->timer_lastcall)) {
|
||||
multi->timer_lastcall = none;
|
||||
/* there's no timeout now but there was one previously, tell the app to
|
||||
|
@ -227,7 +227,7 @@ static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
struct SessionHandle *data = conn->data;
|
||||
LDAPMessage *msg = NULL;
|
||||
struct timeval tv = {0,1}, *tvp;
|
||||
struct timeval tv = {0, 1}, *tvp;
|
||||
int rc, err;
|
||||
char *info = NULL;
|
||||
|
||||
@ -378,7 +378,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)
|
||||
failf(data, "LDAP local: ldap_search_ext %s", ldap_err2string(rc));
|
||||
return CURLE_LDAP_SEARCH_FAILED;
|
||||
}
|
||||
lr = calloc(1,sizeof(ldapreqinfo));
|
||||
lr = calloc(1, sizeof(ldapreqinfo));
|
||||
if(!lr)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
lr->msgid = msgid;
|
||||
@ -420,7 +420,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
|
||||
LDAPMessage *msg = NULL;
|
||||
LDAPMessage *ent;
|
||||
BerElement *ber = NULL;
|
||||
struct timeval tv = {0,1};
|
||||
struct timeval tv = {0, 1};
|
||||
|
||||
(void)len;
|
||||
(void)buf;
|
||||
|
@ -159,7 +159,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
|
||||
fd_set fds_err;
|
||||
curl_socket_t maxfd;
|
||||
#endif
|
||||
struct timeval initial_tv = {0,0};
|
||||
struct timeval initial_tv = {0, 0};
|
||||
int pending_ms = 0;
|
||||
int error;
|
||||
int r;
|
||||
@ -393,7 +393,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
|
||||
fd_set fds_err;
|
||||
curl_socket_t maxfd;
|
||||
#endif
|
||||
struct timeval initial_tv = {0,0};
|
||||
struct timeval initial_tv = {0, 0};
|
||||
bool fds_none = TRUE;
|
||||
unsigned int i;
|
||||
int pending_ms = 0;
|
||||
|
@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -414,7 +414,7 @@ char * unix_path;
|
||||
|
||||
static void des_ecb_encrypt(const_des_cblock *input,
|
||||
des_cblock *output,
|
||||
des_key_schedule ks,int enc) {
|
||||
des_key_schedule ks, int enc) {
|
||||
DES_ECB_ENCRYPT(input, output, ks, enc);
|
||||
}
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -382,7 +382,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
|
||||
|
||||
/* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
|
||||
if(!socks5_resolve_local && hostname_len > 255) {
|
||||
infof(conn->data,"SOCKS5: server resolving disabled for hostnames of "
|
||||
infof(conn->data, "SOCKS5: server resolving disabled for hostnames of "
|
||||
"length > 255 [actual len=%zu]\n", hostname_len);
|
||||
socks5_resolve_local = TRUE;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ static int check_gss_err(struct SessionHandle *data,
|
||||
const char* function)
|
||||
{
|
||||
if(GSS_ERROR(major_status)) {
|
||||
OM_uint32 maj_stat,min_stat;
|
||||
OM_uint32 maj_stat, min_stat;
|
||||
OM_uint32 msg_ctx = 0;
|
||||
gss_buffer_desc status_string;
|
||||
char buf[1024];
|
||||
@ -131,7 +131,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
*/
|
||||
|
||||
/* prepare service name */
|
||||
if(strchr(serviceptr,'/')) {
|
||||
if(strchr(serviceptr, '/')) {
|
||||
service.value = malloc(strlen(serviceptr));
|
||||
if(!service.value)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
@ -155,8 +155,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
|
||||
gss_release_buffer(&gss_status, &service); /* clear allocated memory */
|
||||
|
||||
if(check_gss_err(data,gss_major_status,
|
||||
gss_minor_status,"gss_import_name()")) {
|
||||
if(check_gss_err(data, gss_major_status,
|
||||
gss_minor_status, "gss_import_name()")) {
|
||||
failf(data, "Failed to create service name.");
|
||||
gss_release_name(&gss_status, &server);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
@ -178,8 +178,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
|
||||
if(gss_token != GSS_C_NO_BUFFER)
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
if(check_gss_err(data,gss_major_status,
|
||||
gss_minor_status,"gss_init_sec_context")) {
|
||||
if(check_gss_err(data, gss_major_status,
|
||||
gss_minor_status, "gss_init_sec_context")) {
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
@ -192,7 +192,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
||||
socksreq[1] = 1; /* authentication message type */
|
||||
us_length = htons((short)gss_send_token.length);
|
||||
memcpy(socksreq+2,&us_length,sizeof(short));
|
||||
memcpy(socksreq+2, &us_length, sizeof(short));
|
||||
|
||||
code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);
|
||||
if(code || (4 != written)) {
|
||||
@ -291,8 +291,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_major_status = gss_inquire_context (&gss_minor_status, gss_context,
|
||||
&gss_client_name, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
if(check_gss_err(data,gss_major_status,
|
||||
gss_minor_status,"gss_inquire_context")) {
|
||||
if(check_gss_err(data, gss_major_status,
|
||||
gss_minor_status, "gss_inquire_context")) {
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
gss_release_name(&gss_status, &gss_client_name);
|
||||
failf(data, "Failed to determine user name.");
|
||||
@ -300,8 +300,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
}
|
||||
gss_major_status = gss_display_name(&gss_minor_status, gss_client_name,
|
||||
&gss_send_token, NULL);
|
||||
if(check_gss_err(data,gss_major_status,
|
||||
gss_minor_status,"gss_display_name")) {
|
||||
if(check_gss_err(data, gss_major_status,
|
||||
gss_minor_status, "gss_display_name")) {
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
gss_release_name(&gss_status, &gss_client_name);
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
@ -372,7 +372,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
*/
|
||||
if(data->set.socks5_gssapi_nec) {
|
||||
us_length = htons((short)1);
|
||||
memcpy(socksreq+2,&us_length,sizeof(short));
|
||||
memcpy(socksreq+2, &us_length, sizeof(short));
|
||||
}
|
||||
else {
|
||||
gss_send_token.length = 1;
|
||||
@ -387,7 +387,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
GSS_C_QOP_DEFAULT, &gss_send_token,
|
||||
&gss_conf_state, &gss_w_token);
|
||||
|
||||
if(check_gss_err(data,gss_major_status,gss_minor_status,"gss_wrap")) {
|
||||
if(check_gss_err(data, gss_major_status, gss_minor_status, "gss_wrap")) {
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
@ -397,7 +397,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
gss_release_buffer(&gss_status, &gss_send_token);
|
||||
|
||||
us_length = htons((short)gss_w_token.length);
|
||||
memcpy(socksreq+2,&us_length,sizeof(short));
|
||||
memcpy(socksreq+2, &us_length, sizeof(short));
|
||||
}
|
||||
|
||||
code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);
|
||||
@ -475,7 +475,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
&gss_recv_token, &gss_w_token,
|
||||
0, GSS_C_QOP_DEFAULT);
|
||||
|
||||
if(check_gss_err(data,gss_major_status,gss_minor_status,"gss_unwrap")) {
|
||||
if(check_gss_err(data, gss_major_status, gss_minor_status, "gss_unwrap")) {
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
@ -492,7 +492,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
memcpy(socksreq,gss_w_token.value,gss_w_token.length);
|
||||
memcpy(socksreq, gss_w_token.value, gss_w_token.length);
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
}
|
||||
else {
|
||||
@ -504,7 +504,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
memcpy(socksreq,gss_recv_token.value,gss_recv_token.length);
|
||||
memcpy(socksreq, gss_recv_token.value, gss_recv_token.length);
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
service_name = malloc(strlen(service) + strlen(conn->proxy.name) + 2);
|
||||
if(!service_name)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
snprintf(service_name,strlen(service) +strlen(conn->proxy.name)+2,"%s/%s",
|
||||
service,conn->proxy.name);
|
||||
snprintf(service_name, strlen(service) +strlen(conn->proxy.name)+2,
|
||||
"%s/%s", service, conn->proxy.name);
|
||||
}
|
||||
|
||||
input_desc.cBuffers = 1;
|
||||
@ -402,7 +402,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(sspi_w_token[1].pvBuffer,&gss_enc,1);
|
||||
memcpy(sspi_w_token[1].pvBuffer, &gss_enc, 1);
|
||||
sspi_w_token[2].BufferType = SECBUFFER_PADDING;
|
||||
sspi_w_token[2].cbBuffer = sspi_sizes.cbBlockSize;
|
||||
sspi_w_token[2].pvBuffer = malloc(sspi_sizes.cbBlockSize);
|
||||
@ -456,7 +456,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
sspi_w_token[2].cbBuffer = 0;
|
||||
|
||||
us_length = htons((short)sspi_send_token.cbBuffer);
|
||||
memcpy(socksreq+2,&us_length,sizeof(short));
|
||||
memcpy(socksreq+2, &us_length, sizeof(short));
|
||||
}
|
||||
|
||||
code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);
|
||||
@ -469,7 +469,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
}
|
||||
|
||||
if(data->set.socks5_gssapi_nec) {
|
||||
memcpy(socksreq,&gss_enc,1);
|
||||
memcpy(socksreq, &gss_enc, 1);
|
||||
code = Curl_write_plain(conn, sock, (char *)socksreq, 1, &written);
|
||||
if(code || (1 != written)) {
|
||||
failf(data, "Failed to send SSPI encryption type.");
|
||||
@ -567,7 +567,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
memcpy(socksreq,sspi_w_token[1].pvBuffer,sspi_w_token[1].cbBuffer);
|
||||
memcpy(socksreq, sspi_w_token[1].pvBuffer, sspi_w_token[1].cbBuffer);
|
||||
s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);
|
||||
s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);
|
||||
}
|
||||
@ -579,7 +579,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
||||
s_pSecFn->DeleteSecurityContext(&sspi_context);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
memcpy(socksreq,sspi_w_token[0].pvBuffer,sspi_w_token[0].cbBuffer);
|
||||
memcpy(socksreq, sspi_w_token[0].pvBuffer, sspi_w_token[0].cbBuffer);
|
||||
s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);
|
||||
}
|
||||
|
||||
|
10
lib/splay.c
10
lib/splay.c
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1997 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1997 - 2015, 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
|
||||
@ -101,13 +101,13 @@ struct Curl_tree *Curl_splayinsert(struct timeval i,
|
||||
struct Curl_tree *t,
|
||||
struct Curl_tree *node)
|
||||
{
|
||||
static const struct timeval KEY_NOTUSED = {-1,-1}; /* will *NEVER* appear */
|
||||
static const struct timeval KEY_NOTUSED = {-1, -1}; /* will *NEVER* appear */
|
||||
|
||||
if(node == NULL)
|
||||
return t;
|
||||
|
||||
if(t != NULL) {
|
||||
t = Curl_splay(i,t);
|
||||
t = Curl_splay(i, t);
|
||||
if(compare(i, t->key)==0) {
|
||||
/* There already exists a node in the tree with the very same key. Build
|
||||
a linked list of nodes. We make the new 'node' struct the new master
|
||||
@ -162,7 +162,7 @@ struct Curl_tree *Curl_splaygetbest(struct timeval i,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
t = Curl_splay(i,t);
|
||||
t = Curl_splay(i, t);
|
||||
if(compare(i, t->key) < 0) {
|
||||
/* too big node, try the smaller chain */
|
||||
if(t->smaller)
|
||||
@ -223,7 +223,7 @@ int Curl_splayremovebyaddr(struct Curl_tree *t,
|
||||
struct Curl_tree *removenode,
|
||||
struct Curl_tree **newroot)
|
||||
{
|
||||
static const struct timeval KEY_NOTUSED = {-1,-1}; /* will *NEVER* appear */
|
||||
static const struct timeval KEY_NOTUSED = {-1, -1}; /* will *NEVER* appear */
|
||||
struct Curl_tree *x;
|
||||
|
||||
if(!t || !removenode)
|
||||
|
@ -2242,7 +2242,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
DEBUGF(infof(data, "SFTP DONE done\n"));
|
||||
|
||||
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
|
||||
After nextstate is executed,the control should come back to
|
||||
After nextstate is executed, the control should come back to
|
||||
SSH_SFTP_CLOSE to pass the correct result back */
|
||||
if(sshc->nextstate != SSH_NO_STATE &&
|
||||
sshc->nextstate != SSH_SFTP_CLOSE) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -44,9 +44,9 @@ typedef enum {
|
||||
SSH_AUTH_PKEY,
|
||||
SSH_AUTH_PASS_INIT,
|
||||
SSH_AUTH_PASS,
|
||||
SSH_AUTH_AGENT_INIT,/* initialize then wait for connection to agent */
|
||||
SSH_AUTH_AGENT_LIST,/* ask for list then wait for entire list to come */
|
||||
SSH_AUTH_AGENT, /* attempt one key at a time */
|
||||
SSH_AUTH_AGENT_INIT, /* initialize then wait for connection to agent */
|
||||
SSH_AUTH_AGENT_LIST, /* ask for list then wait for entire list to come */
|
||||
SSH_AUTH_AGENT, /* attempt one key at a time */
|
||||
SSH_AUTH_HOST_INIT,
|
||||
SSH_AUTH_HOST,
|
||||
SSH_AUTH_KEY_INIT,
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -44,7 +44,7 @@ char *curlx_strdup(const char *str)
|
||||
if(!newstr)
|
||||
return (char *)NULL;
|
||||
|
||||
memcpy(newstr,str,(len+1)*sizeof(char));
|
||||
memcpy(newstr, str, (len+1)*sizeof(char));
|
||||
|
||||
return newstr;
|
||||
|
||||
|
@ -641,7 +641,7 @@ const char *Curl_strerror(struct connectdata *conn, int err)
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
|
||||
LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL);
|
||||
wcstombs(buf,wbuf,max);
|
||||
wcstombs(buf, wbuf, max);
|
||||
}
|
||||
#else
|
||||
/* 'sys_nerr' is the maximum errno number, it is not widely portable */
|
||||
@ -708,9 +708,9 @@ const char *Curl_strerror(struct connectdata *conn, int err)
|
||||
buf[max] = '\0'; /* make sure the string is zero terminated */
|
||||
|
||||
/* strip trailing '\r\n' or '\n'. */
|
||||
if((p = strrchr(buf,'\n')) != NULL && (p - buf) >= 2)
|
||||
if((p = strrchr(buf, '\n')) != NULL && (p - buf) >= 2)
|
||||
*p = '\0';
|
||||
if((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1)
|
||||
if((p = strrchr(buf, '\r')) != NULL && (p - buf) >= 1)
|
||||
*p = '\0';
|
||||
|
||||
if(old_errno != ERRNO)
|
||||
@ -1082,7 +1082,7 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, err, LANG_NEUTRAL,
|
||||
wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL)) {
|
||||
wcstombs(msgbuf,wbuf,sizeof(msgbuf)-1);
|
||||
wcstombs(msgbuf, wbuf, sizeof(msgbuf)-1);
|
||||
msg_formatted = TRUE;
|
||||
}
|
||||
}
|
||||
@ -1097,9 +1097,9 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
|
||||
if(msg_formatted) {
|
||||
msgbuf[sizeof(msgbuf)-1] = '\0';
|
||||
/* strip trailing '\r\n' or '\n' */
|
||||
if((p = strrchr(msgbuf,'\n')) != NULL && (p - msgbuf) >= 2)
|
||||
if((p = strrchr(msgbuf, '\n')) != NULL && (p - msgbuf) >= 2)
|
||||
*p = '\0';
|
||||
if((p = strrchr(msgbuf,'\r')) != NULL && (p - msgbuf) >= 1)
|
||||
if((p = strrchr(msgbuf, '\r')) != NULL && (p - msgbuf) >= 1)
|
||||
*p = '\0';
|
||||
msg = msgbuf;
|
||||
}
|
||||
|
40
lib/telnet.c
40
lib/telnet.c
@ -226,9 +226,9 @@ check_wsock2 ( struct SessionHandle *data )
|
||||
if(LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) ||
|
||||
HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested)) {
|
||||
/* Our version isn't supported */
|
||||
failf(data,"insufficient winsock version to support "
|
||||
"telnet");
|
||||
return CURLE_FAILED_INIT;
|
||||
failf(data, "insufficient winsock version to support "
|
||||
"telnet");
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
/* Our version is supported */
|
||||
@ -1174,7 +1174,7 @@ CURLcode telrcv(struct connectdata *conn,
|
||||
if(c == CURL_IAC)
|
||||
tn->telrcv_state = CURL_TS_SE;
|
||||
else
|
||||
CURL_SB_ACCUM(tn,c);
|
||||
CURL_SB_ACCUM(tn, c);
|
||||
break;
|
||||
|
||||
case CURL_TS_SE:
|
||||
@ -1199,7 +1199,7 @@ CURLcode telrcv(struct connectdata *conn,
|
||||
tn->telrcv_state = CURL_TS_IAC;
|
||||
goto process_iac;
|
||||
}
|
||||
CURL_SB_ACCUM(tn,c);
|
||||
CURL_SB_ACCUM(tn, c);
|
||||
tn->telrcv_state = CURL_TS_SB;
|
||||
}
|
||||
else
|
||||
@ -1336,42 +1336,38 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
/* load ws2_32.dll and get the function pointers we need. */
|
||||
wsock2 = LoadLibrary(TEXT("WS2_32.DLL"));
|
||||
if(wsock2 == NULL) {
|
||||
failf(data,"failed to load WS2_32.DLL (%d)", ERRNO);
|
||||
failf(data, "failed to load WS2_32.DLL (%d)", ERRNO);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
/* Grab a pointer to WSACreateEvent */
|
||||
create_event_func = GetProcAddress(wsock2,"WSACreateEvent");
|
||||
create_event_func = GetProcAddress(wsock2, "WSACreateEvent");
|
||||
if(create_event_func == NULL) {
|
||||
failf(data,"failed to find WSACreateEvent function (%d)",
|
||||
ERRNO);
|
||||
failf(data, "failed to find WSACreateEvent function (%d)", ERRNO);
|
||||
FreeLibrary(wsock2);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
/* And WSACloseEvent */
|
||||
close_event_func = GetProcAddress(wsock2,"WSACloseEvent");
|
||||
close_event_func = GetProcAddress(wsock2, "WSACloseEvent");
|
||||
if(close_event_func == NULL) {
|
||||
failf(data,"failed to find WSACloseEvent function (%d)",
|
||||
ERRNO);
|
||||
failf(data, "failed to find WSACloseEvent function (%d)", ERRNO);
|
||||
FreeLibrary(wsock2);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
/* And WSAEventSelect */
|
||||
event_select_func = GetProcAddress(wsock2,"WSAEventSelect");
|
||||
event_select_func = GetProcAddress(wsock2, "WSAEventSelect");
|
||||
if(event_select_func == NULL) {
|
||||
failf(data,"failed to find WSAEventSelect function (%d)",
|
||||
ERRNO);
|
||||
failf(data, "failed to find WSAEventSelect function (%d)", ERRNO);
|
||||
FreeLibrary(wsock2);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
/* And WSAEnumNetworkEvents */
|
||||
enum_netevents_func = GetProcAddress(wsock2,"WSAEnumNetworkEvents");
|
||||
enum_netevents_func = GetProcAddress(wsock2, "WSAEnumNetworkEvents");
|
||||
if(enum_netevents_func == NULL) {
|
||||
failf(data,"failed to find WSAEnumNetworkEvents function (%d)",
|
||||
ERRNO);
|
||||
failf(data, "failed to find WSAEnumNetworkEvents function (%d)", ERRNO);
|
||||
FreeLibrary(wsock2);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
@ -1384,7 +1380,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
/* First, create a sockets event object */
|
||||
event_handle = (WSAEVENT)create_event_func();
|
||||
if(event_handle == WSA_INVALID_EVENT) {
|
||||
failf(data,"WSACreateEvent failed (%d)", SOCKERRNO);
|
||||
failf(data, "WSACreateEvent failed (%d)", SOCKERRNO);
|
||||
FreeLibrary(wsock2);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
@ -1493,7 +1489,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
events.lNetworkEvents = 0;
|
||||
if(SOCKET_ERROR == enum_netevents_func(sockfd, event_handle, &events)) {
|
||||
if((err = SOCKERRNO) != EINPROGRESS) {
|
||||
infof(data,"WSAEnumNetworkEvents failed (%d)", err);
|
||||
infof(data, "WSAEnumNetworkEvents failed (%d)", err);
|
||||
keepon = FALSE;
|
||||
result = CURLE_READ_ERROR;
|
||||
}
|
||||
@ -1550,7 +1546,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
|
||||
/* We called WSACreateEvent, so call WSACloseEvent */
|
||||
if(!close_event_func(event_handle)) {
|
||||
infof(data,"WSACloseEvent failed (%d)", SOCKERRNO);
|
||||
infof(data, "WSACloseEvent failed (%d)", SOCKERRNO);
|
||||
}
|
||||
|
||||
/* "Forget" pointers into the library we're about to free */
|
||||
@ -1561,7 +1557,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
|
||||
/* We called LoadLibrary, so call FreeLibrary */
|
||||
if(!FreeLibrary(wsock2))
|
||||
infof(data,"FreeLibrary(wsock2) failed (%d)", ERRNO);
|
||||
infof(data, "FreeLibrary(wsock2) failed (%d)", ERRNO);
|
||||
#else
|
||||
pfd[0].fd = sockfd;
|
||||
pfd[0].events = POLLIN;
|
||||
|
@ -1632,7 +1632,7 @@ CURLcode Curl_follow(struct SessionHandle *data,
|
||||
if(type == FOLLOW_REDIR) {
|
||||
if((data->set.maxredirs != -1) &&
|
||||
(data->set.followlocation >= data->set.maxredirs)) {
|
||||
failf(data,"Maximum (%ld) redirects followed", data->set.maxredirs);
|
||||
failf(data, "Maximum (%ld) redirects followed", data->set.maxredirs);
|
||||
return CURLE_TOO_MANY_REDIRECTS;
|
||||
}
|
||||
|
||||
|
@ -3626,7 +3626,7 @@ static void fix_hostname(struct SessionHandle *data,
|
||||
stringprep_locale_charset ());
|
||||
if(rc != IDNA_SUCCESS)
|
||||
infof(data, "Failed to convert %s to ACE; %s\n",
|
||||
host->name, Curl_idn_strerror(conn,rc));
|
||||
host->name, Curl_idn_strerror(conn, rc));
|
||||
else {
|
||||
/* tld_check_name() displays a warning if the host name contains
|
||||
"illegal" characters for this TLD */
|
||||
|
@ -140,7 +140,7 @@ cyassl_connect_step1(struct connectdata *conn,
|
||||
data->set.str[STRING_SSL_CAPATH])) {
|
||||
if(data->set.ssl.verifypeer) {
|
||||
/* Fail if we insist on successfully verifying the server. */
|
||||
failf(data,"error setting certificate verify locations:\n"
|
||||
failf(data, "error setting certificate verify locations:\n"
|
||||
" CAfile: %s\n CApath: %s",
|
||||
data->set.str[STRING_SSL_CAFILE]?
|
||||
data->set.str[STRING_SSL_CAFILE]: "none",
|
||||
@ -214,7 +214,7 @@ cyassl_connect_step1(struct connectdata *conn,
|
||||
/* we got a session id, use it! */
|
||||
if(!SSL_set_session(conssl->handle, ssl_sessionid)) {
|
||||
failf(data, "SSL: SSL_set_session failed: %s",
|
||||
ERR_error_string(SSL_get_error(conssl->handle, 0),NULL));
|
||||
ERR_error_string(SSL_get_error(conssl->handle, 0), NULL));
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
/* Informational message */
|
||||
|
@ -26,7 +26,7 @@
|
||||
#ifdef USE_CYASSL
|
||||
|
||||
CURLcode Curl_cyassl_connect(struct connectdata *conn, int sockindex);
|
||||
bool Curl_cyassl_data_pending(const struct connectdata* conn,int connindex);
|
||||
bool Curl_cyassl_data_pending(const struct connectdata* conn, int connindex);
|
||||
int Curl_cyassl_shutdown(struct connectdata* conn, int sockindex);
|
||||
|
||||
/* close a SSL connection */
|
||||
|
@ -779,7 +779,7 @@ gtls_connect_step3(struct connectdata *conn,
|
||||
unsigned int cert_list_size;
|
||||
const gnutls_datum_t *chainp;
|
||||
unsigned int verify_status;
|
||||
gnutls_x509_crt_t x509_cert,x509_issuer;
|
||||
gnutls_x509_crt_t x509_cert, x509_issuer;
|
||||
gnutls_datum_t issuerp;
|
||||
char certbuf[256] = ""; /* big enough? */
|
||||
size_t size;
|
||||
@ -897,7 +897,7 @@ gtls_connect_step3(struct connectdata *conn,
|
||||
gnutls_x509_crt_init(&x509_issuer);
|
||||
issuerp = load_file(data->set.ssl.issuercert);
|
||||
gnutls_x509_crt_import(x509_issuer, &issuerp, GNUTLS_X509_FMT_PEM);
|
||||
rc = gnutls_x509_crt_check_issuer(x509_cert,x509_issuer);
|
||||
rc = gnutls_x509_crt_check_issuer(x509_cert, x509_issuer);
|
||||
gnutls_x509_crt_deinit(x509_issuer);
|
||||
unload_file(issuerp);
|
||||
if(rc <= 0) {
|
||||
@ -906,7 +906,7 @@ gtls_connect_step3(struct connectdata *conn,
|
||||
gnutls_x509_crt_deinit(x509_cert);
|
||||
return CURLE_SSL_ISSUER_ERROR;
|
||||
}
|
||||
infof(data,"\t server certificate issuer check OK (Issuer Cert: %s)\n",
|
||||
infof(data, "\t server certificate issuer check OK (Issuer Cert: %s)\n",
|
||||
data->set.ssl.issuercert?data->set.ssl.issuercert:"none");
|
||||
}
|
||||
|
||||
|
@ -861,7 +861,7 @@ static SECStatus BadCertHandler(void *arg, PRFileDesc *sock)
|
||||
static SECStatus check_issuer_cert(PRFileDesc *sock,
|
||||
char *issuer_nickname)
|
||||
{
|
||||
CERTCertificate *cert,*cert_issuer,*issuer;
|
||||
CERTCertificate *cert, *cert_issuer, *issuer;
|
||||
SECStatus res=SECSuccess;
|
||||
void *proto_win = NULL;
|
||||
|
||||
@ -872,7 +872,7 @@ static SECStatus check_issuer_cert(PRFileDesc *sock,
|
||||
*/
|
||||
|
||||
cert = SSL_PeerCertificate(sock);
|
||||
cert_issuer = CERT_FindCertIssuer(cert,PR_Now(),certUsageObjectSigner);
|
||||
cert_issuer = CERT_FindCertIssuer(cert, PR_Now(), certUsageObjectSigner);
|
||||
|
||||
proto_win = SSL_RevealPinArg(sock);
|
||||
issuer = PK11_FindCertFromNickname(issuer_nickname, proto_win);
|
||||
@ -1734,7 +1734,7 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
|
||||
}
|
||||
|
||||
if(SECFailure == ret) {
|
||||
infof(data,"SSL certificate issuer check failed\n");
|
||||
infof(data, "SSL certificate issuer check failed\n");
|
||||
result = CURLE_SSL_ISSUER_ERROR;
|
||||
goto error;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ int cert_stuff(struct connectdata *conn,
|
||||
STACK_OF(X509) *ca = NULL;
|
||||
int i;
|
||||
|
||||
f = fopen(cert_file,"rb");
|
||||
f = fopen(cert_file, "rb");
|
||||
if(!f) {
|
||||
failf(data, "could not open PKCS12 file '%s'", cert_file);
|
||||
return 0;
|
||||
@ -605,7 +605,7 @@ int cert_stuff(struct connectdata *conn,
|
||||
#endif
|
||||
/* the typecast below was added to please mingw32 */
|
||||
priv_key = (EVP_PKEY *)
|
||||
ENGINE_load_private_key(data->state.engine,key_file,
|
||||
ENGINE_load_private_key(data->state.engine, key_file,
|
||||
#ifdef HAVE_ENGINE_LOAD_FOUR_ARGS
|
||||
ui_method,
|
||||
#endif
|
||||
@ -647,7 +647,7 @@ int cert_stuff(struct connectdata *conn,
|
||||
|
||||
ssl=SSL_new(ctx);
|
||||
if(!ssl) {
|
||||
failf(data,"unable to create an SSL structure");
|
||||
failf(data, "unable to create an SSL structure");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -657,7 +657,7 @@ int cert_stuff(struct connectdata *conn,
|
||||
leak memory as the previous version: */
|
||||
if(x509) {
|
||||
EVP_PKEY *pktmp = X509_get_pubkey(x509);
|
||||
EVP_PKEY_copy_parameters(pktmp,SSL_get_privatekey(ssl));
|
||||
EVP_PKEY_copy_parameters(pktmp, SSL_get_privatekey(ssl));
|
||||
EVP_PKEY_free(pktmp);
|
||||
}
|
||||
|
||||
@ -881,7 +881,7 @@ CURLcode Curl_ossl_set_engine_default(struct SessionHandle *data)
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
if(data->state.engine) {
|
||||
if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) {
|
||||
infof(data,"set default crypto engine '%s'\n",
|
||||
infof(data, "set default crypto engine '%s'\n",
|
||||
ENGINE_get_id(data->state.engine));
|
||||
}
|
||||
else {
|
||||
@ -1070,7 +1070,7 @@ static int asn1_output(const ASN1_UTCTIME *tm,
|
||||
const char *asn1_string;
|
||||
int gmt=FALSE;
|
||||
int i;
|
||||
int year=0,month=0,day=0,hour=0,minute=0,second=0;
|
||||
int year=0, month=0, day=0, hour=0, minute=0, second=0;
|
||||
|
||||
i=tm->length;
|
||||
asn1_string=(const char *)tm->data;
|
||||
@ -1229,7 +1229,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert)
|
||||
else {
|
||||
/* we have to look to the last occurrence of a commonName in the
|
||||
distinguished one to get the most significant one. */
|
||||
int j,i=-1 ;
|
||||
int j, i=-1;
|
||||
|
||||
/* The following is done because of a bug in 0.9.6b */
|
||||
|
||||
@ -1246,7 +1246,8 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert)
|
||||
UTF8 etc. */
|
||||
|
||||
if(i>=0) {
|
||||
ASN1_STRING *tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name,i));
|
||||
ASN1_STRING *tmp =
|
||||
X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));
|
||||
|
||||
/* In OpenSSL 0.9.7d and earlier, ASN1_STRING_to_UTF8 fails if the input
|
||||
is already UTF-8 encoded. We check for this case and copy the raw
|
||||
@ -1965,7 +1966,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
failf(data, "Unable to set SRP user name");
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
}
|
||||
if(!SSL_CTX_set_srp_password(connssl->ctx,data->set.ssl.password)) {
|
||||
if(!SSL_CTX_set_srp_password(connssl->ctx, data->set.ssl.password)) {
|
||||
failf(data, "failed setting SRP password");
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
}
|
||||
@ -1987,7 +1988,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
data->set.str[STRING_SSL_CAPATH])) {
|
||||
if(data->set.ssl.verifypeer) {
|
||||
/* Fail if we insist on successfully verifying the server. */
|
||||
failf(data,"error setting certificate verify locations:\n"
|
||||
failf(data, "error setting certificate verify locations:\n"
|
||||
" CAfile: %s\n CApath: %s",
|
||||
data->set.str[STRING_SSL_CAFILE]?
|
||||
data->set.str[STRING_SSL_CAFILE]: "none",
|
||||
@ -2021,9 +2022,9 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
lookup=X509_STORE_add_lookup(SSL_CTX_get_cert_store(connssl->ctx),
|
||||
X509_LOOKUP_file());
|
||||
if(!lookup ||
|
||||
(!X509_load_crl_file(lookup,data->set.str[STRING_SSL_CRLFILE],
|
||||
(!X509_load_crl_file(lookup, data->set.str[STRING_SSL_CRLFILE],
|
||||
X509_FILETYPE_PEM)) ) {
|
||||
failf(data,"error loading CRL file: %s",
|
||||
failf(data, "error loading CRL file: %s",
|
||||
data->set.str[STRING_SSL_CRLFILE]);
|
||||
return CURLE_SSL_CRL_BADFILE;
|
||||
}
|
||||
@ -2051,7 +2052,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
result = (*data->set.ssl.fsslctx)(data, connssl->ctx,
|
||||
data->set.ssl.fsslctxp);
|
||||
if(result) {
|
||||
failf(data,"error signaled by ssl ctx callback");
|
||||
failf(data, "error signaled by ssl ctx callback");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -2091,7 +2092,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
/* we got a session id, use it! */
|
||||
if(!SSL_set_session(connssl->handle, ssl_sessionid)) {
|
||||
failf(data, "SSL: SSL_set_session failed: %s",
|
||||
ERR_error_string(ERR_get_error(),NULL));
|
||||
ERR_error_string(ERR_get_error(), NULL));
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
/* Informational message */
|
||||
@ -2101,7 +2102,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
/* pass the raw socket into the SSL layers */
|
||||
if(!SSL_set_fd(connssl->handle, (int)sockfd)) {
|
||||
failf(data, "SSL: SSL_set_fd failed: %s",
|
||||
ERR_error_string(ERR_get_error(),NULL));
|
||||
ERR_error_string(ERR_get_error(), NULL));
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
|
||||
@ -2462,7 +2463,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
|
||||
num=X509_get_serialNumber(x);
|
||||
if(num->length <= 4) {
|
||||
value = ASN1_INTEGER_get(num);
|
||||
infof(data," Serial Number: %ld (0x%lx)\n", value, value);
|
||||
infof(data, " Serial Number: %ld (0x%lx)\n", value, value);
|
||||
snprintf(bufp, CERTBUFFERSIZE, "%lx", value);
|
||||
}
|
||||
else {
|
||||
@ -2481,7 +2482,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
|
||||
left-=4;
|
||||
}
|
||||
if(num->length)
|
||||
infof(data," Serial Number: %s\n", bufp);
|
||||
infof(data, " Serial Number: %s\n", bufp);
|
||||
else
|
||||
bufp[0]=0;
|
||||
}
|
||||
@ -2719,7 +2720,7 @@ static CURLcode servercert(struct connectdata *conn,
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if(X509_check_issued(issuer,connssl->server_cert) != X509_V_OK) {
|
||||
if(X509_check_issued(issuer, connssl->server_cert) != X509_V_OK) {
|
||||
if(strict)
|
||||
failf(data, "SSL: Certificate issuer check failed (%s)",
|
||||
data->set.str[STRING_SSL_ISSUERCERT]);
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -129,7 +129,7 @@ CURLcode create_dir_hierarchy(const char *outfile, FILE *errors)
|
||||
snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir);
|
||||
}
|
||||
if(access(dirbuildup, F_OK) == -1) {
|
||||
if(-1 == mkdir(dirbuildup,(mode_t)0000750)) {
|
||||
if(-1 == mkdir(dirbuildup, (mode_t)0000750)) {
|
||||
show_dir_errno(errors, dirbuildup);
|
||||
result = CURLE_WRITE_ERROR;
|
||||
break; /* get out of loop */
|
||||
|
@ -1310,7 +1310,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
break;
|
||||
case 'f': /* crypto engine */
|
||||
GetStr(&config->engine, nextarg);
|
||||
if(config->engine && curlx_raw_equal(config->engine,"list"))
|
||||
if(config->engine && curlx_raw_equal(config->engine, "list"))
|
||||
return PARAM_ENGINES_REQUESTED;
|
||||
break;
|
||||
case 'g': /* CA info PEM file */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -44,11 +44,11 @@ static char *GetEnv(const char *variable, char do_expand)
|
||||
env = buf1;
|
||||
variable = buf1;
|
||||
}
|
||||
if(do_expand && strchr(variable,'%')) {
|
||||
if(do_expand && strchr(variable, '%')) {
|
||||
/* buf2 == variable if not expanded */
|
||||
rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2));
|
||||
if(rc > 0 && rc < sizeof(buf2) &&
|
||||
!strchr(buf2,'%')) /* no vars still unexpanded */
|
||||
!strchr(buf2, '%')) /* no vars still unexpanded */
|
||||
env = buf2;
|
||||
}
|
||||
#else
|
||||
|
@ -114,7 +114,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
|
||||
#endif
|
||||
}
|
||||
|
||||
if(strcmp(filename,"-"))
|
||||
if(strcmp(filename, "-"))
|
||||
file = fopen(filename, "r");
|
||||
else
|
||||
file = stdin;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, 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
|
||||
@ -39,7 +39,7 @@ char *strdup(const char *str)
|
||||
if(!newstr)
|
||||
return (char *)NULL;
|
||||
|
||||
memcpy(newstr,str,(len+1)*sizeof(char));
|
||||
memcpy(newstr, str, (len+1)*sizeof(char));
|
||||
|
||||
return newstr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user