checksrc: use space after comma

This commit is contained in:
Daniel Stenberg
2015-03-17 13:41:49 +01:00
parent a6b8fe2a5f
commit 9395999543
37 changed files with 171 additions and 140 deletions

View 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -71,7 +71,7 @@ bool Curl_amiga_init()
} }
#ifdef __libnix__ #ifdef __libnix__
ADD2EXIT(Curl_amiga_cleanup,-50); ADD2EXIT(Curl_amiga_cleanup, -50);
#endif #endif
#endif /* __AMIGA__ && ! __ixemul__ */ #endif /* __AMIGA__ && ! __ixemul__ */

View File

@@ -164,7 +164,7 @@ void Curl_resolver_cleanup(void *resolver)
int Curl_resolver_duphandle(void **to, void *from) int Curl_resolver_duphandle(void **to, void *from)
{ {
/* Clone the ares channel for the new handle */ /* 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_FAILED_INIT;
return CURLE_OK; return CURLE_OK;
} }
@@ -385,7 +385,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
timeout_ms = 1000; timeout_ms = 1000;
waitperform(conn, timeout_ms); waitperform(conn, timeout_ms);
Curl_resolver_is_resolved(conn,&temp_entry); Curl_resolver_is_resolved(conn, &temp_entry);
if(conn->async.done) if(conn->async.done)
break; break;
@@ -539,7 +539,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
conn->async.done = FALSE; /* not done */ conn->async.done = FALSE; /* not done */
conn->async.status = 0; /* clear */ conn->async.status = 0; /* clear */
conn->async.dns = NULL; /* clear */ conn->async.dns = NULL; /* clear */
res = calloc(sizeof(struct ResolverResults),1); res = calloc(sizeof(struct ResolverResults), 1);
if(!res) { if(!res) {
free(conn->async.hostname); free(conn->async.hostname);
conn->async.hostname = NULL; conn->async.hostname = NULL;

View File

@@ -195,7 +195,7 @@ void destroy_thread_sync_data(struct thread_sync_data * tsd)
if(tsd->res) if(tsd->res)
Curl_freeaddrinfo(tsd->res); Curl_freeaddrinfo(tsd->res);
memset(tsd,0,sizeof(*tsd)); memset(tsd, 0, sizeof(*tsd));
} }
/* Initialize resolver thread synchronization data */ /* Initialize resolver thread synchronization data */

View File

@@ -155,6 +155,38 @@ sub scanfile {
} }
} }
# 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" # check for "} else"
if($l =~ /^(.*)\} *else/) { if($l =~ /^(.*)\} *else/) {
checkwarn($line, length($1), $file, $l, "else after closing brace on same line"); checkwarn($line, length($1), $file, $l, "else after closing brace on same line");

View File

@@ -883,7 +883,7 @@ static void tcpnodelay(struct connectdata *conn,
infof(data, "Could not set TCP_NODELAY: %s\n", infof(data, "Could not set TCP_NODELAY: %s\n",
Curl_strerror(conn, SOCKERRNO)); Curl_strerror(conn, SOCKERRNO));
else else
infof(data,"TCP_NODELAY set\n"); infof(data, "TCP_NODELAY set\n");
#else #else
(void)conn; (void)conn;
(void)sockfd; (void)sockfd;
@@ -1111,7 +1111,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
default: default:
/* unknown error, fallthrough and try another address! */ /* unknown error, fallthrough and try another address! */
infof(data, "Immediate connect fail for %s: %s\n", infof(data, "Immediate connect fail for %s: %s\n",
ipaddress, Curl_strerror(conn,error)); ipaddress, Curl_strerror(conn, error));
data->state.os_errno = error; data->state.os_errno = error;
/* connect failed */ /* connect failed */

View File

@@ -197,7 +197,7 @@ static CURLcode rtmp_setup_connection(struct connectdata *conn)
static CURLcode rtmp_connect(struct connectdata *conn, bool *done) static CURLcode rtmp_connect(struct connectdata *conn, bool *done)
{ {
RTMP *r = conn->proto.generic; RTMP *r = conn->proto.generic;
SET_RCVTIMEO(tv,10); SET_RCVTIMEO(tv, 10);
r->m_sb.sb_socket = conn->sock[FIRSTSOCKET]; r->m_sb.sb_socket = conn->sock[FIRSTSOCKET];

View File

@@ -1491,13 +1491,13 @@ static CURLcode ftp_state_list(struct connectdata *conn)
The other ftp_filemethods will CWD into dir/dir/ first and The other ftp_filemethods will CWD into dir/dir/ first and
then just do LIST (in that case: nothing to do here) then just do LIST (in that case: nothing to do here)
*/ */
char *cmd,*lstArg,*slashPos; char *cmd, *lstArg, *slashPos;
lstArg = NULL; lstArg = NULL;
if((data->set.ftp_filemethod == FTPFILE_NOCWD) && if((data->set.ftp_filemethod == FTPFILE_NOCWD) &&
data->state.path && data->state.path &&
data->state.path[0] && data->state.path[0] &&
strchr(data->state.path,'/')) { strchr(data->state.path, '/')) {
lstArg = strdup(data->state.path); lstArg = strdup(data->state.path);
if(!lstArg) if(!lstArg)
@@ -1507,7 +1507,7 @@ static CURLcode ftp_state_list(struct connectdata *conn)
if(lstArg[strlen(lstArg) - 1] != '/') { if(lstArg[strlen(lstArg) - 1] != '/') {
/* chop off the file part if format is dir/dir/file */ /* chop off the file part if format is dir/dir/file */
slashPos = strrchr(lstArg,'/'); slashPos = strrchr(lstArg, '/');
if(slashPos) if(slashPos)
*(slashPos+1) = '\0'; *(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 */ /* shut down the socket to inform the server we're done */
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
shutdown(conn->sock[SECONDARYSOCKET],2); /* SD_BOTH */ shutdown(conn->sock[SECONDARYSOCKET], 2); /* SD_BOTH */
#endif #endif
if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) { if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {

View File

@@ -297,7 +297,7 @@ remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)
time(&user.now); time(&user.now);
user.cache_timeout = data->set.dns_cache_timeout; user.cache_timeout = data->set.dns_cache_timeout;
if(!hostcache_timestamp_remove(&user,dns) ) if(!hostcache_timestamp_remove(&user, dns) )
return 0; return 0;
Curl_hash_clean_with_criterium(data->dns.hostcache, Curl_hash_clean_with_criterium(data->dns.hostcache,

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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> #include <arpa/inet.h>
#endif #endif
#define Curl_inet_ntop(af,addr,buf,size) \ #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
#endif /* HEADER_CURL_INET_NTOP_H */ #endif /* HEADER_CURL_INET_NTOP_H */

View File

@@ -246,7 +246,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
result = Curl_base64_encode(data, (char *)output_buffer.value, result = Curl_base64_encode(data, (char *)output_buffer.value,
output_buffer.length, &p, &base64_sz); output_buffer.length, &p, &base64_sz);
if(result) { 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; ret = AUTH_CONTINUE;
break; break;
} }
@@ -278,7 +279,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
(unsigned char **)&_gssresp.value, (unsigned char **)&_gssresp.value,
&_gssresp.length); &_gssresp.length);
if(result) { 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; ret = AUTH_CONTINUE;
break; break;
} }

View File

@@ -198,7 +198,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
size_t val_b64_sz = 0; size_t val_b64_sz = 0;
curl_off_t dlsize = 0; curl_off_t dlsize = 0;
#ifdef LDAP_OPT_NETWORK_TIMEOUT #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 #endif
#if defined(USE_WIN32_LDAP) #if defined(USE_WIN32_LDAP)
TCHAR *host = NULL; TCHAR *host = NULL;

View File

@@ -104,13 +104,13 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
#endif #endif
#define socket(domain,type,protocol)\ #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 */ #undef accept /* for those with accept as a macro */
#define accept(sock,addr,len)\ #define accept(sock,addr,len)\
curl_accept(sock,addr,len,__LINE__,__FILE__) curl_accept(sock, addr, len, __LINE__, __FILE__)
#ifdef HAVE_SOCKETPAIR #ifdef HAVE_SOCKETPAIR
#define socketpair(domain,type,protocol,socket_vector)\ #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 #endif
#ifdef HAVE_GETADDRINFO #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 our macro as for other platforms. Instead, we redefine the new name they
define getaddrinfo to become! */ define getaddrinfo to become! */
#define ogetaddrinfo(host,serv,hint,res) \ #define ogetaddrinfo(host,serv,hint,res) \
curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__) curl_dogetaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
#else #else
#undef getaddrinfo #undef getaddrinfo
#define getaddrinfo(host,serv,hint,res) \ #define getaddrinfo(host,serv,hint,res) \
curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__) curl_dogetaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
#endif #endif
#endif /* HAVE_GETADDRINFO */ #endif /* HAVE_GETADDRINFO */
#ifdef HAVE_GETNAMEINFO #ifdef HAVE_GETNAMEINFO
#undef getnameinfo #undef getnameinfo
#define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \ #define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \
curl_dogetnameinfo(sa,salen,host,hostlen,serv,servlen,flags, __LINE__, \ curl_dogetnameinfo(sa, salen, host, hostlen, serv, servlen, flags, \
__FILE__) __LINE__, __FILE__)
#endif /* HAVE_GETNAMEINFO */ #endif /* HAVE_GETNAMEINFO */
#ifdef HAVE_FREEADDRINFO #ifdef HAVE_FREEADDRINFO
#undef freeaddrinfo #undef freeaddrinfo
#define freeaddrinfo(data) \ #define freeaddrinfo(data) \
curl_dofreeaddrinfo(data,__LINE__,__FILE__) curl_dofreeaddrinfo(data, __LINE__, __FILE__)
#endif /* HAVE_FREEADDRINFO */ #endif /* HAVE_FREEADDRINFO */
/* sclose is probably already defined, redefine it! */ /* sclose is probably already defined, redefine it! */

View File

@@ -2426,7 +2426,7 @@ CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles)
static CURLMcode multi_timeout(struct Curl_multi *multi, static CURLMcode multi_timeout(struct Curl_multi *multi,
long *timeout_ms) long *timeout_ms)
{ {
static struct timeval tv_zero = {0,0}; static struct timeval tv_zero = {0, 0};
if(multi->timetree) { if(multi->timetree) {
/* we have a tree of expire times */ /* we have a tree of expire times */
@@ -2484,7 +2484,7 @@ static int update_timer(struct Curl_multi *multi)
return -1; return -1;
} }
if(timeout_ms < 0) { 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)) { if(Curl_splaycomparekeys(none, multi->timer_lastcall)) {
multi->timer_lastcall = none; multi->timer_lastcall = none;
/* there's no timeout now but there was one previously, tell the app to /* there's no timeout now but there was one previously, tell the app to

View File

@@ -227,7 +227,7 @@ static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
ldapconninfo *li = conn->proto.generic; ldapconninfo *li = conn->proto.generic;
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
LDAPMessage *msg = NULL; LDAPMessage *msg = NULL;
struct timeval tv = {0,1}, *tvp; struct timeval tv = {0, 1}, *tvp;
int rc, err; int rc, err;
char *info = NULL; 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)); failf(data, "LDAP local: ldap_search_ext %s", ldap_err2string(rc));
return CURLE_LDAP_SEARCH_FAILED; return CURLE_LDAP_SEARCH_FAILED;
} }
lr = calloc(1,sizeof(ldapreqinfo)); lr = calloc(1, sizeof(ldapreqinfo));
if(!lr) if(!lr)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
lr->msgid = msgid; lr->msgid = msgid;
@@ -420,7 +420,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
LDAPMessage *msg = NULL; LDAPMessage *msg = NULL;
LDAPMessage *ent; LDAPMessage *ent;
BerElement *ber = NULL; BerElement *ber = NULL;
struct timeval tv = {0,1}; struct timeval tv = {0, 1};
(void)len; (void)len;
(void)buf; (void)buf;

View File

@@ -159,7 +159,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
fd_set fds_err; fd_set fds_err;
curl_socket_t maxfd; curl_socket_t maxfd;
#endif #endif
struct timeval initial_tv = {0,0}; struct timeval initial_tv = {0, 0};
int pending_ms = 0; int pending_ms = 0;
int error; int error;
int r; int r;
@@ -393,7 +393,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
fd_set fds_err; fd_set fds_err;
curl_socket_t maxfd; curl_socket_t maxfd;
#endif #endif
struct timeval initial_tv = {0,0}; struct timeval initial_tv = {0, 0};
bool fds_none = TRUE; bool fds_none = TRUE;
unsigned int i; unsigned int i;
int pending_ms = 0; int pending_ms = 0;

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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, static void des_ecb_encrypt(const_des_cblock *input,
des_cblock *output, des_cblock *output,
des_key_schedule ks,int enc) { des_key_schedule ks, int enc) {
DES_ECB_ENCRYPT(input, output, ks, enc); DES_ECB_ENCRYPT(input, output, ks, enc);
} }
#endif #endif

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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 */ /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
if(!socks5_resolve_local && hostname_len > 255) { 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); "length > 255 [actual len=%zu]\n", hostname_len);
socks5_resolve_local = TRUE; socks5_resolve_local = TRUE;
} }

View File

@@ -48,7 +48,7 @@ static int check_gss_err(struct SessionHandle *data,
const char* function) const char* function)
{ {
if(GSS_ERROR(major_status)) { if(GSS_ERROR(major_status)) {
OM_uint32 maj_stat,min_stat; OM_uint32 maj_stat, min_stat;
OM_uint32 msg_ctx = 0; OM_uint32 msg_ctx = 0;
gss_buffer_desc status_string; gss_buffer_desc status_string;
char buf[1024]; char buf[1024];
@@ -131,7 +131,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
*/ */
/* prepare service name */ /* prepare service name */
if(strchr(serviceptr,'/')) { if(strchr(serviceptr, '/')) {
service.value = malloc(strlen(serviceptr)); service.value = malloc(strlen(serviceptr));
if(!service.value) if(!service.value)
return CURLE_OUT_OF_MEMORY; 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 */ gss_release_buffer(&gss_status, &service); /* clear allocated memory */
if(check_gss_err(data,gss_major_status, if(check_gss_err(data, gss_major_status,
gss_minor_status,"gss_import_name()")) { gss_minor_status, "gss_import_name()")) {
failf(data, "Failed to create service name."); failf(data, "Failed to create service name.");
gss_release_name(&gss_status, &server); gss_release_name(&gss_status, &server);
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
@@ -178,8 +178,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
if(gss_token != GSS_C_NO_BUFFER) if(gss_token != GSS_C_NO_BUFFER)
gss_release_buffer(&gss_status, &gss_recv_token); gss_release_buffer(&gss_status, &gss_recv_token);
if(check_gss_err(data,gss_major_status, if(check_gss_err(data, gss_major_status,
gss_minor_status,"gss_init_sec_context")) { gss_minor_status, "gss_init_sec_context")) {
gss_release_name(&gss_status, &server); gss_release_name(&gss_status, &server);
gss_release_buffer(&gss_status, &gss_recv_token); gss_release_buffer(&gss_status, &gss_recv_token);
gss_release_buffer(&gss_status, &gss_send_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[0] = 1; /* GSS-API subnegotiation version */
socksreq[1] = 1; /* authentication message type */ socksreq[1] = 1; /* authentication message type */
us_length = htons((short)gss_send_token.length); 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); code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);
if(code || (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_major_status = gss_inquire_context (&gss_minor_status, gss_context,
&gss_client_name, NULL, NULL, NULL, &gss_client_name, NULL, NULL, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
if(check_gss_err(data,gss_major_status, if(check_gss_err(data, gss_major_status,
gss_minor_status,"gss_inquire_context")) { gss_minor_status, "gss_inquire_context")) {
gss_delete_sec_context(&gss_status, &gss_context, NULL); gss_delete_sec_context(&gss_status, &gss_context, NULL);
gss_release_name(&gss_status, &gss_client_name); gss_release_name(&gss_status, &gss_client_name);
failf(data, "Failed to determine user 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_major_status = gss_display_name(&gss_minor_status, gss_client_name,
&gss_send_token, NULL); &gss_send_token, NULL);
if(check_gss_err(data,gss_major_status, if(check_gss_err(data, gss_major_status,
gss_minor_status,"gss_display_name")) { gss_minor_status, "gss_display_name")) {
gss_delete_sec_context(&gss_status, &gss_context, NULL); gss_delete_sec_context(&gss_status, &gss_context, NULL);
gss_release_name(&gss_status, &gss_client_name); gss_release_name(&gss_status, &gss_client_name);
gss_release_buffer(&gss_status, &gss_send_token); 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) { if(data->set.socks5_gssapi_nec) {
us_length = htons((short)1); us_length = htons((short)1);
memcpy(socksreq+2,&us_length,sizeof(short)); memcpy(socksreq+2, &us_length, sizeof(short));
} }
else { else {
gss_send_token.length = 1; gss_send_token.length = 1;
@@ -387,7 +387,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
GSS_C_QOP_DEFAULT, &gss_send_token, GSS_C_QOP_DEFAULT, &gss_send_token,
&gss_conf_state, &gss_w_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_send_token);
gss_release_buffer(&gss_status, &gss_w_token); gss_release_buffer(&gss_status, &gss_w_token);
gss_delete_sec_context(&gss_status, &gss_context, NULL); 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); gss_release_buffer(&gss_status, &gss_send_token);
us_length = htons((short)gss_w_token.length); 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); 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, &gss_recv_token, &gss_w_token,
0, GSS_C_QOP_DEFAULT); 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_recv_token);
gss_release_buffer(&gss_status, &gss_w_token); gss_release_buffer(&gss_status, &gss_w_token);
gss_delete_sec_context(&gss_status, &gss_context, NULL); gss_delete_sec_context(&gss_status, &gss_context, NULL);
@@ -492,7 +492,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
return CURLE_COULDNT_CONNECT; 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); gss_release_buffer(&gss_status, &gss_w_token);
} }
else { else {
@@ -504,7 +504,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
return CURLE_COULDNT_CONNECT; 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); gss_release_buffer(&gss_status, &gss_recv_token);
} }

View File

@@ -104,8 +104,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
service_name = malloc(strlen(service) + strlen(conn->proxy.name) + 2); service_name = malloc(strlen(service) + strlen(conn->proxy.name) + 2);
if(!service_name) if(!service_name)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
snprintf(service_name,strlen(service) +strlen(conn->proxy.name)+2,"%s/%s", snprintf(service_name, strlen(service) +strlen(conn->proxy.name)+2,
service,conn->proxy.name); "%s/%s", service, conn->proxy.name);
} }
input_desc.cBuffers = 1; input_desc.cBuffers = 1;
@@ -402,7 +402,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
return CURLE_OUT_OF_MEMORY; 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].BufferType = SECBUFFER_PADDING;
sspi_w_token[2].cbBuffer = sspi_sizes.cbBlockSize; sspi_w_token[2].cbBuffer = sspi_sizes.cbBlockSize;
sspi_w_token[2].pvBuffer = malloc(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; sspi_w_token[2].cbBuffer = 0;
us_length = htons((short)sspi_send_token.cbBuffer); 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); 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) { 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); code = Curl_write_plain(conn, sock, (char *)socksreq, 1, &written);
if(code || (1 != written)) { if(code || (1 != written)) {
failf(data, "Failed to send SSPI encryption type."); failf(data, "Failed to send SSPI encryption type.");
@@ -567,7 +567,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
return CURLE_COULDNT_CONNECT; 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[0].pvBuffer);
s_pSecFn->FreeContextBuffer(sspi_w_token[1].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); s_pSecFn->DeleteSecurityContext(&sspi_context);
return CURLE_COULDNT_CONNECT; 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); s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);
} }

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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 *t,
struct Curl_tree *node) 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) if(node == NULL)
return t; return t;
if(t != NULL) { if(t != NULL) {
t = Curl_splay(i,t); t = Curl_splay(i, t);
if(compare(i, t->key)==0) { if(compare(i, t->key)==0) {
/* There already exists a node in the tree with the very same key. Build /* 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 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; return NULL;
} }
t = Curl_splay(i,t); t = Curl_splay(i, t);
if(compare(i, t->key) < 0) { if(compare(i, t->key) < 0) {
/* too big node, try the smaller chain */ /* too big node, try the smaller chain */
if(t->smaller) if(t->smaller)
@@ -223,7 +223,7 @@ int Curl_splayremovebyaddr(struct Curl_tree *t,
struct Curl_tree *removenode, struct Curl_tree *removenode,
struct Curl_tree **newroot) 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; struct Curl_tree *x;
if(!t || !removenode) if(!t || !removenode)

View File

@@ -2242,7 +2242,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
DEBUGF(infof(data, "SFTP DONE done\n")); DEBUGF(infof(data, "SFTP DONE done\n"));
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT /* 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 */ SSH_SFTP_CLOSE to pass the correct result back */
if(sshc->nextstate != SSH_NO_STATE && if(sshc->nextstate != SSH_NO_STATE &&
sshc->nextstate != SSH_SFTP_CLOSE) { sshc->nextstate != SSH_SFTP_CLOSE) {

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -44,8 +44,8 @@ typedef enum {
SSH_AUTH_PKEY, SSH_AUTH_PKEY,
SSH_AUTH_PASS_INIT, SSH_AUTH_PASS_INIT,
SSH_AUTH_PASS, SSH_AUTH_PASS,
SSH_AUTH_AGENT_INIT,/* initialize then wait for connection to agent */ 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_LIST, /* ask for list then wait for entire list to come */
SSH_AUTH_AGENT, /* attempt one key at a time */ SSH_AUTH_AGENT, /* attempt one key at a time */
SSH_AUTH_HOST_INIT, SSH_AUTH_HOST_INIT,
SSH_AUTH_HOST, SSH_AUTH_HOST,

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -44,7 +44,7 @@ char *curlx_strdup(const char *str)
if(!newstr) if(!newstr)
return (char *)NULL; return (char *)NULL;
memcpy(newstr,str,(len+1)*sizeof(char)); memcpy(newstr, str, (len+1)*sizeof(char));
return newstr; return newstr;

View File

@@ -641,7 +641,7 @@ const char *Curl_strerror(struct connectdata *conn, int err)
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL); LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL);
wcstombs(buf,wbuf,max); wcstombs(buf, wbuf, max);
} }
#else #else
/* 'sys_nerr' is the maximum errno number, it is not widely portable */ /* '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 */ buf[max] = '\0'; /* make sure the string is zero terminated */
/* strip trailing '\r\n' or '\n'. */ /* 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'; *p = '\0';
if((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1) if((p = strrchr(buf, '\r')) != NULL && (p - buf) >= 1)
*p = '\0'; *p = '\0';
if(old_errno != ERRNO) if(old_errno != ERRNO)
@@ -1082,7 +1082,7 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, LANG_NEUTRAL, NULL, err, LANG_NEUTRAL,
wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL)) { wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL)) {
wcstombs(msgbuf,wbuf,sizeof(msgbuf)-1); wcstombs(msgbuf, wbuf, sizeof(msgbuf)-1);
msg_formatted = TRUE; msg_formatted = TRUE;
} }
} }
@@ -1097,9 +1097,9 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
if(msg_formatted) { if(msg_formatted) {
msgbuf[sizeof(msgbuf)-1] = '\0'; msgbuf[sizeof(msgbuf)-1] = '\0';
/* strip trailing '\r\n' or '\n' */ /* 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'; *p = '\0';
if((p = strrchr(msgbuf,'\r')) != NULL && (p - msgbuf) >= 1) if((p = strrchr(msgbuf, '\r')) != NULL && (p - msgbuf) >= 1)
*p = '\0'; *p = '\0';
msg = msgbuf; msg = msgbuf;
} }

View File

@@ -226,7 +226,7 @@ check_wsock2 ( struct SessionHandle *data )
if(LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) || if(LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) ||
HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested)) { HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested)) {
/* Our version isn't supported */ /* Our version isn't supported */
failf(data,"insufficient winsock version to support " failf(data, "insufficient winsock version to support "
"telnet"); "telnet");
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
@@ -1174,7 +1174,7 @@ CURLcode telrcv(struct connectdata *conn,
if(c == CURL_IAC) if(c == CURL_IAC)
tn->telrcv_state = CURL_TS_SE; tn->telrcv_state = CURL_TS_SE;
else else
CURL_SB_ACCUM(tn,c); CURL_SB_ACCUM(tn, c);
break; break;
case CURL_TS_SE: case CURL_TS_SE:
@@ -1199,7 +1199,7 @@ CURLcode telrcv(struct connectdata *conn,
tn->telrcv_state = CURL_TS_IAC; tn->telrcv_state = CURL_TS_IAC;
goto process_iac; goto process_iac;
} }
CURL_SB_ACCUM(tn,c); CURL_SB_ACCUM(tn, c);
tn->telrcv_state = CURL_TS_SB; tn->telrcv_state = CURL_TS_SB;
} }
else 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. */ /* load ws2_32.dll and get the function pointers we need. */
wsock2 = LoadLibrary(TEXT("WS2_32.DLL")); wsock2 = LoadLibrary(TEXT("WS2_32.DLL"));
if(wsock2 == NULL) { 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; return CURLE_FAILED_INIT;
} }
/* Grab a pointer to WSACreateEvent */ /* Grab a pointer to WSACreateEvent */
create_event_func = GetProcAddress(wsock2,"WSACreateEvent"); create_event_func = GetProcAddress(wsock2, "WSACreateEvent");
if(create_event_func == NULL) { if(create_event_func == NULL) {
failf(data,"failed to find WSACreateEvent function (%d)", failf(data, "failed to find WSACreateEvent function (%d)", ERRNO);
ERRNO);
FreeLibrary(wsock2); FreeLibrary(wsock2);
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
/* And WSACloseEvent */ /* And WSACloseEvent */
close_event_func = GetProcAddress(wsock2,"WSACloseEvent"); close_event_func = GetProcAddress(wsock2, "WSACloseEvent");
if(close_event_func == NULL) { if(close_event_func == NULL) {
failf(data,"failed to find WSACloseEvent function (%d)", failf(data, "failed to find WSACloseEvent function (%d)", ERRNO);
ERRNO);
FreeLibrary(wsock2); FreeLibrary(wsock2);
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
/* And WSAEventSelect */ /* And WSAEventSelect */
event_select_func = GetProcAddress(wsock2,"WSAEventSelect"); event_select_func = GetProcAddress(wsock2, "WSAEventSelect");
if(event_select_func == NULL) { if(event_select_func == NULL) {
failf(data,"failed to find WSAEventSelect function (%d)", failf(data, "failed to find WSAEventSelect function (%d)", ERRNO);
ERRNO);
FreeLibrary(wsock2); FreeLibrary(wsock2);
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
/* And WSAEnumNetworkEvents */ /* And WSAEnumNetworkEvents */
enum_netevents_func = GetProcAddress(wsock2,"WSAEnumNetworkEvents"); enum_netevents_func = GetProcAddress(wsock2, "WSAEnumNetworkEvents");
if(enum_netevents_func == NULL) { if(enum_netevents_func == NULL) {
failf(data,"failed to find WSAEnumNetworkEvents function (%d)", failf(data, "failed to find WSAEnumNetworkEvents function (%d)", ERRNO);
ERRNO);
FreeLibrary(wsock2); FreeLibrary(wsock2);
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
@@ -1384,7 +1380,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
/* First, create a sockets event object */ /* First, create a sockets event object */
event_handle = (WSAEVENT)create_event_func(); event_handle = (WSAEVENT)create_event_func();
if(event_handle == WSA_INVALID_EVENT) { if(event_handle == WSA_INVALID_EVENT) {
failf(data,"WSACreateEvent failed (%d)", SOCKERRNO); failf(data, "WSACreateEvent failed (%d)", SOCKERRNO);
FreeLibrary(wsock2); FreeLibrary(wsock2);
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
@@ -1493,7 +1489,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
events.lNetworkEvents = 0; events.lNetworkEvents = 0;
if(SOCKET_ERROR == enum_netevents_func(sockfd, event_handle, &events)) { if(SOCKET_ERROR == enum_netevents_func(sockfd, event_handle, &events)) {
if((err = SOCKERRNO) != EINPROGRESS) { if((err = SOCKERRNO) != EINPROGRESS) {
infof(data,"WSAEnumNetworkEvents failed (%d)", err); infof(data, "WSAEnumNetworkEvents failed (%d)", err);
keepon = FALSE; keepon = FALSE;
result = CURLE_READ_ERROR; result = CURLE_READ_ERROR;
} }
@@ -1550,7 +1546,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
/* We called WSACreateEvent, so call WSACloseEvent */ /* We called WSACreateEvent, so call WSACloseEvent */
if(!close_event_func(event_handle)) { 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 */ /* "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 */ /* We called LoadLibrary, so call FreeLibrary */
if(!FreeLibrary(wsock2)) if(!FreeLibrary(wsock2))
infof(data,"FreeLibrary(wsock2) failed (%d)", ERRNO); infof(data, "FreeLibrary(wsock2) failed (%d)", ERRNO);
#else #else
pfd[0].fd = sockfd; pfd[0].fd = sockfd;
pfd[0].events = POLLIN; pfd[0].events = POLLIN;

View File

@@ -1632,7 +1632,7 @@ CURLcode Curl_follow(struct SessionHandle *data,
if(type == FOLLOW_REDIR) { if(type == FOLLOW_REDIR) {
if((data->set.maxredirs != -1) && if((data->set.maxredirs != -1) &&
(data->set.followlocation >= data->set.maxredirs)) { (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; return CURLE_TOO_MANY_REDIRECTS;
} }

View File

@@ -3626,7 +3626,7 @@ static void fix_hostname(struct SessionHandle *data,
stringprep_locale_charset ()); stringprep_locale_charset ());
if(rc != IDNA_SUCCESS) if(rc != IDNA_SUCCESS)
infof(data, "Failed to convert %s to ACE; %s\n", 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 { else {
/* tld_check_name() displays a warning if the host name contains /* tld_check_name() displays a warning if the host name contains
"illegal" characters for this TLD */ "illegal" characters for this TLD */

View File

@@ -140,7 +140,7 @@ cyassl_connect_step1(struct connectdata *conn,
data->set.str[STRING_SSL_CAPATH])) { data->set.str[STRING_SSL_CAPATH])) {
if(data->set.ssl.verifypeer) { if(data->set.ssl.verifypeer) {
/* Fail if we insist on successfully verifying the server. */ /* 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", " CAfile: %s\n CApath: %s",
data->set.str[STRING_SSL_CAFILE]? data->set.str[STRING_SSL_CAFILE]?
data->set.str[STRING_SSL_CAFILE]: "none", data->set.str[STRING_SSL_CAFILE]: "none",
@@ -214,7 +214,7 @@ cyassl_connect_step1(struct connectdata *conn,
/* we got a session id, use it! */ /* we got a session id, use it! */
if(!SSL_set_session(conssl->handle, ssl_sessionid)) { if(!SSL_set_session(conssl->handle, ssl_sessionid)) {
failf(data, "SSL: SSL_set_session failed: %s", 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; return CURLE_SSL_CONNECT_ERROR;
} }
/* Informational message */ /* Informational message */

View File

@@ -26,7 +26,7 @@
#ifdef USE_CYASSL #ifdef USE_CYASSL
CURLcode Curl_cyassl_connect(struct connectdata *conn, int sockindex); 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); int Curl_cyassl_shutdown(struct connectdata* conn, int sockindex);
/* close a SSL connection */ /* close a SSL connection */

View File

@@ -779,7 +779,7 @@ gtls_connect_step3(struct connectdata *conn,
unsigned int cert_list_size; unsigned int cert_list_size;
const gnutls_datum_t *chainp; const gnutls_datum_t *chainp;
unsigned int verify_status; unsigned int verify_status;
gnutls_x509_crt_t x509_cert,x509_issuer; gnutls_x509_crt_t x509_cert, x509_issuer;
gnutls_datum_t issuerp; gnutls_datum_t issuerp;
char certbuf[256] = ""; /* big enough? */ char certbuf[256] = ""; /* big enough? */
size_t size; size_t size;
@@ -897,7 +897,7 @@ gtls_connect_step3(struct connectdata *conn,
gnutls_x509_crt_init(&x509_issuer); gnutls_x509_crt_init(&x509_issuer);
issuerp = load_file(data->set.ssl.issuercert); issuerp = load_file(data->set.ssl.issuercert);
gnutls_x509_crt_import(x509_issuer, &issuerp, GNUTLS_X509_FMT_PEM); 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); gnutls_x509_crt_deinit(x509_issuer);
unload_file(issuerp); unload_file(issuerp);
if(rc <= 0) { if(rc <= 0) {
@@ -906,7 +906,7 @@ gtls_connect_step3(struct connectdata *conn,
gnutls_x509_crt_deinit(x509_cert); gnutls_x509_crt_deinit(x509_cert);
return CURLE_SSL_ISSUER_ERROR; 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"); data->set.ssl.issuercert?data->set.ssl.issuercert:"none");
} }

View File

@@ -861,7 +861,7 @@ static SECStatus BadCertHandler(void *arg, PRFileDesc *sock)
static SECStatus check_issuer_cert(PRFileDesc *sock, static SECStatus check_issuer_cert(PRFileDesc *sock,
char *issuer_nickname) char *issuer_nickname)
{ {
CERTCertificate *cert,*cert_issuer,*issuer; CERTCertificate *cert, *cert_issuer, *issuer;
SECStatus res=SECSuccess; SECStatus res=SECSuccess;
void *proto_win = NULL; void *proto_win = NULL;
@@ -872,7 +872,7 @@ static SECStatus check_issuer_cert(PRFileDesc *sock,
*/ */
cert = SSL_PeerCertificate(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); proto_win = SSL_RevealPinArg(sock);
issuer = PK11_FindCertFromNickname(issuer_nickname, proto_win); issuer = PK11_FindCertFromNickname(issuer_nickname, proto_win);
@@ -1734,7 +1734,7 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
} }
if(SECFailure == ret) { if(SECFailure == ret) {
infof(data,"SSL certificate issuer check failed\n"); infof(data, "SSL certificate issuer check failed\n");
result = CURLE_SSL_ISSUER_ERROR; result = CURLE_SSL_ISSUER_ERROR;
goto error; goto error;
} }

View File

@@ -484,7 +484,7 @@ int cert_stuff(struct connectdata *conn,
STACK_OF(X509) *ca = NULL; STACK_OF(X509) *ca = NULL;
int i; int i;
f = fopen(cert_file,"rb"); f = fopen(cert_file, "rb");
if(!f) { if(!f) {
failf(data, "could not open PKCS12 file '%s'", cert_file); failf(data, "could not open PKCS12 file '%s'", cert_file);
return 0; return 0;
@@ -605,7 +605,7 @@ int cert_stuff(struct connectdata *conn,
#endif #endif
/* the typecast below was added to please mingw32 */ /* the typecast below was added to please mingw32 */
priv_key = (EVP_PKEY *) 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 #ifdef HAVE_ENGINE_LOAD_FOUR_ARGS
ui_method, ui_method,
#endif #endif
@@ -647,7 +647,7 @@ int cert_stuff(struct connectdata *conn,
ssl=SSL_new(ctx); ssl=SSL_new(ctx);
if(!ssl) { if(!ssl) {
failf(data,"unable to create an SSL structure"); failf(data, "unable to create an SSL structure");
return 0; return 0;
} }
@@ -657,7 +657,7 @@ int cert_stuff(struct connectdata *conn,
leak memory as the previous version: */ leak memory as the previous version: */
if(x509) { if(x509) {
EVP_PKEY *pktmp = X509_get_pubkey(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); EVP_PKEY_free(pktmp);
} }
@@ -881,7 +881,7 @@ CURLcode Curl_ossl_set_engine_default(struct SessionHandle *data)
#ifdef HAVE_OPENSSL_ENGINE_H #ifdef HAVE_OPENSSL_ENGINE_H
if(data->state.engine) { if(data->state.engine) {
if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) { 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)); ENGINE_get_id(data->state.engine));
} }
else { else {
@@ -1070,7 +1070,7 @@ static int asn1_output(const ASN1_UTCTIME *tm,
const char *asn1_string; const char *asn1_string;
int gmt=FALSE; int gmt=FALSE;
int i; 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; i=tm->length;
asn1_string=(const char *)tm->data; asn1_string=(const char *)tm->data;
@@ -1229,7 +1229,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert)
else { else {
/* we have to look to the last occurrence of a commonName in the /* we have to look to the last occurrence of a commonName in the
distinguished one to get the most significant one. */ 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 */ /* 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. */ UTF8 etc. */
if(i>=0) { 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 /* 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 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"); failf(data, "Unable to set SRP user name");
return CURLE_BAD_FUNCTION_ARGUMENT; 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"); failf(data, "failed setting SRP password");
return CURLE_BAD_FUNCTION_ARGUMENT; 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])) { data->set.str[STRING_SSL_CAPATH])) {
if(data->set.ssl.verifypeer) { if(data->set.ssl.verifypeer) {
/* Fail if we insist on successfully verifying the server. */ /* 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", " CAfile: %s\n CApath: %s",
data->set.str[STRING_SSL_CAFILE]? data->set.str[STRING_SSL_CAFILE]?
data->set.str[STRING_SSL_CAFILE]: "none", 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), lookup=X509_STORE_add_lookup(SSL_CTX_get_cert_store(connssl->ctx),
X509_LOOKUP_file()); X509_LOOKUP_file());
if(!lookup || 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)) ) { X509_FILETYPE_PEM)) ) {
failf(data,"error loading CRL file: %s", failf(data, "error loading CRL file: %s",
data->set.str[STRING_SSL_CRLFILE]); data->set.str[STRING_SSL_CRLFILE]);
return CURLE_SSL_CRL_BADFILE; 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, result = (*data->set.ssl.fsslctx)(data, connssl->ctx,
data->set.ssl.fsslctxp); data->set.ssl.fsslctxp);
if(result) { if(result) {
failf(data,"error signaled by ssl ctx callback"); failf(data, "error signaled by ssl ctx callback");
return result; return result;
} }
} }
@@ -2091,7 +2092,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
/* we got a session id, use it! */ /* we got a session id, use it! */
if(!SSL_set_session(connssl->handle, ssl_sessionid)) { if(!SSL_set_session(connssl->handle, ssl_sessionid)) {
failf(data, "SSL: SSL_set_session failed: %s", 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; return CURLE_SSL_CONNECT_ERROR;
} }
/* Informational message */ /* Informational message */
@@ -2101,7 +2102,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
/* pass the raw socket into the SSL layers */ /* pass the raw socket into the SSL layers */
if(!SSL_set_fd(connssl->handle, (int)sockfd)) { if(!SSL_set_fd(connssl->handle, (int)sockfd)) {
failf(data, "SSL: SSL_set_fd failed: %s", 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; return CURLE_SSL_CONNECT_ERROR;
} }
@@ -2462,7 +2463,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
num=X509_get_serialNumber(x); num=X509_get_serialNumber(x);
if(num->length <= 4) { if(num->length <= 4) {
value = ASN1_INTEGER_get(num); 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); snprintf(bufp, CERTBUFFERSIZE, "%lx", value);
} }
else { else {
@@ -2481,7 +2482,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
left-=4; left-=4;
} }
if(num->length) if(num->length)
infof(data," Serial Number: %s\n", bufp); infof(data, " Serial Number: %s\n", bufp);
else else
bufp[0]=0; bufp[0]=0;
} }
@@ -2719,7 +2720,7 @@ static CURLcode servercert(struct connectdata *conn,
fclose(fp); 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) if(strict)
failf(data, "SSL: Certificate issuer check failed (%s)", failf(data, "SSL: Certificate issuer check failed (%s)",
data->set.str[STRING_SSL_ISSUERCERT]); data->set.str[STRING_SSL_ISSUERCERT]);

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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); snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir);
} }
if(access(dirbuildup, F_OK) == -1) { 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); show_dir_errno(errors, dirbuildup);
result = CURLE_WRITE_ERROR; result = CURLE_WRITE_ERROR;
break; /* get out of loop */ break; /* get out of loop */

View File

@@ -1310,7 +1310,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
break; break;
case 'f': /* crypto engine */ case 'f': /* crypto engine */
GetStr(&config->engine, nextarg); 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; return PARAM_ENGINES_REQUESTED;
break; break;
case 'g': /* CA info PEM file */ case 'g': /* CA info PEM file */

View 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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; env = buf1;
variable = buf1; variable = buf1;
} }
if(do_expand && strchr(variable,'%')) { if(do_expand && strchr(variable, '%')) {
/* buf2 == variable if not expanded */ /* buf2 == variable if not expanded */
rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2)); rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2));
if(rc > 0 && rc < sizeof(buf2) && if(rc > 0 && rc < sizeof(buf2) &&
!strchr(buf2,'%')) /* no vars still unexpanded */ !strchr(buf2, '%')) /* no vars still unexpanded */
env = buf2; env = buf2;
} }
#else #else

View File

@@ -114,7 +114,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
#endif #endif
} }
if(strcmp(filename,"-")) if(strcmp(filename, "-"))
file = fopen(filename, "r"); file = fopen(filename, "r");
else else
file = stdin; file = stdin;

View File

@@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -39,7 +39,7 @@ char *strdup(const char *str)
if(!newstr) if(!newstr)
return (char *)NULL; return (char *)NULL;
memcpy(newstr,str,(len+1)*sizeof(char)); memcpy(newstr, str, (len+1)*sizeof(char));
return newstr; return newstr;