mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 15:48:49 -05:00
Indentation fixes, untabify and related whitespace-cleanup. No code changed.
This commit is contained in:
parent
e9ea3ba4a2
commit
794b4da840
@ -33,42 +33,39 @@ extern int errno, h_errno;
|
||||
#include <stabs.h>
|
||||
void __request(const char *msg);
|
||||
#else
|
||||
# define __request( msg ) Printf( msg "\n\a")
|
||||
# define __request( msg ) Printf( msg "\n\a")
|
||||
#endif
|
||||
|
||||
void amiga_cleanup()
|
||||
{
|
||||
if(SocketBase) {
|
||||
CloseLibrary(SocketBase);
|
||||
SocketBase = NULL;
|
||||
}
|
||||
if(SocketBase) {
|
||||
CloseLibrary(SocketBase);
|
||||
SocketBase = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL amiga_init()
|
||||
{
|
||||
if(!SocketBase)
|
||||
SocketBase = OpenLibrary("bsdsocket.library", 4);
|
||||
|
||||
if(!SocketBase) {
|
||||
__request("No TCP/IP Stack running!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(SocketBaseTags(
|
||||
SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
|
||||
// SBTM_SETVAL(SBTC_HERRNOLONGPTR), (ULONG) &h_errno,
|
||||
SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL",
|
||||
TAG_DONE)) {
|
||||
|
||||
__request("SocketBaseTags ERROR");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!SocketBase)
|
||||
SocketBase = OpenLibrary("bsdsocket.library", 4);
|
||||
|
||||
if(!SocketBase) {
|
||||
__request("No TCP/IP Stack running!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
|
||||
SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL",
|
||||
TAG_DONE)) {
|
||||
__request("SocketBaseTags ERROR");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef __libnix__
|
||||
atexit(amiga_cleanup);
|
||||
atexit(amiga_cleanup);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef __libnix__
|
||||
|
@ -91,7 +91,7 @@ struct Cookie *Curl_cookie_add(struct SessionHandle *data,
|
||||
struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
const char *, struct CookieInfo *, bool);
|
||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, const char *,
|
||||
const char *, bool);
|
||||
const char *, bool);
|
||||
void Curl_cookie_freelist(struct Cookie *cookies, bool cookiestoo);
|
||||
void Curl_cookie_clearall(struct CookieInfo *cookies);
|
||||
void Curl_cookie_clearsess(struct CookieInfo *cookies);
|
||||
|
@ -347,7 +347,7 @@ static void setup_des_key(const unsigned char *key_56,
|
||||
* Turns a 56 bit key into the 64 bit, odd parity key and sets the key.
|
||||
*/
|
||||
static void setup_des_key(const unsigned char *key_56,
|
||||
gcry_cipher_hd_t *des)
|
||||
gcry_cipher_hd_t *des)
|
||||
{
|
||||
char key[8];
|
||||
|
||||
|
@ -34,7 +34,7 @@ typedef enum {
|
||||
|
||||
/* this is for ntlm header input */
|
||||
CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy,
|
||||
const char *header);
|
||||
const char *header);
|
||||
|
||||
/* this is for creating ntlm header output */
|
||||
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
|
||||
|
122
lib/krb5.c
122
lib/krb5.c
@ -132,15 +132,15 @@ krb5_encode(void *app_data, const void *from, int length, int level, void **to,
|
||||
/* shut gcc up */
|
||||
conn = NULL;
|
||||
|
||||
/* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal
|
||||
/* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal
|
||||
* libraries modify the input buffer in gss_seal()
|
||||
*/
|
||||
dec.value = (void*)from;
|
||||
dec.length = length;
|
||||
maj = gss_seal(&min, *context,
|
||||
level == prot_private,
|
||||
GSS_C_QOP_DEFAULT,
|
||||
&dec, &state, &enc);
|
||||
level == prot_private,
|
||||
GSS_C_QOP_DEFAULT,
|
||||
&dec, &state, &enc);
|
||||
|
||||
if(maj != GSS_S_COMPLETE)
|
||||
return -1;
|
||||
@ -178,10 +178,12 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
|
||||
chan.initiator_addrtype = GSS_C_AF_INET;
|
||||
chan.initiator_address.length = l - 4;
|
||||
chan.initiator_address.value = &((struct sockaddr_in *)LOCAL_ADDR)->sin_addr.s_addr;
|
||||
chan.initiator_address.value =
|
||||
&((struct sockaddr_in *)LOCAL_ADDR)->sin_addr.s_addr;
|
||||
chan.acceptor_addrtype = GSS_C_AF_INET;
|
||||
chan.acceptor_address.length = l - 4;
|
||||
chan.acceptor_address.value = &((struct sockaddr_in *)REMOTE_ADDR)->sin_addr.s_addr;
|
||||
chan.acceptor_address.value =
|
||||
&((struct sockaddr_in *)REMOTE_ADDR)->sin_addr.s_addr;
|
||||
chan.application_data.length = 0;
|
||||
chan.application_data.value = NULL;
|
||||
|
||||
@ -192,12 +194,12 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
result = Curl_ftpsendf(conn, "AUTH GSSAPI");
|
||||
|
||||
if(result)
|
||||
return -2;
|
||||
return -2;
|
||||
if(Curl_GetFTPResponse(&nread, conn, NULL))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
if(data->state.buffer[0] != '3')
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
gssbuf.value = data->state.buffer;
|
||||
@ -206,8 +208,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
if(maj != GSS_S_COMPLETE) {
|
||||
gss_release_name(&min, &gssname);
|
||||
if(service == srv_host) {
|
||||
Curl_failf(data, "Error importing service name %s", gssbuf.value);
|
||||
return AUTH_ERROR;
|
||||
Curl_failf(data, "Error importing service name %s", gssbuf.value);
|
||||
return AUTH_ERROR;
|
||||
}
|
||||
service = srv_host;
|
||||
continue;
|
||||
@ -224,69 +226,71 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
do {
|
||||
ret = AUTH_OK;
|
||||
maj = gss_init_sec_context(&min,
|
||||
GSS_C_NO_CREDENTIAL,
|
||||
context,
|
||||
gssname,
|
||||
GSS_C_NO_OID,
|
||||
GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG,
|
||||
0,
|
||||
&chan,
|
||||
gssresp,
|
||||
NULL,
|
||||
&gssbuf,
|
||||
NULL,
|
||||
NULL);
|
||||
GSS_C_NO_CREDENTIAL,
|
||||
context,
|
||||
gssname,
|
||||
GSS_C_NO_OID,
|
||||
GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG,
|
||||
0,
|
||||
&chan,
|
||||
gssresp,
|
||||
NULL,
|
||||
&gssbuf,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if(gssresp) {
|
||||
free(_gssresp.value);
|
||||
gssresp = NULL;
|
||||
free(_gssresp.value);
|
||||
gssresp = NULL;
|
||||
}
|
||||
|
||||
if(maj != GSS_S_COMPLETE && maj != GSS_S_CONTINUE_NEEDED) {
|
||||
Curl_infof(data, "Error creating security context");
|
||||
ret = AUTH_ERROR;
|
||||
break;
|
||||
Curl_infof(data, "Error creating security context");
|
||||
ret = AUTH_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if(gssbuf.length != 0) {
|
||||
if(Curl_base64_encode(data, (char *)gssbuf.value, gssbuf.length, &p) < 1) {
|
||||
Curl_infof(data, "Out of memory base64-encoding");
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
if(Curl_base64_encode(data, (char *)gssbuf.value, gssbuf.length, &p)
|
||||
< 1) {
|
||||
Curl_infof(data, "Out of memory base64-encoding");
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
|
||||
result = Curl_ftpsendf(conn, "ADAT %s", p);
|
||||
result = Curl_ftpsendf(conn, "ADAT %s", p);
|
||||
|
||||
free(p);
|
||||
free(p);
|
||||
|
||||
if(result) {
|
||||
ret = -2;
|
||||
break;
|
||||
}
|
||||
if(result) {
|
||||
ret = -2;
|
||||
break;
|
||||
}
|
||||
|
||||
if(Curl_GetFTPResponse(&nread, conn, NULL)) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
if(Curl_GetFTPResponse(&nread, conn, NULL)) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3'){
|
||||
Curl_infof(data, "Server didn't accept auth data\n");
|
||||
ret = AUTH_ERROR;
|
||||
break;
|
||||
}
|
||||
if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3'){
|
||||
Curl_infof(data, "Server didn't accept auth data\n");
|
||||
ret = AUTH_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
p = data->state.buffer + 4;
|
||||
p = strstr(p, "ADAT=");
|
||||
if(p) {
|
||||
_gssresp.length = Curl_base64_decode(p + 5, (unsigned char **)&_gssresp.value);
|
||||
if(_gssresp.length < 1) {
|
||||
Curl_failf(data, "Out of memory base64-encoding");
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
p = data->state.buffer + 4;
|
||||
p = strstr(p, "ADAT=");
|
||||
if(p) {
|
||||
_gssresp.length = Curl_base64_decode(p + 5, (unsigned char **)
|
||||
&_gssresp.value);
|
||||
if(_gssresp.length < 1) {
|
||||
Curl_failf(data, "Out of memory base64-encoding");
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gssresp = &_gssresp;
|
||||
gssresp = &_gssresp;
|
||||
}
|
||||
} while(maj == GSS_S_CONTINUE_NEEDED);
|
||||
|
||||
|
@ -455,7 +455,7 @@ static int nss_load_crl(const char* crlfilename, PRBool ascii)
|
||||
NULL,SEC_CRL_TYPE,
|
||||
NULL,CRL_IMPORT_DEFAULT_OPTIONS,
|
||||
NULL,(CRL_DECODE_DEFAULT_OPTIONS|
|
||||
CRL_DECODE_DONT_COPY_DER));
|
||||
CRL_DECODE_DONT_COPY_DER));
|
||||
if (slot) PK11_FreeSlot(slot);
|
||||
if (!crl) return 0;
|
||||
SEC_DestroyCrl(crl);
|
||||
|
44
lib/telnet.c
44
lib/telnet.c
@ -1124,7 +1124,7 @@ void telrcv(struct connectdata *conn,
|
||||
/* Escape and send a telnet data block */
|
||||
/* TODO: write large chunks of data instead of one byte at a time */
|
||||
static CURLcode send_telnet_data(struct connectdata *conn,
|
||||
char *buffer, ssize_t nread)
|
||||
char *buffer, ssize_t nread)
|
||||
{
|
||||
unsigned char outbuf[2];
|
||||
ssize_t bytes_written, total_written;
|
||||
@ -1144,16 +1144,16 @@ static CURLcode send_telnet_data(struct connectdata *conn,
|
||||
pfd[0].fd = conn->sock[FIRSTSOCKET];
|
||||
pfd[0].events = POLLOUT;
|
||||
switch (Curl_poll(pfd, 1, -1)) {
|
||||
case -1: /* error, abort writing */
|
||||
case 0: /* timeout (will never happen) */
|
||||
rc = CURLE_SEND_ERROR;
|
||||
break;
|
||||
default: /* write! */
|
||||
bytes_written = 0;
|
||||
rc = Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf+total_written,
|
||||
out_count-total_written, &bytes_written);
|
||||
total_written += bytes_written;
|
||||
break;
|
||||
case -1: /* error, abort writing */
|
||||
case 0: /* timeout (will never happen) */
|
||||
rc = CURLE_SEND_ERROR;
|
||||
break;
|
||||
default: /* write! */
|
||||
bytes_written = 0;
|
||||
rc = Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf+total_written,
|
||||
out_count-total_written, &bytes_written);
|
||||
total_written += bytes_written;
|
||||
break;
|
||||
}
|
||||
/* handle partial write */
|
||||
} while (rc == CURLE_OK && total_written < out_count);
|
||||
@ -1317,7 +1317,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
while(1) {
|
||||
if(!PeekNamedPipe(stdin_handle, NULL, 0, NULL, &readfile_read, NULL)) {
|
||||
keepon = FALSE;
|
||||
code = CURLE_READ_ERROR;
|
||||
code = CURLE_READ_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1327,15 +1327,15 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
|
||||
&readfile_read, NULL)) {
|
||||
keepon = FALSE;
|
||||
code = CURLE_READ_ERROR;
|
||||
code = CURLE_READ_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
code = send_telnet_data(conn, buf, readfile_read);
|
||||
if(code) {
|
||||
if(code) {
|
||||
keepon = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1345,14 +1345,14 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
|
||||
&readfile_read, NULL)) {
|
||||
keepon = FALSE;
|
||||
code = CURLE_READ_ERROR;
|
||||
code = CURLE_READ_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
code = send_telnet_data(conn, buf, readfile_read);
|
||||
if(code) {
|
||||
keepon = FALSE;
|
||||
break;
|
||||
keepon = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1417,10 +1417,10 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
if(pfd[1].revents & POLLIN) { /* read from stdin */
|
||||
nread = read(0, buf, 255);
|
||||
code = send_telnet_data(conn, buf, nread);
|
||||
if(code) {
|
||||
if(code) {
|
||||
keepon = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(pfd[0].revents & POLLIN) {
|
||||
|
1178
lib/transfer.c
1178
lib/transfer.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user