name
stringlengths
1
473k
code
stringlengths
7
647k
asm
stringlengths
4
3.39M
file
stringlengths
8
196
curl_easy_getinfo
CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...) { va_list arg; void *paramp; CURLcode result; va_start(arg, info); paramp = va_arg(arg, void *); result = Curl_getinfo(data, info, paramp); va_end(arg); return result; }
pushq %rbp movq %rsp, %rbp subq $0x110, %rsp # imm = 0x110 testb %al, %al je 0x80c5ab movaps %xmm0, -0xc0(%rbp) movaps %xmm1, -0xb0(%rbp) movaps %xmm2, -0xa0(%rbp) movaps %xmm3, -0x90(%rbp) movaps %xmm4, -0x80(%rbp) movaps %xmm5, -0x70(%rbp) movaps %xmm6, -0x60(%rbp) movaps %xmm7, -0x50(%rbp) movq %r9, -0xc8(%rbp) movq %r8, -0xd0(%rbp) movq %rcx, -0xd8(%rbp) movq %rdx, -0xe0(%rbp) movq %rdi, -0x8(%rbp) movl %esi, -0xc(%rbp) leaq -0x30(%rbp), %rax leaq -0xf0(%rbp), %rcx movq %rcx, 0x10(%rax) leaq 0x10(%rbp), %rcx movq %rcx, 0x8(%rax) movl $0x30, 0x4(%rax) movl $0x10, (%rax) leaq -0x30(%rbp), %rax movq %rax, -0x100(%rbp) movl -0x30(%rbp), %eax movl %eax, -0xf4(%rbp) cmpl $0x28, %eax ja 0x80c62d movq -0x100(%rbp), %rcx movl -0xf4(%rbp), %edx movslq %edx, %rax addq 0x10(%rcx), %rax addl $0x8, %edx movl %edx, (%rcx) movq %rax, -0x108(%rbp) jmp 0x80c64a movq -0x100(%rbp), %rcx movq 0x8(%rcx), %rax movq %rax, %rdx addq $0x8, %rdx movq %rdx, 0x8(%rcx) movq %rax, -0x108(%rbp) movq -0x108(%rbp), %rax movq (%rax), %rax movq %rax, -0x38(%rbp) movq -0x8(%rbp), %rdi movl -0xc(%rbp), %esi movq -0x38(%rbp), %rdx xorl %eax, %eax callq 0x80d6d0 movl %eax, -0x3c(%rbp) movl -0x3c(%rbp), %eax addq $0x110, %rsp # imm = 0x110 popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/easy.c
dupset
static CURLcode dupset(struct Curl_easy *dst, struct Curl_easy *src) { CURLcode result = CURLE_OK; enum dupstring i; enum dupblob j; /* Copy src->set into dst->set first, then deal with the strings afterwards */ dst->set = src->set; Curl_mime_initpart(&dst->set.mimepost, dst); /* clear all string pointers first */ memset(dst->set.str, 0, STRING_LAST * sizeof(char *)); /* duplicate all strings */ for(i = (enum dupstring)0; i< STRING_LASTZEROTERMINATED; i++) { result = Curl_setstropt(&dst->set.str[i], src->set.str[i]); if(result) return result; } /* clear all blob pointers first */ memset(dst->set.blobs, 0, BLOB_LAST * sizeof(struct curl_blob *)); /* duplicate all blobs */ for(j = (enum dupblob)0; j < BLOB_LAST; j++) { result = Curl_setblobopt(&dst->set.blobs[j], src->set.blobs[j]); if(result) return result; } /* duplicate memory areas pointed to */ i = STRING_COPYPOSTFIELDS; if(src->set.postfieldsize && src->set.str[i]) { /* postfieldsize is curl_off_t, Curl_memdup() takes a size_t ... */ dst->set.str[i] = Curl_memdup(src->set.str[i], curlx_sotouz(src->set.postfieldsize)); if(!dst->set.str[i]) return CURLE_OUT_OF_MEMORY; /* point to the new copy */ dst->set.postfields = dst->set.str[i]; } /* Duplicate mime data. */ result = Curl_mime_duppart(&dst->set.mimepost, &src->set.mimepost); if(src->set.resolve) dst->state.resolve = dst->set.resolve; return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x10(%rbp), %rdi addq $0x1b0, %rdi # imm = 0x1B0 movq -0x18(%rbp), %rsi addq $0x1b0, %rsi # imm = 0x1B0 movl $0x8f0, %edx # imm = 0x8F0 callq 0x3cb70 movq -0x10(%rbp), %rdi addq $0x1b0, %rdi # imm = 0x1B0 addq $0x180, %rdi # imm = 0x180 movq -0x10(%rbp), %rsi callq 0x812d00 movq -0x10(%rbp), %rdi addq $0x1b0, %rdi # imm = 0x1B0 addq $0x580, %rdi # imm = 0x580 xorl %esi, %esi movl $0x278, %edx # imm = 0x278 callq 0x3b780 movl $0x0, -0x20(%rbp) cmpl $0x4c, -0x20(%rbp) jae 0x80caae movq -0x10(%rbp), %rdi addq $0x1b0, %rdi # imm = 0x1B0 addq $0x580, %rdi # imm = 0x580 movl -0x20(%rbp), %eax shlq $0x3, %rax addq %rax, %rdi movq -0x18(%rbp), %rax movl -0x20(%rbp), %ecx movq 0x730(%rax,%rcx,8), %rsi callq 0x821c80 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x80caa1 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x80cc21 jmp 0x80caa3 movl -0x20(%rbp), %eax addl $0x1, %eax movl %eax, -0x20(%rbp) jmp 0x80ca57 movq -0x10(%rbp), %rdi addq $0x1b0, %rdi # imm = 0x1B0 addq $0x7f8, %rdi # imm = 0x7F8 xorl %esi, %esi movl $0x40, %edx callq 0x3b780 movl $0x0, -0x24(%rbp) cmpl $0x8, -0x24(%rbp) jae 0x80cb2a movq -0x10(%rbp), %rdi addq $0x1b0, %rdi # imm = 0x1B0 addq $0x7f8, %rdi # imm = 0x7F8 movl -0x24(%rbp), %eax shlq $0x3, %rax addq %rax, %rdi movq -0x18(%rbp), %rax movl -0x24(%rbp), %ecx movq 0x9a8(%rax,%rcx,8), %rsi callq 0x821d10 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x80cb1d movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x80cc21 jmp 0x80cb1f movl -0x24(%rbp), %eax addl $0x1, %eax movl %eax, -0x24(%rbp) jmp 0x80cad3 movl $0x4d, -0x20(%rbp) movq -0x18(%rbp), %rax cmpq $0x0, 0x220(%rax) je 0x80cbcb movq -0x18(%rbp), %rax movl -0x20(%rbp), %ecx cmpq $0x0, 0x730(%rax,%rcx,8) je 0x80cbcb movq -0x18(%rbp), %rax movl -0x20(%rbp), %ecx movq 0x730(%rax,%rcx,8), %rax movq %rax, -0x30(%rbp) movq -0x18(%rbp), %rax movq 0x220(%rax), %rdi callq 0x840910 movq -0x30(%rbp), %rdi movq %rax, %rsi callq 0x830600 movq %rax, %rdx movq -0x10(%rbp), %rax movl -0x20(%rbp), %ecx movq %rdx, 0x730(%rax,%rcx,8) movq -0x10(%rbp), %rax movl -0x20(%rbp), %ecx cmpq $0x0, 0x730(%rax,%rcx,8) jne 0x80cbb1 movl $0x1b, -0x4(%rbp) jmp 0x80cc21 movq -0x10(%rbp), %rax movl -0x20(%rbp), %ecx movq 0x730(%rax,%rcx,8), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x210(%rax) movq -0x10(%rbp), %rdi addq $0x1b0, %rdi # imm = 0x1B0 addq $0x180, %rdi # imm = 0x180 movq -0x18(%rbp), %rsi addq $0x1b0, %rsi # imm = 0x1B0 addq $0x180, %rsi # imm = 0x180 callq 0x812e40 movl %eax, -0x1c(%rbp) movq -0x18(%rbp), %rax cmpq $0x0, 0x520(%rax) je 0x80cc1b movq -0x10(%rbp), %rax movq 0x520(%rax), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x1200(%rax) movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/easy.c
curl_easy_pause
CURLcode curl_easy_pause(struct Curl_easy *data, int action) { struct SingleRequest *k; CURLcode result = CURLE_OK; int oldstate; int newstate; if(!GOOD_EASY_HANDLE(data) || !data->conn) /* crazy input, don't continue */ return CURLE_BAD_FUNCTION_ARGUMENT; k = &data->req; oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE); /* first switch off both pause bits then set the new pause bits */ newstate = (k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) | ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) | ((action & CURLPAUSE_SEND)?KEEP_SEND_PAUSE:0); if((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) == oldstate) { /* Not changing any pause state, return */ DEBUGF(infof(data, "pause: no change, early return")); return CURLE_OK; } /* Unpause parts in active mime tree. */ if((k->keepon & ~newstate & KEEP_SEND_PAUSE) && (data->mstate == MSTATE_PERFORMING || data->mstate == MSTATE_RATELIMITING) && data->state.fread_func == (curl_read_callback) Curl_mime_read) { Curl_mime_unpause(data->state.in); } /* put it back in the keepon */ k->keepon = newstate; if(!(newstate & KEEP_RECV_PAUSE)) { Curl_http2_stream_pause(data, FALSE); if(data->state.tempcount) { /* there are buffers for sending that can be delivered as the receive pausing is lifted! */ unsigned int i; unsigned int count = data->state.tempcount; struct tempbuf writebuf[3]; /* there can only be three */ /* copy the structs to allow for immediate re-pausing */ for(i = 0; i < data->state.tempcount; i++) { writebuf[i] = data->state.tempwrite[i]; Curl_dyn_init(&data->state.tempwrite[i].b, DYN_PAUSE_BUFFER); } data->state.tempcount = 0; for(i = 0; i < count; i++) { /* even if one function returns error, this loops through and frees all buffers */ if(!result) result = Curl_client_write(data, writebuf[i].type, Curl_dyn_ptr(&writebuf[i].b), Curl_dyn_len(&writebuf[i].b)); Curl_dyn_free(&writebuf[i].b); } if(result) return result; } } #ifdef USE_HYPER if(!(newstate & KEEP_SEND_PAUSE)) { /* need to wake the send body waker */ if(data->hyp.send_body_waker) { hyper_waker_wake(data->hyp.send_body_waker); data->hyp.send_body_waker = NULL; } } #endif /* if there's no error and we're not pausing both directions, we want to have this handle checked soon */ if((newstate & (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) != (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) { Curl_expire(data, 0, EXPIRE_RUN_NOW); /* get this handle going again */ /* reset the too-slow time keeper */ data->state.keeps_speed.tv_sec = 0; if(!data->state.tempcount) /* if not pausing again, force a recv/send check of this connection as the data might've been read off the socket already */ data->conn->cselect_bits = CURL_CSELECT_IN | CURL_CSELECT_OUT; if(data->multi) { if(Curl_update_timer(data->multi)) return CURLE_ABORTED_BY_CALLBACK; } } if(!data->state.done) /* This transfer may have been moved in or out of the bundle, update the corresponding socket callback, if used */ result = Curl_updatesocket(data); return result; }
pushq %rbp movq %rsp, %rbp subq $0xd0, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl $0x0, -0x24(%rbp) cmpq $0x0, -0x10(%rbp) je 0x80cd47 movq -0x10(%rbp), %rax cmpl $0xc0dedbad, (%rax) # imm = 0xC0DEDBAD jne 0x80cd47 movq -0x10(%rbp), %rax cmpq $0x0, 0x18(%rax) jne 0x80cd53 movl $0x2b, -0x4(%rbp) jmp 0x80d04a movq -0x10(%rbp), %rax addq $0xd0, %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax movl 0x74(%rax), %eax andl $0x30, %eax movl %eax, -0x28(%rbp) movq -0x20(%rbp), %rax movl 0x74(%rax), %eax andl $-0x31, %eax movl -0x14(%rbp), %esi andl $0x1, %esi xorl %ecx, %ecx movl $0x10, %edx cmpl $0x0, %esi cmovnel %edx, %ecx orl %ecx, %eax movl -0x14(%rbp), %esi andl $0x4, %esi xorl %ecx, %ecx movl $0x20, %edx cmpl $0x0, %esi cmovnel %edx, %ecx orl %ecx, %eax movl %eax, -0x2c(%rbp) movl -0x2c(%rbp), %eax andl $0x30, %eax cmpl -0x28(%rbp), %eax jne 0x80cdc0 jmp 0x80cdb2 jmp 0x80cdb4 movl $0x0, -0x4(%rbp) jmp 0x80d04a movq -0x20(%rbp), %rax movl 0x74(%rax), %eax movl -0x2c(%rbp), %ecx xorl $-0x1, %ecx andl %ecx, %eax andl $0x20, %eax cmpl $0x0, %eax je 0x80ce0f movq -0x10(%rbp), %rax cmpl $0xc, 0x50(%rax) je 0x80cdeb movq -0x10(%rbp), %rax cmpl $0xd, 0x50(%rax) jne 0x80ce0f movq -0x10(%rbp), %rax leaq 0x70fa(%rip), %rcx # 0x813ef0 cmpq %rcx, 0x1178(%rax) jne 0x80ce0f movq -0x10(%rbp), %rax movq 0x1180(%rax), %rdi callq 0x8150a0 movl -0x2c(%rbp), %ecx movq -0x20(%rbp), %rax movl %ecx, 0x74(%rax) movl -0x2c(%rbp), %eax andl $0x10, %eax cmpl $0x0, %eax jne 0x80cfa8 movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x8103e0 movq -0x10(%rbp), %rax cmpl $0x0, 0xd28(%rax) je 0x80cfa6 movq -0x10(%rbp), %rax movl 0xd28(%rax), %eax movl %eax, -0x34(%rbp) movl $0x0, -0x30(%rbp) movl -0x30(%rbp), %eax movq -0x10(%rbp), %rcx cmpl 0xd28(%rcx), %eax jae 0x80cecf movl -0x30(%rbp), %eax leaq -0xb0(%rbp), %rdi imulq $0x28, %rax, %rax addq %rax, %rdi movq -0x10(%rbp), %rsi addq $0xc30, %rsi # imm = 0xC30 addq $0x80, %rsi movl -0x30(%rbp), %eax imulq $0x28, %rax, %rax addq %rax, %rsi movl $0x28, %edx callq 0x3cb70 movq -0x10(%rbp), %rdi addq $0xc30, %rdi # imm = 0xC30 addq $0x80, %rdi movl -0x30(%rbp), %eax imulq $0x28, %rax, %rax addq %rax, %rdi movl $0x4000000, %esi # imm = 0x4000000 callq 0x84ec00 movl -0x30(%rbp), %eax addl $0x1, %eax movl %eax, -0x30(%rbp) jmp 0x80ce58 movq -0x10(%rbp), %rax movl $0x0, 0xd28(%rax) movl $0x0, -0x30(%rbp) movl -0x30(%rbp), %eax cmpl -0x34(%rbp), %eax jae 0x80cf93 cmpl $0x0, -0x24(%rbp) jne 0x80cf6f movq -0x10(%rbp), %rax movq %rax, -0xc8(%rbp) movl -0x30(%rbp), %eax movl %eax, %ecx leaq -0xb0(%rbp), %rax imulq $0x28, %rcx, %rcx addq %rcx, %rax movl 0x20(%rax), %eax movl %eax, -0xbc(%rbp) movl -0x30(%rbp), %eax leaq -0xb0(%rbp), %rdi imulq $0x28, %rax, %rax addq %rax, %rdi callq 0x84f0c0 movq %rax, -0xb8(%rbp) movl -0x30(%rbp), %eax leaq -0xb0(%rbp), %rdi imulq $0x28, %rax, %rax addq %rax, %rdi callq 0x84f100 movq -0xc8(%rbp), %rdi movl -0xbc(%rbp), %esi movq -0xb8(%rbp), %rdx movq %rax, %rcx callq 0x821330 movl %eax, -0x24(%rbp) movl -0x30(%rbp), %eax leaq -0xb0(%rbp), %rdi imulq $0x28, %rax, %rax addq %rax, %rdi callq 0x84ec50 movl -0x30(%rbp), %eax addl $0x1, %eax movl %eax, -0x30(%rbp) jmp 0x80cee4 cmpl $0x0, -0x24(%rbp) je 0x80cfa4 movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x80d04a jmp 0x80cfa6 jmp 0x80cfa8 movl -0x2c(%rbp), %eax andl $0x30, %eax cmpl $0x30, %eax je 0x80d023 movq -0x10(%rbp), %rdi xorl %eax, %eax movl %eax, %esi movl $0x8, %edx callq 0x819490 movq -0x10(%rbp), %rax movq $0x0, 0xc38(%rax) movq -0x10(%rbp), %rax cmpl $0x0, 0xd28(%rax) jne 0x80cff3 movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movl $0x3, 0x55c(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x80d021 movq -0x10(%rbp), %rax movq 0xb8(%rax), %rdi callq 0x819650 cmpl $0x0, %eax je 0x80d01f movl $0x2a, -0x4(%rbp) jmp 0x80d04a jmp 0x80d021 jmp 0x80d023 movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0xb, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x80d044 movq -0x10(%rbp), %rdi callq 0x81d2b0 movl %eax, -0x24(%rbp) movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xd0, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/easy.c
easy_connection
static CURLcode easy_connection(struct Curl_easy *data, curl_socket_t *sfd, struct connectdata **connp) { if(!data) return CURLE_BAD_FUNCTION_ARGUMENT; /* only allow these to be called on handles with CURLOPT_CONNECT_ONLY */ if(!data->set.connect_only) { failf(data, "CONNECT_ONLY is required"); return CURLE_UNSUPPORTED_PROTOCOL; } *sfd = Curl_getconnectinfo(data, connp); if(*sfd == CURL_SOCKET_BAD) { failf(data, "Failed to get recent socket"); return CURLE_UNSUPPORTED_PROTOCOL; } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) cmpq $0x0, -0x10(%rbp) jne 0x80d144 movl $0x2b, -0x4(%rbp) jmp 0x80d1ac movq -0x10(%rbp), %rax cmpb $0x0, 0xa91(%rax) jne 0x80d16c movq -0x10(%rbp), %rdi leaq 0x392606(%rip), %rsi # 0xb9f762 movb $0x0, %al callq 0x820e10 movl $0x1, -0x4(%rbp) jmp 0x80d1ac movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x848ff0 movl %eax, %ecx movq -0x18(%rbp), %rax movl %ecx, (%rax) movq -0x18(%rbp), %rax cmpl $-0x1, (%rax) jne 0x80d1a5 movq -0x10(%rbp), %rdi leaq 0x3925e6(%rip), %rsi # 0xb9f77b movb $0x0, %al callq 0x820e10 movl $0x1, -0x4(%rbp) jmp 0x80d1ac movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/easy.c
curl_easy_send
CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, size_t buflen, size_t *n) { ssize_t written = 0; CURLcode result; if(Curl_is_in_callback(data)) return CURLE_RECURSIVE_API_CALL; result = Curl_senddata(data, buffer, buflen, &written); *n = (size_t)written; return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq $0x0, -0x30(%rbp) movq -0x10(%rbp), %rdi callq 0x81e4a0 testb $0x1, %al jne 0x80d2df jmp 0x80d2e8 movl $0x5d, -0x4(%rbp) jmp 0x80d311 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x20(%rbp), %rdx leaq -0x30(%rbp), %rcx callq 0x80d1c0 movl %eax, -0x34(%rbp) movq -0x30(%rbp), %rcx movq -0x28(%rbp), %rax movq %rcx, (%rax) movl -0x34(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/easy.c
h2_process_pending_input
static int h2_process_pending_input(struct Curl_easy *data, struct http_conn *httpc, CURLcode *err) { ssize_t nread; char *inbuf; ssize_t rv; nread = httpc->inbuflen - httpc->nread_inbuf; inbuf = httpc->inbuf + httpc->nread_inbuf; set_transfer(httpc, data); /* set the transfer */ rv = nghttp2_session_mem_recv(httpc->h2, (const uint8_t *)inbuf, nread); if(rv < 0) { failf(data, "h2_process_pending_input: nghttp2_session_mem_recv() returned " "%zd:%s", rv, nghttp2_strerror((int)rv)); *err = CURLE_RECV_ERROR; return -1; } if(nread == rv) { H2BUGF(infof(data, "h2_process_pending_input: All data in connection buffer " "processed")); httpc->inbuflen = 0; httpc->nread_inbuf = 0; } else { httpc->nread_inbuf += rv; H2BUGF(infof(data, "h2_process_pending_input: %zu bytes left in connection " "buffer", httpc->inbuflen - httpc->nread_inbuf)); } rv = h2_session_send(data, httpc->h2); if(rv) { *err = CURLE_SEND_ERROR; return -1; } if(nghttp2_session_check_request_allowed(httpc->h2) == 0) { /* No more requests are allowed in the current session, so the connection may not be reused. This is set when a GOAWAY frame has been received or when the limit of stream identifiers has been reached. */ connclose(data->conn, "http/2: No new requests allowed"); } if(should_close_session(httpc)) { struct HTTP *stream = data->req.p.http; H2BUGF(infof(data, "h2_process_pending_input: nothing to do in this session")); if(stream->error) *err = CURLE_HTTP2; else { /* not an error per se, but should still close the connection */ connclose(data->conn, "GOAWAY received"); *err = CURLE_OK; } return -1; } return 0; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq -0x18(%rbp), %rax movq 0x80(%rax), %rax movq -0x18(%rbp), %rcx subq 0x88(%rcx), %rax movq %rax, -0x28(%rbp) movq -0x18(%rbp), %rax movq 0x78(%rax), %rax movq -0x18(%rbp), %rcx addq 0x88(%rcx), %rax movq %rax, -0x30(%rbp) movq -0x18(%rbp), %rdi movq -0x10(%rbp), %rsi callq 0x80ec00 movq -0x18(%rbp), %rax movq 0x60(%rax), %rdi movq -0x30(%rbp), %rsi movq -0x28(%rbp), %rdx callq 0x887a50 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) jge 0x80f00c movq -0x10(%rbp), %rax movq %rax, -0x50(%rbp) movq -0x38(%rbp), %rax movq %rax, -0x48(%rbp) movq -0x38(%rbp), %rax movl %eax, %edi callq 0x8808f0 movq -0x50(%rbp), %rdi movq -0x48(%rbp), %rdx movq %rax, %rcx leaq 0x390e43(%rip), %rsi # 0xb9fe32 movb $0x0, %al callq 0x820e10 movq -0x20(%rbp), %rax movl $0x38, (%rax) movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF jmp 0x80f110 movq -0x28(%rbp), %rax cmpq -0x38(%rbp), %rax jne 0x80f03a jmp 0x80f018 jmp 0x80f01a movq -0x18(%rbp), %rax movq $0x0, 0x80(%rax) movq -0x18(%rbp), %rax movq $0x0, 0x88(%rax) jmp 0x80f054 movq -0x38(%rbp), %rcx movq -0x18(%rbp), %rax addq 0x88(%rax), %rcx movq %rcx, 0x88(%rax) jmp 0x80f052 jmp 0x80f054 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rax movq 0x60(%rax), %rsi callq 0x80f120 cltq movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) je 0x80f088 movq -0x20(%rbp), %rax movl $0x37, (%rax) movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF jmp 0x80f110 movq -0x18(%rbp), %rax movq 0x60(%rax), %rdi callq 0x883ae0 cmpl $0x0, %eax jne 0x80f0ac movq -0x10(%rbp), %rax movq 0x18(%rax), %rdi movl $0x1, %esi callq 0x849490 movq -0x18(%rbp), %rdi callq 0x810c50 cmpl $0x0, %eax je 0x80f109 movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x40(%rbp) jmp 0x80f0cb movq -0x40(%rbp), %rax cmpl $0x0, 0x2a8(%rax) je 0x80f0e4 movq -0x20(%rbp), %rax movl $0x10, (%rax) jmp 0x80f100 movq -0x10(%rbp), %rax movq 0x18(%rax), %rdi movl $0x1, %esi callq 0x849490 movq -0x20(%rbp), %rax movl $0x0, (%rax) movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF jmp 0x80f110 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x50, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http2.c
Curl_http2_setup
CURLcode Curl_http2_setup(struct Curl_easy *data, struct connectdata *conn) { CURLcode result; struct http_conn *httpc = &conn->proto.httpc; struct HTTP *stream = data->req.p.http; DEBUGASSERT(data->state.buffer); stream->stream_id = -1; Curl_dyn_init(&stream->header_recvbuf, DYN_H2_HEADERS); Curl_dyn_init(&stream->trailer_recvbuf, DYN_H2_TRAILERS); stream->upload_left = 0; stream->upload_mem = NULL; stream->upload_len = 0; stream->mem = data->state.buffer; stream->len = data->set.buffer_size; multi_connchanged(data->multi); /* below this point only connection related inits are done, which only needs to be done once per connection */ if((conn->handler == &Curl_handler_http2_ssl) || (conn->handler == &Curl_handler_http2)) return CURLE_OK; /* already done */ if(conn->handler->flags & PROTOPT_SSL) conn->handler = &Curl_handler_http2_ssl; else conn->handler = &Curl_handler_http2; result = http2_init(data, conn); if(result) { Curl_dyn_free(&stream->header_recvbuf); return result; } infof(data, "Using HTTP2, server supports multiplexing"); conn->bits.multiplex = TRUE; /* at least potentially multiplexed */ conn->httpversion = 20; conn->bundle->multiuse = BUNDLE_MULTIPLEX; httpc->inbuflen = 0; httpc->nread_inbuf = 0; httpc->pause_stream_id = 0; httpc->drain_total = 0; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x30(%rbp) jmp 0x80f23f movq -0x30(%rbp), %rax movl $0xffffffff, 0x228(%rax) # imm = 0xFFFFFFFF movq -0x30(%rbp), %rdi addq $0x230, %rdi # imm = 0x230 movl $0x20000, %esi # imm = 0x20000 callq 0x84ec00 movq -0x30(%rbp), %rdi addq $0x258, %rdi # imm = 0x258 movl $0x20000, %esi # imm = 0x20000 callq 0x84ec00 movq -0x30(%rbp), %rax movq $0x0, 0x2e0(%rax) movq -0x30(%rbp), %rax movq $0x0, 0x2d0(%rax) movq -0x30(%rbp), %rax movq $0x0, 0x2d8(%rax) movq -0x10(%rbp), %rax movq 0xc70(%rax), %rcx movq -0x30(%rbp), %rax movq %rcx, 0x2b8(%rax) movq -0x10(%rbp), %rax movl 0x6cc(%rax), %eax movl %eax, %ecx movq -0x30(%rbp), %rax movq %rcx, 0x2c0(%rax) movq -0x10(%rbp), %rax movq 0xb8(%rax), %rdi callq 0x80f420 movq -0x18(%rbp), %rax leaq 0x6e44a4(%rip), %rcx # 0xef3790 cmpq %rcx, 0x398(%rax) je 0x80f309 movq -0x18(%rbp), %rax leaq 0x6e4520(%rip), %rcx # 0xef3820 cmpq %rcx, 0x398(%rax) jne 0x80f315 movl $0x0, -0x4(%rbp) jmp 0x80f411 movq -0x18(%rbp), %rax movq 0x398(%rax), %rax movl 0x8c(%rax), %eax andl $0x1, %eax cmpl $0x0, %eax je 0x80f342 movq -0x18(%rbp), %rax leaq 0x6e4457(%rip), %rcx # 0xef3790 movq %rcx, 0x398(%rax) jmp 0x80f354 movq -0x18(%rbp), %rax leaq 0x6e44d3(%rip), %rcx # 0xef3820 movq %rcx, 0x398(%rax) movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x80f440 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x80f385 movq -0x30(%rbp), %rdi addq $0x230, %rdi # imm = 0x230 callq 0x84ec50 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x80f411 movq -0x10(%rbp), %rdi leaq 0x3908a8(%rip), %rsi # 0xb9fc38 movb $0x0, %al callq 0x820bf0 movq -0x18(%rbp), %rax movl 0x374(%rax), %ecx andl $0xfeffffff, %ecx # imm = 0xFEFFFFFF orl $0x1000000, %ecx # imm = 0x1000000 movl %ecx, 0x374(%rax) movq -0x18(%rbp), %rax movb $0x14, 0x57f(%rax) movq -0x18(%rbp), %rax movq 0x548(%rax), %rax movl $0x2, (%rax) movq -0x28(%rbp), %rax movq $0x0, 0x80(%rax) movq -0x28(%rbp), %rax movq $0x0, 0x88(%rax) movq -0x28(%rbp), %rax movl $0x0, 0x90(%rax) movq -0x28(%rbp), %rax movq $0x0, 0x98(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http2.c
http2_disconnect
static CURLcode http2_disconnect(struct Curl_easy *data, struct connectdata *conn, bool dead_connection) { struct http_conn *c = &conn->proto.httpc; (void)dead_connection; #ifndef DEBUG_HTTP2 (void)data; #endif H2BUGF(infof(data, "HTTP/2 DISCONNECT starts now")); nghttp2_session_del(c->h2); Curl_safefree(c->inbuf); H2BUGF(infof(data, "HTTP/2 DISCONNECT done")); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movb %dl, %al movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) andb $0x1, %al movb %al, -0x11(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) jmp 0x810957 movq -0x20(%rbp), %rax movq 0x60(%rax), %rdi callq 0x881ee0 leaq 0x6eba95(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x20(%rbp), %rcx movq 0x78(%rcx), %rdi callq *%rax movq -0x20(%rbp), %rax movq $0x0, 0x78(%rax) jmp 0x810986 jmp 0x810988 xorl %eax, %eax addq $0x20, %rsp popq %rbp retq
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http2.c
decode_status_code
static int decode_status_code(const uint8_t *value, size_t len) { int i; int res; if(len != 3) { return -1; } res = 0; for(i = 0; i < 3; ++i) { char c = value[i]; if(c < '0' || c > '9') { return -1; } res *= 10; res += c - '0'; } return res; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) cmpq $0x3, -0x18(%rbp) je 0x8122ec movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF jmp 0x81234e movl $0x0, -0x20(%rbp) movl $0x0, -0x1c(%rbp) cmpl $0x3, -0x1c(%rbp) jge 0x812348 movq -0x10(%rbp), %rax movslq -0x1c(%rbp), %rcx movb (%rax,%rcx), %al movb %al, -0x21(%rbp) movsbl -0x21(%rbp), %eax cmpl $0x30, %eax jl 0x812320 movsbl -0x21(%rbp), %eax cmpl $0x39, %eax jle 0x812329 movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF jmp 0x81234e imull $0xa, -0x20(%rbp), %eax movl %eax, -0x20(%rbp) movsbl -0x21(%rbp), %eax subl $0x30, %eax addl -0x20(%rbp), %eax movl %eax, -0x20(%rbp) movl -0x1c(%rbp), %eax addl $0x1, %eax movl %eax, -0x1c(%rbp) jmp 0x8122fa movl -0x20(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http2.c
data_source_read_callback
static ssize_t data_source_read_callback(nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t length, uint32_t *data_flags, nghttp2_data_source *source, void *userp) { struct Curl_easy *data_s; struct HTTP *stream = NULL; size_t nread; (void)source; (void)userp; if(stream_id) { /* get the stream from the hash based on Stream ID, stream ID zero is for connection-oriented stuff */ data_s = nghttp2_session_get_stream_user_data(session, stream_id); if(!data_s) /* Receiving a Stream ID not in the hash should not happen, this is an internal error more than anything else! */ return NGHTTP2_ERR_CALLBACK_FAILURE; stream = data_s->req.p.http; if(!stream) return NGHTTP2_ERR_CALLBACK_FAILURE; } else return NGHTTP2_ERR_INVALID_ARGUMENT; nread = CURLMIN(stream->upload_len, length); if(nread > 0) { memcpy(buf, stream->upload_mem, nread); stream->upload_mem += nread; stream->upload_len -= nread; if(data_s->state.infilesize != -1) stream->upload_left -= nread; } if(stream->upload_left == 0) *data_flags = NGHTTP2_DATA_FLAG_EOF; else if(nread == 0) return NGHTTP2_ERR_DEFERRED; H2BUGF(infof(data_s, "data_source_read_callback: " "returns %zu bytes stream %u", nread, stream_id)); return nread; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq 0x10(%rbp), %rax movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq %r9, -0x38(%rbp) movq $0x0, -0x48(%rbp) cmpl $0x0, -0x14(%rbp) je 0x81265a movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x88c820 movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) jne 0x812635 movq $-0x386, -0x8(%rbp) # imm = 0xFC7A jmp 0x812749 movq -0x40(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x48(%rbp) cmpq $0x0, -0x48(%rbp) jne 0x812658 movq $-0x386, -0x8(%rbp) # imm = 0xFC7A jmp 0x812749 jmp 0x812667 movq $-0x1f5, -0x8(%rbp) # imm = 0xFE0B jmp 0x812749 movq -0x48(%rbp), %rax movq 0x2d8(%rax), %rax cmpq -0x28(%rbp), %rax jae 0x812689 movq -0x48(%rbp), %rax movq 0x2d8(%rax), %rax movq %rax, -0x58(%rbp) jmp 0x812691 movq -0x28(%rbp), %rax movq %rax, -0x58(%rbp) movq -0x58(%rbp), %rax movq %rax, -0x50(%rbp) cmpq $0x0, -0x50(%rbp) jbe 0x812710 movq -0x20(%rbp), %rdi movq -0x48(%rbp), %rax movq 0x2d0(%rax), %rsi movq -0x50(%rbp), %rdx callq 0x3cb70 movq -0x50(%rbp), %rcx movq -0x48(%rbp), %rax addq 0x2d0(%rax), %rcx movq %rcx, 0x2d0(%rax) movq -0x50(%rbp), %rdx movq -0x48(%rbp), %rax movq 0x2d8(%rax), %rcx subq %rdx, %rcx movq %rcx, 0x2d8(%rax) movq -0x40(%rbp), %rax cmpq $-0x1, 0x1168(%rax) je 0x81270e movq -0x50(%rbp), %rdx movq -0x48(%rbp), %rax movq 0x2e0(%rax), %rcx subq %rdx, %rcx movq %rcx, 0x2e0(%rax) jmp 0x812710 movq -0x48(%rbp), %rax cmpq $0x0, 0x2e0(%rax) jne 0x81272a movq -0x30(%rbp), %rax movl $0x1, (%rax) jmp 0x81273d cmpq $0x0, -0x50(%rbp) jne 0x81273b movq $-0x1fc, -0x8(%rbp) # imm = 0xFE04 jmp 0x812749 jmp 0x81273d jmp 0x81273f jmp 0x812741 movq -0x50(%rbp), %rax movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x60, %rsp popq %rbp retq nopw %cs:(%rax,%rax) nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http2.c
curl_mime_data_cb
CURLcode curl_mime_data_cb(curl_mimepart *part, curl_off_t datasize, curl_read_callback readfunc, curl_seek_callback seekfunc, curl_free_callback freefunc, void *arg) { if(!part) return CURLE_BAD_FUNCTION_ARGUMENT; cleanup_part_content(part); if(readfunc) { part->readfunc = readfunc; part->seekfunc = seekfunc; part->freefunc = freefunc; part->arg = arg; part->datasize = datasize; part->kind = MIMEKIND_CALLBACK; } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq %r9, -0x38(%rbp) cmpq $0x0, -0x10(%rbp) jne 0x813360 movl $0x2b, -0x4(%rbp) jmp 0x8133be movq -0x10(%rbp), %rdi callq 0x812c30 cmpq $0x0, -0x20(%rbp) je 0x8133b7 movq -0x20(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x28(%rax) movq -0x28(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x30(%rax) movq -0x30(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x38(%rax) movq -0x38(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x40(%rax) movq -0x18(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x78(%rax) movq -0x10(%rbp), %rax movl $0x3, 0x18(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/mime.c
Curl_mime_set_subparts
CURLcode Curl_mime_set_subparts(curl_mimepart *part, curl_mime *subparts, int take_ownership) { curl_mime *root; if(!part) return CURLE_BAD_FUNCTION_ARGUMENT; /* Accept setting twice the same subparts. */ if(part->kind == MIMEKIND_MULTIPART && part->arg == subparts) return CURLE_OK; cleanup_part_content(part); if(subparts) { /* Must belong to the same data handle. */ if(part->easy && subparts->easy && part->easy != subparts->easy) return CURLE_BAD_FUNCTION_ARGUMENT; /* Should not have been attached already. */ if(subparts->parent) return CURLE_BAD_FUNCTION_ARGUMENT; /* Should not be the part's root. */ root = part->parent; if(root) { while(root->parent && root->parent->parent) root = root->parent->parent; if(subparts == root) { if(part->easy) failf(part->easy, "Can't add itself as a subpart"); return CURLE_BAD_FUNCTION_ARGUMENT; } } subparts->parent = part; /* Subparts are processed internally: no read callback. */ part->seekfunc = mime_subparts_seek; part->freefunc = take_ownership? mime_subparts_free: mime_subparts_unbind; part->arg = subparts; part->datasize = -1; part->kind = MIMEKIND_MULTIPART; } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) cmpq $0x0, -0x10(%rbp) jne 0x813c66 movl $0x2b, -0x4(%rbp) jmp 0x813dd1 movq -0x10(%rbp), %rax cmpl $0x4, 0x18(%rax) jne 0x813c8a movq -0x10(%rbp), %rax movq 0x40(%rax), %rax cmpq -0x18(%rbp), %rax jne 0x813c8a movl $0x0, -0x4(%rbp) jmp 0x813dd1 movq -0x10(%rbp), %rdi callq 0x812c30 cmpq $0x0, -0x18(%rbp) je 0x813dca movq -0x10(%rbp), %rax cmpq $0x0, (%rax) je 0x813cce movq -0x18(%rbp), %rax cmpq $0x0, (%rax) je 0x813cce movq -0x10(%rbp), %rax movq (%rax), %rax movq -0x18(%rbp), %rcx cmpq (%rcx), %rax je 0x813cce movl $0x2b, -0x4(%rbp) jmp 0x813dd1 movq -0x18(%rbp), %rax cmpq $0x0, 0x8(%rax) je 0x813ce5 movl $0x2b, -0x4(%rbp) jmp 0x813dd1 movq -0x10(%rbp), %rax movq 0x8(%rax), %rax movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) je 0x813d6c jmp 0x813cfa movq -0x28(%rbp), %rcx xorl %eax, %eax cmpq $0x0, 0x8(%rcx) movb %al, -0x29(%rbp) je 0x813d1d movq -0x28(%rbp), %rax movq 0x8(%rax), %rax cmpq $0x0, 0x8(%rax) setne %al movb %al, -0x29(%rbp) movb -0x29(%rbp), %al testb $0x1, %al jne 0x813d26 jmp 0x813d38 movq -0x28(%rbp), %rax movq 0x8(%rax), %rax movq 0x8(%rax), %rax movq %rax, -0x28(%rbp) jmp 0x813cfa movq -0x18(%rbp), %rax cmpq -0x28(%rbp), %rax jne 0x813d6a movq -0x10(%rbp), %rax cmpq $0x0, (%rax) je 0x813d61 movq -0x10(%rbp), %rax movq (%rax), %rdi leaq 0x38c5a6(%rip), %rsi # 0xba0300 movb $0x0, %al callq 0x820e10 movl $0x2b, -0x4(%rbp) jmp 0x813dd1 jmp 0x813d6c movq -0x10(%rbp), %rcx movq -0x18(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x10(%rbp), %rax leaq 0x5d(%rip), %rcx # 0x813de0 movq %rcx, 0x30(%rax) movl -0x1c(%rbp), %edx leaq -0xfb1(%rip), %rcx # 0x812de0 leaq 0xf8(%rip), %rax # 0x813e90 cmpl $0x0, %edx cmovneq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x38(%rax) movq -0x18(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x40(%rax) movq -0x10(%rbp), %rax movq $-0x1, 0x78(%rax) movq -0x10(%rbp), %rax movl $0x4, 0x18(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/mime.c
Curl_conncache_find_bundle
struct connectbundle * Curl_conncache_find_bundle(struct Curl_easy *data, struct connectdata *conn, struct conncache *connc) { struct connectbundle *bundle = NULL; CONNCACHE_LOCK(data); if(connc) { char key[HASHKEY_SIZE]; hashkey(conn, key, sizeof(key)); bundle = Curl_hash_pick(&connc->hash, key, strlen(key)); } return bundle; }
pushq %rbp movq %rsp, %rbp subq $0xb0, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movq $0x0, -0x20(%rbp) movq -0x8(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x846630 movq -0x8(%rbp), %rdi movl $0x5, %esi movl $0x2, %edx callq 0x82d500 cmpq $0x0, -0x18(%rbp) je 0x84668b movq -0x10(%rbp), %rdi leaq -0xa0(%rbp), %rsi movl $0x80, %edx callq 0x8466a0 movq -0x18(%rbp), %rax movq %rax, -0xb0(%rbp) leaq -0xa0(%rbp), %rax movq %rax, -0xa8(%rbp) leaq -0xa0(%rbp), %rdi callq 0x3b8f0 movq -0xb0(%rbp), %rdi movq -0xa8(%rbp), %rsi movq %rax, %rdx callq 0x85aeb0 movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax addq $0xb0, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/conncache.c
bundle_remove_conn
static int bundle_remove_conn(struct connectbundle *bundle, struct connectdata *conn) { struct Curl_llist_element *curr; curr = bundle->conn_list.head; while(curr) { if(curr->ptr == conn) { Curl_llist_remove(&bundle->conn_list, curr, NULL); bundle->num_connections--; conn->bundle = NULL; return 1; /* we removed a handle */ } curr = curr->next; } DEBUGASSERT(0); return 0; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x846b9b movq -0x20(%rbp), %rax movq (%rax), %rax cmpq -0x18(%rbp), %rax jne 0x846b8d movq -0x10(%rbp), %rdi addq $0x10, %rdi movq -0x20(%rbp), %rsi xorl %eax, %eax movl %eax, %edx callq 0x869f10 movq -0x10(%rbp), %rax movq 0x8(%rax), %rcx addq $-0x1, %rcx movq %rcx, 0x8(%rax) movq -0x18(%rbp), %rax movq $0x0, 0x548(%rax) movl $0x1, -0x4(%rbp) jmp 0x846ba6 movq -0x20(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x20(%rbp) jmp 0x846b3c jmp 0x846b9d jmp 0x846b9f movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/conncache.c
Curl_conncache_foreach
bool Curl_conncache_foreach(struct Curl_easy *data, struct conncache *connc, void *param, int (*func)(struct Curl_easy *data, struct connectdata *conn, void *param)) { struct Curl_hash_iterator iter; struct Curl_llist_element *curr; struct Curl_hash_element *he; if(!connc) return FALSE; CONNCACHE_LOCK(data); Curl_hash_start_iterate(&connc->hash, &iter); he = Curl_hash_next_element(&iter); while(he) { struct connectbundle *bundle; bundle = he->ptr; he = Curl_hash_next_element(&iter); curr = bundle->conn_list.head; while(curr) { /* Yes, we need to update curr before calling func(), because func() might decide to remove the connection */ struct connectdata *conn = curr->ptr; curr = curr->next; if(1 == func(data, conn, param)) { CONNCACHE_UNLOCK(data); return TRUE; } } } CONNCACHE_UNLOCK(data); return FALSE; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) cmpq $0x0, -0x18(%rbp) jne 0x846c58 movb $0x0, -0x1(%rbp) jmp 0x846d47 movq -0x10(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x846c79 movq -0x10(%rbp), %rdi movl $0x5, %esi movl $0x2, %edx callq 0x82d500 movq -0x18(%rbp), %rdi leaq -0x40(%rbp), %rsi callq 0x85b210 leaq -0x40(%rbp), %rdi callq 0x85b240 movq %rax, -0x50(%rbp) cmpq $0x0, -0x50(%rbp) je 0x846d27 movq -0x50(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x58(%rbp) leaq -0x40(%rbp), %rdi callq 0x85b240 movq %rax, -0x50(%rbp) movq -0x58(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x48(%rbp) cmpq $0x0, -0x48(%rbp) je 0x846d22 movq -0x48(%rbp), %rax movq (%rax), %rax movq %rax, -0x60(%rbp) movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x48(%rbp) movq -0x28(%rbp), %rax movq -0x10(%rbp), %rdi movq -0x60(%rbp), %rsi movq -0x20(%rbp), %rdx callq *%rax movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax jne 0x846d20 movq -0x10(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x846d1a movq -0x10(%rbp), %rdi movl $0x5, %esi callq 0x82d590 movb $0x1, -0x1(%rbp) jmp 0x846d47 jmp 0x846cc3 jmp 0x846c93 movq -0x10(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x846d43 movq -0x10(%rbp), %rdi movl $0x5, %esi callq 0x82d590 movb $0x0, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x60, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/conncache.c
Curl_connalive
bool Curl_connalive(struct connectdata *conn) { /* First determine if ssl */ if(conn->ssl[FIRSTSOCKET].use) { /* use the SSL context */ if(!Curl_ssl_check_cxn(conn)) return false; /* FIN received */ } /* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */ #ifdef MSG_PEEK else if(conn->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) return false; else { /* use the socket */ char buf; if(recv((RECV_TYPE_ARG1)conn->sock[FIRSTSOCKET], (RECV_TYPE_ARG2)&buf, (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK) == 0) { return false; /* FIN received */ } } #endif return true; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq -0x10(%rbp), %rax movb 0x228(%rax), %al andb $0x1, %al movzbl %al, %eax cmpl $0x0, %eax je 0x8491c6 movq -0x10(%rbp), %rdi callq 0x844b60 cmpl $0x0, %eax jne 0x8491c4 movb $0x0, -0x1(%rbp) jmp 0x84920a jmp 0x849206 movq -0x10(%rbp), %rax cmpl $-0x1, 0x1e0(%rax) jne 0x8491d9 movb $0x0, -0x1(%rbp) jmp 0x84920a movq -0x10(%rbp), %rax movl 0x1e0(%rax), %edi leaq -0x11(%rbp), %rsi movl $0x1, %edx movl $0x2, %ecx callq 0x3c470 cmpq $0x0, %rax jne 0x849202 movb $0x0, -0x1(%rbp) jmp 0x84920a jmp 0x849204 jmp 0x849206 movb $0x1, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/connect.c
Curl_get_line
char *Curl_get_line(char *buf, int len, FILE *input) { bool partial = FALSE; while(1) { char *b = fgets(buf, len, input); if(b) { size_t rlen = strlen(b); if(rlen && (b[rlen-1] == '\n')) { if(partial) { partial = FALSE; continue; } return b; } /* read a partial, discard the next piece that ends with newline */ partial = TRUE; } else break; } return NULL; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movb $0x0, -0x21(%rbp) movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi movq -0x20(%rbp), %rdx callq 0x3d770 movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) je 0x84eb67 movq -0x30(%rbp), %rdi callq 0x3b8f0 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) je 0x84eb61 movq -0x30(%rbp), %rax movq -0x38(%rbp), %rcx subq $0x1, %rcx movsbl (%rax,%rcx), %eax cmpl $0xa, %eax jne 0x84eb61 testb $0x1, -0x21(%rbp) je 0x84eb57 movb $0x0, -0x21(%rbp) jmp 0x84eb07 movq -0x30(%rbp), %rax movq %rax, -0x8(%rbp) jmp 0x84eb73 movb $0x1, -0x21(%rbp) jmp 0x84eb69 jmp 0x84eb6b jmp 0x84eb07 movq $0x0, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x40, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/curl_get_line.c
Curl_memrchr
void * Curl_memrchr(const void *s, int c, size_t n) { if(n > 0) { const unsigned char *p = s; const unsigned char *q = s; p += n - 1; while(p >= q) { if(*p == (unsigned char)c) return (void *)p; p--; } } return NULL; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) jbe 0x84ebeb movq -0x10(%rbp), %rax movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x20(%rbp), %rax subq $0x1, %rax addq -0x28(%rbp), %rax movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax cmpq -0x30(%rbp), %rax jb 0x84ebe9 movq -0x28(%rbp), %rax movzbl (%rax), %eax movl -0x14(%rbp), %ecx movzbl %cl, %ecx cmpl %ecx, %eax jne 0x84ebdb movq -0x28(%rbp), %rax movq %rax, -0x8(%rbp) jmp 0x84ebf3 movq -0x28(%rbp), %rax addq $-0x1, %rax movq %rax, -0x28(%rbp) jmp 0x84ebb6 jmp 0x84ebeb movq $0x0, -0x8(%rbp) movq -0x8(%rbp), %rax popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/curl_memrchr.c
Curl_dyn_init
void Curl_dyn_init(struct dynbuf *s, size_t toobig) { DEBUGASSERT(s); DEBUGASSERT(toobig); s->bufr = NULL; s->leng = 0; s->allc = 0; s->toobig = toobig; #ifdef DEBUGBUILD s->init = DYNINIT; #endif }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) jmp 0x84ec0e jmp 0x84ec10 jmp 0x84ec12 movq -0x8(%rbp), %rax movq $0x0, (%rax) movq -0x8(%rbp), %rax movq $0x0, 0x8(%rax) movq -0x8(%rbp), %rax movq $0x0, 0x10(%rax) movq -0x10(%rbp), %rcx movq -0x8(%rbp), %rax movq %rcx, 0x18(%rax) popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/dynbuf.c
Curl_dyn_tail
CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail) { DEBUGASSERT(s); DEBUGASSERT(s->init == DYNINIT); DEBUGASSERT(!s->leng || s->bufr); if(trail > s->leng) return CURLE_BAD_FUNCTION_ARGUMENT; else if(trail == s->leng) return CURLE_OK; else if(!trail) { Curl_dyn_reset(s); } else { memmove(&s->bufr[0], &s->bufr[s->leng - trail], trail); s->leng = trail; s->bufr[s->leng] = 0; } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) jmp 0x84ecf2 jmp 0x84ecf4 jmp 0x84ecf6 jmp 0x84ecf8 jmp 0x84ecfa movq -0x18(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x8(%rcx), %rax jbe 0x84ed11 movl $0x2b, -0x4(%rbp) jmp 0x84ed8a movq -0x18(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x8(%rcx), %rax jne 0x84ed28 movl $0x0, -0x4(%rbp) jmp 0x84ed8a cmpq $0x0, -0x18(%rbp) jne 0x84ed3a movq -0x10(%rbp), %rdi callq 0x84eca0 jmp 0x84ed7f movq -0x10(%rbp), %rax movq (%rax), %rdi movq -0x10(%rbp), %rax movq (%rax), %rsi movq -0x10(%rbp), %rax movq 0x8(%rax), %rax subq -0x18(%rbp), %rax addq %rax, %rsi movq -0x18(%rbp), %rdx callq 0x3b370 movq -0x18(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x10(%rbp), %rax movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x8(%rcx), %rcx movb $0x0, (%rax,%rcx) jmp 0x84ed81 jmp 0x84ed83 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/dynbuf.c
dyn_nappend
static CURLcode dyn_nappend(struct dynbuf *s, const unsigned char *mem, size_t len) { size_t indx = s->leng; size_t a = s->allc; size_t fit = len + indx + 1; /* new string + old string + zero byte */ /* try to detect if there's rubbish in the struct */ DEBUGASSERT(s->init == DYNINIT); DEBUGASSERT(s->toobig); DEBUGASSERT(indx < s->toobig); DEBUGASSERT(!s->leng || s->bufr); if(fit > s->toobig) { Curl_dyn_free(s); return CURLE_OUT_OF_MEMORY; } else if(!a) { DEBUGASSERT(!indx); /* first invoke */ if(fit < MIN_FIRST_ALLOC) a = MIN_FIRST_ALLOC; else a = fit; } else { while(a < fit) a *= 2; } if(a != s->allc) { /* this logic is not using Curl_saferealloc() to make the tool not have to include that as well when it uses this code */ void *p = realloc(s->bufr, a); if(!p) { Curl_safefree(s->bufr); s->leng = s->allc = 0; return CURLE_OUT_OF_MEMORY; } s->bufr = p; s->allc = a; } if(len) memcpy(&s->bufr[indx], mem, len); s->leng = indx + len; s->bufr[s->leng] = 0; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq -0x10(%rbp), %rax movq 0x8(%rax), %rax movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x30(%rbp) movq -0x20(%rbp), %rax addq -0x28(%rbp), %rax addq $0x1, %rax movq %rax, -0x38(%rbp) jmp 0x84ee1e jmp 0x84ee20 jmp 0x84ee22 jmp 0x84ee24 jmp 0x84ee26 jmp 0x84ee28 jmp 0x84ee2a movq -0x38(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x18(%rcx), %rax jbe 0x84ee4d movq -0x10(%rbp), %rdi callq 0x84ec50 movl $0x1b, -0x4(%rbp) jmp 0x84ef61 cmpq $0x0, -0x30(%rbp) jne 0x84ee73 jmp 0x84ee56 jmp 0x84ee58 cmpq $0x20, -0x38(%rbp) jae 0x84ee69 movq $0x20, -0x30(%rbp) jmp 0x84ee71 movq -0x38(%rbp), %rax movq %rax, -0x30(%rbp) jmp 0x84ee8e jmp 0x84ee75 movq -0x30(%rbp), %rax cmpq -0x38(%rbp), %rax jae 0x84ee8c movq -0x30(%rbp), %rax shlq %rax movq %rax, -0x30(%rbp) jmp 0x84ee75 jmp 0x84ee8e jmp 0x84ee90 movq -0x30(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x10(%rcx), %rax je 0x84ef18 leaq 0x6ad563(%rip), %rax # 0xefc408 movq (%rax), %rax movq -0x10(%rbp), %rcx movq (%rcx), %rdi movq -0x30(%rbp), %rsi callq *%rax movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) jne 0x84ef01 jmp 0x84eec2 leaq 0x6ad537(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x10(%rbp), %rcx movq (%rcx), %rdi callq *%rax movq -0x10(%rbp), %rax movq $0x0, (%rax) movq -0x10(%rbp), %rax movq $0x0, 0x10(%rax) movq -0x10(%rbp), %rax movq $0x0, 0x8(%rax) movl $0x1b, -0x4(%rbp) jmp 0x84ef61 movq -0x40(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, (%rax) movq -0x30(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x10(%rax) cmpq $0x0, -0x20(%rbp) je 0x84ef37 movq -0x10(%rbp), %rax movq (%rax), %rdi addq -0x28(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x20(%rbp), %rdx callq 0x3cb70 movq -0x28(%rbp), %rcx addq -0x20(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x10(%rbp), %rax movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x8(%rcx), %rcx movb $0x0, (%rax,%rcx) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/dynbuf.c
Curl_dyn_addf
CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...) { CURLcode result; va_list ap; DEBUGASSERT(s); DEBUGASSERT(s->init == DYNINIT); DEBUGASSERT(!s->leng || s->bufr); va_start(ap, fmt); result = Curl_dyn_vaddf(s, fmt, ap); va_end(ap); return result; }
pushq %rbp movq %rsp, %rbp subq $0xe0, %rsp testb %al, %al je 0x84f048 movaps %xmm0, -0xb0(%rbp) movaps %xmm1, -0xa0(%rbp) movaps %xmm2, -0x90(%rbp) movaps %xmm3, -0x80(%rbp) movaps %xmm4, -0x70(%rbp) movaps %xmm5, -0x60(%rbp) movaps %xmm6, -0x50(%rbp) movaps %xmm7, -0x40(%rbp) movq %r9, -0xb8(%rbp) movq %r8, -0xc0(%rbp) movq %rcx, -0xc8(%rbp) movq %rdx, -0xd0(%rbp) movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) jmp 0x84f06e jmp 0x84f070 jmp 0x84f072 jmp 0x84f074 jmp 0x84f076 leaq -0xe0(%rbp), %rax movq %rax, -0x20(%rbp) leaq 0x10(%rbp), %rax movq %rax, -0x28(%rbp) movl $0x30, -0x2c(%rbp) movl $0x10, -0x30(%rbp) movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi leaq -0x30(%rbp), %rdx callq 0x84efb0 movl %eax, -0x14(%rbp) movl -0x14(%rbp), %eax addq $0xe0, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/dynbuf.c
Curl_dyn_setlen
CURLcode Curl_dyn_setlen(struct dynbuf *s, size_t set) { DEBUGASSERT(s); DEBUGASSERT(s->init == DYNINIT); DEBUGASSERT(!s->leng || s->bufr); if(set > s->leng) return CURLE_BAD_FUNCTION_ARGUMENT; s->leng = set; s->bufr[s->leng] = 0; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) jmp 0x84f12e jmp 0x84f130 jmp 0x84f132 jmp 0x84f134 jmp 0x84f136 movq -0x18(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x8(%rcx), %rax jbe 0x84f14d movl $0x2b, -0x4(%rbp) jmp 0x84f173 movq -0x18(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x10(%rbp), %rax movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x8(%rcx), %rcx movb $0x0, (%rax,%rcx) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/dynbuf.c
Curl_isunreserved
bool Curl_isunreserved(unsigned char in) { switch(in) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '-': case '.': case '_': case '~': return TRUE; default: break; } return FALSE; }
pushq %rbp movq %rsp, %rbp movb %dil, %al movb %al, -0x2(%rbp) movzbl -0x2(%rbp), %eax addl $-0x2d, %eax movl %eax, %ecx movq %rcx, -0x10(%rbp) subl $0x51, %eax ja 0x84f1b6 movq -0x10(%rbp), %rax leaq 0x3557a5(%rip), %rcx # 0xba494c movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax movb $0x1, -0x1(%rbp) jmp 0x84f1bc jmp 0x84f1b8 movb $0x0, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/escape.c
curl_easy_escape
char *curl_easy_escape(struct Curl_easy *data, const char *string, int inlength) { size_t length; struct dynbuf d; (void)data; if(inlength < 0) return NULL; Curl_dyn_init(&d, CURL_MAX_INPUT_LENGTH * 3); length = (inlength?(size_t)inlength:strlen(string)); if(!length) return strdup(""); while(length--) { unsigned char in = *string; /* we need to treat the characters unsigned */ if(Curl_isunreserved(in)) { /* append this */ if(Curl_dyn_addn(&d, &in, 1)) return NULL; } else { /* encode it */ if(Curl_dyn_addf(&d, "%%%02X", in)) return NULL; } string++; } return Curl_dyn_ptr(&d); }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jge 0x84f226 movq $0x0, -0x8(%rbp) jmp 0x84f310 leaq -0x48(%rbp), %rdi movl $0x16e3600, %esi # imm = 0x16E3600 callq 0x84ec00 cmpl $0x0, -0x1c(%rbp) je 0x84f244 movslq -0x1c(%rbp), %rax movq %rax, -0x58(%rbp) jmp 0x84f251 movq -0x18(%rbp), %rdi callq 0x3b8f0 movq %rax, -0x58(%rbp) movq -0x58(%rbp), %rax movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) jne 0x84f279 leaq 0x36ff50(%rip), %rdi # 0xbbf1b7 leaq 0x6ad1a2(%rip), %rax # 0xefc410 callq *(%rax) movq %rax, -0x8(%rbp) jmp 0x84f310 jmp 0x84f27b movq -0x28(%rbp), %rax movq %rax, %rcx addq $-0x1, %rcx movq %rcx, -0x28(%rbp) cmpq $0x0, %rax je 0x84f303 movq -0x18(%rbp), %rax movb (%rax), %al movb %al, -0x49(%rbp) movzbl -0x49(%rbp), %edi callq 0x84f180 testb $0x1, %al jne 0x84f2a8 jmp 0x84f2cb leaq -0x48(%rbp), %rdi leaq -0x49(%rbp), %rsi movl $0x1, %edx callq 0x84eda0 cmpl $0x0, %eax je 0x84f2c9 movq $0x0, -0x8(%rbp) jmp 0x84f310 jmp 0x84f2f2 movzbl -0x49(%rbp), %edx leaq -0x48(%rbp), %rdi leaq 0x310fb4(%rip), %rsi # 0xb6028e movb $0x0, %al callq 0x84f010 cmpl $0x0, %eax je 0x84f2f0 movq $0x0, -0x8(%rbp) jmp 0x84f310 jmp 0x84f2f2 movq -0x18(%rbp), %rax addq $0x1, %rax movq %rax, -0x18(%rbp) jmp 0x84f27b leaq -0x48(%rbp), %rdi callq 0x84f0c0 movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x60, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/escape.c
curl_easy_unescape
char *curl_easy_unescape(struct Curl_easy *data, const char *string, int length, int *olen) { char *str = NULL; (void)data; if(length >= 0) { size_t inputlen = length; size_t outputlen; CURLcode res = Curl_urldecode(string, inputlen, &str, &outputlen, REJECT_NADA); if(res) return NULL; if(olen) { if(outputlen <= (size_t) INT_MAX) *olen = curlx_uztosi(outputlen); else /* too large to return in an int, fail! */ Curl_safefree(str); } } return str; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) movq %rcx, -0x28(%rbp) movq $0x0, -0x30(%rbp) cmpl $0x0, -0x1c(%rbp) jl 0x84f3ef movslq -0x1c(%rbp), %rax movq %rax, -0x38(%rbp) movq -0x18(%rbp), %rdi movq -0x38(%rbp), %rsi leaq -0x30(%rbp), %rdx leaq -0x40(%rbp), %rcx movl $0x2, %r8d callq 0x84f410 movl %eax, -0x44(%rbp) cmpl $0x0, -0x44(%rbp) je 0x84f3ab movq $0x0, -0x8(%rbp) jmp 0x84f3f7 cmpq $0x0, -0x28(%rbp) je 0x84f3ed cmpq $0x7fffffff, -0x40(%rbp) # imm = 0x7FFFFFFF ja 0x84f3cf movq -0x40(%rbp), %rdi callq 0x840830 movl %eax, %ecx movq -0x28(%rbp), %rax movl %ecx, (%rax) jmp 0x84f3eb jmp 0x84f3d1 leaq 0x6ad028(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rdi callq *%rax movq $0x0, -0x30(%rbp) jmp 0x84f3eb jmp 0x84f3ed jmp 0x84f3ef movq -0x30(%rbp), %rax movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x50, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/escape.c
Curl_urldecode
CURLcode Curl_urldecode(const char *string, size_t length, char **ostring, size_t *olen, enum urlreject ctrl) { size_t alloc; char *ns; size_t strindex = 0; unsigned long hex; DEBUGASSERT(string); DEBUGASSERT(ctrl >= REJECT_NADA); /* crash on TRUE/FALSE */ alloc = (length?length:strlen(string)) + 1; ns = malloc(alloc); if(!ns) return CURLE_OUT_OF_MEMORY; while(--alloc > 0) { unsigned char in = *string; if(('%' == in) && (alloc > 2) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) { /* this is two hexadecimal digits following a '%' */ char hexstr[3]; char *ptr; hexstr[0] = string[1]; hexstr[1] = string[2]; hexstr[2] = 0; hex = strtoul(hexstr, &ptr, 16); in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */ string += 2; alloc -= 2; } if(((ctrl == REJECT_CTRL) && (in < 0x20)) || ((ctrl == REJECT_ZERO) && (in == 0))) { free(ns); return CURLE_URL_MALFORMAT; } ns[strindex++] = in; string++; } ns[strindex] = 0; /* terminate it */ if(olen) /* store output size */ *olen = strindex; /* store output string */ *ostring = ns; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x70, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movl %r8d, -0x2c(%rbp) movq $0x0, -0x48(%rbp) jmp 0x84f436 jmp 0x84f438 jmp 0x84f43a cmpq $0x0, -0x18(%rbp) je 0x84f44b movq -0x18(%rbp), %rax movq %rax, -0x68(%rbp) jmp 0x84f458 movq -0x10(%rbp), %rdi callq 0x3b8f0 movq %rax, -0x68(%rbp) movq -0x68(%rbp), %rax addq $0x1, %rax movq %rax, -0x38(%rbp) leaq 0x6acf8d(%rip), %rax # 0xefc3f8 movq (%rax), %rax movq -0x38(%rbp), %rdi callq *%rax movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) jne 0x84f48b movl $0x1b, -0x4(%rbp) jmp 0x84f64f jmp 0x84f48d movq -0x38(%rbp), %rax addq $-0x1, %rax movq %rax, -0x38(%rbp) cmpq $0x0, %rax jbe 0x84f61f movq -0x10(%rbp), %rax movb (%rax), %al movb %al, -0x51(%rbp) movzbl -0x51(%rbp), %ecx movl $0x25, %eax cmpl %ecx, %eax jne 0x84f5be cmpq $0x2, -0x38(%rbp) jbe 0x84f5be movq -0x10(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x30, %eax jl 0x84f4e2 movq -0x10(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x39, %eax jle 0x84f51e movq -0x10(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x61, %eax jl 0x84f4fc movq -0x10(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x66, %eax jle 0x84f51e movq -0x10(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x41, %eax jl 0x84f5be movq -0x10(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x46, %eax jg 0x84f5be movq -0x10(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x30, %eax jl 0x84f538 movq -0x10(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x39, %eax jle 0x84f56c movq -0x10(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x61, %eax jl 0x84f552 movq -0x10(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x66, %eax jle 0x84f56c movq -0x10(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x41, %eax jl 0x84f5be movq -0x10(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x46, %eax jg 0x84f5be movq -0x10(%rbp), %rax movb 0x1(%rax), %al movb %al, -0x54(%rbp) movq -0x10(%rbp), %rax movb 0x2(%rax), %al movb %al, -0x53(%rbp) movb $0x0, -0x52(%rbp) leaq -0x54(%rbp), %rdi leaq -0x60(%rbp), %rsi movl $0x10, %edx callq 0x3c160 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rdi callq 0x8407f0 movb %al, -0x51(%rbp) movq -0x10(%rbp), %rax addq $0x2, %rax movq %rax, -0x10(%rbp) movq -0x38(%rbp), %rax subq $0x2, %rax movq %rax, -0x38(%rbp) cmpl $0x3, -0x2c(%rbp) jne 0x84f5cd movzbl -0x51(%rbp), %eax cmpl $0x20, %eax jl 0x84f5dc cmpl $0x4, -0x2c(%rbp) jne 0x84f5f5 movzbl -0x51(%rbp), %eax cmpl $0x0, %eax jne 0x84f5f5 leaq 0x6ace1d(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x40(%rbp), %rdi callq *%rax movl $0x3, -0x4(%rbp) jmp 0x84f64f movb -0x51(%rbp), %dl movq -0x40(%rbp), %rax movq -0x48(%rbp), %rcx movq %rcx, %rsi addq $0x1, %rsi movq %rsi, -0x48(%rbp) movb %dl, (%rax,%rcx) movq -0x10(%rbp), %rax addq $0x1, %rax movq %rax, -0x10(%rbp) jmp 0x84f48d movq -0x40(%rbp), %rax movq -0x48(%rbp), %rcx movb $0x0, (%rax,%rcx) cmpq $0x0, -0x28(%rbp) je 0x84f63d movq -0x48(%rbp), %rcx movq -0x28(%rbp), %rax movq %rcx, (%rax) movq -0x40(%rbp), %rcx movq -0x20(%rbp), %rax movq %rcx, (%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x70, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/escape.c
file_setup_connection
static CURLcode file_setup_connection(struct Curl_easy *data, struct connectdata *conn) { (void)conn; /* allocate the FILE specific struct */ data->req.p.file = calloc(1, sizeof(struct FILEPROTO)); if(!data->req.p.file) return CURLE_OUT_OF_MEMORY; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x1, %edi movl $0x18, %esi leaq 0x6acd67(%rip), %rax # 0xefc418 callq *(%rax) movq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x198(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x198(%rax) jne 0x84f6d8 movl $0x1b, -0x4(%rbp) jmp 0x84f6df movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/file.c
file_do
static CURLcode file_do(struct Curl_easy *data, bool *done) { /* This implementation ignores the host name in conformance with RFC 1738. Only local files (reachable via the standard file system) are supported. This means that files on remotely mounted directories (via NFS, Samba, NT sharing) can be accessed through a file:// URL */ CURLcode result = CURLE_OK; struct_stat statbuf; /* struct_stat instead of struct stat just to allow the Windows version to have a different struct without having to redefine the simple word 'stat' */ curl_off_t expected_size = -1; bool size_known; bool fstated = FALSE; char *buf = data->state.buffer; curl_off_t bytecount = 0; int fd; struct FILEPROTO *file; *done = TRUE; /* unconditionally */ Curl_pgrsStartNow(data); if(data->set.upload) return file_upload(data); file = data->req.p.file; /* get the fd from the connection phase */ fd = file->fd; /* VMS: This only works reliable for STREAMLF files */ if(-1 != fstat(fd, &statbuf)) { if(!S_ISDIR(statbuf.st_mode)) expected_size = statbuf.st_size; /* and store the modification time */ data->info.filetime = statbuf.st_mtime; fstated = TRUE; } if(fstated && !data->state.range && data->set.timecondition) { if(!Curl_meets_timecondition(data, data->info.filetime)) { *done = TRUE; return CURLE_OK; } } if(fstated) { time_t filetime; struct tm buffer; const struct tm *tm = &buffer; char header[80]; int headerlen; char accept_ranges[24]= { "Accept-ranges: bytes\r\n" }; if(expected_size >= 0) { headerlen = msnprintf(header, sizeof(header), "Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", expected_size); result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen); if(result) return result; result = Curl_client_write(data, CLIENTWRITE_HEADER, accept_ranges, strlen(accept_ranges)); if(result != CURLE_OK) return result; } filetime = (time_t)statbuf.st_mtime; result = Curl_gmtime(filetime, &buffer); if(result) return result; /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ headerlen = msnprintf(header, sizeof(header), "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n%s", Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], tm->tm_mday, Curl_month[tm->tm_mon], tm->tm_year + 1900, tm->tm_hour, tm->tm_min, tm->tm_sec, data->set.opt_no_body ? "": "\r\n"); result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen); if(result) return result; /* set the file size to make it available post transfer */ Curl_pgrsSetDownloadSize(data, expected_size); if(data->set.opt_no_body) return result; } /* Check whether file range has been specified */ result = Curl_range(data); if(result) return result; /* Adjust the start offset in case we want to get the N last bytes * of the stream if the filesize could be determined */ if(data->state.resume_from < 0) { if(!fstated) { failf(data, "Can't get the size of file."); return CURLE_READ_ERROR; } data->state.resume_from += (curl_off_t)statbuf.st_size; } if(data->state.resume_from > 0) { /* We check explicitly if we have a start offset, because * expected_size may be -1 if we don't know how large the file is, * in which case we should not adjust it. */ if(data->state.resume_from <= expected_size) expected_size -= data->state.resume_from; else { failf(data, "failed to resume file:// transfer"); return CURLE_BAD_DOWNLOAD_RESUME; } } /* A high water mark has been specified so we obey... */ if(data->req.maxdownload > 0) expected_size = data->req.maxdownload; if(!fstated || (expected_size <= 0)) size_known = FALSE; else size_known = TRUE; /* The following is a shortcut implementation of file reading this is both more efficient than the former call to download() and it avoids problems with select() and recv() on file descriptors in Winsock */ if(size_known) Curl_pgrsSetDownloadSize(data, expected_size); if(data->state.resume_from) { if(data->state.resume_from != lseek(fd, data->state.resume_from, SEEK_SET)) return CURLE_BAD_DOWNLOAD_RESUME; } Curl_pgrsTime(data, TIMER_STARTTRANSFER); while(!result) { ssize_t nread; /* Don't fill a whole buffer if we want less than all data */ size_t bytestoread; if(size_known) { bytestoread = (expected_size < data->set.buffer_size) ? curlx_sotouz(expected_size) : (size_t)data->set.buffer_size; } else bytestoread = data->set.buffer_size-1; nread = read(fd, buf, bytestoread); if(nread > 0) buf[nread] = 0; if(nread <= 0 || (size_known && (expected_size == 0))) break; bytecount += nread; if(size_known) expected_size -= nread; result = Curl_client_write(data, CLIENTWRITE_BODY, buf, nread); if(result) return result; Curl_pgrsSetDownloadCounter(data, bytecount); if(Curl_pgrsUpdate(data)) result = CURLE_ABORTED_BY_CALLBACK; else result = Curl_speedcheck(data, Curl_now()); } if(Curl_pgrsUpdate(data)) result = CURLE_ABORTED_BY_CALLBACK; return result; }
pushq %rbp movq %rsp, %rbp pushq %r14 pushq %rbx subq $0x230, %rsp # imm = 0x230 movq %rdi, -0x20(%rbp) movq %rsi, -0x28(%rbp) movl $0x0, -0x2c(%rbp) movq $-0x1, -0xc8(%rbp) movb $0x0, -0xca(%rbp) movq -0x20(%rbp), %rax movq 0xc70(%rax), %rax movq %rax, -0xd8(%rbp) movq $0x0, -0xe0(%rbp) movq -0x28(%rbp), %rax movb $0x1, (%rax) movq -0x20(%rbp), %rdi callq 0x81f560 movq -0x20(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x1a, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x84f775 movq -0x20(%rbp), %rdi callq 0x850030 movl %eax, -0x14(%rbp) jmp 0x84fe31 movq -0x20(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0xf0(%rbp) movq -0xf0(%rbp), %rax movl 0x10(%rax), %eax movl %eax, -0xe4(%rbp) movl -0xe4(%rbp), %edi leaq -0xc0(%rbp), %rsi callq 0x3d900 movl %eax, %ecx movl $0xffffffff, %eax # imm = 0xFFFFFFFF cmpl %ecx, %eax je 0x84f7ea movl -0xa8(%rbp), %eax andl $0xf000, %eax # imm = 0xF000 cmpl $0x4000, %eax # imm = 0x4000 je 0x84f7d4 movq -0x90(%rbp), %rax movq %rax, -0xc8(%rbp) movq -0x68(%rbp), %rcx movq -0x20(%rbp), %rax movq %rcx, 0x1368(%rax) movb $0x1, -0xca(%rbp) testb $0x1, -0xca(%rbp) je 0x84f83e movq -0x20(%rbp), %rax cmpq $0x0, 0x1158(%rax) jne 0x84f83e movq -0x20(%rbp), %rax movzbl 0x538(%rax), %eax cmpl $0x0, %eax je 0x84f83e movq -0x20(%rbp), %rdi movq -0x20(%rbp), %rax movq 0x1368(%rax), %rsi callq 0x831d50 testb $0x1, %al jne 0x84f83c movq -0x28(%rbp), %rax movb $0x1, (%rax) movl $0x0, -0x14(%rbp) jmp 0x84fe31 jmp 0x84f83e testb $0x1, -0xca(%rbp) je 0x84fad9 leaq -0x130(%rbp), %rax movq %rax, -0x138(%rbp) movq 0x355310(%rip), %rax # 0xba4b70 movq %rax, -0x1b0(%rbp) movq 0x35530a(%rip), %rax # 0xba4b78 movq %rax, -0x1a8(%rbp) movq 0x355304(%rip), %rax # 0xba4b80 movq %rax, -0x1a0(%rbp) cmpq $0x0, -0xc8(%rbp) jl 0x84f93e leaq -0x190(%rbp), %rdi movq -0xc8(%rbp), %rcx movl $0x50, %esi leaq 0x3551ff(%rip), %rdx # 0xba4aaa movb $0x0, %al callq 0x8179a0 movl %eax, -0x194(%rbp) movq -0x20(%rbp), %rdi leaq -0x190(%rbp), %rdx movslq -0x194(%rbp), %rcx movl $0x2, %esi callq 0x821330 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x84f8e8 movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) jmp 0x84fe31 movq -0x20(%rbp), %rax movq %rax, -0x1f0(%rbp) leaq -0x1b0(%rbp), %rax movq %rax, -0x1e8(%rbp) leaq -0x1b0(%rbp), %rdi callq 0x3b8f0 movq -0x1f0(%rbp), %rdi movq -0x1e8(%rbp), %rdx movq %rax, %rcx movl $0x2, %esi callq 0x821330 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x84f93c movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) jmp 0x84fe31 jmp 0x84f93e movq -0x68(%rbp), %rax movq %rax, -0xf8(%rbp) movq -0xf8(%rbp), %rdi leaq -0x130(%rbp), %rsi callq 0x86b980 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x84f970 movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) jmp 0x84fe31 leaq -0x190(%rbp), %rax movq %rax, -0x1f8(%rbp) movq -0x138(%rbp), %rax cmpl $0x0, 0x18(%rax) je 0x84f9a0 movq -0x138(%rbp), %rax movl 0x18(%rax), %eax subl $0x1, %eax movl %eax, -0x1fc(%rbp) jmp 0x84f9ad movl $0x6, %eax movl %eax, -0x1fc(%rbp) jmp 0x84f9ad movq -0x1f8(%rbp), %rdi movl -0x1fc(%rbp), %eax movslq %eax, %rcx leaq 0x6a46fc(%rip), %rax # 0xef40c0 movq (%rax,%rcx,8), %rcx movq -0x138(%rbp), %rax movl 0xc(%rax), %r8d movq -0x138(%rbp), %rax movslq 0x10(%rax), %rdx leaq 0x6a471b(%rip), %rax # 0xef4100 movq (%rax,%rdx,8), %r9 movq -0x138(%rbp), %rax movl 0x14(%rax), %r14d addl $0x76c, %r14d # imm = 0x76C movq -0x138(%rbp), %rax movl 0x8(%rax), %ebx movq -0x138(%rbp), %rax movl 0x4(%rax), %r11d movq -0x138(%rbp), %rax movl (%rax), %r10d movq -0x20(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x19, %rax andq $0x1, %rax movl %eax, %esi leaq 0x33c66c(%rip), %rax # 0xb8c0a2 leaq 0x36f77a(%rip), %rdx # 0xbbf1b7 cmpl $0x0, %esi cmovneq %rdx, %rax movl $0x50, %esi leaq 0x355070(%rip), %rdx # 0xba4ac0 movl %r14d, (%rsp) movl %ebx, 0x8(%rsp) movl %r11d, 0x10(%rsp) movl %r10d, 0x18(%rsp) movq %rax, 0x20(%rsp) movb $0x0, %al callq 0x8179a0 movl %eax, -0x194(%rbp) movq -0x20(%rbp), %rdi leaq -0x190(%rbp), %rdx movslq -0x194(%rbp), %rcx movl $0x2, %esi callq 0x821330 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x84faa4 movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) jmp 0x84fe31 movq -0x20(%rbp), %rdi movq -0xc8(%rbp), %rsi callq 0x81f2c0 movq -0x20(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x19, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x84fad7 movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) jmp 0x84fe31 jmp 0x84fad9 movq -0x20(%rbp), %rdi callq 0x87a260 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x84faf6 movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) jmp 0x84fe31 movq -0x20(%rbp), %rax cmpq $0x0, 0x1160(%rax) jge 0x84fb44 testb $0x1, -0xca(%rbp) jne 0x84fb2b movq -0x20(%rbp), %rdi leaq 0x354fde(%rip), %rsi # 0xba4af6 movb $0x0, %al callq 0x820e10 movl $0x1a, -0x14(%rbp) jmp 0x84fe31 movq -0x90(%rbp), %rcx movq -0x20(%rbp), %rax addq 0x1160(%rax), %rcx movq %rcx, 0x1160(%rax) movq -0x20(%rbp), %rax cmpq $0x0, 0x1160(%rax) jle 0x84fba4 movq -0x20(%rbp), %rax movq 0x1160(%rax), %rax cmpq -0xc8(%rbp), %rax jg 0x84fb84 movq -0x20(%rbp), %rax movq 0x1160(%rax), %rcx movq -0xc8(%rbp), %rax subq %rcx, %rax movq %rax, -0xc8(%rbp) jmp 0x84fba2 movq -0x20(%rbp), %rdi leaq 0x354f83(%rip), %rsi # 0xba4b12 movb $0x0, %al callq 0x820e10 movl $0x24, -0x14(%rbp) jmp 0x84fe31 jmp 0x84fba4 movq -0x20(%rbp), %rax cmpq $0x0, 0xd8(%rax) jle 0x84fbc4 movq -0x20(%rbp), %rax movq 0xd8(%rax), %rax movq %rax, -0xc8(%rbp) testb $0x1, -0xca(%rbp) je 0x84fbd7 cmpq $0x0, -0xc8(%rbp) jg 0x84fbe0 movb $0x0, -0xc9(%rbp) jmp 0x84fbe7 movb $0x1, -0xc9(%rbp) testb $0x1, -0xc9(%rbp) je 0x84fc00 movq -0x20(%rbp), %rdi movq -0xc8(%rbp), %rsi callq 0x81f2c0 movq -0x20(%rbp), %rax cmpq $0x0, 0x1160(%rax) je 0x84fc55 movq -0x20(%rbp), %rax movq 0x1160(%rax), %rax movq %rax, -0x208(%rbp) movl -0xe4(%rbp), %edi movq -0x20(%rbp), %rax movq 0x1160(%rax), %rsi xorl %edx, %edx callq 0x3c3e0 movq %rax, %rcx movq -0x208(%rbp), %rax cmpq %rcx, %rax je 0x84fc53 movl $0x24, -0x14(%rbp) jmp 0x84fe31 jmp 0x84fc55 movq -0x20(%rbp), %rdi movl $0x7, %esi callq 0x81f380 movq %rax, -0x1c0(%rbp) movl %edx, -0x1b8(%rbp) cmpl $0x0, -0x2c(%rbp) setne %al xorb $-0x1, %al testb $0x1, %al jne 0x84fc82 jmp 0x84fe16 testb $0x1, -0xc9(%rbp) je 0x84fcd7 movq -0xc8(%rbp), %rax movq -0x20(%rbp), %rcx movl 0x6cc(%rcx), %ecx cmpq %rcx, %rax jge 0x84fcb6 movq -0xc8(%rbp), %rdi callq 0x840910 movq %rax, -0x210(%rbp) jmp 0x84fcc7 movq -0x20(%rbp), %rax movl 0x6cc(%rax), %eax movq %rax, -0x210(%rbp) movq -0x210(%rbp), %rax movq %rax, -0x1d0(%rbp) jmp 0x84fced movq -0x20(%rbp), %rax movl 0x6cc(%rax), %eax subl $0x1, %eax movl %eax, %eax movq %rax, -0x1d0(%rbp) movl -0xe4(%rbp), %edi movq -0xd8(%rbp), %rsi movq -0x1d0(%rbp), %rdx callq 0x3da70 movq %rax, -0x1c8(%rbp) cmpq $0x0, -0x1c8(%rbp) jle 0x84fd29 movq -0xd8(%rbp), %rax movq -0x1c8(%rbp), %rcx movb $0x0, (%rax,%rcx) cmpq $0x0, -0x1c8(%rbp) jle 0x84fd46 testb $0x1, -0xc9(%rbp) je 0x84fd4b cmpq $0x0, -0xc8(%rbp) jne 0x84fd4b jmp 0x84fe16 movq -0x1c8(%rbp), %rax addq -0xe0(%rbp), %rax movq %rax, -0xe0(%rbp) testb $0x1, -0xc9(%rbp) je 0x84fd81 movq -0x1c8(%rbp), %rcx movq -0xc8(%rbp), %rax subq %rcx, %rax movq %rax, -0xc8(%rbp) movq -0x20(%rbp), %rdi movq -0xd8(%rbp), %rdx movq -0x1c8(%rbp), %rcx movl $0x1, %esi callq 0x821330 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x84fdb1 movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) jmp 0x84fe31 movq -0x20(%rbp), %rdi movq -0xe0(%rbp), %rsi callq 0x81f860 movq -0x20(%rbp), %rdi callq 0x81f0d0 cmpl $0x0, %eax je 0x84fdd8 movl $0x2a, -0x2c(%rbp) jmp 0x84fe11 movq -0x20(%rbp), %rax movq %rax, -0x218(%rbp) callq 0x831130 movq -0x218(%rbp), %rdi movq %rax, -0x1e0(%rbp) movl %edx, -0x1d8(%rbp) movq -0x1e0(%rbp), %rsi movl -0x1d8(%rbp), %edx callq 0x82f690 movl %eax, -0x2c(%rbp) jmp 0x84fc70 movq -0x20(%rbp), %rdi callq 0x81f0d0 cmpl $0x0, %eax je 0x84fe2b movl $0x2a, -0x2c(%rbp) movl -0x2c(%rbp), %eax movl %eax, -0x14(%rbp) movl -0x14(%rbp), %eax addq $0x230, %rsp # imm = 0x230 popq %rbx popq %r14 popq %rbp retq
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/file.c
file_connect
static CURLcode file_connect(struct Curl_easy *data, bool *done) { char *real_path; struct FILEPROTO *file = data->req.p.file; int fd; #ifdef DOS_FILESYSTEM size_t i; char *actual_path; #endif size_t real_path_len; CURLcode result = Curl_urldecode(data->state.up.path, 0, &real_path, &real_path_len, REJECT_ZERO); if(result) return result; #ifdef DOS_FILESYSTEM /* If the first character is a slash, and there's something that looks like a drive at the beginning of the path, skip the slash. If we remove the initial slash in all cases, paths without drive letters end up relative to the current directory which isn't how browsers work. Some browsers accept | instead of : as the drive letter separator, so we do too. On other platforms, we need the slash to indicate an absolute pathname. On Windows, absolute paths start with a drive letter. */ actual_path = real_path; if((actual_path[0] == '/') && actual_path[1] && (actual_path[2] == ':' || actual_path[2] == '|')) { actual_path[2] = ':'; actual_path++; real_path_len--; } /* change path separators from '/' to '\\' for DOS, Windows and OS/2 */ for(i = 0; i < real_path_len; ++i) if(actual_path[i] == '/') actual_path[i] = '\\'; else if(!actual_path[i]) { /* binary zero */ Curl_safefree(real_path); return CURLE_URL_MALFORMAT; } fd = open_readonly(actual_path, O_RDONLY|O_BINARY); file->path = actual_path; #else if(memchr(real_path, 0, real_path_len)) { /* binary zeroes indicate foul play */ Curl_safefree(real_path); return CURLE_URL_MALFORMAT; } #ifdef AMIGA_FILESYSTEM /* * A leading slash in an AmigaDOS path denotes the parent * directory, and hence we block this as it is relative. * Absolute paths start with 'volumename:', so we check for * this first. Failing that, we treat the path as a real unix * path, but only if the application was compiled with -lunix. */ fd = -1; file->path = real_path; if(real_path[0] == '/') { extern int __unix_path_semantics; if(strchr(real_path + 1, ':')) { /* Amiga absolute path */ fd = open_readonly(real_path + 1, O_RDONLY); file->path++; } else if(__unix_path_semantics) { /* -lunix fallback */ fd = open_readonly(real_path, O_RDONLY); } } #else fd = open_readonly(real_path, O_RDONLY); file->path = real_path; #endif #endif file->freepath = real_path; /* free this when done */ file->fd = fd; if(!data->set.upload && (fd == -1)) { failf(data, "Couldn't open file %s", data->state.up.path); file_done(data, CURLE_FILE_COULDNT_READ_FILE, FALSE); return CURLE_FILE_COULDNT_READ_FILE; } *done = TRUE; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq 0x11d0(%rax), %rdi xorl %eax, %eax movl %eax, %esi leaq -0x20(%rbp), %rdx leaq -0x38(%rbp), %rcx movl $0x4, %r8d callq 0x84f410 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x84ff25 movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x84fff3 movq -0x20(%rbp), %rdi movq -0x38(%rbp), %rdx xorl %esi, %esi callq 0x3d250 cmpq $0x0, %rax je 0x84ff60 jmp 0x84ff3c leaq 0x6ac4bd(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x20(%rbp), %rdi callq *%rax movq $0x0, -0x20(%rbp) movl $0x3, -0x4(%rbp) jmp 0x84fff3 movq -0x20(%rbp), %rdi xorl %esi, %esi movb $0x0, %al callq 0x3b0b0 movl %eax, -0x2c(%rbp) movq -0x20(%rbp), %rcx movq -0x28(%rbp), %rax movq %rcx, (%rax) movq -0x20(%rbp), %rcx movq -0x28(%rbp), %rax movq %rcx, 0x8(%rax) movl -0x2c(%rbp), %ecx movq -0x28(%rbp), %rax movl %ecx, 0x10(%rax) movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x1a, %rax andq $0x1, %rax cmpl $0x0, %eax jne 0x84ffe5 cmpl $-0x1, -0x2c(%rbp) jne 0x84ffe5 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0x11d0(%rax), %rdx leaq 0x354acf(%rip), %rsi # 0xba4a94 movb $0x0, %al callq 0x820e10 movq -0x10(%rbp), %rdi movl $0x25, %esi xorl %edx, %edx callq 0x84fe40 movl $0x25, -0x4(%rbp) jmp 0x84fff3 movq -0x18(%rbp), %rax movb $0x1, (%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/file.c
file_upload
static CURLcode file_upload(struct Curl_easy *data) { struct FILEPROTO *file = data->req.p.file; const char *dir = strchr(file->path, DIRSEP); int fd; int mode; CURLcode result = CURLE_OK; char *buf = data->state.buffer; curl_off_t bytecount = 0; struct_stat file_stat; const char *buf2; /* * Since FILE: doesn't do the full init, we need to provide some extra * assignments here. */ data->req.upload_fromhere = buf; if(!dir) return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */ if(!dir[1]) return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */ #ifdef O_BINARY #define MODE_DEFAULT O_WRONLY|O_CREAT|O_BINARY #else #define MODE_DEFAULT O_WRONLY|O_CREAT #endif if(data->state.resume_from) mode = MODE_DEFAULT|O_APPEND; else mode = MODE_DEFAULT|O_TRUNC; fd = open(file->path, mode, data->set.new_file_perms); if(fd < 0) { failf(data, "Can't open %s for writing", file->path); return CURLE_WRITE_ERROR; } if(-1 != data->state.infilesize) /* known size of data to "upload" */ Curl_pgrsSetUploadSize(data, data->state.infilesize); /* treat the negative resume offset value as the case of "-" */ if(data->state.resume_from < 0) { if(fstat(fd, &file_stat)) { close(fd); failf(data, "Can't get the size of %s", file->path); return CURLE_WRITE_ERROR; } data->state.resume_from = (curl_off_t)file_stat.st_size; } while(!result) { size_t nread; size_t nwrite; size_t readcount; result = Curl_fillreadbuffer(data, data->set.buffer_size, &readcount); if(result) break; if(!readcount) break; nread = readcount; /*skip bytes before resume point*/ if(data->state.resume_from) { if((curl_off_t)nread <= data->state.resume_from) { data->state.resume_from -= nread; nread = 0; buf2 = buf; } else { buf2 = buf + data->state.resume_from; nread -= (size_t)data->state.resume_from; data->state.resume_from = 0; } } else buf2 = buf; /* write the data to the target */ nwrite = write(fd, buf2, nread); if(nwrite != nread) { result = CURLE_SEND_ERROR; break; } bytecount += nread; Curl_pgrsSetUploadCounter(data, bytecount); if(Curl_pgrsUpdate(data)) result = CURLE_ABORTED_BY_CALLBACK; else result = Curl_speedcheck(data, Curl_now()); } if(!result && Curl_pgrsUpdate(data)) result = CURLE_ABORTED_BY_CALLBACK; close(fd); return result; }
pushq %rbp movq %rsp, %rbp subq $0x110, %rsp # imm = 0x110 movq %rdi, -0x10(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax movq (%rax), %rdi movl $0x2f, %esi callq 0x3d450 movq %rax, -0x20(%rbp) movl $0x0, -0x2c(%rbp) movq -0x10(%rbp), %rax movq 0xc70(%rax), %rax movq %rax, -0x38(%rbp) movq $0x0, -0x40(%rbp) movq -0x38(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x190(%rax) cmpq $0x0, -0x20(%rbp) jne 0x8500a3 movl $0x25, -0x4(%rbp) jmp 0x85037c movq -0x20(%rbp), %rax cmpb $0x0, 0x1(%rax) jne 0x8500b9 movl $0x25, -0x4(%rbp) jmp 0x85037c movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) je 0x8500d0 movl $0x441, -0x28(%rbp) # imm = 0x441 jmp 0x8500d7 movl $0x241, -0x28(%rbp) # imm = 0x241 movq -0x18(%rbp), %rax movq (%rax), %rdi movl -0x28(%rbp), %esi movq -0x10(%rbp), %rax movl 0x720(%rax), %edx movb $0x0, %al callq 0x3b0b0 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) jge 0x850120 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rax movq (%rax), %rdx leaq 0x354a27(%rip), %rsi # 0xba4b34 movb $0x0, %al callq 0x820e10 movl $0x17, -0x4(%rbp) jmp 0x85037c movq -0x10(%rbp), %rcx movq $-0x1, %rax cmpq 0x1168(%rcx), %rax je 0x850148 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0x1168(%rax), %rsi callq 0x81f320 movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) jge 0x8501a9 movl -0x24(%rbp), %edi leaq -0xd0(%rbp), %rsi callq 0x3d900 cmpl $0x0, %eax je 0x850197 movl -0x24(%rbp), %edi callq 0x3ce50 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rax movq (%rax), %rdx leaq 0x3549ca(%rip), %rsi # 0xba4b4e movb $0x0, %al callq 0x820e10 movl $0x17, -0x4(%rbp) jmp 0x85037c movq -0xa0(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x1160(%rax) jmp 0x8501ab cmpl $0x0, -0x2c(%rbp) setne %al xorb $-0x1, %al testb $0x1, %al jne 0x8501bd jmp 0x850353 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movl 0x6cc(%rax), %eax movl %eax, %esi leaq -0xf0(%rbp), %rdx callq 0x8313c0 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x8501e7 jmp 0x850353 cmpq $0x0, -0xf0(%rbp) jne 0x8501f6 jmp 0x850353 movq -0xf0(%rbp), %rax movq %rax, -0xe0(%rbp) movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) je 0x8502a1 movq -0xe0(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x1160(%rcx), %rax jg 0x85025e movq -0xe0(%rbp), %rdx movq -0x10(%rbp), %rax movq 0x1160(%rax), %rcx subq %rdx, %rcx movq %rcx, 0x1160(%rax) movq $0x0, -0xe0(%rbp) movq -0x38(%rbp), %rax movq %rax, -0xd8(%rbp) jmp 0x85029f movq -0x38(%rbp), %rax movq -0x10(%rbp), %rcx addq 0x1160(%rcx), %rax movq %rax, -0xd8(%rbp) movq -0x10(%rbp), %rax movq 0x1160(%rax), %rcx movq -0xe0(%rbp), %rax subq %rcx, %rax movq %rax, -0xe0(%rbp) movq -0x10(%rbp), %rax movq $0x0, 0x1160(%rax) jmp 0x8502ac movq -0x38(%rbp), %rax movq %rax, -0xd8(%rbp) movl -0x24(%rbp), %edi movq -0xd8(%rbp), %rsi movq -0xe0(%rbp), %rdx callq 0x3e020 movq %rax, -0xe8(%rbp) movq -0xe8(%rbp), %rax cmpq -0xe0(%rbp), %rax je 0x8502e2 movl $0x37, -0x2c(%rbp) jmp 0x850353 movq -0xe0(%rbp), %rax addq -0x40(%rbp), %rax movq %rax, -0x40(%rbp) movq -0x10(%rbp), %rdi movq -0x40(%rbp), %rsi callq 0x81f880 movq -0x10(%rbp), %rdi callq 0x81f0d0 cmpl $0x0, %eax je 0x850315 movl $0x2a, -0x2c(%rbp) jmp 0x85034e movq -0x10(%rbp), %rax movq %rax, -0x108(%rbp) callq 0x831130 movq -0x108(%rbp), %rdi movq %rax, -0x100(%rbp) movl %edx, -0xf8(%rbp) movq -0x100(%rbp), %rsi movl -0xf8(%rbp), %edx callq 0x82f690 movl %eax, -0x2c(%rbp) jmp 0x8501ab cmpl $0x0, -0x2c(%rbp) jne 0x85036e movq -0x10(%rbp), %rdi callq 0x81f0d0 cmpl $0x0, %eax je 0x85036e movl $0x2a, -0x2c(%rbp) movl -0x24(%rbp), %edi callq 0x3ce50 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x110, %rsp # imm = 0x110 popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/file.c
ftp_setup_connection
static CURLcode ftp_setup_connection(struct Curl_easy *data, struct connectdata *conn) { char *type; struct FTP *ftp; data->req.p.ftp = ftp = calloc(sizeof(struct FTP), 1); if(!ftp) return CURLE_OUT_OF_MEMORY; ftp->path = &data->state.up.path[1]; /* don't include the initial slash */ /* FTP URLs support an extension like ";type=<typecode>" that * we'll try to get now! */ type = strstr(ftp->path, ";type="); if(!type) type = strstr(conn->host.rawalloc, ";type="); if(type) { char command; *type = 0; /* it was in the middle of the hostname */ command = Curl_raw_toupper(type[6]); switch(command) { case 'A': /* ASCII mode */ data->state.prefer_ascii = TRUE; break; case 'D': /* directory mode */ data->state.list_only = TRUE; break; case 'I': /* binary mode */ default: /* switch off ASCII */ data->state.prefer_ascii = FALSE; break; } } /* get some initial data into the ftp struct */ ftp->transfer = PPTRANSFER_BODY; ftp->downloadsize = 0; conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x20, %edi movl $0x1, %esi leaq 0x6abe07(%rip), %rax # 0xefc418 callq *(%rax) movq %rax, %rcx movq %rcx, -0x28(%rbp) movq -0x10(%rbp), %rax movq %rcx, 0x198(%rax) cmpq $0x0, -0x28(%rbp) jne 0x850638 movl $0x1b, -0x4(%rbp) jmp 0x850751 movq -0x10(%rbp), %rax movq 0x11d0(%rax), %rcx addq $0x1, %rcx movq -0x28(%rbp), %rax movq %rcx, (%rax) movq -0x28(%rbp), %rax movq (%rax), %rdi leaq 0x3553f5(%rip), %rsi # 0xba5a51 callq 0x3ba00 movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) jne 0x850687 movq -0x18(%rbp), %rax movq 0x88(%rax), %rdi leaq 0x3553d3(%rip), %rsi # 0xba5a51 callq 0x3ba00 movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x850724 movq -0x20(%rbp), %rax movb $0x0, (%rax) movq -0x20(%rbp), %rax movsbl 0x6(%rax), %edi callq 0x830120 movb %al, -0x29(%rbp) movsbl -0x29(%rbp), %eax movl %eax, -0x30(%rbp) subl $0x41, %eax je 0x8506cb jmp 0x8506b7 movl -0x30(%rbp), %eax subl $0x44, %eax je 0x8506e9 jmp 0x8506c1 movl -0x30(%rbp), %eax subl $0x49, %eax je 0x850707 jmp 0x850709 movq -0x10(%rbp), %rax movl 0x1300(%rax), %ecx andl $0xffff7fff, %ecx # imm = 0xFFFF7FFF orl $0x8000, %ecx # imm = 0x8000 movl %ecx, 0x1300(%rax) jmp 0x850722 movq -0x10(%rbp), %rax movl 0x1300(%rax), %ecx andl $0xfffeffff, %ecx # imm = 0xFFFEFFFF orl $0x10000, %ecx # imm = 0x10000 movl %ecx, 0x1300(%rax) jmp 0x850722 jmp 0x850709 movq -0x10(%rbp), %rax movl 0x1300(%rax), %ecx andl $0xffff7fff, %ecx # imm = 0xFFFF7FFF orl $0x0, %ecx movl %ecx, 0x1300(%rax) jmp 0x850724 movq -0x28(%rbp), %rax movl $0x0, 0x10(%rax) movq -0x28(%rbp), %rax movq $0x0, 0x18(%rax) movq -0x18(%rbp), %rax movq $-0x1, 0x530(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_do
static CURLcode ftp_do(struct Curl_easy *data, bool *done) { CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; *done = FALSE; /* default to false */ ftpc->wait_data_conn = FALSE; /* default to no such wait */ if(data->state.wildcardmatch) { result = wc_statemach(data); if(data->wildcard.state == CURLWC_SKIP || data->wildcard.state == CURLWC_DONE) { /* do not call ftp_regular_transfer */ return CURLE_OK; } if(result) /* error, loop or skipping the file */ return result; } else { /* no wildcard FSM needed */ result = ftp_parse_url_path(data); if(result) return result; } result = ftp_regular_transfer(data, done); return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x30(%rbp) movq -0x18(%rbp), %rax movb $0x0, (%rax) movq -0x30(%rbp), %rax movb $0x0, 0xad(%rax) movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0x6, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x8507f7 movq -0x10(%rbp), %rdi callq 0x8570a0 movl %eax, -0x1c(%rbp) movq -0x10(%rbp), %rax cmpl $0x5, 0x1308(%rax) je 0x8507de movq -0x10(%rbp), %rax cmpl $0x7, 0x1308(%rax) jne 0x8507e7 movl $0x0, -0x4(%rbp) jmp 0x850829 cmpl $0x0, -0x1c(%rbp) je 0x8507f5 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x850829 jmp 0x850813 movq -0x10(%rbp), %rdi callq 0x8574b0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x850811 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x850829 jmp 0x850813 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x857aa0 movl %eax, -0x1c(%rbp) movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_done
static CURLcode ftp_done(struct Curl_easy *data, CURLcode status, bool premature) { struct connectdata *conn = data->conn; struct FTP *ftp = data->req.p.ftp; struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; ssize_t nread; int ftpcode; CURLcode result = CURLE_OK; char *rawPath = NULL; size_t pathLen = 0; if(!ftp) return CURLE_OK; switch(status) { case CURLE_BAD_DOWNLOAD_RESUME: case CURLE_FTP_WEIRD_PASV_REPLY: case CURLE_FTP_PORT_FAILED: case CURLE_FTP_ACCEPT_FAILED: case CURLE_FTP_ACCEPT_TIMEOUT: case CURLE_FTP_COULDNT_SET_TYPE: case CURLE_FTP_COULDNT_RETR_FILE: case CURLE_PARTIAL_FILE: case CURLE_UPLOAD_FAILED: case CURLE_REMOTE_ACCESS_DENIED: case CURLE_FILESIZE_EXCEEDED: case CURLE_REMOTE_FILE_NOT_FOUND: case CURLE_WRITE_ERROR: /* the connection stays alive fine even though this happened */ /* fall-through */ case CURLE_OK: /* doesn't affect the control connection's status */ if(!premature) break; /* until we cope better with prematurely ended requests, let them * fallback as if in complete failure */ /* FALLTHROUGH */ default: /* by default, an error means the control connection is wedged and should not be used anymore */ ftpc->ctl_valid = FALSE; ftpc->cwdfail = TRUE; /* set this TRUE to prevent us to remember the current path, as this connection is going */ connclose(conn, "FTP ended with bad error code"); result = status; /* use the already set error code */ break; } if(data->state.wildcardmatch) { if(data->set.chunk_end && ftpc->file) { Curl_set_in_callback(data, true); data->set.chunk_end(data->wildcard.customptr); Curl_set_in_callback(data, false); } ftpc->known_filesize = -1; } if(!result) /* get the url-decoded "raw" path */ result = Curl_urldecode(ftp->path, 0, &rawPath, &pathLen, REJECT_CTRL); if(result) { /* We can limp along anyway (and should try to since we may already be in * the error path) */ ftpc->ctl_valid = FALSE; /* mark control connection as bad */ connclose(conn, "FTP: out of memory!"); /* mark for connection closure */ free(ftpc->prevpath); ftpc->prevpath = NULL; /* no path remembering */ } else { /* remember working directory for connection reuse */ if((data->set.ftp_filemethod == FTPFILE_NOCWD) && (rawPath[0] == '/')) free(rawPath); /* full path => no CWDs happened => keep ftpc->prevpath */ else { free(ftpc->prevpath); if(!ftpc->cwdfail) { if(data->set.ftp_filemethod == FTPFILE_NOCWD) pathLen = 0; /* relative path => working directory is FTP home */ else pathLen -= ftpc->file?strlen(ftpc->file):0; /* file is url-decoded */ rawPath[pathLen] = '\0'; ftpc->prevpath = rawPath; } else { free(rawPath); ftpc->prevpath = NULL; /* no path */ } } if(ftpc->prevpath) infof(data, "Remembering we are in dir \"%s\"", ftpc->prevpath); } /* free the dir tree and file parts */ freedirs(ftpc); /* shut down the socket to inform the server we're done */ #ifdef _WIN32_WCE shutdown(conn->sock[SECONDARYSOCKET], 2); /* SD_BOTH */ #endif if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) { if(!result && ftpc->dont_check && data->req.maxdownload > 0) { /* partial download completed */ result = Curl_pp_sendf(data, pp, "%s", "ABOR"); if(result) { failf(data, "Failure sending ABOR command: %s", curl_easy_strerror(result)); ftpc->ctl_valid = FALSE; /* mark control connection as bad */ connclose(conn, "ABOR command failed"); /* connection closure */ } } if(conn->ssl[SECONDARYSOCKET].use) { /* The secondary socket is using SSL so we must close down that part first before we close the socket for real */ Curl_ssl_close(data, conn, SECONDARYSOCKET); /* Note that we keep "use" set to TRUE since that (next) connection is still requested to use SSL */ } close_secondarysocket(data, conn); } if(!result && (ftp->transfer == PPTRANSFER_BODY) && ftpc->ctl_valid && pp->pending_resp && !premature) { /* * Let's see what the server says about the transfer we just performed, * but lower the timeout as sometimes this connection has died while the * data has been transferred. This happens when doing through NATs etc that * abandon old silent connections. */ timediff_t old_time = pp->response_time; pp->response_time = 60*1000; /* give it only a minute for now */ pp->response = Curl_now(); /* timeout relative now */ result = Curl_GetFTPResponse(data, &nread, &ftpcode); pp->response_time = old_time; /* set this back to previous value */ if(!nread && (CURLE_OPERATION_TIMEDOUT == result)) { failf(data, "control connection looks dead"); ftpc->ctl_valid = FALSE; /* mark control connection as bad */ connclose(conn, "Timeout or similar in FTP DONE operation"); /* close */ } if(result) { Curl_safefree(ftp->pathalloc); return result; } if(ftpc->dont_check && data->req.maxdownload > 0) { /* we have just sent ABOR and there is no reliable way to check if it was * successful or not; we have to close the connection now */ infof(data, "partial download completed, closing connection"); connclose(conn, "Partial download with no ability to check"); return result; } if(!ftpc->dont_check) { /* 226 Transfer complete, 250 Requested file action okay, completed. */ switch(ftpcode) { case 226: case 250: break; case 552: failf(data, "Exceeded storage allocation"); result = CURLE_REMOTE_DISK_FULL; break; default: failf(data, "server did not report OK, got %d", ftpcode); result = CURLE_PARTIAL_FILE; break; } } } if(result || premature) /* the response code from the transfer showed an error already so no use checking further */ ; else if(data->set.upload) { if((-1 != data->state.infilesize) && (data->state.infilesize != data->req.writebytecount) && !data->set.crlf && (ftp->transfer == PPTRANSFER_BODY)) { failf(data, "Uploaded unaligned file size (%" CURL_FORMAT_CURL_OFF_T " out of %" CURL_FORMAT_CURL_OFF_T " bytes)", data->req.writebytecount, data->state.infilesize); result = CURLE_PARTIAL_FILE; } } else { if((-1 != data->req.size) && (data->req.size != data->req.bytecount) && #ifdef CURL_DO_LINEEND_CONV /* Most FTP servers don't adjust their file SIZE response for CRLFs, so * we'll check to see if the discrepancy can be explained by the number * of CRLFs we've changed to LFs. */ ((data->req.size + data->state.crlf_conversions) != data->req.bytecount) && #endif /* CURL_DO_LINEEND_CONV */ (data->req.maxdownload != data->req.bytecount)) { failf(data, "Received only partial file: %" CURL_FORMAT_CURL_OFF_T " bytes", data->req.bytecount); result = CURLE_PARTIAL_FILE; } else if(!ftpc->dont_check && !data->req.bytecount && (data->req.size>0)) { failf(data, "No data was received"); result = CURLE_FTP_COULDNT_RETR_FILE; } } /* clear these for next connection */ ftp->transfer = PPTRANSFER_BODY; ftpc->dont_check = FALSE; /* Send any post-transfer QUOTE strings? */ if(!status && !result && !premature && data->set.postquote) result = ftp_sendquote(data, conn, data->set.postquote); Curl_safefree(ftp->pathalloc); return result; }
pushq %rbp movq %rsp, %rbp subq $0xa0, %rsp movb %dl, %al movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) andb $0x1, %al movb %al, -0x15(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax movq %rax, -0x38(%rbp) movl $0x0, -0x48(%rbp) movq $0x0, -0x50(%rbp) movq $0x0, -0x58(%rbp) cmpq $0x0, -0x28(%rbp) jne 0x8508b4 movl $0x0, -0x4(%rbp) jmp 0x850fb4 movl -0x14(%rbp), %eax movq %rax, -0x78(%rbp) subq $0x4e, %rax ja 0x8508df movq -0x78(%rbp), %rax leaq 0x3542d4(%rip), %rcx # 0xba4ba0 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax testb $0x1, -0x15(%rbp) jne 0x8508dd jmp 0x850909 jmp 0x8508df movq -0x30(%rbp), %rax movb $0x0, 0xa5(%rax) movq -0x30(%rbp), %rax movb $0x1, 0xac(%rax) movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 movl -0x14(%rbp), %eax movl %eax, -0x48(%rbp) movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0x6, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x85097a movq -0x10(%rbp), %rax cmpq $0x0, 0xa00(%rax) je 0x85096b movq -0x30(%rbp), %rax cmpq $0x0, 0x90(%rax) je 0x85096b movq -0x10(%rbp), %rdi movl $0x1, %esi callq 0x81e430 movq -0x10(%rbp), %rax movq 0xa00(%rax), %rax movq -0x10(%rbp), %rcx movq 0x1350(%rcx), %rdi callq *%rax movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x81e430 movq -0x30(%rbp), %rax movq $-0x1, 0xe8(%rax) cmpl $0x0, -0x48(%rbp) jne 0x8509a1 movq -0x28(%rbp), %rax movq (%rax), %rdi xorl %eax, %eax movl %eax, %esi leaq -0x50(%rbp), %rdx leaq -0x58(%rbp), %rcx movl $0x3, %r8d callq 0x84f410 movl %eax, -0x48(%rbp) cmpl $0x0, -0x48(%rbp) je 0x8509eb movq -0x30(%rbp), %rax movb $0x0, 0xa5(%rax) movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 leaq 0x6aba39(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rcx movq 0xb8(%rcx), %rdi callq *%rax movq -0x30(%rbp), %rax movq $0x0, 0xb8(%rax) jmp 0x850b00 movq -0x10(%rbp), %rax movzbl 0x6f8(%rax), %eax cmpl $0x2, %eax jne 0x850a1c movq -0x50(%rbp), %rax movsbl (%rax), %eax cmpl $0x2f, %eax jne 0x850a1c leaq 0x6ab9f2(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x50(%rbp), %rdi callq *%rax jmp 0x850ad3 leaq 0x6ab9dd(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rcx movq 0xb8(%rcx), %rdi callq *%rax movq -0x30(%rbp), %rax testb $0x1, 0xac(%rax) jne 0x850ab2 movq -0x10(%rbp), %rax movzbl 0x6f8(%rax), %eax cmpl $0x2, %eax jne 0x850a5a movq $0x0, -0x58(%rbp) jmp 0x850a95 movq -0x30(%rbp), %rax cmpq $0x0, 0x90(%rax) je 0x850a7e movq -0x30(%rbp), %rax movq 0x90(%rax), %rdi callq 0x3b8f0 movq %rax, -0x80(%rbp) jmp 0x850a86 xorl %eax, %eax movq %rax, -0x80(%rbp) jmp 0x850a86 movq -0x80(%rbp), %rcx movq -0x58(%rbp), %rax subq %rcx, %rax movq %rax, -0x58(%rbp) movq -0x50(%rbp), %rax movq -0x58(%rbp), %rcx movb $0x0, (%rax,%rcx) movq -0x50(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, 0xb8(%rax) jmp 0x850ad1 leaq 0x6ab947(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x50(%rbp), %rdi callq *%rax movq -0x30(%rbp), %rax movq $0x0, 0xb8(%rax) jmp 0x850ad3 movq -0x30(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x850afe movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rax movq 0xb8(%rax), %rdx leaq 0x354cf3(%rip), %rsi # 0xba57ea movb $0x0, %al callq 0x820bf0 jmp 0x850b00 movq -0x30(%rbp), %rdi callq 0x856e60 movq -0x20(%rbp), %rax cmpl $-0x1, 0x1e4(%rax) je 0x850bde cmpl $0x0, -0x48(%rbp) jne 0x850bab movq -0x30(%rbp), %rax testb $0x1, 0xa4(%rax) je 0x850bab movq -0x10(%rbp), %rax cmpq $0x0, 0xd8(%rax) jle 0x850bab movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi leaq 0x353d74(%rip), %rdx # 0xba48c2 leaq 0x354cb4(%rip), %rcx # 0xba5809 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x48(%rbp) cmpl $0x0, -0x48(%rbp) je 0x850ba9 movq -0x10(%rbp), %rax movq %rax, -0x88(%rbp) movl -0x48(%rbp), %edi callq 0x8306b0 movq -0x88(%rbp), %rdi movq %rax, %rdx leaq 0x354c85(%rip), %rsi # 0xba580e movb $0x0, %al callq 0x820e10 movq -0x30(%rbp), %rax movb $0x0, 0xa5(%rax) movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 jmp 0x850bab movq -0x20(%rbp), %rax movb 0x240(%rax), %al andb $0x1, %al movzbl %al, %eax cmpl $0x0, %eax je 0x850bd1 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movl $0x1, %edx callq 0x8448f0 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x856240 cmpl $0x0, -0x48(%rbp) jne 0x850db7 movq -0x28(%rbp), %rax cmpl $0x0, 0x10(%rax) jne 0x850db7 movq -0x30(%rbp), %rax testb $0x1, 0xa5(%rax) je 0x850db7 movq -0x38(%rbp), %rax testb $0x1, 0x20(%rax) je 0x850db7 testb $0x1, -0x15(%rbp) jne 0x850db7 movq -0x38(%rbp), %rax movq 0x50(%rax), %rax movq %rax, -0x60(%rbp) movq -0x38(%rbp), %rax movq $0xea60, 0x50(%rax) # imm = 0xEA60 movq -0x38(%rbp), %rax movq %rax, -0x90(%rbp) callq 0x831130 movq %rax, %rcx movq -0x90(%rbp), %rax movq %rcx, -0x70(%rbp) movl %edx, -0x68(%rbp) movq -0x70(%rbp), %rcx movq %rcx, 0x40(%rax) movq -0x68(%rbp), %rcx movq %rcx, 0x48(%rax) movq -0x10(%rbp), %rdi leaq -0x40(%rbp), %rsi leaq -0x44(%rbp), %rdx callq 0x8518a0 movl %eax, -0x48(%rbp) movq -0x60(%rbp), %rcx movq -0x38(%rbp), %rax movq %rcx, 0x50(%rax) cmpq $0x0, -0x40(%rbp) jne 0x850cc4 movl $0x1c, %eax cmpl -0x48(%rbp), %eax jne 0x850cc4 movq -0x10(%rbp), %rdi leaq 0x354b8b(%rip), %rsi # 0xba582f movb $0x0, %al callq 0x820e10 movq -0x30(%rbp), %rax movb $0x0, 0xa5(%rax) movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 cmpl $0x0, -0x48(%rbp) je 0x850cf7 jmp 0x850ccc leaq 0x6ab72d(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x28(%rbp), %rcx movq 0x8(%rcx), %rdi callq *%rax movq -0x28(%rbp), %rax movq $0x0, 0x8(%rax) movl -0x48(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x850fb4 movq -0x30(%rbp), %rax testb $0x1, 0xa4(%rax) je 0x850d3d movq -0x10(%rbp), %rax cmpq $0x0, 0xd8(%rax) jle 0x850d3d movq -0x10(%rbp), %rdi leaq 0x354b30(%rip), %rsi # 0xba584d movb $0x0, %al callq 0x820bf0 movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 movl -0x48(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x850fb4 movq -0x30(%rbp), %rax testb $0x1, 0xa4(%rax) jne 0x850db5 movl -0x44(%rbp), %eax movl %eax, -0x94(%rbp) subl $0xe2, %eax je 0x850d7a jmp 0x850d5c movl -0x94(%rbp), %eax subl $0xfa, %eax je 0x850d7a jmp 0x850d6b movl -0x94(%rbp), %eax subl $0x228, %eax # imm = 0x228 je 0x850d7c jmp 0x850d97 jmp 0x850db3 movq -0x10(%rbp), %rdi leaq 0x354af5(%rip), %rsi # 0xba587c movb $0x0, %al callq 0x820e10 movl $0x46, -0x48(%rbp) jmp 0x850db3 movq -0x10(%rbp), %rdi movl -0x44(%rbp), %edx leaq 0x354af3(%rip), %rsi # 0xba5898 movb $0x0, %al callq 0x820e10 movl $0x12, -0x48(%rbp) jmp 0x850db5 jmp 0x850db7 cmpl $0x0, -0x48(%rbp) jne 0x850dc3 testb $0x1, -0x15(%rbp) je 0x850dc8 jmp 0x850f3b movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x1a, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x850e66 movq -0x10(%rbp), %rcx movq $-0x1, %rax cmpq 0x1168(%rcx), %rax je 0x850e61 movq -0x10(%rbp), %rax movq 0x1168(%rax), %rax movq -0x10(%rbp), %rcx cmpq 0xe8(%rcx), %rax je 0x850e61 movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x3, %rax andq $0x1, %rax cmpl $0x0, %eax jne 0x850e61 movq -0x28(%rbp), %rax cmpl $0x0, 0x10(%rax) jne 0x850e61 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0xe8(%rax), %rdx movq -0x10(%rbp), %rax movq 0x1168(%rax), %rcx leaq 0x354a66(%rip), %rsi # 0xba58b9 movb $0x0, %al callq 0x820e10 movl $0x12, -0x48(%rbp) jmp 0x850f39 movq -0x10(%rbp), %rcx movq $-0x1, %rax cmpq 0xd0(%rcx), %rax je 0x850ef3 movq -0x10(%rbp), %rax movq 0xd0(%rax), %rax movq -0x10(%rbp), %rcx cmpq 0xe0(%rcx), %rax je 0x850ef3 movq -0x10(%rbp), %rax movq 0xd0(%rax), %rax movq -0x10(%rbp), %rcx addq 0x1150(%rcx), %rax movq -0x10(%rbp), %rcx cmpq 0xe0(%rcx), %rax je 0x850ef3 movq -0x10(%rbp), %rax movq 0xd8(%rax), %rax movq -0x10(%rbp), %rcx cmpq 0xe0(%rcx), %rax je 0x850ef3 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0xe0(%rax), %rdx leaq 0x354a0a(%rip), %rsi # 0xba58ed movb $0x0, %al callq 0x820e10 movl $0x12, -0x48(%rbp) jmp 0x850f37 movq -0x30(%rbp), %rax testb $0x1, 0xa4(%rax) jne 0x850f35 movq -0x10(%rbp), %rax cmpq $0x0, 0xe0(%rax) jne 0x850f35 movq -0x10(%rbp), %rax cmpq $0x0, 0xd0(%rax) jle 0x850f35 movq -0x10(%rbp), %rdi leaq 0x3549ec(%rip), %rsi # 0xba5913 movb $0x0, %al callq 0x820e10 movl $0x13, -0x48(%rbp) jmp 0x850f37 jmp 0x850f39 jmp 0x850f3b movq -0x28(%rbp), %rax movl $0x0, 0x10(%rax) movq -0x30(%rbp), %rax movb $0x0, 0xa4(%rax) cmpl $0x0, -0x14(%rbp) jne 0x850f8c cmpl $0x0, -0x48(%rbp) jne 0x850f8c testb $0x1, -0x15(%rbp) jne 0x850f8c movq -0x10(%rbp), %rax cmpq $0x0, 0x4f8(%rax) je 0x850f8c movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x10(%rbp), %rax movq 0x4f8(%rax), %rdx callq 0x856f60 movl %eax, -0x48(%rbp) jmp 0x850f8e leaq 0x6ab46b(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x28(%rbp), %rcx movq 0x8(%rcx), %rdi callq *%rax movq -0x28(%rbp), %rax movq $0x0, 0x8(%rax) movl -0x48(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xa0, %rsp popq %rbp retq
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_do_more
static CURLcode ftp_do_more(struct Curl_easy *data, int *completep) { struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result = CURLE_OK; bool connected = FALSE; bool complete = FALSE; /* the ftp struct is inited in ftp_connect(). If we are connecting to an HTTP * proxy then the state will not be valid until after that connection is * complete */ struct FTP *ftp = NULL; /* if the second connection isn't done yet, wait for it */ if(!conn->bits.tcpconnect[SECONDARYSOCKET]) { if(Curl_connect_ongoing(conn)) { /* As we're in TUNNEL_CONNECT state now, we know the proxy name and port aren't used so we blank their arguments. */ result = Curl_proxyCONNECT(data, SECONDARYSOCKET, NULL, 0); return result; } result = Curl_is_connected(data, conn, SECONDARYSOCKET, &connected); /* Ready to do more? */ if(connected) { DEBUGF(infof(data, "DO-MORE connected phase starts")); } else { if(result && (ftpc->count1 == 0)) { *completep = -1; /* go back to DOING please */ /* this is a EPSV connect failing, try PASV instead */ return ftp_epsv_disable(data, conn); } return result; } } #ifndef CURL_DISABLE_PROXY result = Curl_proxy_connect(data, SECONDARYSOCKET); if(result) return result; if(CONNECT_SECONDARYSOCKET_PROXY_SSL()) return result; if(conn->bits.tunnel_proxy && conn->bits.httpproxy && Curl_connect_ongoing(conn)) return result; #endif /* Curl_proxy_connect might have moved the protocol state */ ftp = data->req.p.ftp; if(ftpc->state) { /* already in a state so skip the initial commands. They are only done to kickstart the do_more state */ result = ftp_multi_statemach(data, &complete); *completep = (int)complete; /* if we got an error or if we don't wait for a data connection return immediately */ if(result || !ftpc->wait_data_conn) return result; /* if we reach the end of the FTP state machine here, *complete will be TRUE but so is ftpc->wait_data_conn, which says we need to wait for the data connection and therefore we're not actually complete */ *completep = 0; } if(ftp->transfer <= PPTRANSFER_INFO) { /* a transfer is about to take place, or if not a file name was given so we'll do a SIZE on it later and then we need the right TYPE first */ if(ftpc->wait_data_conn == TRUE) { bool serv_conned; result = ReceivedServerConnect(data, &serv_conned); if(result) return result; /* Failed to accept data connection */ if(serv_conned) { /* It looks data connection is established */ result = AcceptServerConnect(data); ftpc->wait_data_conn = FALSE; if(!result) result = InitiateTransfer(data); if(result) return result; *completep = 1; /* this state is now complete when the server has connected back to us */ } } else if(data->set.upload) { result = ftp_nb_type(data, conn, data->state.prefer_ascii, FTP_STOR_TYPE); if(result) return result; result = ftp_multi_statemach(data, &complete); if(ftpc->wait_data_conn) /* if we reach the end of the FTP state machine here, *complete will be TRUE but so is ftpc->wait_data_conn, which says we need to wait for the data connection and therefore we're not actually complete */ *completep = 0; else *completep = (int)complete; } else { /* download */ ftp->downloadsize = -1; /* unknown as of yet */ result = Curl_range(data); if(result == CURLE_OK && data->req.maxdownload >= 0) { /* Don't check for successful transfer */ ftpc->dont_check = TRUE; } if(result) ; else if(data->state.list_only || !ftpc->file) { /* The specified path ends with a slash, and therefore we think this is a directory that is requested, use LIST. But before that we need to set ASCII transfer mode. */ /* But only if a body transfer was requested. */ if(ftp->transfer == PPTRANSFER_BODY) { result = ftp_nb_type(data, conn, TRUE, FTP_LIST_TYPE); if(result) return result; } /* otherwise just fall through */ } else { result = ftp_nb_type(data, conn, data->state.prefer_ascii, FTP_RETR_TYPE); if(result) return result; } result = ftp_multi_statemach(data, &complete); *completep = (int)complete; } return result; } /* no data to transfer */ Curl_setup_transfer(data, -1, -1, FALSE, -1); if(!ftpc->wait_data_conn) { /* no waiting for the data connection so this is now complete */ *completep = 1; DEBUGF(infof(data, "DO-MORE phase ends with %d", (int)result)); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movl $0x0, -0x2c(%rbp) movb $0x0, -0x2d(%rbp) movb $0x0, -0x2e(%rbp) movq $0x0, -0x38(%rbp) movq -0x20(%rbp), %rax testb $0x1, 0x371(%rax) jne 0x8510a7 movq -0x20(%rbp), %rdi callq 0x8672c0 testb $0x1, %al jne 0x851021 jmp 0x851043 movq -0x10(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %edx xorl %ecx, %ecx callq 0x8671e0 movl %eax, -0x2c(%rbp) movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movl $0x1, %edx leaq -0x2d(%rbp), %rcx callq 0x847b10 movl %eax, -0x2c(%rbp) testb $0x1, -0x2d(%rbp) je 0x851068 jmp 0x851064 jmp 0x851066 jmp 0x8510a5 cmpl $0x0, -0x2c(%rbp) je 0x85109a movq -0x28(%rbp), %rax cmpl $0x0, 0xc4(%rax) jne 0x85109a movq -0x18(%rbp), %rax movl $0xffffffff, (%rax) # imm = 0xFFFFFFFF movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x856590 movl %eax, -0x4(%rbp) jmp 0x851401 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 jmp 0x8510a7 movq -0x10(%rbp), %rdi movl $0x1, %esi callq 0x866fc0 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x8510c9 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x20(%rbp), %rax movzbl 0x140(%rax), %eax cmpl $0x2, %eax jne 0x8510f1 movq -0x20(%rbp), %rax testb $0x1, 0x373(%rax) jne 0x8510f1 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x20(%rbp), %rax movl 0x374(%rax), %eax shrl $0x3, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x851132 movq -0x20(%rbp), %rax movl 0x374(%rax), %eax andl $0x1, %eax cmpl $0x0, %eax je 0x851132 movq -0x20(%rbp), %rdi callq 0x8672c0 testb $0x1, %al jne 0x851127 jmp 0x851132 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x38(%rbp) movq -0x28(%rbp), %rax cmpl $0x0, 0xd0(%rax) je 0x851194 movq -0x10(%rbp), %rdi leaq -0x2e(%rbp), %rsi callq 0x851520 movl %eax, -0x2c(%rbp) movb -0x2e(%rbp), %al andb $0x1, %al movzbl %al, %ecx movq -0x18(%rbp), %rax movl %ecx, (%rax) cmpl $0x0, -0x2c(%rbp) jne 0x85117f movq -0x28(%rbp), %rax testb $0x1, 0xad(%rax) jne 0x85118a movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x18(%rbp), %rax movl $0x0, (%rax) movq -0x38(%rbp), %rax cmpl $0x1, 0x10(%rax) ja 0x8513c5 movq -0x28(%rbp), %rax movb 0xad(%rax), %al andb $0x1, %al movzbl %al, %eax cmpl $0x1, %eax jne 0x851226 movq -0x10(%rbp), %rdi leaq -0x39(%rbp), %rsi callq 0x856af0 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x8511d7 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 testb $0x1, -0x39(%rbp) je 0x851221 movq -0x10(%rbp), %rdi callq 0x856cc0 movl %eax, -0x2c(%rbp) movq -0x28(%rbp), %rax movb $0x0, 0xad(%rax) cmpl $0x0, -0x2c(%rbp) jne 0x851206 movq -0x10(%rbp), %rdi callq 0x856920 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x851217 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x18(%rbp), %rax movl $0x1, (%rax) jmp 0x8513bd movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x1a, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x8512bc movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0xf, %eax andl $0x1, %eax cmpl $0x0, %eax setne %al movzbl %al, %edx andl $0x1, %edx movl $0x16, %ecx callq 0x855010 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x851280 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x10(%rbp), %rdi leaq -0x2e(%rbp), %rsi callq 0x851520 movl %eax, -0x2c(%rbp) movq -0x28(%rbp), %rax testb $0x1, 0xad(%rax) je 0x8512a9 movq -0x18(%rbp), %rax movl $0x0, (%rax) jmp 0x8512b7 movb -0x2e(%rbp), %al andb $0x1, %al movzbl %al, %ecx movq -0x18(%rbp), %rax movl %ecx, (%rax) jmp 0x8513bb movq -0x38(%rbp), %rax movq $-0x1, 0x18(%rax) movq -0x10(%rbp), %rdi callq 0x87a260 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) jne 0x8512f3 movq -0x10(%rbp), %rax cmpq $0x0, 0xd8(%rax) jl 0x8512f3 movq -0x28(%rbp), %rax movb $0x1, 0xa4(%rax) cmpl $0x0, -0x2c(%rbp) je 0x8512fe jmp 0x85139d movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0x10, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x851321 movq -0x28(%rbp), %rax cmpq $0x0, 0x90(%rax) jne 0x85135a movq -0x38(%rbp), %rax cmpl $0x0, 0x10(%rax) jne 0x851358 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movl $0x1, %edx movl $0x14, %ecx callq 0x855010 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x851356 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 jmp 0x851358 jmp 0x85139b movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0xf, %eax andl $0x1, %eax cmpl $0x0, %eax setne %al movzbl %al, %edx andl $0x1, %edx movl $0x15, %ecx callq 0x855010 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x851399 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 jmp 0x85139b jmp 0x85139d movq -0x10(%rbp), %rdi leaq -0x2e(%rbp), %rsi callq 0x851520 movl %eax, -0x2c(%rbp) movb -0x2e(%rbp), %al andb $0x1, %al movzbl %al, %ecx movq -0x18(%rbp), %rax movl %ecx, (%rax) jmp 0x8513bd movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851401 movq -0x10(%rbp), %rdi movl $0xffffffff, %r8d # imm = 0xFFFFFFFF movq $-0x1, %rdx xorl %ecx, %ecx movl %r8d, %esi callq 0x8348c0 movq -0x28(%rbp), %rax testb $0x1, 0xad(%rax) jne 0x8513fb movq -0x18(%rbp), %rax movl $0x1, (%rax) jmp 0x8513f9 jmp 0x8513fb movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_connect
static CURLcode ftp_connect(struct Curl_easy *data, bool *done) /* see description above */ { CURLcode result; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; *done = FALSE; /* default to not done yet */ /* We always support persistent connections on ftp */ connkeep(conn, "FTP default"); PINGPONG_SETUP(pp, ftp_statemachine, ftp_endofresp); if(conn->handler->flags & PROTOPT_SSL) { /* BLOCKING */ result = Curl_ssl_connect(data, conn, FIRSTSOCKET); if(result) return result; conn->bits.ftp_use_control_ssl = TRUE; } Curl_pp_setup(pp); /* once per transfer */ Curl_pp_init(data, pp); /* init the generic pingpong data */ /* When we connect, we start in the state where we await the 220 response */ state(data, FTP_WAIT220); result = ftp_multi_statemach(data, done); return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax movq %rax, -0x38(%rbp) movq -0x18(%rbp), %rax movb $0x0, (%rax) movq -0x28(%rbp), %rdi xorl %esi, %esi callq 0x849490 movq -0x38(%rbp), %rax movq $0x1d4c0, 0x50(%rax) # imm = 0x1D4C0 movq -0x38(%rbp), %rax leaq 0x725(%rip), %rcx # 0x851b90 movq %rcx, 0x78(%rax) movq -0x38(%rbp), %rax leaq 0x1496(%rip), %rcx # 0x852910 movq %rcx, 0x80(%rax) movq -0x28(%rbp), %rax movq 0x398(%rax), %rax movl 0x8c(%rax), %eax andl $0x1, %eax cmpl $0x0, %eax je 0x8514d6 movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rsi xorl %edx, %edx callq 0x843950 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x8514ba movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851510 movq -0x28(%rbp), %rax movl 0x374(%rax), %ecx andl $0xffdfffff, %ecx # imm = 0xFFDFFFFF orl $0x200000, %ecx # imm = 0x200000 movl %ecx, 0x374(%rax) movq -0x38(%rbp), %rdi callq 0x86c0f0 movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi callq 0x86c080 movq -0x10(%rbp), %rdi movl $0x1, %esi callq 0x851b50 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x851520 movl %eax, -0x1c(%rbp) movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_multi_statemach
static CURLcode ftp_multi_statemach(struct Curl_easy *data, bool *done) { struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result = Curl_pp_statemach(data, &ftpc->pp, FALSE, FALSE); /* Check for the state outside of the Curl_socket_check() return code checks since at times we are in fact already in this state when this function gets called. */ *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE; return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movq -0x8(%rbp), %rdi movq -0x20(%rbp), %rsi xorl %ecx, %ecx movl %ecx, %edx callq 0x86be20 movl %eax, -0x24(%rbp) movq -0x20(%rbp), %rax movl 0xd0(%rax), %edx xorl %eax, %eax movl $0x1, %ecx cmpl $0x0, %edx cmovel %ecx, %eax cmpl $0x0, %eax setne %cl movq -0x10(%rbp), %rax andb $0x1, %cl movb %cl, (%rax) movl -0x24(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_doing
static CURLcode ftp_doing(struct Curl_easy *data, bool *dophase_done) { CURLcode result = ftp_multi_statemach(data, dophase_done); if(result) DEBUGF(infof(data, "DO phase failed")); else if(*dophase_done) { result = ftp_dophase_done(data, FALSE /* not connected */); DEBUGF(infof(data, "DO phase is complete2")); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi callq 0x851520 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) je 0x8515bc jmp 0x8515b8 jmp 0x8515ba jmp 0x8515d9 movq -0x10(%rbp), %rax testb $0x1, (%rax) je 0x8515d7 movq -0x8(%rbp), %rdi xorl %esi, %esi callq 0x856710 movl %eax, -0x14(%rbp) jmp 0x8515d5 jmp 0x8515d7 jmp 0x8515d9 movl -0x14(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_domore_getsock
static int ftp_domore_getsock(struct Curl_easy *data, struct connectdata *conn, curl_socket_t *socks) { struct ftp_conn *ftpc = &conn->proto.ftpc; (void)data; /* When in DO_MORE state, we could be either waiting for us to connect to a * remote site, or we could wait for that site to connect to us. Or just * handle ordinary commands. */ if(SOCKS_STATE(conn->cnnct.state)) return Curl_SOCKS_getsock(conn, socks, SECONDARYSOCKET); if(FTP_STOP == ftpc->state) { int bits = GETSOCK_READSOCK(0); bool any = FALSE; /* if stopped and still in this state, then we're also waiting for a connect on the secondary connection */ socks[0] = conn->sock[FIRSTSOCKET]; if(!data->set.ftp_use_port) { int s; int i; /* PORT is used to tell the server to connect to us, and during that we don't do happy eyeballs, but we do if we connect to the server */ for(s = 1, i = 0; i<2; i++) { if(conn->tempsock[i] != CURL_SOCKET_BAD) { socks[s] = conn->tempsock[i]; bits |= GETSOCK_WRITESOCK(s++); any = TRUE; } } } if(!any) { socks[1] = conn->sock[SECONDARYSOCKET]; bits |= GETSOCK_WRITESOCK(1) | GETSOCK_READSOCK(1); } return bits; } return Curl_pp_getsock(data, &conn->proto.ftpc.pp, socks); }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq -0x18(%rbp), %rax cmpl $0x1, (%rax) jb 0x85167e movq -0x18(%rbp), %rax cmpl $0x11, (%rax) jae 0x85167e movq -0x18(%rbp), %rdi movq -0x20(%rbp), %rsi movl $0x1, %edx callq 0x82d850 movl %eax, -0x4(%rbp) jmp 0x851776 movq -0x28(%rbp), %rcx xorl %eax, %eax cmpl 0xd0(%rcx), %eax jne 0x85175b movl $0x1, -0x2c(%rbp) movb $0x0, -0x2d(%rbp) movq -0x18(%rbp), %rax movl 0x1e0(%rax), %ecx movq -0x20(%rbp), %rax movl %ecx, (%rax) movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0xa, %rax andq $0x1, %rax cmpl $0x0, %eax jne 0x851731 movl $0x1, -0x34(%rbp) movl $0x0, -0x38(%rbp) cmpl $0x2, -0x38(%rbp) jge 0x85172f movq -0x18(%rbp), %rax movslq -0x38(%rbp), %rcx cmpl $-0x1, 0x1e8(%rax,%rcx,4) je 0x851722 movq -0x18(%rbp), %rax movslq -0x38(%rbp), %rcx movl 0x1e8(%rax,%rcx,4), %edx movq -0x20(%rbp), %rax movslq -0x34(%rbp), %rcx movl %edx, (%rax,%rcx,4) movl -0x34(%rbp), %ecx movl %ecx, %eax addl $0x1, %eax movl %eax, -0x34(%rbp) addl $0x10, %ecx movl $0x1, %eax shll %cl, %eax orl -0x2c(%rbp), %eax movl %eax, -0x2c(%rbp) movb $0x1, -0x2d(%rbp) jmp 0x851724 movl -0x38(%rbp), %eax addl $0x1, %eax movl %eax, -0x38(%rbp) jmp 0x8516d1 jmp 0x851731 testb $0x1, -0x2d(%rbp) jne 0x851753 movq -0x18(%rbp), %rax movl 0x1e4(%rax), %ecx movq -0x20(%rbp), %rax movl %ecx, 0x4(%rax) movl -0x2c(%rbp), %eax orl $0x20002, %eax # imm = 0x20002 movl %eax, -0x2c(%rbp) movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x851776 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi addq $0x448, %rsi # imm = 0x448 movq -0x20(%rbp), %rdx callq 0x86c8a0 movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_disconnect
static CURLcode ftp_disconnect(struct Curl_easy *data, struct connectdata *conn, bool dead_connection) { struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; /* We cannot send quit unconditionally. If this connection is stale or bad in any way, sending quit and waiting around here will make the disconnect wait in vain and cause more problems than we need to. ftp_quit() will check the state of ftp->ctl_valid. If it's ok it will try to send the QUIT command, otherwise it will just return. */ if(dead_connection) ftpc->ctl_valid = FALSE; /* The FTP session may or may not have been allocated/setup at this point! */ (void)ftp_quit(data, conn); /* ignore errors on the QUIT */ if(ftpc->entrypath) { if(data->state.most_recent_ftp_entrypath == ftpc->entrypath) { data->state.most_recent_ftp_entrypath = NULL; } Curl_safefree(ftpc->entrypath); } freedirs(ftpc); Curl_safefree(ftpc->prevpath); Curl_safefree(ftpc->server_os); Curl_pp_disconnect(pp); Curl_sec_end(conn); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movb %dl, %al movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) andb $0x1, %al movb %al, -0x11(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax movq %rax, -0x28(%rbp) testb $0x1, -0x11(%rbp) je 0x8517be movq -0x20(%rbp), %rax movb $0x0, 0xa5(%rax) movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi callq 0x857fc0 movq -0x20(%rbp), %rax cmpq $0x0, 0x88(%rax) je 0x85182a movq -0x8(%rbp), %rax movq 0x1140(%rax), %rax movq -0x20(%rbp), %rcx cmpq 0x88(%rcx), %rax jne 0x851800 movq -0x8(%rbp), %rax movq $0x0, 0x1140(%rax) jmp 0x851802 leaq 0x6aabf7(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x20(%rbp), %rcx movq 0x88(%rcx), %rdi callq *%rax movq -0x20(%rbp), %rax movq $0x0, 0x88(%rax) jmp 0x85182a movq -0x20(%rbp), %rdi callq 0x856e60 leaq 0x6aabc6(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x20(%rbp), %rcx movq 0xb8(%rcx), %rdi callq *%rax movq -0x20(%rbp), %rax movq $0x0, 0xb8(%rax) jmp 0x85185b leaq 0x6aab9e(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x20(%rbp), %rcx movq 0xe0(%rcx), %rdi callq *%rax movq -0x20(%rbp), %rax movq $0x0, 0xe0(%rax) movq -0x28(%rbp), %rdi callq 0x86c9f0 xorl %eax, %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
Curl_GetFTPResponse
CURLcode Curl_GetFTPResponse(struct Curl_easy *data, ssize_t *nreadp, /* return number of bytes read */ int *ftpcode) /* return the ftp-code */ { /* * We cannot read just one byte per read() and then go back to select() as * the OpenSSL read() doesn't grok that properly. * * Alas, read as much as possible, split up into lines, use the ending * line in a response or continue reading. */ struct connectdata *conn = data->conn; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; CURLcode result = CURLE_OK; struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; size_t nread; int cache_skip = 0; int value_to_be_ignored = 0; if(ftpcode) *ftpcode = 0; /* 0 for errors */ else /* make the pointer point to something for the rest of this function */ ftpcode = &value_to_be_ignored; *nreadp = 0; while(!*ftpcode && !result) { /* check and reset timeout value every lap */ timediff_t timeout = Curl_pp_state_timeout(data, pp, FALSE); timediff_t interval_ms; if(timeout <= 0) { failf(data, "FTP response timeout"); return CURLE_OPERATION_TIMEDOUT; /* already too little time */ } interval_ms = 1000; /* use 1 second timeout intervals */ if(timeout < interval_ms) interval_ms = timeout; /* * Since this function is blocking, we need to wait here for input on the * connection and only then we call the response reading function. We do * timeout at least every second to make the timeout check run. * * A caution here is that the ftp_readresp() function has a cache that may * contain pieces of a response from the previous invoke and we need to * make sure we don't just wait for input while there is unhandled data in * that cache. But also, if the cache is there, we call ftp_readresp() and * the cache wasn't good enough to continue we must not just busy-loop * around this function. * */ if(pp->cache && (cache_skip < 2)) { /* * There's a cache left since before. We then skipping the wait for * socket action, unless this is the same cache like the previous round * as then the cache was deemed not enough to act on and we then need to * wait for more data anyway. */ } else if(!Curl_conn_data_pending(conn, FIRSTSOCKET)) { switch(SOCKET_READABLE(sockfd, interval_ms)) { case -1: /* select() error, stop reading */ failf(data, "FTP response aborted due to select/poll error: %d", SOCKERRNO); return CURLE_RECV_ERROR; case 0: /* timeout */ if(Curl_pgrsUpdate(data)) return CURLE_ABORTED_BY_CALLBACK; continue; /* just continue in our loop for the timeout duration */ default: /* for clarity */ break; } } result = ftp_readresp(data, sockfd, pp, ftpcode, &nread); if(result) break; if(!nread && pp->cache) /* bump cache skip counter as on repeated skips we must wait for more data */ cache_skip++; else /* when we got data or there is no cache left, we reset the cache skip counter */ cache_skip = 0; *nreadp += nread; } /* while there's buffer left and loop is requested */ pp->pending_resp = FALSE; return result; }
pushq %rbp movq %rsp, %rbp subq $0x70, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax movl 0x1e0(%rax), %eax movl %eax, -0x2c(%rbp) movl $0x0, -0x30(%rbp) movq -0x28(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x38(%rbp) movq -0x38(%rbp), %rax movq %rax, -0x40(%rbp) movl $0x0, -0x4c(%rbp) movl $0x0, -0x50(%rbp) cmpq $0x0, -0x20(%rbp) je 0x85190b movq -0x20(%rbp), %rax movl $0x0, (%rax) jmp 0x851913 leaq -0x50(%rbp), %rax movq %rax, -0x20(%rbp) movq -0x18(%rbp), %rax movq $0x0, (%rax) movq -0x20(%rbp), %rcx xorl %eax, %eax cmpl $0x0, (%rcx) movb %al, -0x61(%rbp) jne 0x851938 cmpl $0x0, -0x30(%rbp) setne %al xorb $-0x1, %al movb %al, -0x61(%rbp) movb -0x61(%rbp), %al testb $0x1, %al jne 0x851944 jmp 0x851a8a movq -0x10(%rbp), %rdi movq -0x40(%rbp), %rsi xorl %edx, %edx callq 0x86bd00 movq %rax, -0x58(%rbp) cmpq $0x0, -0x58(%rbp) jg 0x85197c movq -0x10(%rbp), %rdi leaq 0x353472(%rip), %rsi # 0xba4ddb movb $0x0, %al callq 0x820e10 movl $0x1c, -0x4(%rbp) jmp 0x851a98 movq $0x3e8, -0x60(%rbp) # imm = 0x3E8 movq -0x58(%rbp), %rax cmpq -0x60(%rbp), %rax jge 0x851996 movq -0x58(%rbp), %rax movq %rax, -0x60(%rbp) movq -0x40(%rbp), %rax cmpq $0x0, (%rax) je 0x8519ab cmpl $0x2, -0x4c(%rbp) jge 0x8519ab jmp 0x851a31 movq -0x28(%rbp), %rdi xorl %esi, %esi callq 0x849550 testb $0x1, %al jne 0x851a2f movl -0x2c(%rbp), %edi movq -0x60(%rbp), %rcx movl $0xffffffff, %edx # imm = 0xFFFFFFFF movl %edx, %esi callq 0x820880 movl %eax, %ecx movl %ecx, -0x68(%rbp) subl $-0x1, %eax je 0x8519e2 jmp 0x8519d9 movl -0x68(%rbp), %eax testl %eax, %eax je 0x851a0f jmp 0x851a2b movq -0x10(%rbp), %rax movq %rax, -0x70(%rbp) callq 0x3e130 movq -0x70(%rbp), %rdi movl (%rax), %edx leaq 0x3533f4(%rip), %rsi # 0xba4df0 movb $0x0, %al callq 0x820e10 movl $0x38, -0x4(%rbp) jmp 0x851a98 movq -0x10(%rbp), %rdi callq 0x81f0d0 cmpl $0x0, %eax je 0x851a26 movl $0x2a, -0x4(%rbp) jmp 0x851a98 jmp 0x85191e jmp 0x851a2d jmp 0x851a2f jmp 0x851a31 movq -0x10(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x40(%rbp), %rdx movq -0x20(%rbp), %rcx leaq -0x48(%rbp), %r8 callq 0x851ab0 movl %eax, -0x30(%rbp) cmpl $0x0, -0x30(%rbp) je 0x851a54 jmp 0x851a8a cmpq $0x0, -0x48(%rbp) jne 0x851a70 movq -0x40(%rbp), %rax cmpq $0x0, (%rax) je 0x851a70 movl -0x4c(%rbp), %eax addl $0x1, %eax movl %eax, -0x4c(%rbp) jmp 0x851a77 movl $0x0, -0x4c(%rbp) movq -0x48(%rbp), %rcx movq -0x18(%rbp), %rax addq (%rax), %rcx movq %rcx, (%rax) jmp 0x85191e movq -0x40(%rbp), %rax movb $0x0, 0x20(%rax) movl -0x30(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x70, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_readresp
static CURLcode ftp_readresp(struct Curl_easy *data, curl_socket_t sockfd, struct pingpong *pp, int *ftpcode, /* return the ftp-code if done */ size_t *size) /* size of the response */ { int code; CURLcode result = Curl_pp_readresp(data, sockfd, pp, &code, size); #ifdef HAVE_GSSAPI { struct connectdata *conn = data->conn; char * const buf = data->state.buffer; /* handle the security-oriented responses 6xx ***/ switch(code) { case 631: code = Curl_sec_read_msg(data, conn, buf, PROT_SAFE); break; case 632: code = Curl_sec_read_msg(data, conn, buf, PROT_PRIVATE); break; case 633: code = Curl_sec_read_msg(data, conn, buf, PROT_CONFIDENTIAL); break; default: /* normal ftp stuff we pass through! */ break; } } #endif /* store the latest code for later retrieval */ data->info.httpcode = code; if(ftpcode) *ftpcode = code; if(421 == code) { /* 421 means "Service not available, closing control connection." and FTP * servers use it to signal that idle session timeout has been exceeded. * If we ignored the response, it could end up hanging in some cases. * * This response code can come at any point so having it treated * generically is a good idea. */ infof(data, "We got a 421 - timeout"); state(data, FTP_STOP); return CURLE_OPERATION_TIMEDOUT; } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi movq -0x20(%rbp), %rdx movq -0x30(%rbp), %r8 leaq -0x34(%rbp), %rcx callq 0x86c390 movl %eax, -0x38(%rbp) movl -0x34(%rbp), %ecx movq -0x10(%rbp), %rax movl %ecx, 0x1358(%rax) cmpq $0x0, -0x28(%rbp) je 0x851b03 movl -0x34(%rbp), %ecx movq -0x28(%rbp), %rax movl %ecx, (%rax) movl $0x1a5, %eax # imm = 0x1A5 cmpl -0x34(%rbp), %eax jne 0x851b33 movq -0x10(%rbp), %rdi leaq 0x35330a(%rip), %rsi # 0xba4e22 movb $0x0, %al callq 0x820bf0 movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movl $0x1c, -0x4(%rbp) jmp 0x851b39 movl -0x38(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
state
static void _state(struct Curl_easy *data, ftpstate newstate #ifdef DEBUGBUILD , int lineno #endif ) { struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; #if defined(DEBUGBUILD) #if defined(CURL_DISABLE_VERBOSE_STRINGS) (void) lineno; #else if(ftpc->state != newstate) infof(data, "FTP %p (line %d) state change from %s to %s", (void *)ftpc, lineno, ftp_state_names[ftpc->state], ftp_state_names[newstate]); #endif #endif ftpc->state = newstate; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x8(%rbp) movl %esi, -0xc(%rbp) movq -0x8(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movl -0xc(%rbp), %ecx movq -0x20(%rbp), %rax movl %ecx, 0xd0(%rax) popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_statemachine
static CURLcode ftp_statemachine(struct Curl_easy *data, struct connectdata *conn) { CURLcode result; curl_socket_t sock = conn->sock[FIRSTSOCKET]; int ftpcode; struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; static const char ftpauth[][4] = { "SSL", "TLS" }; size_t nread = 0; if(pp->sendleft) return Curl_pp_flushsend(data, pp); result = ftp_readresp(data, sock, pp, &ftpcode, &nread); if(result) return result; if(ftpcode) { /* we have now received a full FTP server response */ switch(ftpc->state) { case FTP_WAIT220: if(ftpcode == 230) { /* 230 User logged in - already! Take as 220 if TLS required. */ if(data->set.use_ssl <= CURLUSESSL_TRY || conn->bits.ftp_use_control_ssl) return ftp_state_user_resp(data, ftpcode, ftpc->state); } else if(ftpcode != 220) { failf(data, "Got a %03d ftp-server response when 220 was expected", ftpcode); return CURLE_WEIRD_SERVER_REPLY; } /* We have received a 220 response fine, now we proceed. */ #ifdef HAVE_GSSAPI if(data->set.krb) { /* If not anonymous login, try a secure login. Note that this procedure is still BLOCKING. */ Curl_sec_request_prot(conn, "private"); /* We set private first as default, in case the line below fails to set a valid level */ Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]); if(Curl_sec_login(data, conn)) { failf(data, "secure login failed"); return CURLE_WEIRD_SERVER_REPLY; } infof(data, "Authentication successful"); } #endif if(data->set.use_ssl && !conn->bits.ftp_use_control_ssl) { /* We don't have a SSL/TLS control connection yet, but FTPS is requested. Try a FTPS connection now */ ftpc->count3 = 0; switch(data->set.ftpsslauth) { case CURLFTPAUTH_DEFAULT: case CURLFTPAUTH_SSL: ftpc->count2 = 1; /* add one to get next */ ftpc->count1 = 0; break; case CURLFTPAUTH_TLS: ftpc->count2 = -1; /* subtract one to get next */ ftpc->count1 = 1; break; default: failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d", (int)data->set.ftpsslauth); return CURLE_UNKNOWN_OPTION; /* we don't know what to do */ } result = Curl_pp_sendf(data, &ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]); if(!result) state(data, FTP_AUTH); } else result = ftp_state_user(data, conn); break; case FTP_AUTH: /* we have gotten the response to a previous AUTH command */ if(pp->cache_size) return CURLE_WEIRD_SERVER_REPLY; /* Forbid pipelining in response. */ /* RFC2228 (page 5) says: * * If the server is willing to accept the named security mechanism, * and does not require any security data, it must respond with * reply code 234/334. */ if((ftpcode == 234) || (ftpcode == 334)) { /* Curl_ssl_connect is BLOCKING */ result = Curl_ssl_connect(data, conn, FIRSTSOCKET); if(!result) { conn->bits.ftp_use_data_ssl = FALSE; /* clear-text data */ conn->bits.ftp_use_control_ssl = TRUE; /* SSL on control */ result = ftp_state_user(data, conn); } } else if(ftpc->count3 < 1) { ftpc->count3++; ftpc->count1 += ftpc->count2; /* get next attempt */ result = Curl_pp_sendf(data, &ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]); /* remain in this same state */ } else { if(data->set.use_ssl > CURLUSESSL_TRY) /* we failed and CURLUSESSL_CONTROL or CURLUSESSL_ALL is set */ result = CURLE_USE_SSL_FAILED; else /* ignore the failure and continue */ result = ftp_state_user(data, conn); } break; case FTP_USER: case FTP_PASS: result = ftp_state_user_resp(data, ftpcode, ftpc->state); break; case FTP_ACCT: result = ftp_state_acct_resp(data, ftpcode); break; case FTP_PBSZ: result = Curl_pp_sendf(data, &ftpc->pp, "PROT %c", data->set.use_ssl == CURLUSESSL_CONTROL ? 'C' : 'P'); if(!result) state(data, FTP_PROT); break; case FTP_PROT: if(ftpcode/100 == 2) /* We have enabled SSL for the data connection! */ conn->bits.ftp_use_data_ssl = (data->set.use_ssl != CURLUSESSL_CONTROL) ? TRUE : FALSE; /* FTP servers typically responds with 500 if they decide to reject our 'P' request */ else if(data->set.use_ssl > CURLUSESSL_CONTROL) /* we failed and bails out */ return CURLE_USE_SSL_FAILED; if(data->set.ftp_ccc) { /* CCC - Clear Command Channel */ result = Curl_pp_sendf(data, &ftpc->pp, "%s", "CCC"); if(!result) state(data, FTP_CCC); } else result = ftp_state_pwd(data, conn); break; case FTP_CCC: if(ftpcode < 500) { /* First shut down the SSL layer (note: this call will block) */ result = Curl_ssl_shutdown(data, conn, FIRSTSOCKET); if(result) failf(data, "Failed to clear the command channel (CCC)"); } if(!result) /* Then continue as normal */ result = ftp_state_pwd(data, conn); break; case FTP_PWD: if(ftpcode == 257) { char *ptr = &data->state.buffer[4]; /* start on the first letter */ const size_t buf_size = data->set.buffer_size; char *dir; bool entry_extracted = FALSE; dir = malloc(nread + 1); if(!dir) return CURLE_OUT_OF_MEMORY; /* Reply format is like 257<space>[rubbish]"<directory-name>"<space><commentary> and the RFC959 says The directory name can contain any character; embedded double-quotes should be escaped by double-quotes (the "quote-doubling" convention). */ /* scan for the first double-quote for non-standard responses */ while(ptr < &data->state.buffer[buf_size] && *ptr != '\n' && *ptr != '\0' && *ptr != '"') ptr++; if('\"' == *ptr) { /* it started good */ char *store; ptr++; for(store = dir; *ptr;) { if('\"' == *ptr) { if('\"' == ptr[1]) { /* "quote-doubling" */ *store = ptr[1]; ptr++; } else { /* end of path */ entry_extracted = TRUE; break; /* get out of this loop */ } } else *store = *ptr; store++; ptr++; } *store = '\0'; /* null-terminate */ } if(entry_extracted) { /* If the path name does not look like an absolute path (i.e.: it does not start with a '/'), we probably need some server-dependent adjustments. For example, this is the case when connecting to an OS400 FTP server: this server supports two name syntaxes, the default one being incompatible with standard paths. In addition, this server switches automatically to the regular path syntax when one is encountered in a command: this results in having an entrypath in the wrong syntax when later used in CWD. The method used here is to check the server OS: we do it only if the path name looks strange to minimize overhead on other systems. */ if(!ftpc->server_os && dir[0] != '/') { result = Curl_pp_sendf(data, &ftpc->pp, "%s", "SYST"); if(result) { free(dir); return result; } Curl_safefree(ftpc->entrypath); ftpc->entrypath = dir; /* remember this */ infof(data, "Entry path is '%s'", ftpc->entrypath); /* also save it where getinfo can access it: */ data->state.most_recent_ftp_entrypath = ftpc->entrypath; state(data, FTP_SYST); break; } Curl_safefree(ftpc->entrypath); ftpc->entrypath = dir; /* remember this */ infof(data, "Entry path is '%s'", ftpc->entrypath); /* also save it where getinfo can access it: */ data->state.most_recent_ftp_entrypath = ftpc->entrypath; } else { /* couldn't get the path */ free(dir); infof(data, "Failed to figure out path"); } } state(data, FTP_STOP); /* we are done with the CONNECT phase! */ DEBUGF(infof(data, "protocol connect phase DONE")); break; case FTP_SYST: if(ftpcode == 215) { char *ptr = &data->state.buffer[4]; /* start on the first letter */ char *os; char *store; os = malloc(nread + 1); if(!os) return CURLE_OUT_OF_MEMORY; /* Reply format is like 215<space><OS-name><space><commentary> */ while(*ptr == ' ') ptr++; for(store = os; *ptr && *ptr != ' ';) *store++ = *ptr++; *store = '\0'; /* null-terminate */ /* Check for special servers here. */ if(strcasecompare(os, "OS/400")) { /* Force OS400 name format 1. */ result = Curl_pp_sendf(data, &ftpc->pp, "%s", "SITE NAMEFMT 1"); if(result) { free(os); return result; } /* remember target server OS */ Curl_safefree(ftpc->server_os); ftpc->server_os = os; state(data, FTP_NAMEFMT); break; } /* Nothing special for the target server. */ /* remember target server OS */ Curl_safefree(ftpc->server_os); ftpc->server_os = os; } else { /* Cannot identify server OS. Continue anyway and cross fingers. */ } state(data, FTP_STOP); /* we are done with the CONNECT phase! */ DEBUGF(infof(data, "protocol connect phase DONE")); break; case FTP_NAMEFMT: if(ftpcode == 250) { /* Name format change successful: reload initial path. */ ftp_state_pwd(data, conn); break; } state(data, FTP_STOP); /* we are done with the CONNECT phase! */ DEBUGF(infof(data, "protocol connect phase DONE")); break; case FTP_QUOTE: case FTP_POSTQUOTE: case FTP_RETR_PREQUOTE: case FTP_STOR_PREQUOTE: if((ftpcode >= 400) && !ftpc->count2) { /* failure response code, and not allowed to fail */ failf(data, "QUOT command failed with %03d", ftpcode); result = CURLE_QUOTE_ERROR; } else result = ftp_state_quote(data, FALSE, ftpc->state); break; case FTP_CWD: if(ftpcode/100 != 2) { /* failure to CWD there */ if(data->set.ftp_create_missing_dirs && ftpc->cwdcount && !ftpc->count2) { /* try making it */ ftpc->count2++; /* counter to prevent CWD-MKD loops */ /* count3 is set to allow MKD to fail once per dir. In the case when CWD fails and then MKD fails (due to another session raced it to create the dir) this then allows for a second try to CWD to it. */ ftpc->count3 = (data->set.ftp_create_missing_dirs == 2) ? 1 : 0; result = Curl_pp_sendf(data, &ftpc->pp, "MKD %s", ftpc->dirs[ftpc->cwdcount - 1]); if(!result) state(data, FTP_MKD); } else { /* return failure */ failf(data, "Server denied you to change to the given directory"); ftpc->cwdfail = TRUE; /* don't remember this path as we failed to enter it */ result = CURLE_REMOTE_ACCESS_DENIED; } } else { /* success */ ftpc->count2 = 0; if(++ftpc->cwdcount <= ftpc->dirdepth) /* send next CWD */ result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", ftpc->dirs[ftpc->cwdcount - 1]); else result = ftp_state_mdtm(data); } break; case FTP_MKD: if((ftpcode/100 != 2) && !ftpc->count3--) { /* failure to MKD the dir */ failf(data, "Failed to MKD dir: %03d", ftpcode); result = CURLE_REMOTE_ACCESS_DENIED; } else { state(data, FTP_CWD); /* send CWD */ result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", ftpc->dirs[ftpc->cwdcount - 1]); } break; case FTP_MDTM: result = ftp_state_mdtm_resp(data, ftpcode); break; case FTP_TYPE: case FTP_LIST_TYPE: case FTP_RETR_TYPE: case FTP_STOR_TYPE: result = ftp_state_type_resp(data, ftpcode, ftpc->state); break; case FTP_SIZE: case FTP_RETR_SIZE: case FTP_STOR_SIZE: result = ftp_state_size_resp(data, ftpcode, ftpc->state); break; case FTP_REST: case FTP_RETR_REST: result = ftp_state_rest_resp(data, conn, ftpcode, ftpc->state); break; case FTP_PRET: if(ftpcode != 200) { /* there only is this one standard OK return code. */ failf(data, "PRET command not accepted: %03d", ftpcode); return CURLE_FTP_PRET_FAILED; } result = ftp_state_use_pasv(data, conn); break; case FTP_PASV: result = ftp_state_pasv_resp(data, ftpcode); break; case FTP_PORT: result = ftp_state_port_resp(data, ftpcode); break; case FTP_LIST: case FTP_RETR: result = ftp_state_get_resp(data, ftpcode, ftpc->state); break; case FTP_STOR: result = ftp_state_stor_resp(data, ftpcode, ftpc->state); break; case FTP_QUIT: /* fallthrough, just stop! */ default: /* internal error */ state(data, FTP_STOP); break; } } /* if(ftpcode) */ return result; }
pushq %rbp movq %rsp, %rbp subq $0x90, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x18(%rbp), %rax movl 0x1e0(%rax), %eax movl %eax, -0x20(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax movq %rax, -0x38(%rbp) movq $0x0, -0x40(%rbp) movq -0x38(%rbp), %rax cmpq $0x0, 0x30(%rax) je 0x851bee movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi callq 0x86c8f0 movl %eax, -0x4(%rbp) jmp 0x8528f5 movq -0x10(%rbp), %rdi movl -0x20(%rbp), %esi movq -0x38(%rbp), %rdx leaq -0x24(%rbp), %rcx leaq -0x40(%rbp), %r8 callq 0x851ab0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x851c1a movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x8528f5 cmpl $0x0, -0x24(%rbp) je 0x8528ef movq -0x30(%rbp), %rax movl 0xd0(%rax), %eax decl %eax movl %eax, %ecx movq %rcx, -0x88(%rbp) subl $0x21, %eax ja 0x8528e2 movq -0x88(%rbp), %rax leaq 0x35308c(%rip), %rcx # 0xba4cdc movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0xe6, -0x24(%rbp) jne 0x851ca4 movq -0x10(%rbp), %rax cmpl $0x1, 0x71c(%rax) jbe 0x851c84 movq -0x18(%rbp), %rax movl 0x374(%rax), %eax shrl $0x15, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x851ca2 movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi movq -0x30(%rbp), %rax movl 0xd0(%rax), %edx callq 0x8529d0 movl %eax, -0x4(%rbp) jmp 0x8528f5 jmp 0x851cd0 cmpl $0xdc, -0x24(%rbp) je 0x851cce movq -0x10(%rbp), %rdi movl -0x24(%rbp), %edx leaq 0x35317e(%rip), %rsi # 0xba4e39 movb $0x0, %al callq 0x820e10 movl $0x8, -0x4(%rbp) jmp 0x8528f5 jmp 0x851cd0 movq -0x10(%rbp), %rax cmpl $0x0, 0x71c(%rax) je 0x851dda movq -0x18(%rbp), %rax movl 0x374(%rax), %eax shrl $0x15, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x851dda movq -0x30(%rbp), %rax movl $0x0, 0xcc(%rax) movq -0x10(%rbp), %rax movzbl 0x6f9(%rax), %eax movl %eax, -0x8c(%rbp) subl $0x2, %eax jb 0x851d2d jmp 0x851d20 movl -0x8c(%rbp), %eax subl $0x2, %eax je 0x851d4b jmp 0x851d69 movq -0x30(%rbp), %rax movl $0x1, 0xc8(%rax) movq -0x30(%rbp), %rax movl $0x0, 0xc4(%rax) jmp 0x851d92 movq -0x30(%rbp), %rax movl $0xffffffff, 0xc8(%rax) # imm = 0xFFFFFFFF movq -0x30(%rbp), %rax movl $0x1, 0xc4(%rax) jmp 0x851d92 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movzbl 0x6f9(%rax), %edx leaq 0x3530ef(%rip), %rsi # 0xba4e6e movb $0x0, %al callq 0x820e10 movl $0x30, -0x4(%rbp) jmp 0x8528f5 movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x30(%rbp), %rax movslq 0xc4(%rax), %rax leaq 0x352fe8(%rip), %rcx # 0xba4d94 shlq $0x2, %rax addq %rax, %rcx leaq 0x3530e4(%rip), %rdx # 0xba4e9e movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x851dd8 movq -0x10(%rbp), %rdi movl $0x2, %esi callq 0x851b50 jmp 0x851dea movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x852bc0 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x38(%rbp), %rax cmpq $0x0, 0x8(%rax) je 0x851e06 movl $0x8, -0x4(%rbp) jmp 0x8528f5 cmpl $0xea, -0x24(%rbp) je 0x851e18 cmpl $0x14e, -0x24(%rbp) # imm = 0x14E jne 0x851e7a movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi xorl %edx, %edx callq 0x843950 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x851e75 movq -0x18(%rbp), %rax movl 0x374(%rax), %ecx andl $0xffefffff, %ecx # imm = 0xFFEFFFFF orl $0x0, %ecx movl %ecx, 0x374(%rax) movq -0x18(%rbp), %rax movl 0x374(%rax), %ecx andl $0xffdfffff, %ecx # imm = 0xFFDFFFFF orl $0x200000, %ecx # imm = 0x200000 movl %ecx, 0x374(%rax) movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x852bc0 movl %eax, -0x1c(%rbp) jmp 0x851f12 movq -0x30(%rbp), %rax cmpl $0x1, 0xcc(%rax) jge 0x851ee8 movq -0x30(%rbp), %rax movl 0xcc(%rax), %ecx addl $0x1, %ecx movl %ecx, 0xcc(%rax) movq -0x30(%rbp), %rax movl 0xc8(%rax), %ecx movq -0x30(%rbp), %rax addl 0xc4(%rax), %ecx movl %ecx, 0xc4(%rax) movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x30(%rbp), %rax movslq 0xc4(%rax), %rax leaq 0x352ec6(%rip), %rcx # 0xba4d94 shlq $0x2, %rax addq %rax, %rcx leaq 0x352fc2(%rip), %rdx # 0xba4e9e movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) jmp 0x851f10 movq -0x10(%rbp), %rax cmpl $0x1, 0x71c(%rax) jbe 0x851efe movl $0x40, -0x1c(%rbp) jmp 0x851f0e movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x852bc0 movl %eax, -0x1c(%rbp) jmp 0x851f10 jmp 0x851f12 jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi movq -0x30(%rbp), %rax movl 0xd0(%rax), %edx callq 0x8529d0 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi callq 0x852c70 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x10(%rbp), %rax movl 0x71c(%rax), %edx movl $0x50, %ecx movl $0x43, %eax cmpl $0x2, %edx cmovel %eax, %ecx leaq 0x352f34(%rip), %rdx # 0xba4ea6 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x851f90 movq -0x10(%rbp), %rdi movl $0x7, %esi callq 0x851b50 jmp 0x8528ed movl -0x24(%rbp), %eax movl $0x64, %ecx cltd idivl %ecx cmpl $0x2, %eax jne 0x851fdc movq -0x10(%rbp), %rax movl 0x71c(%rax), %ecx xorl %edx, %edx movl $0x1, %eax cmpl $0x2, %ecx cmovnel %eax, %edx movq -0x18(%rbp), %rax movl 0x374(%rax), %ecx andl $0x1, %edx shll $0x14, %edx andl $0xffefffff, %ecx # imm = 0xFFEFFFFF orl %edx, %ecx movl %ecx, 0x374(%rax) jmp 0x851ff7 movq -0x10(%rbp), %rax cmpl $0x2, 0x71c(%rax) jbe 0x851ff5 movl $0x40, -0x4(%rbp) jmp 0x8528f5 jmp 0x851ff7 movq -0x10(%rbp), %rax cmpb $0x0, 0x6fa(%rax) je 0x85203a movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi leaq 0x3528af(%rip), %rdx # 0xba48c2 leaq 0x352e94(%rip), %rcx # 0xba4eae movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x852038 movq -0x10(%rbp), %rdi movl $0x8, %esi callq 0x851b50 jmp 0x85204a movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x852cd0 movl %eax, -0x1c(%rbp) jmp 0x8528ed cmpl $0x1f4, -0x24(%rbp) # imm = 0x1F4 jge 0x852084 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi xorl %edx, %edx callq 0x844950 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x852082 movq -0x10(%rbp), %rdi leaq 0x352e37(%rip), %rsi # 0xba4eb2 movb $0x0, %al callq 0x820e10 jmp 0x852084 cmpl $0x0, -0x1c(%rbp) jne 0x85209a movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x852cd0 movl %eax, -0x1c(%rbp) jmp 0x8528ed cmpl $0x101, -0x24(%rbp) # imm = 0x101 jne 0x85238f movq -0x10(%rbp), %rax movq 0xc70(%rax), %rax addq $0x4, %rax movq %rax, -0x48(%rbp) movq -0x10(%rbp), %rax movl 0x6cc(%rax), %eax movq %rax, -0x50(%rbp) movb $0x0, -0x59(%rbp) leaq 0x6aa320(%rip), %rax # 0xefc3f8 movq (%rax), %rax movq -0x40(%rbp), %rdi addq $0x1, %rdi callq *%rax movq %rax, -0x58(%rbp) cmpq $0x0, -0x58(%rbp) jne 0x8520fc movl $0x1b, -0x4(%rbp) jmp 0x8528f5 jmp 0x8520fe movq -0x48(%rbp), %rcx movq -0x10(%rbp), %rax movq 0xc70(%rax), %rdx addq -0x50(%rbp), %rdx xorl %eax, %eax cmpq %rdx, %rcx movb %al, -0x8d(%rbp) jae 0x852159 movq -0x48(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0xa, %ecx movb %al, -0x8d(%rbp) je 0x852159 movq -0x48(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x8d(%rbp) je 0x852159 movq -0x48(%rbp), %rax movsbl (%rax), %eax cmpl $0x22, %eax setne %al movb %al, -0x8d(%rbp) movb -0x8d(%rbp), %al testb $0x1, %al jne 0x852165 jmp 0x852173 movq -0x48(%rbp), %rax addq $0x1, %rax movq %rax, -0x48(%rbp) jmp 0x8520fe movq -0x48(%rbp), %rax movsbl (%rax), %ecx movl $0x22, %eax cmpl %ecx, %eax jne 0x852215 movq -0x48(%rbp), %rax addq $0x1, %rax movq %rax, -0x48(%rbp) movq -0x58(%rbp), %rax movq %rax, -0x68(%rbp) movq -0x48(%rbp), %rax cmpb $0x0, (%rax) je 0x85220e movq -0x48(%rbp), %rax movsbl (%rax), %ecx movl $0x22, %eax cmpl %ecx, %eax jne 0x8521e8 movq -0x48(%rbp), %rax movsbl 0x1(%rax), %ecx movl $0x22, %eax cmpl %ecx, %eax jne 0x8521e0 movq -0x48(%rbp), %rax movb 0x1(%rax), %cl movq -0x68(%rbp), %rax movb %cl, (%rax) movq -0x48(%rbp), %rax addq $0x1, %rax movq %rax, -0x48(%rbp) jmp 0x8521e6 movb $0x1, -0x59(%rbp) jmp 0x85220e jmp 0x8521f4 movq -0x48(%rbp), %rax movb (%rax), %cl movq -0x68(%rbp), %rax movb %cl, (%rax) movq -0x68(%rbp), %rax addq $0x1, %rax movq %rax, -0x68(%rbp) movq -0x48(%rbp), %rax addq $0x1, %rax movq %rax, -0x48(%rbp) jmp 0x85219b movq -0x68(%rbp), %rax movb $0x0, (%rax) testb $0x1, -0x59(%rbp) je 0x85236b movq -0x30(%rbp), %rax cmpq $0x0, 0xe0(%rax) jne 0x8522ff movq -0x58(%rbp), %rax movsbl (%rax), %eax cmpl $0x2f, %eax je 0x8522ff movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi leaq 0x352672(%rip), %rdx # 0xba48c2 leaq 0x352c85(%rip), %rcx # 0xba4edc movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x852282 leaq 0x6aa192(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x58(%rbp), %rdi callq *%rax movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x8528f5 jmp 0x852284 leaq 0x6aa175(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rcx movq 0x88(%rcx), %rdi callq *%rax movq -0x30(%rbp), %rax movq $0x0, 0x88(%rax) movq -0x58(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, 0x88(%rax) movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rax movq 0x88(%rax), %rdx leaq 0x352c12(%rip), %rsi # 0xba4ee1 movb $0x0, %al callq 0x820bf0 movq -0x30(%rbp), %rax movq 0x88(%rax), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x1140(%rax) movq -0x10(%rbp), %rdi movl $0xa, %esi callq 0x851b50 jmp 0x8528ed jmp 0x852301 leaq 0x6aa0f8(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rcx movq 0x88(%rcx), %rdi callq *%rax movq -0x30(%rbp), %rax movq $0x0, 0x88(%rax) movq -0x58(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, 0x88(%rax) movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rax movq 0x88(%rax), %rdx leaq 0x352b95(%rip), %rsi # 0xba4ee1 movb $0x0, %al callq 0x820bf0 movq -0x30(%rbp), %rax movq 0x88(%rax), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x1140(%rax) jmp 0x85238d leaq 0x6aa08e(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x58(%rbp), %rdi callq *%rax movq -0x10(%rbp), %rdi leaq 0x352b6e(%rip), %rsi # 0xba4ef4 movb $0x0, %al callq 0x820bf0 jmp 0x85238f movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 jmp 0x85239c jmp 0x8528ed cmpl $0xd7, -0x24(%rbp) jne 0x85254b movq -0x10(%rbp), %rax movq 0xc70(%rax), %rax addq $0x4, %rax movq %rax, -0x70(%rbp) leaq 0x6aa030(%rip), %rax # 0xefc3f8 movq (%rax), %rax movq -0x40(%rbp), %rdi addq $0x1, %rdi callq *%rax movq %rax, -0x78(%rbp) cmpq $0x0, -0x78(%rbp) jne 0x8523ec movl $0x1b, -0x4(%rbp) jmp 0x8528f5 jmp 0x8523ee movq -0x70(%rbp), %rax movsbl (%rax), %eax cmpl $0x20, %eax jne 0x852408 movq -0x70(%rbp), %rax addq $0x1, %rax movq %rax, -0x70(%rbp) jmp 0x8523ee movq -0x78(%rbp), %rax movq %rax, -0x80(%rbp) movq -0x70(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x8e(%rbp) je 0x852437 movq -0x70(%rbp), %rax movsbl (%rax), %eax cmpl $0x20, %eax setne %al movb %al, -0x8e(%rbp) movb -0x8e(%rbp), %al testb $0x1, %al jne 0x852443 jmp 0x852467 movq -0x70(%rbp), %rax movq %rax, %rcx addq $0x1, %rcx movq %rcx, -0x70(%rbp) movb (%rax), %cl movq -0x80(%rbp), %rax movq %rax, %rdx addq $0x1, %rdx movq %rdx, -0x80(%rbp) movb %cl, (%rax) jmp 0x852410 movq -0x80(%rbp), %rax movb $0x0, (%rax) movq -0x78(%rbp), %rdi leaq 0x352a95(%rip), %rsi # 0xba4f0e callq 0x830160 cmpl $0x0, %eax je 0x852512 movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi leaq 0x35242c(%rip), %rdx # 0xba48c2 leaq 0x352a78(%rip), %rcx # 0xba4f15 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x8524c8 leaq 0x6a9f4c(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x78(%rbp), %rdi callq *%rax movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x8528f5 jmp 0x8524ca leaq 0x6a9f2f(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rcx movq 0xe0(%rcx), %rdi callq *%rax movq -0x30(%rbp), %rax movq $0x0, 0xe0(%rax) movq -0x78(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, 0xe0(%rax) movq -0x10(%rbp), %rdi movl $0xb, %esi callq 0x851b50 jmp 0x8528ed jmp 0x852514 leaq 0x6a9ee5(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rcx movq 0xe0(%rcx), %rdi callq *%rax movq -0x30(%rbp), %rax movq $0x0, 0xe0(%rax) movq -0x78(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, 0xe0(%rax) jmp 0x85254d jmp 0x85254d movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 jmp 0x85255a jmp 0x8528ed cmpl $0xfa, -0x24(%rbp) jne 0x85257a movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x852cd0 jmp 0x8528ed movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 jmp 0x852587 jmp 0x8528ed cmpl $0x190, -0x24(%rbp) # imm = 0x190 jl 0x8525c0 movq -0x30(%rbp), %rax cmpl $0x0, 0xc8(%rax) jne 0x8525c0 movq -0x10(%rbp), %rdi movl -0x24(%rbp), %edx leaq 0x352974(%rip), %rsi # 0xba4f24 movb $0x0, %al callq 0x820e10 movl $0x15, -0x1c(%rbp) jmp 0x8525d8 movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rax movl 0xd0(%rax), %edx xorl %esi, %esi callq 0x852d30 movl %eax, -0x1c(%rbp) jmp 0x8528ed movl -0x24(%rbp), %eax movl $0x64, %ecx cltd idivl %ecx cmpl $0x2, %eax je 0x8526d0 movq -0x10(%rbp), %rax movzbl 0x700(%rax), %eax cmpl $0x0, %eax je 0x8526aa movq -0x30(%rbp), %rax cmpl $0x0, 0xa8(%rax) je 0x8526aa movq -0x30(%rbp), %rax cmpl $0x0, 0xc8(%rax) jne 0x8526aa movq -0x30(%rbp), %rax movl 0xc8(%rax), %ecx addl $0x1, %ecx movl %ecx, 0xc8(%rax) movq -0x10(%rbp), %rax movzbl 0x700(%rax), %edx xorl %ecx, %ecx movl $0x1, %eax cmpl $0x2, %edx cmovel %eax, %ecx movq -0x30(%rbp), %rax movl %ecx, 0xcc(%rax) movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x30(%rbp), %rax movq 0x98(%rax), %rax movq -0x30(%rbp), %rcx movl 0xa8(%rcx), %ecx subl $0x1, %ecx movslq %ecx, %rcx movq (%rax,%rcx,8), %rcx leaq 0x3528b8(%rip), %rdx # 0xba4f42 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x8526a8 movq -0x10(%rbp), %rdi movl $0x11, %esi callq 0x851b50 jmp 0x8526ce movq -0x10(%rbp), %rdi leaq 0x352894(%rip), %rsi # 0xba4f49 movb $0x0, %al callq 0x820e10 movq -0x30(%rbp), %rax movb $0x1, 0xac(%rax) movl $0x9, -0x1c(%rbp) jmp 0x852745 movq -0x30(%rbp), %rax movl $0x0, 0xc8(%rax) movq -0x30(%rbp), %rcx movl 0xa8(%rcx), %eax addl $0x1, %eax movl %eax, 0xa8(%rcx) movq -0x30(%rbp), %rcx cmpl 0xa0(%rcx), %eax jg 0x852737 movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x30(%rbp), %rax movq 0x98(%rax), %rax movq -0x30(%rbp), %rcx movl 0xa8(%rcx), %ecx subl $0x1, %ecx movslq %ecx, %rcx movq (%rax,%rcx,8), %rcx leaq 0x352851(%rip), %rdx # 0xba4f7c movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) jmp 0x852743 movq -0x10(%rbp), %rdi callq 0x853040 movl %eax, -0x1c(%rbp) jmp 0x852745 jmp 0x8528ed movl -0x24(%rbp), %eax movl $0x64, %ecx cltd idivl %ecx cmpl $0x2, %eax je 0x852792 movq -0x30(%rbp), %rcx movl 0xcc(%rcx), %eax movl %eax, %edx addl $-0x1, %edx movl %edx, 0xcc(%rcx) cmpl $0x0, %eax jne 0x852792 movq -0x10(%rbp), %rdi movl -0x24(%rbp), %edx leaq 0x352801(%rip), %rsi # 0xba4f83 movb $0x0, %al callq 0x820e10 movl $0x9, -0x1c(%rbp) jmp 0x8527d8 movq -0x10(%rbp), %rdi movl $0x10, %esi callq 0x851b50 movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x30(%rbp), %rax movq 0x98(%rax), %rax movq -0x30(%rbp), %rcx movl 0xa8(%rcx), %ecx subl $0x1, %ecx movslq %ecx, %rcx movq (%rax,%rcx,8), %rcx leaq 0x3527ae(%rip), %rdx # 0xba4f7c movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi callq 0x853100 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi movq -0x30(%rbp), %rax movl 0xd0(%rax), %edx callq 0x853530 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi movq -0x30(%rbp), %rax movl 0xd0(%rax), %edx callq 0x853610 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movl -0x24(%rbp), %edx movq -0x30(%rbp), %rax movl 0xd0(%rax), %ecx callq 0x853830 movl %eax, -0x1c(%rbp) jmp 0x8528ed cmpl $0xc8, -0x24(%rbp) je 0x852876 movq -0x10(%rbp), %rdi movl -0x24(%rbp), %edx leaq 0x352735(%rip), %rsi # 0xba4f9b movb $0x0, %al callq 0x820e10 movl $0x54, -0x4(%rbp) jmp 0x8528f5 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x853960 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi callq 0x853a60 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi callq 0x854200 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi movq -0x30(%rbp), %rax movl 0xd0(%rax), %edx callq 0x8542f0 movl %eax, -0x1c(%rbp) jmp 0x8528ed movq -0x10(%rbp), %rdi movl -0x24(%rbp), %esi movq -0x30(%rbp), %rax movl 0xd0(%rax), %edx callq 0x854610 movl %eax, -0x1c(%rbp) jmp 0x8528ed jmp 0x8528e2 movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 jmp 0x8528ef movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x90, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_endofresp
static bool ftp_endofresp(struct Curl_easy *data, struct connectdata *conn, char *line, size_t len, int *code) { (void)data; (void)conn; if((len > 3) && LASTLINE(line)) { *code = curlx_sltosi(strtol(line, NULL, 10)); return TRUE; } return FALSE; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) cmpq $0x3, -0x28(%rbp) jbe 0x8529bc movq -0x20(%rbp), %rax movsbl (%rax), %eax cmpl $0x30, %eax jl 0x8529bc movq -0x20(%rbp), %rax movsbl (%rax), %eax cmpl $0x39, %eax jg 0x8529bc movq -0x20(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x30, %eax jl 0x8529bc movq -0x20(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x39, %eax jg 0x8529bc movq -0x20(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x30, %eax jl 0x8529bc movq -0x20(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x39, %eax jg 0x8529bc movq -0x20(%rbp), %rax movsbl 0x3(%rax), %ecx movl $0x20, %eax cmpl %ecx, %eax jne 0x8529bc movq -0x20(%rbp), %rdi xorl %eax, %eax movl %eax, %esi movl $0xa, %edx callq 0x3e520 movq %rax, %rdi callq 0x840890 movl %eax, %ecx movq -0x30(%rbp), %rax movl %ecx, (%rax) movb $0x1, -0x1(%rbp) jmp 0x8529c0 movb $0x0, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x30, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_user_resp
static CURLcode ftp_state_user_resp(struct Curl_easy *data, int ftpcode, ftpstate instate) { CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; (void)instate; /* no use for this yet */ /* some need password anyway, and others just return 2xx ignored */ if((ftpcode == 331) && (ftpc->state == FTP_USER)) { /* 331 Password required for ... (the server requires to send the user's password too) */ result = Curl_pp_sendf(data, &ftpc->pp, "PASS %s", conn->passwd?conn->passwd:""); if(!result) state(data, FTP_PASS); } else if(ftpcode/100 == 2) { /* 230 User ... logged in. (the user logged in with or without password) */ result = ftp_state_loggedin(data); } else if(ftpcode == 332) { if(data->set.str[STRING_FTP_ACCOUNT]) { result = Curl_pp_sendf(data, &ftpc->pp, "ACCT %s", data->set.str[STRING_FTP_ACCOUNT]); if(!result) state(data, FTP_ACCT); } else { failf(data, "ACCT requested but none available"); result = CURLE_LOGIN_DENIED; } } else { /* All other response codes, like: 530 User ... access denied (the server denies to log the specified user) */ if(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER] && !ftpc->ftp_trying_alternative) { /* Ok, USER failed. Let's try the supplied command. */ result = Curl_pp_sendf(data, &ftpc->pp, "%s", data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]); if(!result) { ftpc->ftp_trying_alternative = TRUE; state(data, FTP_USER); } } else { failf(data, "Access denied: %03d", ftpcode); result = CURLE_LOGIN_DENIED; } } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x8(%rbp) movl %esi, -0xc(%rbp) movl %edx, -0x10(%rbp) movl $0x0, -0x14(%rbp) movq -0x8(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) cmpl $0x14b, -0xc(%rbp) # imm = 0x14B jne 0x852a8b movq -0x28(%rbp), %rax cmpl $0x3, 0xd0(%rax) jne 0x852a8b movq -0x8(%rbp), %rax movq %rax, -0x38(%rbp) movq -0x28(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x20(%rbp), %rax cmpq $0x0, 0x190(%rax) je 0x852a48 movq -0x20(%rbp), %rax movq 0x190(%rax), %rax movq %rax, -0x40(%rbp) jmp 0x852a55 leaq 0x36c768(%rip), %rax # 0xbbf1b7 movq %rax, -0x40(%rbp) jmp 0x852a55 movq -0x30(%rbp), %rsi movq -0x38(%rbp), %rdi movq -0x40(%rbp), %rcx leaq 0x352553(%rip), %rdx # 0xba4fbb movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x852a86 movq -0x8(%rbp), %rdi movl $0x4, %esi callq 0x851b50 jmp 0x852baf movl -0xc(%rbp), %eax movl $0x64, %ecx cltd idivl %ecx cmpl $0x2, %eax jne 0x852aac movq -0x8(%rbp), %rdi callq 0x854710 movl %eax, -0x14(%rbp) jmp 0x852bad cmpl $0x14c, -0xc(%rbp) # imm = 0x14C jne 0x852b1b movq -0x8(%rbp), %rax cmpq $0x0, 0x780(%rax) je 0x852afd movq -0x8(%rbp), %rdi movq -0x28(%rbp), %rsi movq -0x8(%rbp), %rax movq 0x780(%rax), %rcx leaq 0x3524e6(%rip), %rdx # 0xba4fc3 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x852afb movq -0x8(%rbp), %rdi movl $0x5, %esi callq 0x851b50 jmp 0x852b16 movq -0x8(%rbp), %rdi leaq 0x3524c3(%rip), %rsi # 0xba4fcb movb $0x0, %al callq 0x820e10 movl $0x43, -0x14(%rbp) jmp 0x852bab movq -0x8(%rbp), %rax cmpq $0x0, 0x788(%rax) je 0x852b8d movq -0x28(%rbp), %rax movb 0xf0(%rax), %al andb $0x1, %al movzbl %al, %eax cmpl $0x0, %eax jne 0x852b8d movq -0x8(%rbp), %rdi movq -0x28(%rbp), %rsi movq -0x8(%rbp), %rax movq 0x788(%rax), %rcx leaq 0x351d6b(%rip), %rdx # 0xba48c2 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x852b8b movq -0x28(%rbp), %rax movb 0xf0(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0xf0(%rax) movq -0x8(%rbp), %rdi movl $0x3, %esi callq 0x851b50 jmp 0x852ba9 movq -0x8(%rbp), %rdi movl -0xc(%rbp), %edx leaq 0x352452(%rip), %rsi # 0xba4fed movb $0x0, %al callq 0x820e10 movl $0x43, -0x14(%rbp) jmp 0x852bab jmp 0x852bad jmp 0x852baf movl -0x14(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_user
static CURLcode ftp_state_user(struct Curl_easy *data, struct connectdata *conn) { CURLcode result = Curl_pp_sendf(data, &conn->proto.ftpc.pp, "USER %s", conn->user?conn->user:""); if(!result) { struct ftp_conn *ftpc = &conn->proto.ftpc; ftpc->ftp_trying_alternative = FALSE; state(data, FTP_USER); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax cmpq $0x0, 0x188(%rax) je 0x852c05 movq -0x10(%rbp), %rax movq 0x188(%rax), %rax movq %rax, -0x38(%rbp) jmp 0x852c12 leaq 0x36c5ab(%rip), %rax # 0xbbf1b7 movq %rax, -0x38(%rbp) jmp 0x852c12 movq -0x28(%rbp), %rsi movq -0x30(%rbp), %rdi movq -0x38(%rbp), %rcx leaq 0x3523e4(%rip), %rdx # 0xba5009 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x852c67 movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax movb 0xf0(%rax), %cl andb $-0x2, %cl orb $0x0, %cl movb %cl, 0xf0(%rax) movq -0x8(%rbp), %rdi movl $0x3, %esi callq 0x851b50 movl -0x14(%rbp), %eax addq $0x40, %rsp popq %rbp retq
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_acct_resp
static CURLcode ftp_state_acct_resp(struct Curl_easy *data, int ftpcode) { CURLcode result = CURLE_OK; if(ftpcode != 230) { failf(data, "ACCT rejected by server: %03d", ftpcode); result = CURLE_FTP_WEIRD_PASS_REPLY; /* FIX */ } else result = ftp_state_loggedin(data); return result; }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) movl %esi, -0xc(%rbp) movl $0x0, -0x10(%rbp) cmpl $0xe6, -0xc(%rbp) je 0x852cad movq -0x8(%rbp), %rdi movl -0xc(%rbp), %edx leaq 0x352374(%rip), %rsi # 0xba5011 movb $0x0, %al callq 0x820e10 movl $0xb, -0x10(%rbp) jmp 0x852cb9 movq -0x8(%rbp), %rdi callq 0x854710 movl %eax, -0x10(%rbp) movl -0x10(%rbp), %eax addq $0x10, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_mdtm
static CURLcode ftp_state_mdtm(struct Curl_easy *data) { CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; /* Requested time of file or time-depended transfer? */ if((data->set.get_filetime || data->set.timecondition) && ftpc->file) { /* we have requested to get the modified-time of the file, this is a white spot as the MDTM is not mentioned in RFC959 */ result = Curl_pp_sendf(data, &ftpc->pp, "MDTM %s", ftpc->file); if(!result) state(data, FTP_MDTM); } else result = ftp_state_type(data); return result; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movl $0x0, -0xc(%rbp) movq -0x8(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movq -0x8(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x5, %rax andq $0x1, %rax cmpl $0x0, %eax jne 0x853095 movq -0x8(%rbp), %rax movzbl 0x538(%rax), %eax cmpl $0x0, %eax je 0x8530dd movq -0x20(%rbp), %rax cmpq $0x0, 0x90(%rax) je 0x8530dd movq -0x8(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x20(%rbp), %rax movq 0x90(%rax), %rcx leaq 0x35206c(%rip), %rdx # 0xba5129 movb $0x0, %al callq 0x86c2e0 movl %eax, -0xc(%rbp) cmpl $0x0, -0xc(%rbp) jne 0x8530db movq -0x8(%rbp), %rdi movl $0x12, %esi callq 0x851b50 jmp 0x8530e9 movq -0x8(%rbp), %rdi callq 0x854ed0 movl %eax, -0xc(%rbp) movl -0xc(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_mdtm_resp
static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data, int ftpcode) { CURLcode result = CURLE_OK; struct FTP *ftp = data->req.p.ftp; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; switch(ftpcode) { case 213: { /* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the last .sss part is optional and means fractions of a second */ int year, month, day, hour, minute, second; if(6 == sscanf(&data->state.buffer[4], "%04d%02d%02d%02d%02d%02d", &year, &month, &day, &hour, &minute, &second)) { /* we have a time, reformat it */ char timebuf[24]; msnprintf(timebuf, sizeof(timebuf), "%04d%02d%02d %02d:%02d:%02d GMT", year, month, day, hour, minute, second); /* now, convert this into a time() value: */ data->info.filetime = Curl_getdate_capped(timebuf); } #ifdef CURL_FTP_HTTPSTYLE_HEAD /* If we asked for a time of the file and we actually got one as well, we "emulate" a HTTP-style header in our output. */ if(data->set.opt_no_body && ftpc->file && data->set.get_filetime && (data->info.filetime >= 0) ) { char headerbuf[128]; int headerbuflen; time_t filetime = data->info.filetime; struct tm buffer; const struct tm *tm = &buffer; result = Curl_gmtime(filetime, &buffer); if(result) return result; /* format: "Tue, 15 Nov 1994 12:45:26" */ headerbuflen = msnprintf(headerbuf, sizeof(headerbuf), "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n", Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], tm->tm_mday, Curl_month[tm->tm_mon], tm->tm_year + 1900, tm->tm_hour, tm->tm_min, tm->tm_sec); result = Curl_client_write(data, CLIENTWRITE_BOTH, headerbuf, headerbuflen); if(result) return result; } /* end of a ridiculous amount of conditionals */ #endif } break; default: infof(data, "unsupported MDTM reply format"); break; case 550: /* 550 is used for several different problems, e.g. "No such file or directory" or "Permission denied". It does not mean that the file does not exist at all. */ infof(data, "MDTM failed: file does not exist or permission problem," " continuing"); break; } if(data->set.timecondition) { if((data->info.filetime > 0) && (data->set.timevalue > 0)) { switch(data->set.timecondition) { case CURL_TIMECOND_IFMODSINCE: default: if(data->info.filetime <= data->set.timevalue) { infof(data, "The requested document is not new enough"); ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */ data->info.timecond = TRUE; state(data, FTP_STOP); return CURLE_OK; } break; case CURL_TIMECOND_IFUNMODSINCE: if(data->info.filetime > data->set.timevalue) { infof(data, "The requested document is not old enough"); ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */ data->info.timecond = TRUE; state(data, FTP_STOP); return CURLE_OK; } break; } /* switch */ } else { infof(data, "Skipping time comparison"); } } if(!result) result = ftp_state_type(data); return result; }
pushq %rbp movq %rsp, %rbp pushq %rbx subq $0x178, %rsp # imm = 0x178 movq %rdi, -0x18(%rbp) movl %esi, -0x1c(%rbp) movl $0x0, -0x20(%rbp) movq -0x18(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x28(%rbp) movq -0x18(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x38(%rbp) movl -0x1c(%rbp), %eax movl %eax, -0x144(%rbp) subl $0xd5, %eax je 0x85316b jmp 0x853155 movl -0x144(%rbp), %eax subl $0x226, %eax # imm = 0x226 je 0x8533c2 jmp 0x8533ae movq -0x18(%rbp), %rax movq 0xc70(%rax), %rdi addq $0x4, %rdi leaq 0x35210a(%rip), %rsi # 0xba528b leaq -0x3c(%rbp), %rdx leaq -0x40(%rbp), %rcx leaq -0x44(%rbp), %r8 leaq -0x48(%rbp), %r9 leaq -0x4c(%rbp), %r10 leaq -0x50(%rbp), %rax movq %r10, (%rsp) movq %rax, 0x8(%rsp) movb $0x0, %al callq 0x3b220 movl %eax, %ecx movl $0x6, %eax cmpl %ecx, %eax jne 0x853205 leaq -0x70(%rbp), %rdi movl -0x3c(%rbp), %ecx movl -0x40(%rbp), %r8d movl -0x44(%rbp), %r9d movl -0x48(%rbp), %r11d movl -0x4c(%rbp), %r10d movl -0x50(%rbp), %eax movl $0x18, %esi leaq 0x3520ca(%rip), %rdx # 0xba52a4 movl %r11d, (%rsp) movl %r10d, 0x8(%rsp) movl %eax, 0x10(%rsp) movb $0x0, %al callq 0x8179a0 leaq -0x70(%rbp), %rdi callq 0x86b900 movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x1368(%rax) movq -0x18(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x19, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x8533ac movq -0x38(%rbp), %rax cmpq $0x0, 0x90(%rax) je 0x8533ac movq -0x18(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x5, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x8533ac movq -0x18(%rbp), %rax cmpq $0x0, 0x1368(%rax) jl 0x8533ac movq -0x18(%rbp), %rax movq 0x1368(%rax), %rax movq %rax, -0x100(%rbp) leaq -0x138(%rbp), %rax movq %rax, -0x140(%rbp) movq -0x100(%rbp), %rdi leaq -0x138(%rbp), %rsi callq 0x86b980 movl %eax, -0x20(%rbp) cmpl $0x0, -0x20(%rbp) je 0x8532a8 movl -0x20(%rbp), %eax movl %eax, -0xc(%rbp) jmp 0x853523 leaq -0xf0(%rbp), %rax movq %rax, -0x150(%rbp) movq -0x140(%rbp), %rax cmpl $0x0, 0x18(%rax) je 0x8532d8 movq -0x140(%rbp), %rax movl 0x18(%rax), %eax subl $0x1, %eax movl %eax, -0x154(%rbp) jmp 0x8532e5 movl $0x6, %eax movl %eax, -0x154(%rbp) jmp 0x8532e5 movq -0x150(%rbp), %rdi movl -0x154(%rbp), %eax movslq %eax, %rcx leaq 0x6a0dc4(%rip), %rax # 0xef40c0 movq (%rax,%rcx,8), %rcx movq -0x140(%rbp), %rax movl 0xc(%rax), %r8d movq -0x140(%rbp), %rax movslq 0x10(%rax), %rdx leaq 0x6a0de3(%rip), %rax # 0xef4100 movq (%rax,%rdx,8), %r9 movq -0x140(%rbp), %rax movl 0x14(%rax), %ebx addl $0x76c, %ebx # imm = 0x76C movq -0x140(%rbp), %rax movl 0x8(%rax), %r11d movq -0x140(%rbp), %rax movl 0x4(%rax), %r10d movq -0x140(%rbp), %rax movl (%rax), %eax movl $0x80, %esi leaq 0x351f68(%rip), %rdx # 0xba52c4 movl %ebx, (%rsp) movl %r11d, 0x8(%rsp) movl %r10d, 0x10(%rsp) movl %eax, 0x18(%rsp) movb $0x0, %al callq 0x8179a0 movl %eax, -0xf4(%rbp) movq -0x18(%rbp), %rdi leaq -0xf0(%rbp), %rdx movslq -0xf4(%rbp), %rcx movl $0x3, %esi callq 0x821330 movl %eax, -0x20(%rbp) cmpl $0x0, -0x20(%rbp) je 0x8533aa movl -0x20(%rbp), %eax movl %eax, -0xc(%rbp) jmp 0x853523 jmp 0x8533ac jmp 0x8533d4 movq -0x18(%rbp), %rdi leaq 0x351f3f(%rip), %rsi # 0xba52f8 movb $0x0, %al callq 0x820bf0 jmp 0x8533d4 movq -0x18(%rbp), %rdi leaq 0x351f49(%rip), %rsi # 0xba5316 movb $0x0, %al callq 0x820bf0 movq -0x18(%rbp), %rax cmpb $0x0, 0x538(%rax) je 0x85350b movq -0x18(%rbp), %rax cmpq $0x0, 0x1368(%rax) jle 0x8534f7 movq -0x18(%rbp), %rax cmpq $0x0, 0x530(%rax) jle 0x8534f7 movq -0x18(%rbp), %rax movzbl 0x538(%rax), %eax movl %eax, -0x158(%rbp) subl $0x1, %eax je 0x85342e jmp 0x853421 movl -0x158(%rbp), %eax subl $0x2, %eax je 0x853494 jmp 0x853430 jmp 0x853430 movq -0x18(%rbp), %rax movq 0x1368(%rax), %rax movq -0x18(%rbp), %rcx cmpq 0x530(%rcx), %rax jg 0x853492 movq -0x18(%rbp), %rdi leaq 0x34fc75(%rip), %rsi # 0xba30c8 movb $0x0, %al callq 0x820bf0 movq -0x28(%rbp), %rax movl $0x2, 0x10(%rax) movq -0x18(%rbp), %rax movb 0x1444(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0x1444(%rax) movq -0x18(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movl $0x0, -0xc(%rbp) jmp 0x853523 jmp 0x8534f5 movq -0x18(%rbp), %rax movq 0x1368(%rax), %rax movq -0x18(%rbp), %rcx cmpq 0x530(%rcx), %rax jle 0x8534f3 movq -0x18(%rbp), %rdi leaq 0x34fc3a(%rip), %rsi # 0xba30f1 movb $0x0, %al callq 0x820bf0 movq -0x28(%rbp), %rax movl $0x2, 0x10(%rax) movq -0x18(%rbp), %rax movb 0x1444(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0x1444(%rax) movq -0x18(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movl $0x0, -0xc(%rbp) jmp 0x853523 jmp 0x8534f5 jmp 0x853509 movq -0x18(%rbp), %rdi leaq 0x351e57(%rip), %rsi # 0xba5359 movb $0x0, %al callq 0x820bf0 jmp 0x85350b cmpl $0x0, -0x20(%rbp) jne 0x85351d movq -0x18(%rbp), %rdi callq 0x854ed0 movl %eax, -0x20(%rbp) movl -0x20(%rbp), %eax movl %eax, -0xc(%rbp) movl -0xc(%rbp), %eax addq $0x178, %rsp # imm = 0x178 popq %rbx popq %rbp retq
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_size_resp
static CURLcode ftp_state_size_resp(struct Curl_easy *data, int ftpcode, ftpstate instate) { CURLcode result = CURLE_OK; curl_off_t filesize = -1; char *buf = data->state.buffer; /* get the size from the ascii string: */ if(ftpcode == 213) { /* To allow servers to prepend "rubbish" in the response string, we scan for all the digits at the end of the response and parse only those as a number. */ char *start = &buf[4]; char *fdigit = strchr(start, '\r'); if(fdigit) { do fdigit--; while(ISDIGIT(*fdigit) && (fdigit > start)); if(!ISDIGIT(*fdigit)) fdigit++; } else fdigit = start; /* ignores parsing errors, which will make the size remain unknown */ (void)curlx_strtoofft(fdigit, NULL, 0, &filesize); } else if(ftpcode == 550) { /* "No such file or directory" */ /* allow a SIZE failure for (resumed) uploads, when probing what command to use */ if(instate != FTP_STOR_SIZE) { failf(data, "The file does not exist"); return CURLE_REMOTE_FILE_NOT_FOUND; } } if(instate == FTP_SIZE) { #ifdef CURL_FTP_HTTPSTYLE_HEAD if(-1 != filesize) { char clbuf[128]; int clbuflen = msnprintf(clbuf, sizeof(clbuf), "Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", filesize); result = Curl_client_write(data, CLIENTWRITE_BOTH, clbuf, clbuflen); if(result) return result; } #endif Curl_pgrsSetDownloadSize(data, filesize); result = ftp_state_rest(data, data->conn); } else if(instate == FTP_RETR_SIZE) { Curl_pgrsSetDownloadSize(data, filesize); result = ftp_state_retr(data, filesize); } else if(instate == FTP_STOR_SIZE) { data->state.resume_from = filesize; result = ftp_state_ul_setup(data, TRUE); } return result; }
pushq %rbp movq %rsp, %rbp subq $0xd0, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl %edx, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq $-0x1, -0x28(%rbp) movq -0x10(%rbp), %rax movq 0xc70(%rax), %rax movq %rax, -0x30(%rbp) cmpl $0xd5, -0x14(%rbp) jne 0x853709 movq -0x30(%rbp), %rax addq $0x4, %rax movq %rax, -0x38(%rbp) movq -0x38(%rbp), %rdi movl $0xd, %esi callq 0x3d450 movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) je 0x8536ec jmp 0x853677 movq -0x40(%rbp), %rax addq $-0x1, %rax movq %rax, -0x40(%rbp) movq -0x40(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x30, %ecx movb %al, -0xc5(%rbp) jl 0x8536bc movq -0x40(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x39, %ecx movb %al, -0xc5(%rbp) jg 0x8536bc movq -0x40(%rbp), %rax cmpq -0x38(%rbp), %rax seta %al movb %al, -0xc5(%rbp) movb -0xc5(%rbp), %al testb $0x1, %al jne 0x853677 movq -0x40(%rbp), %rax movsbl (%rax), %eax cmpl $0x30, %eax jl 0x8536de movq -0x40(%rbp), %rax movsbl (%rax), %eax cmpl $0x39, %eax jle 0x8536ea movq -0x40(%rbp), %rax addq $0x1, %rax movq %rax, -0x40(%rbp) jmp 0x8536f4 movq -0x38(%rbp), %rax movq %rax, -0x40(%rbp) movq -0x40(%rbp), %rdi xorl %eax, %eax movl %eax, %esi xorl %edx, %edx leaq -0x28(%rbp), %rcx callq 0x86e850 jmp 0x85373a cmpl $0x226, -0x14(%rbp) # imm = 0x226 jne 0x853738 cmpl $0x19, -0x18(%rbp) je 0x853736 movq -0x10(%rbp), %rdi leaq 0x351c9d(%rip), %rsi # 0xba53c0 movb $0x0, %al callq 0x820e10 movl $0x4e, -0x4(%rbp) jmp 0x85381c jmp 0x853738 jmp 0x85373a cmpl $0x17, -0x18(%rbp) jne 0x8537c7 movq $-0x1, %rax cmpq -0x28(%rbp), %rax je 0x8537a4 leaq -0xc0(%rbp), %rdi movq -0x28(%rbp), %rcx movl $0x80, %esi leaq 0x351342(%rip), %rdx # 0xba4aaa movb $0x0, %al callq 0x8179a0 movl %eax, -0xc4(%rbp) movq -0x10(%rbp), %rdi leaq -0xc0(%rbp), %rdx movslq -0xc4(%rbp), %rcx movl $0x3, %esi callq 0x821330 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x8537a2 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x85381c jmp 0x8537a4 movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rsi callq 0x81f2c0 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0x18(%rax), %rsi callq 0x855170 movl %eax, -0x1c(%rbp) jmp 0x853816 cmpl $0x18, -0x18(%rbp) jne 0x8537ec movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rsi callq 0x81f2c0 movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rsi callq 0x854910 movl %eax, -0x1c(%rbp) jmp 0x853814 cmpl $0x19, -0x18(%rbp) jne 0x853812 movq -0x28(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x1160(%rax) movq -0x10(%rbp), %rdi movl $0x1, %esi callq 0x854ba0 movl %eax, -0x1c(%rbp) jmp 0x853814 jmp 0x853816 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xd0, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_rest_resp
static CURLcode ftp_state_rest_resp(struct Curl_easy *data, struct connectdata *conn, int ftpcode, ftpstate instate) { CURLcode result = CURLE_OK; struct ftp_conn *ftpc = &conn->proto.ftpc; switch(instate) { case FTP_REST: default: #ifdef CURL_FTP_HTTPSTYLE_HEAD if(ftpcode == 350) { char buffer[24]= { "Accept-ranges: bytes\r\n" }; result = Curl_client_write(data, CLIENTWRITE_BOTH, buffer, strlen(buffer)); if(result) return result; } #endif result = ftp_state_prepare_transfer(data); break; case FTP_RETR_REST: if(ftpcode != 350) { failf(data, "Couldn't use REST"); result = CURLE_FTP_COULDNT_USE_REST; } else { result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file); if(!result) state(data, FTP_RETR); } break; } return result; }
pushq %rbp movq %rsp, %rbp subq $0x70, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) movl %ecx, -0x20(%rbp) movl $0x0, -0x24(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x30(%rbp) movl -0x20(%rbp), %eax movl %eax, -0x54(%rbp) subl $0x1a, %eax je 0x853872 jmp 0x853868 movl -0x54(%rbp), %eax subl $0x1b, %eax je 0x8538ed jmp 0x853874 jmp 0x853874 cmpl $0x15e, -0x1c(%rbp) # imm = 0x15E jne 0x8538df movq 0x35152c(%rip), %rax # 0xba4db0 movq %rax, -0x50(%rbp) movq 0x351529(%rip), %rax # 0xba4db8 movq %rax, -0x48(%rbp) movq 0x351526(%rip), %rax # 0xba4dc0 movq %rax, -0x40(%rbp) movq -0x10(%rbp), %rax movq %rax, -0x68(%rbp) leaq -0x50(%rbp), %rax movq %rax, -0x60(%rbp) leaq -0x50(%rbp), %rdi callq 0x3b8f0 movq -0x68(%rbp), %rdi movq -0x60(%rbp), %rdx movq %rax, %rcx movl $0x3, %esi callq 0x821330 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x8538dd movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x853953 jmp 0x8538df movq -0x10(%rbp), %rdi callq 0x855210 movl %eax, -0x24(%rbp) jmp 0x85394d cmpl $0x15e, -0x1c(%rbp) # imm = 0x15E je 0x853911 movq -0x10(%rbp), %rdi leaq 0x351ad7(%rip), %rsi # 0xba53d8 movb $0x0, %al callq 0x820e10 movl $0x1f, -0x24(%rbp) jmp 0x85394b movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x30(%rbp), %rax movq 0x90(%rax), %rcx leaq 0x351835(%rip), %rdx # 0xba5160 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) jne 0x853949 movq -0x10(%rbp), %rdi movl $0x20, %esi callq 0x851b50 jmp 0x85394b jmp 0x85394d movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x70, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_use_pasv
static CURLcode ftp_state_use_pasv(struct Curl_easy *data, struct connectdata *conn) { struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result = CURLE_OK; /* Here's the executive summary on what to do: PASV is RFC959, expect: 227 Entering Passive Mode (a1,a2,a3,a4,p1,p2) LPSV is RFC1639, expect: 228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2) EPSV is RFC2428, expect: 229 Entering Extended Passive Mode (|||port|) */ static const char mode[][5] = { "EPSV", "PASV" }; int modeoff; #ifdef PF_INET6 if(!conn->bits.ftp_use_epsv && conn->bits.ipv6) /* EPSV is disabled but we are connected to a IPv6 host, so we ignore the request and enable EPSV again! */ conn->bits.ftp_use_epsv = TRUE; #endif modeoff = conn->bits.ftp_use_epsv?0:1; result = Curl_pp_sendf(data, &ftpc->pp, "%s", mode[modeoff]); if(!result) { ftpc->count1 = modeoff; state(data, FTP_PASV); infof(data, "Connect data stream passively"); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x10(%rbp), %rax movl 0x374(%rax), %eax shrl $0x12, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x8539cb movq -0x10(%rbp), %rax movl 0x374(%rax), %eax shrl $0xc, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x8539cb movq -0x10(%rbp), %rax movl 0x374(%rax), %ecx andl $0xfffbffff, %ecx # imm = 0xFFFBFFFF orl $0x40000, %ecx # imm = 0x40000 movl %ecx, 0x374(%rax) movq -0x10(%rbp), %rax movl 0x374(%rax), %edx shrl $0x12, %edx andl $0x1, %edx movl $0x1, %eax xorl %ecx, %ecx cmpl $0x0, %edx cmovnel %ecx, %eax movl %eax, -0x20(%rbp) movq -0x8(%rbp), %rdi movq -0x18(%rbp), %rsi movslq -0x20(%rbp), %rax leaq 0x3513ca(%rip), %rcx # 0xba4dc8 imulq $0x5, %rax, %rax addq %rax, %rcx leaq 0x350eb6(%rip), %rdx # 0xba48c2 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x853a49 movl -0x20(%rbp), %ecx movq -0x18(%rbp), %rax movl %ecx, 0xc4(%rax) movq -0x8(%rbp), %rdi movl $0x1e, %esi callq 0x851b50 movq -0x8(%rbp), %rdi leaq 0x3519a8(%rip), %rsi # 0xba53ea movb $0x0, %al callq 0x820bf0 movl -0x1c(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_pasv_resp
static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, int ftpcode) { struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result; struct Curl_dns_entry *addr = NULL; enum resolve_t rc; unsigned short connectport; /* the local port connect() should use! */ char *str = &data->state.buffer[4]; /* start on the first letter */ /* if we come here again, make sure the former name is cleared */ Curl_safefree(ftpc->newhost); if((ftpc->count1 == 0) && (ftpcode == 229)) { /* positive EPSV response */ char *ptr = strchr(str, '('); if(ptr) { unsigned int num; char separator[4]; ptr++; if(5 == sscanf(ptr, "%c%c%c%u%c", &separator[0], &separator[1], &separator[2], &num, &separator[3])) { const char sep1 = separator[0]; int i; /* The four separators should be identical, or else this is an oddly formatted reply and we bail out immediately. */ for(i = 1; i<4; i++) { if(separator[i] != sep1) { ptr = NULL; /* set to NULL to signal error */ break; } } if(num > 0xffff) { failf(data, "Illegal port number in EPSV reply"); return CURLE_FTP_WEIRD_PASV_REPLY; } if(ptr) { ftpc->newport = (unsigned short)(num & 0xffff); ftpc->newhost = strdup(control_address(conn)); if(!ftpc->newhost) return CURLE_OUT_OF_MEMORY; } } else ptr = NULL; } if(!ptr) { failf(data, "Weirdly formatted EPSV reply"); return CURLE_FTP_WEIRD_PASV_REPLY; } } else if((ftpc->count1 == 1) && (ftpcode == 227)) { /* positive PASV response */ unsigned int ip[4] = {0, 0, 0, 0}; unsigned int port[2] = {0, 0}; /* * Scan for a sequence of six comma-separated numbers and use them as * IP+port indicators. * * Found reply-strings include: * "227 Entering Passive Mode (127,0,0,1,4,51)" * "227 Data transfer will passively listen to 127,0,0,1,4,51" * "227 Entering passive mode. 127,0,0,1,4,51" */ while(*str) { if(6 == sscanf(str, "%u,%u,%u,%u,%u,%u", &ip[0], &ip[1], &ip[2], &ip[3], &port[0], &port[1])) break; str++; } if(!*str || (ip[0] > 255) || (ip[1] > 255) || (ip[2] > 255) || (ip[3] > 255) || (port[0] > 255) || (port[1] > 255) ) { failf(data, "Couldn't interpret the 227-response"); return CURLE_FTP_WEIRD_227_FORMAT; } /* we got OK from server */ if(data->set.ftp_skip_ip) { /* told to ignore the remotely given IP but instead use the host we used for the control connection */ infof(data, "Skip %u.%u.%u.%u for data connection, re-use %s instead", ip[0], ip[1], ip[2], ip[3], conn->host.name); ftpc->newhost = strdup(control_address(conn)); } else ftpc->newhost = aprintf("%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); if(!ftpc->newhost) return CURLE_OUT_OF_MEMORY; ftpc->newport = (unsigned short)(((port[0]<<8) + port[1]) & 0xffff); } else if(ftpc->count1 == 0) { /* EPSV failed, move on to PASV */ return ftp_epsv_disable(data, conn); } else { failf(data, "Bad PASV/EPSV response: %03d", ftpcode); return CURLE_FTP_WEIRD_PASV_REPLY; } #ifndef CURL_DISABLE_PROXY if(conn->bits.proxy) { /* * This connection uses a proxy and we need to connect to the proxy again * here. We don't want to rely on a former host lookup that might've * expired now, instead we remake the lookup here and now! */ const char * const host_name = conn->bits.socksproxy ? conn->socks_proxy.host.name : conn->http_proxy.host.name; rc = Curl_resolv(data, host_name, (int)conn->port, FALSE, &addr); if(rc == CURLRESOLV_PENDING) /* BLOCKING, ignores the return code but 'addr' will be NULL in case of failure */ (void)Curl_resolver_wait_resolv(data, &addr); connectport = (unsigned short)conn->port; /* we connect to the proxy's port */ if(!addr) { failf(data, "Can't resolve proxy host %s:%hu", host_name, connectport); return CURLE_COULDNT_RESOLVE_PROXY; } } else #endif { /* normal, direct, ftp connection */ DEBUGASSERT(ftpc->newhost); /* postponed address resolution in case of tcp fastopen */ if(conn->bits.tcp_fastopen && !conn->bits.reuse && !ftpc->newhost[0]) { Curl_conninfo_remote(data, conn, conn->sock[FIRSTSOCKET]); Curl_safefree(ftpc->newhost); ftpc->newhost = strdup(control_address(conn)); if(!ftpc->newhost) return CURLE_OUT_OF_MEMORY; } rc = Curl_resolv(data, ftpc->newhost, ftpc->newport, FALSE, &addr); if(rc == CURLRESOLV_PENDING) /* BLOCKING */ (void)Curl_resolver_wait_resolv(data, &addr); connectport = ftpc->newport; /* we connect to the remote port */ if(!addr) { failf(data, "Can't resolve new host %s:%hu", ftpc->newhost, connectport); return CURLE_FTP_CANT_GET_HOST; } } conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE; result = Curl_connecthost(data, conn, addr); if(result) { Curl_resolv_unlock(data, addr); /* we're done using this address */ if(ftpc->count1 == 0 && ftpcode == 229) return ftp_epsv_disable(data, conn); return result; } /* * When this is used from the multi interface, this might've returned with * the 'connected' set to FALSE and thus we are now awaiting a non-blocking * connect to connect. */ if(data->set.verbose) /* this just dumps information about this second connection */ ftp_pasv_verbose(data, addr->addr, ftpc->newhost, connectport); Curl_resolv_unlock(data, addr); /* we're done using this address */ Curl_safefree(conn->secondaryhostname); conn->secondary_port = ftpc->newport; conn->secondaryhostname = strdup(ftpc->newhost); if(!conn->secondaryhostname) return CURLE_OUT_OF_MEMORY; conn->bits.do_more = TRUE; state(data, FTP_STOP); /* this phase is completed */ return result; }
pushq %rbp movq %rsp, %rbp subq $0xb0, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq $0x0, -0x38(%rbp) movq -0x10(%rbp), %rax movq 0xc70(%rax), %rax addq $0x4, %rax movq %rax, -0x48(%rbp) leaq 0x6a8952(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x28(%rbp), %rcx movq 0xb0(%rcx), %rdi callq *%rax movq -0x28(%rbp), %rax movq $0x0, 0xb0(%rax) movq -0x28(%rbp), %rax cmpl $0x0, 0xc4(%rax) jne 0x853c5e cmpl $0xe5, -0x14(%rbp) jne 0x853c5e movq -0x48(%rbp), %rdi movl $0x28, %esi callq 0x3d450 movq %rax, -0x50(%rbp) cmpq $0x0, -0x50(%rbp) je 0x853c34 movq -0x50(%rbp), %rax addq $0x1, %rax movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rdi leaq -0x58(%rbp), %rdx leaq -0x58(%rbp), %rcx addq $0x1, %rcx leaq -0x58(%rbp), %r8 addq $0x2, %r8 leaq -0x58(%rbp), %rax addq $0x3, %rax leaq 0x3518cd(%rip), %rsi # 0xba5408 leaq -0x54(%rbp), %r9 movq %rax, (%rsp) movb $0x0, %al callq 0x3b220 movl %eax, %ecx movl $0x5, %eax cmpl %ecx, %eax jne 0x853c2a movb -0x58(%rbp), %al movb %al, -0x59(%rbp) movl $0x1, -0x60(%rbp) cmpl $0x4, -0x60(%rbp) jge 0x853b94 movslq -0x60(%rbp), %rax movsbl -0x58(%rbp,%rax), %eax movsbl -0x59(%rbp), %ecx cmpl %ecx, %eax je 0x853b87 movq $0x0, -0x50(%rbp) jmp 0x853b94 jmp 0x853b89 movl -0x60(%rbp), %eax addl $0x1, %eax movl %eax, -0x60(%rbp) jmp 0x853b66 cmpl $0xffff, -0x54(%rbp) # imm = 0xFFFF jbe 0x853bbb movq -0x10(%rbp), %rdi leaq 0x35186b(%rip), %rsi # 0xba5413 movb $0x0, %al callq 0x820e10 movl $0xd, -0x4(%rbp) jmp 0x8541e6 cmpq $0x0, -0x50(%rbp) je 0x853c28 movl -0x54(%rbp), %eax andl $0xffff, %eax # imm = 0xFFFF movw %ax, %cx movq -0x28(%rbp), %rax movw %cx, 0xae(%rax) leaq 0x6a8831(%rip), %rax # 0xefc410 movq (%rax), %rax movq %rax, -0x88(%rbp) movq -0x20(%rbp), %rdi callq 0x856530 movq %rax, %rdi movq -0x88(%rbp), %rax callq *%rax movq %rax, %rcx movq -0x28(%rbp), %rax movq %rcx, 0xb0(%rax) movq -0x28(%rbp), %rax cmpq $0x0, 0xb0(%rax) jne 0x853c26 movl $0x1b, -0x4(%rbp) jmp 0x8541e6 jmp 0x853c28 jmp 0x853c32 movq $0x0, -0x50(%rbp) jmp 0x853c34 cmpq $0x0, -0x50(%rbp) jne 0x853c59 movq -0x10(%rbp), %rdi leaq 0x3517ef(%rip), %rsi # 0xba5435 movb $0x0, %al callq 0x820e10 movl $0xd, -0x4(%rbp) jmp 0x8541e6 jmp 0x853e83 movq -0x28(%rbp), %rax cmpl $0x1, 0xc4(%rax) jne 0x853e3e cmpl $0xe3, -0x14(%rbp) jne 0x853e3e leaq -0x70(%rbp), %rdi xorl %esi, %esi movl $0x10, %edx callq 0x3b780 leaq -0x78(%rbp), %rdi xorl %esi, %esi movl $0x8, %edx callq 0x3b780 movq -0x48(%rbp), %rax cmpb $0x0, (%rax) je 0x853d03 movq -0x48(%rbp), %rdi leaq -0x70(%rbp), %rdx leaq -0x70(%rbp), %rcx addq $0x4, %rcx leaq -0x70(%rbp), %r8 addq $0x8, %r8 leaq -0x70(%rbp), %r9 addq $0xc, %r9 leaq -0x78(%rbp), %r10 leaq -0x78(%rbp), %rax addq $0x4, %rax leaq 0x35177a(%rip), %rsi # 0xba5452 movq %r10, (%rsp) movq %rax, 0x8(%rsp) movb $0x0, %al callq 0x3b220 movl %eax, %ecx movl $0x6, %eax cmpl %ecx, %eax jne 0x853cf5 jmp 0x853d03 movq -0x48(%rbp), %rax addq $0x1, %rax movq %rax, -0x48(%rbp) jmp 0x853c9c movq -0x48(%rbp), %rax cmpb $0x0, (%rax) je 0x853d42 cmpl $0xff, -0x70(%rbp) ja 0x853d42 cmpl $0xff, -0x6c(%rbp) ja 0x853d42 cmpl $0xff, -0x68(%rbp) ja 0x853d42 cmpl $0xff, -0x64(%rbp) ja 0x853d42 cmpl $0xff, -0x78(%rbp) ja 0x853d42 cmpl $0xff, -0x74(%rbp) jbe 0x853d60 movq -0x10(%rbp), %rdi leaq 0x351717(%rip), %rsi # 0xba5464 movb $0x0, %al callq 0x820e10 movl $0xe, -0x4(%rbp) jmp 0x8541e6 movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0xe, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x853ddd movq -0x10(%rbp), %rdi movl -0x70(%rbp), %edx movl -0x6c(%rbp), %ecx movl -0x68(%rbp), %r8d movl -0x64(%rbp), %r9d movq -0x20(%rbp), %rax movq 0x98(%rax), %rax leaq 0x3516ec(%rip), %rsi # 0xba5488 movq %rax, (%rsp) movb $0x0, %al callq 0x820bf0 leaq 0x6a8662(%rip), %rax # 0xefc410 movq (%rax), %rax movq %rax, -0x90(%rbp) movq -0x20(%rbp), %rdi callq 0x856530 movq %rax, %rdi movq -0x90(%rbp), %rax callq *%rax movq %rax, %rcx movq -0x28(%rbp), %rax movq %rcx, 0xb0(%rax) jmp 0x853e06 movl -0x70(%rbp), %esi movl -0x6c(%rbp), %edx movl -0x68(%rbp), %ecx movl -0x64(%rbp), %r8d leaq 0x3550f6(%rip), %rdi # 0xba8ee7 movb $0x0, %al callq 0x817bb0 movq %rax, %rcx movq -0x28(%rbp), %rax movq %rcx, 0xb0(%rax) movq -0x28(%rbp), %rax cmpq $0x0, 0xb0(%rax) jne 0x853e20 movl $0x1b, -0x4(%rbp) jmp 0x8541e6 movl -0x78(%rbp), %eax shll $0x8, %eax addl -0x74(%rbp), %eax andl $0xffff, %eax # imm = 0xFFFF movw %ax, %cx movq -0x28(%rbp), %rax movw %cx, 0xae(%rax) jmp 0x853e81 movq -0x28(%rbp), %rax cmpl $0x0, 0xc4(%rax) jne 0x853e60 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x856590 movl %eax, -0x4(%rbp) jmp 0x8541e6 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %edx leaq 0x351652(%rip), %rsi # 0xba54c0 movb $0x0, %al callq 0x820e10 movl $0xd, -0x4(%rbp) jmp 0x8541e6 jmp 0x853e83 movq -0x20(%rbp), %rax movl 0x374(%rax), %eax shrl $0x5, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x853f49 movq -0x20(%rbp), %rax movl 0x374(%rax), %eax shrl %eax andl $0x1, %eax cmpl $0x0, %eax je 0x853ec4 movq -0x20(%rbp), %rax movq 0xe8(%rax), %rax movq %rax, -0x98(%rbp) jmp 0x853ed6 movq -0x20(%rbp), %rax movq 0x128(%rax), %rax movq %rax, -0x98(%rbp) movq -0x98(%rbp), %rax movq %rax, -0x80(%rbp) movq -0x10(%rbp), %rdi movq -0x80(%rbp), %rsi movq -0x20(%rbp), %rax movl 0x568(%rax), %edx xorl %ecx, %ecx leaq -0x38(%rbp), %r8 callq 0x85c930 movl %eax, -0x3c(%rbp) cmpl $0x1, -0x3c(%rbp) jne 0x853f09 jmp 0x853f09 movq -0x20(%rbp), %rax movl 0x568(%rax), %eax movw %ax, -0x3e(%rbp) cmpq $0x0, -0x38(%rbp) jne 0x853f44 movq -0x10(%rbp), %rdi movq -0x80(%rbp), %rdx movzwl -0x3e(%rbp), %ecx leaq 0x3515ac(%rip), %rsi # 0xba54dd movb $0x0, %al callq 0x820e10 movl $0x5, -0x4(%rbp) jmp 0x8541e6 jmp 0x854095 jmp 0x853f4b jmp 0x853f4d movq -0x20(%rbp), %rax movl 0x374(%rax), %eax shrl $0x19, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x854020 movq -0x20(%rbp), %rax movl 0x374(%rax), %eax shrl $0x7, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x854020 movq -0x28(%rbp), %rax movq 0xb0(%rax), %rax cmpb $0x0, (%rax) jne 0x854020 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x20(%rbp), %rax movl 0x1e0(%rax), %edx callq 0x847800 leaq 0x6a844f(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x28(%rbp), %rcx movq 0xb0(%rcx), %rdi callq *%rax movq -0x28(%rbp), %rax movq $0x0, 0xb0(%rax) leaq 0x6a8439(%rip), %rax # 0xefc410 movq (%rax), %rax movq %rax, -0xa0(%rbp) movq -0x20(%rbp), %rdi callq 0x856530 movq %rax, %rdi movq -0xa0(%rbp), %rax callq *%rax movq %rax, %rcx movq -0x28(%rbp), %rax movq %rcx, 0xb0(%rax) movq -0x28(%rbp), %rax cmpq $0x0, 0xb0(%rax) jne 0x85401e movl $0x1b, -0x4(%rbp) jmp 0x8541e6 jmp 0x854020 movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rax movq 0xb0(%rax), %rsi movq -0x28(%rbp), %rax movzwl 0xae(%rax), %edx xorl %ecx, %ecx leaq -0x38(%rbp), %r8 callq 0x85c930 movl %eax, -0x3c(%rbp) cmpl $0x1, -0x3c(%rbp) jne 0x854050 jmp 0x854050 movq -0x28(%rbp), %rax movw 0xae(%rax), %ax movw %ax, -0x3e(%rbp) cmpq $0x0, -0x38(%rbp) jne 0x854093 movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rax movq 0xb0(%rax), %rdx movzwl -0x3e(%rbp), %ecx leaq 0x35147d(%rip), %rsi # 0xba54fd movb $0x0, %al callq 0x820e10 movl $0xf, -0x4(%rbp) jmp 0x8541e6 jmp 0x854095 movq -0x20(%rbp), %rax movb $0x0, 0x371(%rax) movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x38(%rbp), %rdx callq 0x8487a0 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x8540fd movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi callq 0x85d210 movq -0x28(%rbp), %rax cmpl $0x0, 0xc4(%rax) jne 0x8540f2 cmpl $0xe5, -0x14(%rbp) jne 0x8540f2 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x856590 movl %eax, -0x4(%rbp) jmp 0x8541e6 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x8541e6 movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x1b, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x854134 movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rax movq (%rax), %rsi movq -0x28(%rbp), %rax movq 0xb0(%rax), %rdx movzwl -0x3e(%rbp), %ecx callq 0x8566b0 movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi callq 0x85d210 leaq 0x6a82b8(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x20(%rbp), %rcx movq 0xb0(%rcx), %rdi callq *%rax movq -0x20(%rbp), %rax movq $0x0, 0xb0(%rax) movq -0x28(%rbp), %rax movw 0xae(%rax), %cx movq -0x20(%rbp), %rax movw %cx, 0x57a(%rax) leaq 0x6a828c(%rip), %rax # 0xefc410 movq (%rax), %rax movq -0x28(%rbp), %rcx movq 0xb0(%rcx), %rdi callq *%rax movq %rax, %rcx movq -0x20(%rbp), %rax movq %rcx, 0xb0(%rax) movq -0x20(%rbp), %rax cmpq $0x0, 0xb0(%rax) jne 0x8541b9 movl $0x1b, -0x4(%rbp) jmp 0x8541e6 movq -0x20(%rbp), %rax movl 0x374(%rax), %ecx andl $0xffffdfff, %ecx # imm = 0xFFFFDFFF orl $0x2000, %ecx # imm = 0x2000 movl %ecx, 0x374(%rax) movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xb0, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_port_resp
static CURLcode ftp_state_port_resp(struct Curl_easy *data, int ftpcode) { struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; ftpport fcmd = (ftpport)ftpc->count1; CURLcode result = CURLE_OK; /* The FTP spec tells a positive response should have code 200. Be more permissive here to tolerate deviant servers. */ if(ftpcode / 100 != 2) { /* the command failed */ if(EPRT == fcmd) { infof(data, "disabling EPRT usage"); conn->bits.ftp_use_eprt = FALSE; } fcmd++; if(fcmd == DONE) { failf(data, "Failed to do PORT"); result = CURLE_FTP_PORT_FAILED; } else /* try next */ result = ftp_state_use_port(data, fcmd); } else { infof(data, "Connect data stream actively"); state(data, FTP_STOP); /* end of DO phase */ result = ftp_dophase_done(data, FALSE); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movl %esi, -0xc(%rbp) movq -0x8(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax movl 0xc4(%rax), %eax movl %eax, -0x24(%rbp) movl $0x0, -0x28(%rbp) movl -0xc(%rbp), %eax movl $0x64, %ecx cltd idivl %ecx cmpl $0x2, %eax je 0x8542ba xorl %eax, %eax cmpl -0x24(%rbp), %eax jne 0x85427f movq -0x8(%rbp), %rdi leaq 0x351320(%rip), %rsi # 0xba557f movb $0x0, %al callq 0x820bf0 movq -0x18(%rbp), %rax movl 0x374(%rax), %ecx andl $0xfff7ffff, %ecx # imm = 0xFFF7FFFF orl $0x0, %ecx movl %ecx, 0x374(%rax) movl -0x24(%rbp), %eax addl $0x1, %eax movl %eax, -0x24(%rbp) cmpl $0x2, -0x24(%rbp) jne 0x8542a9 movq -0x8(%rbp), %rdi leaq 0x3512fb(%rip), %rsi # 0xba5594 movb $0x0, %al callq 0x820e10 movl $0x1e, -0x28(%rbp) jmp 0x8542b8 movq -0x8(%rbp), %rdi movl -0x24(%rbp), %esi callq 0x8553f0 movl %eax, -0x28(%rbp) jmp 0x8542e5 movq -0x8(%rbp), %rdi leaq 0x3512e1(%rip), %rsi # 0xba55a6 movb $0x0, %al callq 0x820bf0 movq -0x8(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movq -0x8(%rbp), %rdi xorl %esi, %esi callq 0x856710 movl %eax, -0x28(%rbp) movl -0x28(%rbp), %eax addq $0x30, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_get_resp
static CURLcode ftp_state_get_resp(struct Curl_easy *data, int ftpcode, ftpstate instate) { CURLcode result = CURLE_OK; struct FTP *ftp = data->req.p.ftp; struct connectdata *conn = data->conn; if((ftpcode == 150) || (ftpcode == 125)) { /* A; 150 Opening BINARY mode data connection for /etc/passwd (2241 bytes). (ok, the file is being transferred) B: 150 Opening ASCII mode data connection for /bin/ls C: 150 ASCII data connection for /bin/ls (137.167.104.91,37445) (0 bytes). D: 150 Opening ASCII mode data connection for [file] (0.0.0.0,0) (545 bytes) E: 125 Data connection already open; Transfer starting. */ curl_off_t size = -1; /* default unknown size */ /* * It appears that there are FTP-servers that return size 0 for files when * SIZE is used on the file while being in BINARY mode. To work around * that (stupid) behavior, we attempt to parse the RETR response even if * the SIZE returned size zero. * * Debugging help from Salvatore Sorrentino on February 26, 2003. */ if((instate != FTP_LIST) && !data->state.prefer_ascii && (ftp->downloadsize < 1)) { /* * It seems directory listings either don't show the size or very * often uses size 0 anyway. ASCII transfers may very well turn out * that the transferred amount of data is not the same as this line * tells, why using this number in those cases only confuses us. * * Example D above makes this parsing a little tricky */ char *bytes; char *buf = data->state.buffer; bytes = strstr(buf, " bytes"); if(bytes) { long in = (long)(--bytes-buf); /* this is a hint there is size information in there! ;-) */ while(--in) { /* scan for the left parenthesis and break there */ if('(' == *bytes) break; /* skip only digits */ if(!ISDIGIT(*bytes)) { bytes = NULL; break; } /* one more estep backwards */ bytes--; } /* if we have nothing but digits: */ if(bytes) { ++bytes; /* get the number! */ (void)curlx_strtoofft(bytes, NULL, 0, &size); } } } else if(ftp->downloadsize > -1) size = ftp->downloadsize; if(size > data->req.maxdownload && data->req.maxdownload > 0) size = data->req.size = data->req.maxdownload; else if((instate != FTP_LIST) && (data->state.prefer_ascii)) size = -1; /* kludge for servers that understate ASCII mode file size */ infof(data, "Maxdownload = %" CURL_FORMAT_CURL_OFF_T, data->req.maxdownload); if(instate != FTP_LIST) infof(data, "Getting file with size: %" CURL_FORMAT_CURL_OFF_T, size); /* FTP download: */ conn->proto.ftpc.state_saved = instate; conn->proto.ftpc.retr_size_saved = size; if(data->set.ftp_use_port) { bool connected; result = AllowServerConnect(data, &connected); if(result) return result; if(!connected) { struct ftp_conn *ftpc = &conn->proto.ftpc; infof(data, "Data conn was not available immediately"); state(data, FTP_STOP); ftpc->wait_data_conn = TRUE; } } else return InitiateTransfer(data); } else { if((instate == FTP_LIST) && (ftpcode == 450)) { /* simply no matching files in the dir listing */ ftp->transfer = PPTRANSFER_NONE; /* don't download anything */ state(data, FTP_STOP); /* this phase is over */ } else { failf(data, "RETR response: %03d", ftpcode); return instate == FTP_RETR && ftpcode == 550? CURLE_REMOTE_FILE_NOT_FOUND: CURLE_FTP_COULDNT_RETR_FILE; } } return result; }
pushq %rbp movq %rsp, %rbp subq $0x70, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl %edx, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x30(%rbp) cmpl $0x96, -0x14(%rbp) je 0x854337 cmpl $0x7d, -0x14(%rbp) jne 0x854589 movq $-0x1, -0x38(%rbp) cmpl $0x1f, -0x18(%rbp) je 0x854434 movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0xf, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x854434 movq -0x28(%rbp), %rax cmpq $0x1, 0x18(%rax) jge 0x854434 movq -0x10(%rbp), %rax movq 0xc70(%rax), %rax movq %rax, -0x48(%rbp) movq -0x48(%rbp), %rdi leaq 0x36aef8(%rip), %rsi # 0xbbf283 callq 0x3ba00 movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) je 0x854432 movq -0x40(%rbp), %rax addq $-0x1, %rax movq %rax, -0x40(%rbp) movq -0x48(%rbp), %rcx subq %rcx, %rax movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax addq $-0x1, %rax movq %rax, -0x50(%rbp) cmpq $0x0, %rax je 0x85440a movq -0x40(%rbp), %rax movsbl (%rax), %ecx movl $0x28, %eax cmpl %ecx, %eax jne 0x8543da jmp 0x85440a movq -0x40(%rbp), %rax movsbl (%rax), %eax cmpl $0x30, %eax jl 0x8543f2 movq -0x40(%rbp), %rax movsbl (%rax), %eax cmpl $0x39, %eax jle 0x8543fc movq $0x0, -0x40(%rbp) jmp 0x85440a movq -0x40(%rbp), %rax addq $-0x1, %rax movq %rax, -0x40(%rbp) jmp 0x8543b6 cmpq $0x0, -0x40(%rbp) je 0x854430 movq -0x40(%rbp), %rax addq $0x1, %rax movq %rax, -0x40(%rbp) movq -0x40(%rbp), %rdi xorl %eax, %eax movl %eax, %esi xorl %edx, %edx leaq -0x38(%rbp), %rcx callq 0x86e850 jmp 0x854432 jmp 0x85444d movq -0x28(%rbp), %rax cmpq $-0x1, 0x18(%rax) jle 0x85444b movq -0x28(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x38(%rbp) jmp 0x85444d movq -0x38(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0xd8(%rcx), %rax jle 0x854488 movq -0x10(%rbp), %rax cmpq $0x0, 0xd8(%rax) jle 0x854488 movq -0x10(%rbp), %rax movq 0xd8(%rax), %rax movq -0x10(%rbp), %rcx movq %rax, 0xd0(%rcx) movq %rax, -0x38(%rbp) jmp 0x8544ad cmpl $0x1f, -0x18(%rbp) je 0x8544ab movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0xf, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x8544ab movq $-0x1, -0x38(%rbp) jmp 0x8544ad movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0xd8(%rax), %rdx leaq 0x351100(%rip), %rsi # 0xba55c3 movb $0x0, %al callq 0x820bf0 cmpl $0x1f, -0x18(%rbp) je 0x8544e6 movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rdx leaq 0x3510f6(%rip), %rsi # 0xba55d5 movb $0x0, %al callq 0x820bf0 movl -0x18(%rbp), %ecx movq -0x30(%rbp), %rax movl %ecx, 0x51c(%rax) movq -0x38(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, 0x520(%rax) movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0xa, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x854579 movq -0x10(%rbp), %rdi leaq -0x51(%rbp), %rsi callq 0x8567f0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x85453b movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x8545fd testb $0x1, -0x51(%rbp) jne 0x854577 movq -0x30(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x60(%rbp) movq -0x10(%rbp), %rdi leaq 0x351097(%rip), %rsi # 0xba55f1 movb $0x0, %al callq 0x820bf0 movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movq -0x60(%rbp), %rax movb $0x1, 0xad(%rax) jmp 0x854587 movq -0x10(%rbp), %rdi callq 0x856920 movl %eax, -0x4(%rbp) jmp 0x8545fd jmp 0x8545f7 cmpl $0x1f, -0x18(%rbp) jne 0x8545b0 cmpl $0x1c2, -0x14(%rbp) # imm = 0x1C2 jne 0x8545b0 movq -0x28(%rbp), %rax movl $0x2, 0x10(%rax) movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 jmp 0x8545f5 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %edx leaq 0x35105b(%rip), %rsi # 0xba5619 movb $0x0, %al callq 0x820e10 xorl %eax, %eax cmpl $0x20, -0x18(%rbp) movb %al, -0x61(%rbp) jne 0x8545dd cmpl $0x226, -0x14(%rbp) # imm = 0x226 sete %al movb %al, -0x61(%rbp) movb -0x61(%rbp), %dl movl $0x13, %eax movl $0x4e, %ecx testb $0x1, %dl cmovnel %ecx, %eax movl %eax, -0x4(%rbp) jmp 0x8545fd jmp 0x8545f7 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x70, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_stor_resp
static CURLcode ftp_state_stor_resp(struct Curl_easy *data, int ftpcode, ftpstate instate) { CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; if(ftpcode >= 400) { failf(data, "Failed FTP upload: %0d", ftpcode); state(data, FTP_STOP); /* oops, we never close the sockets! */ return CURLE_UPLOAD_FAILED; } conn->proto.ftpc.state_saved = instate; /* PORT means we are now awaiting the server to connect to us. */ if(data->set.ftp_use_port) { bool connected; state(data, FTP_STOP); /* no longer in STOR state */ result = AllowServerConnect(data, &connected); if(result) return result; if(!connected) { struct ftp_conn *ftpc = &conn->proto.ftpc; infof(data, "Data conn was not available immediately"); ftpc->wait_data_conn = TRUE; } return CURLE_OK; } return InitiateTransfer(data); }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl %edx, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x28(%rbp) cmpl $0x190, -0x14(%rbp) # imm = 0x190 jl 0x85466a movq -0x10(%rbp), %rdi movl -0x14(%rbp), %edx leaq 0x351187(%rip), %rsi # 0xba57d3 movb $0x0, %al callq 0x820e10 movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movl $0x19, -0x4(%rbp) jmp 0x8546fe movl -0x18(%rbp), %ecx movq -0x28(%rbp), %rax movl %ecx, 0x51c(%rax) movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0xa, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x8546f2 movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movq -0x10(%rbp), %rdi leaq -0x29(%rbp), %rsi callq 0x8567f0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x8546b8 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x8546fe testb $0x1, -0x29(%rbp) jne 0x8546e9 movq -0x28(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rdi leaq 0x350f1a(%rip), %rsi # 0xba55f1 movb $0x0, %al callq 0x820bf0 movq -0x38(%rbp), %rax movb $0x1, 0xad(%rax) movl $0x0, -0x4(%rbp) jmp 0x8546fe movq -0x10(%rbp), %rdi callq 0x856920 movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_loggedin
static CURLcode ftp_state_loggedin(struct Curl_easy *data) { CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; if(conn->bits.ftp_use_control_ssl) { /* PBSZ = PROTECTION BUFFER SIZE. The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says: Specifically, the PROT command MUST be preceded by a PBSZ command and a PBSZ command MUST be preceded by a successful security data exchange (the TLS negotiation in this case) ... (and on page 8): Thus the PBSZ command must still be issued, but must have a parameter of '0' to indicate that no buffering is taking place and the data connection should not be encapsulated. */ result = Curl_pp_sendf(data, &conn->proto.ftpc.pp, "PBSZ %d", 0); if(!result) state(data, FTP_PBSZ); } else { result = ftp_state_pwd(data, conn); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movl $0x0, -0xc(%rbp) movq -0x8(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax movl 0x374(%rax), %eax shrl $0x15, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x85477c movq -0x8(%rbp), %rdi movq -0x18(%rbp), %rsi addq $0x448, %rsi # imm = 0x448 leaq 0x3508a7(%rip), %rdx # 0xba5001 xorl %ecx, %ecx movb $0x0, %al callq 0x86c2e0 movl %eax, -0xc(%rbp) cmpl $0x0, -0xc(%rbp) jne 0x85477a movq -0x8(%rbp), %rdi movl $0x6, %esi callq 0x851b50 jmp 0x85478c movq -0x8(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x852cd0 movl %eax, -0xc(%rbp) movl -0xc(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_cwd
static CURLcode ftp_state_cwd(struct Curl_easy *data, struct connectdata *conn) { CURLcode result = CURLE_OK; struct ftp_conn *ftpc = &conn->proto.ftpc; if(ftpc->cwddone) /* already done and fine */ result = ftp_state_mdtm(data); else { /* FTPFILE_NOCWD with full path: expect ftpc->cwddone! */ DEBUGASSERT((data->set.ftp_filemethod != FTPFILE_NOCWD) || !(ftpc->dirdepth && ftpc->dirs[0][0] == '/')); ftpc->count2 = 0; /* count2 counts failed CWDs */ if(conn->bits.reuse && ftpc->entrypath && /* no need to go to entrypath when we have an absolute path */ !(ftpc->dirdepth && ftpc->dirs[0][0] == '/')) { /* This is a re-used connection. Since we change directory to where the transfer is taking place, we must first get back to the original dir where we ended up after login: */ ftpc->cwdcount = 0; /* we count this as the first path, then we add one for all upcoming ones in the ftp->dirs[] array */ result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", ftpc->entrypath); if(!result) state(data, FTP_CWD); } else { if(ftpc->dirdepth) { ftpc->cwdcount = 1; /* issue the first CWD, the rest is sent when the CWD responses are received... */ result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", ftpc->dirs[ftpc->cwdcount -1]); if(!result) state(data, FTP_CWD); } else { /* No CWD necessary */ result = ftp_state_mdtm(data); } } } return result; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl $0x0, -0x14(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax testb $0x1, 0xa6(%rax) je 0x8547e3 movq -0x8(%rbp), %rdi callq 0x853040 movl %eax, -0x14(%rbp) jmp 0x8548fc jmp 0x8547e5 jmp 0x8547e7 movq -0x20(%rbp), %rax movl $0x0, 0xc8(%rax) movq -0x10(%rbp), %rax movl 0x374(%rax), %eax shrl $0x7, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x854883 movq -0x20(%rbp), %rax cmpq $0x0, 0x88(%rax) je 0x854883 movq -0x20(%rbp), %rax cmpl $0x0, 0xa0(%rax) je 0x85483b movq -0x20(%rbp), %rax movq 0x98(%rax), %rax movq (%rax), %rax movsbl (%rax), %eax cmpl $0x2f, %eax je 0x854883 movq -0x20(%rbp), %rax movl $0x0, 0xa8(%rax) movq -0x8(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x20(%rbp), %rax movq 0x88(%rax), %rcx leaq 0x350719(%rip), %rdx # 0xba4f7c movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x854881 movq -0x8(%rbp), %rdi movl $0x10, %esi callq 0x851b50 jmp 0x8548fa movq -0x20(%rbp), %rax cmpl $0x0, 0xa0(%rax) je 0x8548ec movq -0x20(%rbp), %rax movl $0x1, 0xa8(%rax) movq -0x8(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x20(%rbp), %rax movq 0x98(%rax), %rax movq -0x20(%rbp), %rcx movl 0xa8(%rcx), %ecx subl $0x1, %ecx movslq %ecx, %rcx movq (%rax,%rcx,8), %rcx leaq 0x3506b0(%rip), %rdx # 0xba4f7c movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x8548ea movq -0x8(%rbp), %rdi movl $0x10, %esi callq 0x851b50 jmp 0x8548f8 movq -0x8(%rbp), %rdi callq 0x853040 movl %eax, -0x14(%rbp) jmp 0x8548fa jmp 0x8548fc movl -0x14(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_retr
static CURLcode ftp_state_retr(struct Curl_easy *data, curl_off_t filesize) { CURLcode result = CURLE_OK; struct FTP *ftp = data->req.p.ftp; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; if(data->set.max_filesize && (filesize > data->set.max_filesize)) { failf(data, "Maximum file size exceeded"); return CURLE_FILESIZE_EXCEEDED; } ftp->downloadsize = filesize; if(data->state.resume_from) { /* We always (attempt to) get the size of downloads, so it is done before this even when not doing resumes. */ if(filesize == -1) { infof(data, "ftp server doesn't support SIZE"); /* We couldn't get the size and therefore we can't know if there really is a part of the file left to get, although the server will just close the connection when we start the connection so it won't cause us any harm, just not make us exit as nicely. */ } else { /* We got a file size report, so we check that there actually is a part of the file left to get, or else we go home. */ if(data->state.resume_from< 0) { /* We're supposed to download the last abs(from) bytes */ if(filesize < -data->state.resume_from) { failf(data, "Offset (%" CURL_FORMAT_CURL_OFF_T ") was beyond file size (%" CURL_FORMAT_CURL_OFF_T ")", data->state.resume_from, filesize); return CURLE_BAD_DOWNLOAD_RESUME; } /* convert to size to download */ ftp->downloadsize = -data->state.resume_from; /* download from where? */ data->state.resume_from = filesize - ftp->downloadsize; } else { if(filesize < data->state.resume_from) { failf(data, "Offset (%" CURL_FORMAT_CURL_OFF_T ") was beyond file size (%" CURL_FORMAT_CURL_OFF_T ")", data->state.resume_from, filesize); return CURLE_BAD_DOWNLOAD_RESUME; } /* Now store the number of bytes we are expected to download */ ftp->downloadsize = filesize-data->state.resume_from; } } if(ftp->downloadsize == 0) { /* no data to transfer */ Curl_setup_transfer(data, -1, -1, FALSE, -1); infof(data, "File already completely downloaded"); /* Set ->transfer so that we won't get any error in ftp_done() * because we didn't transfer the any file */ ftp->transfer = PPTRANSFER_NONE; state(data, FTP_STOP); return CURLE_OK; } /* Set resume file transfer offset */ infof(data, "Instructs server to resume from offset %" CURL_FORMAT_CURL_OFF_T, data->state.resume_from); result = Curl_pp_sendf(data, &ftpc->pp, "REST %" CURL_FORMAT_CURL_OFF_T, data->state.resume_from); if(!result) state(data, FTP_RETR_REST); } else { /* no resume */ result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file); if(!result) state(data, FTP_RETR); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rax cmpq $0x0, 0x6f0(%rax) je 0x85498d movq -0x18(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x6f0(%rcx), %rax jle 0x85498d movq -0x10(%rbp), %rdi leaq 0x34dcbb(%rip), %rsi # 0xba2635 movb $0x0, %al callq 0x820e10 movl $0x3f, -0x4(%rbp) jmp 0x854b90 movq -0x18(%rbp), %rcx movq -0x28(%rbp), %rax movq %rcx, 0x18(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) je 0x854b50 cmpq $-0x1, -0x18(%rbp) jne 0x8549c9 movq -0x10(%rbp), %rdi leaq 0x35067a(%rip), %rsi # 0xba5037 movb $0x0, %al callq 0x820bf0 jmp 0x854a9f movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) jge 0x854a48 movq -0x18(%rbp), %rax movq -0x10(%rbp), %rdx xorl %ecx, %ecx subq 0x1160(%rdx), %rcx cmpq %rcx, %rax jge 0x854a1a movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0x1160(%rax), %rdx movq -0x18(%rbp), %rcx leaq 0x350650(%rip), %rsi # 0xba5057 movb $0x0, %al callq 0x820e10 movl $0x24, -0x4(%rbp) jmp 0x854b90 movq -0x10(%rbp), %rax xorl %ecx, %ecx subq 0x1160(%rax), %rcx movq -0x28(%rbp), %rax movq %rcx, 0x18(%rax) movq -0x18(%rbp), %rcx movq -0x28(%rbp), %rax subq 0x18(%rax), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x1160(%rax) jmp 0x854a9d movq -0x18(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x1160(%rcx), %rax jge 0x854a86 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0x1160(%rax), %rdx movq -0x18(%rbp), %rcx leaq 0x3505e4(%rip), %rsi # 0xba5057 movb $0x0, %al callq 0x820e10 movl $0x24, -0x4(%rbp) jmp 0x854b90 movq -0x18(%rbp), %rcx movq -0x10(%rbp), %rax subq 0x1160(%rax), %rcx movq -0x28(%rbp), %rax movq %rcx, 0x18(%rax) jmp 0x854a9f movq -0x28(%rbp), %rax cmpq $0x0, 0x18(%rax) jne 0x854af9 movq -0x10(%rbp), %rdi movl $0xffffffff, %r8d # imm = 0xFFFFFFFF movq $-0x1, %rdx xorl %ecx, %ecx movl %r8d, %esi callq 0x8348c0 movq -0x10(%rbp), %rdi leaq 0x3505af(%rip), %rsi # 0xba507f movb $0x0, %al callq 0x820bf0 movq -0x28(%rbp), %rax movl $0x2, 0x10(%rax) movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movl $0x0, -0x4(%rbp) jmp 0x854b90 movq -0x10(%rbp), %rdi movq -0x10(%rbp), %rax movq 0x1160(%rax), %rdx leaq 0x350593(%rip), %rsi # 0xba50a2 movb $0x0, %al callq 0x820bf0 movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi movq -0x10(%rbp), %rax movq 0x1160(%rax), %rcx leaq 0x35059d(%rip), %rdx # 0xba50cd movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x854b4e movq -0x10(%rbp), %rdi movl $0x1b, %esi callq 0x851b50 jmp 0x854b8a movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi movq -0x38(%rbp), %rax movq 0x90(%rax), %rcx leaq 0x3505f6(%rip), %rdx # 0xba5160 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x854b88 movq -0x10(%rbp), %rdi movl $0x20, %esi callq 0x851b50 jmp 0x854b8a movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_ul_setup
static CURLcode ftp_state_ul_setup(struct Curl_easy *data, bool sizechecked) { CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; struct FTP *ftp = data->req.p.ftp; struct ftp_conn *ftpc = &conn->proto.ftpc; bool append = data->set.remote_append; if((data->state.resume_from && !sizechecked) || ((data->state.resume_from > 0) && sizechecked)) { /* we're about to continue the uploading of a file */ /* 1. get already existing file's size. We use the SIZE command for this which may not exist in the server! The SIZE command is not in RFC959. */ /* 2. This used to set REST. But since we can do append, we don't another ftp command. We just skip the source file offset and then we APPEND the rest on the file instead */ /* 3. pass file-size number of bytes in the source file */ /* 4. lower the infilesize counter */ /* => transfer as usual */ int seekerr = CURL_SEEKFUNC_OK; if(data->state.resume_from < 0) { /* Got no given size to start from, figure it out */ result = Curl_pp_sendf(data, &ftpc->pp, "SIZE %s", ftpc->file); if(!result) state(data, FTP_STOR_SIZE); return result; } /* enable append */ append = TRUE; /* Let's read off the proper amount of bytes from the input. */ if(conn->seek_func) { Curl_set_in_callback(data, true); seekerr = conn->seek_func(conn->seek_client, data->state.resume_from, SEEK_SET); Curl_set_in_callback(data, false); } if(seekerr != CURL_SEEKFUNC_OK) { curl_off_t passed = 0; if(seekerr != CURL_SEEKFUNC_CANTSEEK) { failf(data, "Could not seek stream"); return CURLE_FTP_COULDNT_USE_REST; } /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ do { size_t readthisamountnow = (data->state.resume_from - passed > data->set.buffer_size) ? (size_t)data->set.buffer_size : curlx_sotouz(data->state.resume_from - passed); size_t actuallyread = data->state.fread_func(data->state.buffer, 1, readthisamountnow, data->state.in); passed += actuallyread; if((actuallyread == 0) || (actuallyread > readthisamountnow)) { /* this checks for greater-than only to make sure that the CURL_READFUNC_ABORT return code still aborts */ failf(data, "Failed to read data"); return CURLE_FTP_COULDNT_USE_REST; } } while(passed < data->state.resume_from); } /* now, decrease the size of the read */ if(data->state.infilesize>0) { data->state.infilesize -= data->state.resume_from; if(data->state.infilesize <= 0) { infof(data, "File already completely uploaded"); /* no data to transfer */ Curl_setup_transfer(data, -1, -1, FALSE, -1); /* Set ->transfer so that we won't get any error in * ftp_done() because we didn't transfer anything! */ ftp->transfer = PPTRANSFER_NONE; state(data, FTP_STOP); return CURLE_OK; } } /* we've passed, proceed as normal */ } /* resume_from */ result = Curl_pp_sendf(data, &ftpc->pp, append?"APPE %s":"STOR %s", ftpc->file); if(!result) state(data, FTP_STOR); return result; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movb %sil, %al movq %rdi, -0x10(%rbp) andb $0x1, %al movb %al, -0x11(%rbp) movl $0x0, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x30(%rbp) movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x8, %rax andq $0x1, %rax cmpl $0x0, %eax setne %al andb $0x1, %al movb %al, -0x31(%rbp) movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) je 0x854c16 testb $0x1, -0x11(%rbp) je 0x854c32 movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) jle 0x854e73 testb $0x1, -0x11(%rbp) je 0x854e73 movl $0x0, -0x38(%rbp) movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) jge 0x854c8a movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x30(%rbp), %rax movq 0x90(%rax), %rcx leaq 0x3503ce(%rip), %rdx # 0xba502f movb $0x0, %al callq 0x86c2e0 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) jne 0x854c7f movq -0x10(%rbp), %rdi movl $0x19, %esi callq 0x851b50 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x854ec2 movb $0x1, -0x31(%rbp) movq -0x20(%rbp), %rax cmpq $0x0, 0x3e0(%rax) je 0x854cdd movq -0x10(%rbp), %rdi movl $0x1, %esi callq 0x81e430 movq -0x20(%rbp), %rax movq 0x3e0(%rax), %rax movq -0x20(%rbp), %rcx movq 0x3e8(%rcx), %rdi movq -0x10(%rbp), %rcx movq 0x1160(%rcx), %rsi xorl %edx, %edx callq *%rax movl %eax, -0x38(%rbp) movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x81e430 cmpl $0x0, -0x38(%rbp) je 0x854de7 movq $0x0, -0x40(%rbp) cmpl $0x2, -0x38(%rbp) je 0x854d13 movq -0x10(%rbp), %rdi leaq 0x3503d6(%rip), %rsi # 0xba50d6 movb $0x0, %al callq 0x820e10 movl $0x1f, -0x4(%rbp) jmp 0x854ec2 jmp 0x854d15 movq -0x10(%rbp), %rax movq 0x1160(%rax), %rax subq -0x40(%rbp), %rax movq -0x10(%rbp), %rcx movl 0x6cc(%rcx), %ecx cmpq %rcx, %rax jle 0x854d43 movq -0x10(%rbp), %rax movl 0x6cc(%rax), %eax movq %rax, -0x58(%rbp) jmp 0x854d5b movq -0x10(%rbp), %rax movq 0x1160(%rax), %rdi subq -0x40(%rbp), %rdi callq 0x840910 movq %rax, -0x58(%rbp) movq -0x58(%rbp), %rax movq %rax, -0x48(%rbp) movq -0x10(%rbp), %rax movq 0x1178(%rax), %rax movq -0x10(%rbp), %rcx movq 0xc70(%rcx), %rdi movq -0x48(%rbp), %rdx movq -0x10(%rbp), %rcx movq 0x1180(%rcx), %rcx movl $0x1, %esi callq *%rax movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax addq -0x40(%rbp), %rax movq %rax, -0x40(%rbp) cmpq $0x0, -0x50(%rbp) je 0x854db0 movq -0x50(%rbp), %rax cmpq -0x48(%rbp), %rax jbe 0x854dce movq -0x10(%rbp), %rdi leaq 0x350331(%rip), %rsi # 0xba50ec movb $0x0, %al callq 0x820e10 movl $0x1f, -0x4(%rbp) jmp 0x854ec2 jmp 0x854dd0 movq -0x40(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x1160(%rcx), %rax jl 0x854d15 jmp 0x854de7 movq -0x10(%rbp), %rax cmpq $0x0, 0x1168(%rax) jle 0x854e71 movq -0x10(%rbp), %rax movq 0x1160(%rax), %rdx movq -0x10(%rbp), %rax movq 0x1168(%rax), %rcx subq %rdx, %rcx movq %rcx, 0x1168(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x1168(%rax) jg 0x854e6f movq -0x10(%rbp), %rdi leaq 0x3502d2(%rip), %rsi # 0xba5100 movb $0x0, %al callq 0x820bf0 movq -0x10(%rbp), %rdi movl $0xffffffff, %r8d # imm = 0xFFFFFFFF movq $-0x1, %rdx xorl %ecx, %ecx movl %r8d, %esi callq 0x8348c0 movq -0x28(%rbp), %rax movl $0x2, 0x10(%rax) movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x851b50 movl $0x0, -0x4(%rbp) jmp 0x854ec2 jmp 0x854e71 jmp 0x854e73 movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movb -0x31(%rbp), %cl leaq 0x3502ce(%rip), %rdx # 0xba5153 leaq 0x350295(%rip), %rax # 0xba5121 testb $0x1, %cl cmovneq %rax, %rdx movq -0x30(%rbp), %rax movq 0x90(%rax), %rcx movb $0x0, %al callq 0x86c2e0 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) jne 0x854ebc movq -0x10(%rbp), %rdi movl $0x21, %esi callq 0x851b50 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x60, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_type
static CURLcode ftp_state_type(struct Curl_easy *data) { CURLcode result = CURLE_OK; struct FTP *ftp = data->req.p.ftp; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; /* If we have selected NOBODY and HEADER, it means that we only want file information. Which in FTP can't be much more than the file size and date. */ if(data->set.opt_no_body && ftpc->file && ftp_need_type(conn, data->state.prefer_ascii)) { /* The SIZE command is _not_ RFC 959 specified, and therefore many servers may not support it! It is however the only way we have to get a file's size! */ ftp->transfer = PPTRANSFER_INFO; /* this means no actual transfer will be made */ /* Some servers return different sizes for different modes, and thus we must set the proper type before we check the size */ result = ftp_nb_type(data, conn, data->state.prefer_ascii, FTP_TYPE); if(result) return result; } else result = ftp_state_size(data, conn); return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movl $0x0, -0x14(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x30(%rbp) movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x19, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x854fac movq -0x30(%rbp), %rax cmpq $0x0, 0x90(%rax) je 0x854fac movq -0x28(%rbp), %rdi movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0xf, %eax andl $0x1, %eax cmpl $0x0, %eax setne %al movzbl %al, %esi andl $0x1, %esi callq 0x854fd0 cmpl $0x0, %eax je 0x854fac movq -0x20(%rbp), %rax movl $0x1, 0x10(%rax) movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rsi movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0xf, %eax andl $0x1, %eax cmpl $0x0, %eax setne %al movzbl %al, %edx andl $0x1, %edx movl $0x13, %ecx callq 0x855010 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) je 0x854faa movl -0x14(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x854fc2 jmp 0x854fbc movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rsi callq 0x8550d0 movl %eax, -0x14(%rbp) movl -0x14(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_nb_type
static CURLcode ftp_nb_type(struct Curl_easy *data, struct connectdata *conn, bool ascii, ftpstate newstate) { struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result; char want = (char)(ascii?'A':'I'); if(ftpc->transfertype == want) { state(data, newstate); return ftp_state_type_resp(data, 200, newstate); } result = Curl_pp_sendf(data, &ftpc->pp, "TYPE %c", want); if(!result) { state(data, newstate); /* keep track of our current transfer type */ ftpc->transfertype = want; } return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movb %dl, %al movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) andb $0x1, %al movb %al, -0x19(%rbp) movl %ecx, -0x20(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movb -0x19(%rbp), %dl movl $0x49, %eax movl $0x41, %ecx testb $0x1, %dl cmovnel %ecx, %eax movb %al, -0x2d(%rbp) movq -0x28(%rbp), %rax movsbl 0xc0(%rax), %eax movsbl -0x2d(%rbp), %ecx cmpl %ecx, %eax jne 0x855083 movq -0x10(%rbp), %rdi movl -0x20(%rbp), %esi callq 0x851b50 movq -0x10(%rbp), %rdi movl -0x20(%rbp), %edx movl $0xc8, %esi callq 0x853530 movl %eax, -0x4(%rbp) jmp 0x8550c5 movq -0x10(%rbp), %rdi movq -0x28(%rbp), %rsi movsbl -0x2d(%rbp), %ecx leaq 0x35009b(%rip), %rdx # 0xba5131 movb $0x0, %al callq 0x86c2e0 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) jne 0x8550bf movq -0x10(%rbp), %rdi movl -0x20(%rbp), %esi callq 0x851b50 movb -0x2d(%rbp), %cl movq -0x28(%rbp), %rax movb %cl, 0xc0(%rax) movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_size
static CURLcode ftp_state_size(struct Curl_easy *data, struct connectdata *conn) { CURLcode result = CURLE_OK; struct FTP *ftp = data->req.p.ftp; struct ftp_conn *ftpc = &conn->proto.ftpc; if((ftp->transfer == PPTRANSFER_INFO) && ftpc->file) { /* if a "head"-like request is being made (on a file) */ /* we know ftpc->file is a valid pointer to a file name */ result = Curl_pp_sendf(data, &ftpc->pp, "SIZE %s", ftpc->file); if(!result) state(data, FTP_SIZE); } else result = ftp_state_rest(data, conn); return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl $0x0, -0x14(%rbp) movq -0x8(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax cmpl $0x1, 0x10(%rax) jne 0x855156 movq -0x28(%rbp), %rax cmpq $0x0, 0x90(%rax) je 0x855156 movq -0x8(%rbp), %rdi movq -0x28(%rbp), %rsi movq -0x28(%rbp), %rax movq 0x90(%rax), %rcx leaq 0x34fef9(%rip), %rdx # 0xba502f movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x855154 movq -0x8(%rbp), %rdi movl $0x17, %esi callq 0x851b50 jmp 0x855166 movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi callq 0x855170 movl %eax, -0x14(%rbp) movl -0x14(%rbp), %eax addq $0x30, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_rest
static CURLcode ftp_state_rest(struct Curl_easy *data, struct connectdata *conn) { CURLcode result = CURLE_OK; struct FTP *ftp = data->req.p.ftp; struct ftp_conn *ftpc = &conn->proto.ftpc; if((ftp->transfer != PPTRANSFER_BODY) && ftpc->file) { /* if a "head"-like request is being made (on a file) */ /* Determine if server can respond to REST command and therefore whether it supports range */ result = Curl_pp_sendf(data, &ftpc->pp, "REST %d", 0); if(!result) state(data, FTP_REST); } else result = ftp_state_prepare_transfer(data); return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl $0x0, -0x14(%rbp) movq -0x8(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax cmpl $0x0, 0x10(%rax) je 0x8551ed movq -0x28(%rbp), %rax cmpq $0x0, 0x90(%rax) je 0x8551ed movq -0x8(%rbp), %rdi movq -0x28(%rbp), %rsi leaq 0x34ff6e(%rip), %rdx # 0xba5139 xorl %ecx, %ecx movb $0x0, %al callq 0x86c2e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) jne 0x8551eb movq -0x8(%rbp), %rdi movl $0x1a, %esi callq 0x851b50 jmp 0x8551f9 movq -0x8(%rbp), %rdi callq 0x855210 movl %eax, -0x14(%rbp) movl -0x14(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_state_prepare_transfer
static CURLcode ftp_state_prepare_transfer(struct Curl_easy *data) { CURLcode result = CURLE_OK; struct FTP *ftp = data->req.p.ftp; struct connectdata *conn = data->conn; if(ftp->transfer != PPTRANSFER_BODY) { /* doesn't transfer any data */ /* still possibly do PRE QUOTE jobs */ state(data, FTP_RETR_PREQUOTE); result = ftp_state_quote(data, TRUE, FTP_RETR_PREQUOTE); } else if(data->set.ftp_use_port) { /* We have chosen to use the PORT (or similar) command */ result = ftp_state_use_port(data, EPRT); } else { /* We have chosen (this is default) to use the PASV (or similar) command */ if(data->set.ftp_use_pret) { /* The user has requested that we send a PRET command to prepare the server for the upcoming PASV */ struct ftp_conn *ftpc = &conn->proto.ftpc; if(!conn->proto.ftpc.file) result = Curl_pp_sendf(data, &ftpc->pp, "PRET %s", data->set.str[STRING_CUSTOMREQUEST]? data->set.str[STRING_CUSTOMREQUEST]: (data->state.list_only?"NLST":"LIST")); else if(data->set.upload) result = Curl_pp_sendf(data, &ftpc->pp, "PRET STOR %s", conn->proto.ftpc.file); else result = Curl_pp_sendf(data, &ftpc->pp, "PRET RETR %s", conn->proto.ftpc.file); if(!result) state(data, FTP_PRET); } else result = ftp_state_use_pasv(data, conn); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x8(%rbp) movl $0x0, -0xc(%rbp) movq -0x8(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x18(%rbp) movq -0x8(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x18(%rbp), %rax cmpl $0x0, 0x10(%rax) je 0x855271 movq -0x8(%rbp), %rdi movl $0xd, %esi callq 0x851b50 movq -0x8(%rbp), %rdi movl $0x1, %esi movl $0xd, %edx callq 0x852d30 movl %eax, -0xc(%rbp) jmp 0x8553d9 movq -0x8(%rbp), %rax movq 0xa92(%rax), %rax shrq $0xa, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x85529c movq -0x8(%rbp), %rdi xorl %esi, %esi callq 0x8553f0 movl %eax, -0xc(%rbp) jmp 0x8553d7 movq -0x8(%rbp), %rax movq 0xa92(%rax), %rax shrq $0xd, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x8553c5 movq -0x20(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax cmpq $0x0, 0x4d8(%rax) jne 0x85534b movq -0x8(%rbp), %rax movq %rax, -0x38(%rbp) movq -0x28(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x8(%rbp), %rax cmpq $0x0, 0x760(%rax) je 0x855303 movq -0x8(%rbp), %rax movq 0x760(%rax), %rax movq %rax, -0x40(%rbp) jmp 0x85532c movq -0x8(%rbp), %rax movl 0x1300(%rax), %edx shrl $0x10, %edx andl $0x1, %edx leaq 0x320f69(%rip), %rax # 0xb76283 leaq 0x34fe28(%rip), %rcx # 0xba5149 cmpl $0x0, %edx cmovneq %rcx, %rax movq %rax, -0x40(%rbp) movq -0x30(%rbp), %rsi movq -0x38(%rbp), %rdi movq -0x40(%rbp), %rcx leaq 0x34fe02(%rip), %rdx # 0xba5141 movb $0x0, %al callq 0x86c2e0 movl %eax, -0xc(%rbp) jmp 0x8553af movq -0x8(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x1a, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x855389 movq -0x8(%rbp), %rdi movq -0x28(%rbp), %rsi movq -0x20(%rbp), %rax movq 0x4d8(%rax), %rcx leaq 0x34fdd1(%rip), %rdx # 0xba514e movb $0x0, %al callq 0x86c2e0 movl %eax, -0xc(%rbp) jmp 0x8553ad movq -0x8(%rbp), %rdi movq -0x28(%rbp), %rsi movq -0x20(%rbp), %rax movq 0x4d8(%rax), %rcx leaq 0x34fdb8(%rip), %rdx # 0xba515b movb $0x0, %al callq 0x86c2e0 movl %eax, -0xc(%rbp) jmp 0x8553af cmpl $0x0, -0xc(%rbp) jne 0x8553c3 movq -0x8(%rbp), %rdi movl $0x1d, %esi callq 0x851b50 jmp 0x8553d5 movq -0x8(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x853960 movl %eax, -0xc(%rbp) jmp 0x8553d7 jmp 0x8553d9 movl -0xc(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftp.c
ftp_pl_get_permission
static int ftp_pl_get_permission(const char *str) { int permissions = 0; /* USER */ if(str[0] == 'r') permissions |= 1 << 8; else if(str[0] != '-') permissions |= FTP_LP_MALFORMATED_PERM; if(str[1] == 'w') permissions |= 1 << 7; else if(str[1] != '-') permissions |= FTP_LP_MALFORMATED_PERM; if(str[2] == 'x') permissions |= 1 << 6; else if(str[2] == 's') { permissions |= 1 << 6; permissions |= 1 << 11; } else if(str[2] == 'S') permissions |= 1 << 11; else if(str[2] != '-') permissions |= FTP_LP_MALFORMATED_PERM; /* GROUP */ if(str[3] == 'r') permissions |= 1 << 5; else if(str[3] != '-') permissions |= FTP_LP_MALFORMATED_PERM; if(str[4] == 'w') permissions |= 1 << 4; else if(str[4] != '-') permissions |= FTP_LP_MALFORMATED_PERM; if(str[5] == 'x') permissions |= 1 << 3; else if(str[5] == 's') { permissions |= 1 << 3; permissions |= 1 << 10; } else if(str[5] == 'S') permissions |= 1 << 10; else if(str[5] != '-') permissions |= FTP_LP_MALFORMATED_PERM; /* others */ if(str[6] == 'r') permissions |= 1 << 2; else if(str[6] != '-') permissions |= FTP_LP_MALFORMATED_PERM; if(str[7] == 'w') permissions |= 1 << 1; else if(str[7] != '-') permissions |= FTP_LP_MALFORMATED_PERM; if(str[8] == 'x') permissions |= 1; else if(str[8] == 't') { permissions |= 1; permissions |= 1 << 9; } else if(str[8] == 'T') permissions |= 1 << 9; else if(str[8] != '-') permissions |= FTP_LP_MALFORMATED_PERM; return permissions; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x8(%rbp) movl $0x0, -0xc(%rbp) movq -0x8(%rbp), %rax movsbl (%rax), %eax cmpl $0x72, %eax jne 0x859a28 movl -0xc(%rbp), %eax orl $0x100, %eax # imm = 0x100 movl %eax, -0xc(%rbp) jmp 0x859a41 movq -0x8(%rbp), %rax movsbl (%rax), %eax cmpl $0x2d, %eax je 0x859a3f movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859a41 movq -0x8(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x77, %eax jne 0x859a5b movl -0xc(%rbp), %eax orl $0x80, %eax movl %eax, -0xc(%rbp) jmp 0x859a75 movq -0x8(%rbp), %rax movsbl 0x1(%rax), %eax cmpl $0x2d, %eax je 0x859a73 movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859a75 movq -0x8(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x78, %eax jne 0x859a8d movl -0xc(%rbp), %eax orl $0x40, %eax movl %eax, -0xc(%rbp) jmp 0x859ae8 movq -0x8(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x73, %eax jne 0x859ab0 movl -0xc(%rbp), %eax orl $0x40, %eax movl %eax, -0xc(%rbp) movl -0xc(%rbp), %eax orl $0x800, %eax # imm = 0x800 movl %eax, -0xc(%rbp) jmp 0x859ae6 movq -0x8(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x53, %eax jne 0x859aca movl -0xc(%rbp), %eax orl $0x800, %eax # imm = 0x800 movl %eax, -0xc(%rbp) jmp 0x859ae4 movq -0x8(%rbp), %rax movsbl 0x2(%rax), %eax cmpl $0x2d, %eax je 0x859ae2 movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859ae4 jmp 0x859ae6 jmp 0x859ae8 movq -0x8(%rbp), %rax movsbl 0x3(%rax), %eax cmpl $0x72, %eax jne 0x859b00 movl -0xc(%rbp), %eax orl $0x20, %eax movl %eax, -0xc(%rbp) jmp 0x859b1a movq -0x8(%rbp), %rax movsbl 0x3(%rax), %eax cmpl $0x2d, %eax je 0x859b18 movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859b1a movq -0x8(%rbp), %rax movsbl 0x4(%rax), %eax cmpl $0x77, %eax jne 0x859b32 movl -0xc(%rbp), %eax orl $0x10, %eax movl %eax, -0xc(%rbp) jmp 0x859b4c movq -0x8(%rbp), %rax movsbl 0x4(%rax), %eax cmpl $0x2d, %eax je 0x859b4a movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859b4c movq -0x8(%rbp), %rax movsbl 0x5(%rax), %eax cmpl $0x78, %eax jne 0x859b64 movl -0xc(%rbp), %eax orl $0x8, %eax movl %eax, -0xc(%rbp) jmp 0x859bbf movq -0x8(%rbp), %rax movsbl 0x5(%rax), %eax cmpl $0x73, %eax jne 0x859b87 movl -0xc(%rbp), %eax orl $0x8, %eax movl %eax, -0xc(%rbp) movl -0xc(%rbp), %eax orl $0x400, %eax # imm = 0x400 movl %eax, -0xc(%rbp) jmp 0x859bbd movq -0x8(%rbp), %rax movsbl 0x5(%rax), %eax cmpl $0x53, %eax jne 0x859ba1 movl -0xc(%rbp), %eax orl $0x400, %eax # imm = 0x400 movl %eax, -0xc(%rbp) jmp 0x859bbb movq -0x8(%rbp), %rax movsbl 0x5(%rax), %eax cmpl $0x2d, %eax je 0x859bb9 movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859bbb jmp 0x859bbd jmp 0x859bbf movq -0x8(%rbp), %rax movsbl 0x6(%rax), %eax cmpl $0x72, %eax jne 0x859bd7 movl -0xc(%rbp), %eax orl $0x4, %eax movl %eax, -0xc(%rbp) jmp 0x859bf1 movq -0x8(%rbp), %rax movsbl 0x6(%rax), %eax cmpl $0x2d, %eax je 0x859bef movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859bf1 movq -0x8(%rbp), %rax movsbl 0x7(%rax), %eax cmpl $0x77, %eax jne 0x859c09 movl -0xc(%rbp), %eax orl $0x2, %eax movl %eax, -0xc(%rbp) jmp 0x859c23 movq -0x8(%rbp), %rax movsbl 0x7(%rax), %eax cmpl $0x2d, %eax je 0x859c21 movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859c23 movq -0x8(%rbp), %rax movsbl 0x8(%rax), %eax cmpl $0x78, %eax jne 0x859c3b movl -0xc(%rbp), %eax orl $0x1, %eax movl %eax, -0xc(%rbp) jmp 0x859c96 movq -0x8(%rbp), %rax movsbl 0x8(%rax), %eax cmpl $0x74, %eax jne 0x859c5e movl -0xc(%rbp), %eax orl $0x1, %eax movl %eax, -0xc(%rbp) movl -0xc(%rbp), %eax orl $0x200, %eax # imm = 0x200 movl %eax, -0xc(%rbp) jmp 0x859c94 movq -0x8(%rbp), %rax movsbl 0x8(%rax), %eax cmpl $0x54, %eax jne 0x859c78 movl -0xc(%rbp), %eax orl $0x200, %eax # imm = 0x200 movl %eax, -0xc(%rbp) jmp 0x859c92 movq -0x8(%rbp), %rax movsbl 0x8(%rax), %eax cmpl $0x2d, %eax je 0x859c90 movl -0xc(%rbp), %eax orl $0x1000000, %eax # imm = 0x1000000 movl %eax, -0xc(%rbp) jmp 0x859c92 jmp 0x859c94 jmp 0x859c96 movl -0xc(%rbp), %eax popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/ftplistparser.c
GetEnv
static char *GetEnv(const char *variable) { #if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP) (void)variable; return NULL; #elif defined(WIN32) /* This uses Windows API instead of C runtime getenv() to get the environment variable since some changes aren't always visible to the latter. #4774 */ char *buf = NULL; char *tmp; DWORD bufsize; DWORD rc = 1; const DWORD max = 32768; /* max env var size from MSCRT source */ for(;;) { tmp = realloc(buf, rc); if(!tmp) { free(buf); return NULL; } buf = tmp; bufsize = rc; /* It's possible for rc to be 0 if the variable was found but empty. Since getenv doesn't make that distinction we ignore it as well. */ rc = GetEnvironmentVariableA(variable, buf, bufsize); if(!rc || rc == bufsize || rc > max) { free(buf); return NULL; } /* if rc < bufsize then rc is bytes written not including null */ if(rc < bufsize) return buf; /* else rc is bytes needed, try again */ } #else char *env = getenv(variable); return (env && env[0])?strdup(env):NULL; #endif }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rdi callq 0x3da30 movq %rax, -0x10(%rbp) cmpq $0x0, -0x10(%rbp) je 0x859f32 movq -0x10(%rbp), %rax movsbl (%rax), %eax cmpl $0x0, %eax je 0x859f32 leaq 0x6a24ed(%rip), %rax # 0xefc410 movq (%rax), %rax movq -0x10(%rbp), %rdi callq *%rax movq %rax, -0x18(%rbp) jmp 0x859f3a xorl %eax, %eax movq %rax, -0x18(%rbp) jmp 0x859f3a movq -0x18(%rbp), %rax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax) nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/getenv.c
inspect_header
static header_instruction inspect_header(const char *name, size_t namelen, const char *value, size_t valuelen) { switch(namelen) { case 2: if(!strncasecompare("te", name, namelen)) return HEADERINST_FORWARD; return contains_trailers(value, valuelen) ? HEADERINST_TE_TRAILERS : HEADERINST_IGNORE; case 7: return strncasecompare("upgrade", name, namelen) ? HEADERINST_IGNORE : HEADERINST_FORWARD; case 10: return (strncasecompare("connection", name, namelen) || strncasecompare("keep-alive", name, namelen)) ? HEADERINST_IGNORE : HEADERINST_FORWARD; case 16: return strncasecompare("proxy-connection", name, namelen) ? HEADERINST_IGNORE : HEADERINST_FORWARD; case 17: return strncasecompare("transfer-encoding", name, namelen) ? HEADERINST_IGNORE : HEADERINST_FORWARD; default: return HEADERINST_FORWARD; } }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq -0x18(%rbp), %rax addq $-0x2, %rax movq %rax, -0x30(%rbp) subq $0xf, %rax ja 0x85a8eb movq -0x30(%rbp), %rax leaq 0x34b44f(%rip), %rcx # 0xba5c18 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx leaq 0x34c7fd(%rip), %rdi # 0xba6fde callq 0x830290 cmpl $0x0, %eax jne 0x85a7f7 movl $0x0, -0x4(%rbp) jmp 0x85a8f2 movq -0x20(%rbp), %rdi movq -0x28(%rbp), %rsi callq 0x85a930 movb %al, %dl movl $0x1, %eax movl $0x2, %ecx testb $0x1, %dl cmovnel %ecx, %eax movl %eax, -0x4(%rbp) jmp 0x85a8f2 movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx leaq 0x34b4e6(%rip), %rdi # 0xba5d13 callq 0x830290 movl %eax, %edx xorl %eax, %eax movl $0x1, %ecx cmpl $0x0, %edx cmovnel %ecx, %eax movl %eax, -0x4(%rbp) jmp 0x85a8f2 movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx leaq 0x347e2f(%rip), %rdi # 0xba2687 callq 0x830290 movl %eax, %ecx movb $0x1, %al cmpl $0x0, %ecx movb %al, -0x31(%rbp) jne 0x85a886 movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx leaq 0x34b4a3(%rip), %rdi # 0xba5d1b callq 0x830290 cmpl $0x0, %eax setne %al movb %al, -0x31(%rbp) movb -0x31(%rbp), %dl xorl %eax, %eax movl $0x1, %ecx testb $0x1, %dl cmovnel %ecx, %eax movl %eax, -0x4(%rbp) jmp 0x85a8f2 movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx leaq 0x34b47c(%rip), %rdi # 0xba5d26 callq 0x830290 movl %eax, %edx xorl %eax, %eax movl $0x1, %ecx cmpl $0x0, %edx cmovnel %ecx, %eax movl %eax, -0x4(%rbp) jmp 0x85a8f2 movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx leaq 0x34b465(%rip), %rdi # 0xba5d37 callq 0x830290 movl %eax, %edx xorl %eax, %eax movl $0x1, %ecx cmpl $0x0, %edx cmovnel %ecx, %eax movl %eax, -0x4(%rbp) jmp 0x85a8f2 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/h2h3.c
Curl_hash_init
void Curl_hash_init(struct Curl_hash *h, int slots, hash_function hfunc, comp_function comparator, Curl_hash_dtor dtor) { DEBUGASSERT(h); DEBUGASSERT(slots); DEBUGASSERT(hfunc); DEBUGASSERT(comparator); DEBUGASSERT(dtor); h->table = NULL; h->hash_func = hfunc; h->comp_func = comparator; h->dtor = dtor; h->size = 0; h->slots = slots; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x8(%rbp) movl %esi, -0xc(%rbp) movq %rdx, -0x18(%rbp) movq %rcx, -0x20(%rbp) movq %r8, -0x28(%rbp) jmp 0x85aad9 jmp 0x85aadb jmp 0x85aadd jmp 0x85aadf jmp 0x85aae1 jmp 0x85aae3 jmp 0x85aae5 jmp 0x85aae7 jmp 0x85aae9 movq -0x8(%rbp), %rax movq $0x0, (%rax) movq -0x18(%rbp), %rcx movq -0x8(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x20(%rbp), %rcx movq -0x8(%rbp), %rax movq %rcx, 0x10(%rax) movq -0x28(%rbp), %rcx movq -0x8(%rbp), %rax movq %rcx, 0x18(%rax) movq -0x8(%rbp), %rax movq $0x0, 0x28(%rax) movl -0xc(%rbp), %ecx movq -0x8(%rbp), %rax movl %ecx, 0x20(%rax) popq %rbp retq
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/hash.c
copy_header_external
static void copy_header_external(struct Curl_easy *data, struct Curl_header_store *hs, size_t index, size_t amount, struct Curl_llist_element *e, struct curl_header **hout) { struct curl_header *h = *hout = &data->state.headerout; h->name = hs->name; h->value = hs->value; h->amount = amount; h->index = index; /* this will randomly OR a reserved bit for the sole purpose of making it impossible for applications to do == comparisons, as that would otherwise be very tempting and then lead to the reserved bits not being reserved anymore. */ h->origin = hs->type | (1<<27); h->anchor = e; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movq %rcx, -0x20(%rbp) movq %r8, -0x28(%rbp) movq %r9, -0x30(%rbp) movq -0x8(%rbp), %rax addq $0xc30, %rax # imm = 0xC30 addq $0x620, %rax # imm = 0x620 movq -0x30(%rbp), %rcx movq %rax, (%rcx) movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rcx movq -0x38(%rbp), %rax movq %rcx, (%rax) movq -0x10(%rbp), %rax movq 0x20(%rax), %rcx movq -0x38(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x20(%rbp), %rcx movq -0x38(%rbp), %rax movq %rcx, 0x10(%rax) movq -0x18(%rbp), %rcx movq -0x38(%rbp), %rax movq %rcx, 0x18(%rax) movq -0x10(%rbp), %rax movzbl 0x2c(%rax), %ecx orl $0x8000000, %ecx # imm = 0x8000000 movq -0x38(%rbp), %rax movl %ecx, 0x20(%rax) movq -0x28(%rbp), %rcx movq -0x38(%rbp), %rax movq %rcx, 0x28(%rax) popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/headers.c
curl_easy_nextheader
struct curl_header *curl_easy_nextheader(CURL *easy, unsigned int type, int request, struct curl_header *prev) { struct Curl_easy *data = easy; struct Curl_llist_element *pick; struct Curl_llist_element *e; struct Curl_header_store *hs; struct curl_header *hout; size_t amount = 0; size_t index = 0; if(request > data->state.requests) return NULL; if(request == -1) request = data->state.requests; if(prev) { pick = prev->anchor; if(!pick) /* something is wrong */ return NULL; pick = pick->next; } else pick = data->state.httphdrs.head; if(pick) { /* make sure it is the next header of the desired type */ do { hs = pick->ptr; if((hs->type & type) && (hs->request == request)) break; pick = pick->next; } while(pick); } if(!pick) /* no more headers available */ return NULL; hs = pick->ptr; /* count number of occurrences of this name within the mask and figure out the index for the currently selected entry */ for(e = data->state.httphdrs.head; e; e = e->next) { struct Curl_header_store *check = e->ptr; if(strcasecompare(hs->name, check->name) && (check->request == request) && (check->type & type)) amount++; if(e == pick) index = amount - 1; } copy_header_external(data, hs, index, amount, pick, &hout); return hout; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl %edx, -0x18(%rbp) movq %rcx, -0x20(%rbp) movq -0x10(%rbp), %rax movq %rax, -0x28(%rbp) movq $0x0, -0x50(%rbp) movq $0x0, -0x58(%rbp) movl -0x18(%rbp), %eax movq -0x28(%rbp), %rcx cmpl 0xd40(%rcx), %eax jle 0x85b69a movq $0x0, -0x8(%rbp) jmp 0x85b805 cmpl $-0x1, -0x18(%rbp) jne 0x85b6ad movq -0x28(%rbp), %rax movl 0xd40(%rax), %eax movl %eax, -0x18(%rbp) cmpq $0x0, -0x20(%rbp) je 0x85b6e2 movq -0x20(%rbp), %rax movq 0x28(%rax), %rax movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) jne 0x85b6d4 movq $0x0, -0x8(%rbp) jmp 0x85b805 movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x30(%rbp) jmp 0x85b6f1 movq -0x28(%rbp), %rax movq 0x1230(%rax), %rax movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) je 0x85b738 jmp 0x85b6fa movq -0x30(%rbp), %rax movq (%rax), %rax movq %rax, -0x40(%rbp) movq -0x40(%rbp), %rax movzbl 0x2c(%rax), %eax andl -0x14(%rbp), %eax cmpl $0x0, %eax je 0x85b723 movq -0x40(%rbp), %rax movl 0x28(%rax), %eax cmpl -0x18(%rbp), %eax jne 0x85b723 jmp 0x85b736 movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) jne 0x85b6fa jmp 0x85b738 cmpq $0x0, -0x30(%rbp) jne 0x85b74c movq $0x0, -0x8(%rbp) jmp 0x85b805 movq -0x30(%rbp), %rax movq (%rax), %rax movq %rax, -0x40(%rbp) movq -0x28(%rbp), %rax movq 0x1230(%rax), %rax movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) je 0x85b7e0 movq -0x38(%rbp), %rax movq (%rax), %rax movq %rax, -0x60(%rbp) movq -0x40(%rbp), %rax movq 0x18(%rax), %rdi movq -0x60(%rbp), %rax movq 0x18(%rax), %rsi callq 0x830160 cmpl $0x0, %eax je 0x85b7ba movq -0x60(%rbp), %rax movl 0x28(%rax), %eax cmpl -0x18(%rbp), %eax jne 0x85b7ba movq -0x60(%rbp), %rax movzbl 0x2c(%rax), %eax andl -0x14(%rbp), %eax cmpl $0x0, %eax je 0x85b7ba movq -0x50(%rbp), %rax addq $0x1, %rax movq %rax, -0x50(%rbp) movq -0x38(%rbp), %rax cmpq -0x30(%rbp), %rax jne 0x85b7d0 movq -0x50(%rbp), %rax subq $0x1, %rax movq %rax, -0x58(%rbp) jmp 0x85b7d2 movq -0x38(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x38(%rbp) jmp 0x85b766 movq -0x28(%rbp), %rdi movq -0x40(%rbp), %rsi movq -0x58(%rbp), %rdx movq -0x50(%rbp), %rcx movq -0x30(%rbp), %r8 leaq -0x48(%rbp), %r9 callq 0x85b5b0 movq -0x48(%rbp), %rax movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x60, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/headers.c
namevalue
static CURLcode namevalue(char *header, size_t hlen, unsigned int type, char **name, char **value) { char *end = header + hlen - 1; /* point to the last byte */ DEBUGASSERT(hlen); *name = header; if(type == CURLH_PSEUDO) { if(*header != ':') return CURLE_BAD_FUNCTION_ARGUMENT; header++; } /* Find the end of the header name */ while(*header && (*header != ':')) ++header; if(*header) /* Skip over colon, null it */ *header++ = 0; else return CURLE_BAD_FUNCTION_ARGUMENT; /* skip all leading space letters */ while(*header && ISBLANK(*header)) header++; *value = header; /* skip all trailing space letters */ while((end > header) && ISSPACE(*end)) *end-- = 0; /* nul terminate */ return CURLE_OK; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq -0x10(%rbp), %rax addq -0x18(%rbp), %rax addq $-0x1, %rax movq %rax, -0x38(%rbp) jmp 0x85bc99 movq -0x10(%rbp), %rcx movq -0x28(%rbp), %rax movq %rcx, (%rax) cmpl $0x10, -0x1c(%rbp) jne 0x85bcce movq -0x10(%rbp), %rax movsbl (%rax), %eax cmpl $0x3a, %eax je 0x85bcc2 movl $0x2b, -0x4(%rbp) jmp 0x85be0f movq -0x10(%rbp), %rax addq $0x1, %rax movq %rax, -0x10(%rbp) jmp 0x85bcd0 movq -0x10(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x39(%rbp) je 0x85bcf1 movq -0x10(%rbp), %rax movsbl (%rax), %eax cmpl $0x3a, %eax setne %al movb %al, -0x39(%rbp) movb -0x39(%rbp), %al testb $0x1, %al jne 0x85bcfa jmp 0x85bd08 movq -0x10(%rbp), %rax addq $0x1, %rax movq %rax, -0x10(%rbp) jmp 0x85bcd0 movq -0x10(%rbp), %rax cmpb $0x0, (%rax) je 0x85bd25 movq -0x10(%rbp), %rax movq %rax, %rcx addq $0x1, %rcx movq %rcx, -0x10(%rbp) movb $0x0, (%rax) jmp 0x85bd31 movl $0x2b, -0x4(%rbp) jmp 0x85be0f jmp 0x85bd33 movq -0x10(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x3a(%rbp) je 0x85bd6b movq -0x10(%rbp), %rax movsbl (%rax), %ecx movb $0x1, %al cmpl $0x20, %ecx movb %al, -0x3b(%rbp) je 0x85bd65 movq -0x10(%rbp), %rax movsbl (%rax), %eax cmpl $0x9, %eax sete %al movb %al, -0x3b(%rbp) movb -0x3b(%rbp), %al movb %al, -0x3a(%rbp) movb -0x3a(%rbp), %al testb $0x1, %al jne 0x85bd74 jmp 0x85bd82 movq -0x10(%rbp), %rax addq $0x1, %rax movq %rax, -0x10(%rbp) jmp 0x85bd33 movq -0x10(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, (%rax) movq -0x38(%rbp), %rcx xorl %eax, %eax cmpq -0x10(%rbp), %rcx movb %al, -0x3c(%rbp) jbe 0x85bdeb movq -0x38(%rbp), %rax movsbl (%rax), %ecx movb $0x1, %al cmpl $0x20, %ecx movb %al, -0x3d(%rbp) je 0x85bde5 movq -0x38(%rbp), %rax movsbl (%rax), %ecx movb $0x1, %al cmpl $0x9, %ecx movb %al, -0x3d(%rbp) je 0x85bde5 movq -0x38(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0xa, %ecx movb %al, -0x3e(%rbp) jl 0x85bddf movq -0x38(%rbp), %rax movsbl (%rax), %eax cmpl $0xd, %eax setle %al movb %al, -0x3e(%rbp) movb -0x3e(%rbp), %al movb %al, -0x3d(%rbp) movb -0x3d(%rbp), %al movb %al, -0x3c(%rbp) movb -0x3c(%rbp), %al testb $0x1, %al jne 0x85bdf4 jmp 0x85be08 movq -0x38(%rbp), %rax movq %rax, %rcx addq $-0x1, %rcx movq %rcx, -0x38(%rbp) movb $0x0, (%rax) jmp 0x85bd8d movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/headers.c
Curl_hostcache_prune
void Curl_hostcache_prune(struct Curl_easy *data) { time_t now; if((data->set.dns_cache_timeout == -1) || !data->dns.hostcache) /* cache forever means never prune, and NULL hostcache means we can't do it */ return; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); time(&now); /* Remove outdated and unused entries from the hostcache */ hostcache_prune(data->dns.hostcache, data->set.dns_cache_timeout, now); if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax cmpl $-0x1, 0x6c8(%rax) je 0x85bfd7 movq -0x8(%rbp), %rax cmpq $0x0, 0xa8(%rax) jne 0x85bfd9 jmp 0x85c03e movq -0x8(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x85bffa movq -0x8(%rbp), %rdi movl $0x3, %esi movl $0x2, %edx callq 0x82d500 leaq -0x10(%rbp), %rdi callq 0x3d990 movq -0x8(%rbp), %rax movq 0xa8(%rax), %rdi movq -0x8(%rbp), %rax movslq 0x6c8(%rax), %rsi movq -0x10(%rbp), %rdx callq 0x85c050 movq -0x8(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x85c03e movq -0x8(%rbp), %rdi movl $0x3, %esi callq 0x82d590 addq $0x10, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/hostip.c
hostcache_prune
static void hostcache_prune(struct Curl_hash *hostcache, long cache_timeout, time_t now) { struct hostcache_prune_data user; user.cache_timeout = cache_timeout; user.now = now; Curl_hash_clean_with_criterium(hostcache, (void *) &user, hostcache_timestamp_remove); }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movq -0x10(%rbp), %rax movq %rax, -0x28(%rbp) movq -0x18(%rbp), %rax movq %rax, -0x20(%rbp) movq -0x8(%rbp), %rdi leaq -0x28(%rbp), %rsi leaq 0x1b2d(%rip), %rdx # 0x85dbb0 callq 0x85b050 addq $0x30, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/hostip.c
Curl_fetch_addr
struct Curl_dns_entry * Curl_fetch_addr(struct Curl_easy *data, const char *hostname, int port) { struct Curl_dns_entry *dns = NULL; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); dns = fetch_addr(data, hostname, port); if(dns) dns->inuse++; /* we use it! */ if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); return dns; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl %edx, -0x14(%rbp) movq $0x0, -0x20(%rbp) movq -0x8(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x85c0cc movq -0x8(%rbp), %rdi movl $0x3, %esi movl $0x2, %edx callq 0x82d500 movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi movl -0x14(%rbp), %edx callq 0x85c120 movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x85c0f7 movq -0x20(%rbp), %rax movq 0x10(%rax), %rcx addq $0x1, %rcx movq %rcx, 0x10(%rax) movq -0x8(%rbp), %rax cmpq $0x0, 0xc8(%rax) je 0x85c113 movq -0x8(%rbp), %rdi movl $0x3, %esi callq 0x82d590 movq -0x20(%rbp), %rax addq $0x20, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/hostip.c
Curl_shuffle_addr
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data, struct Curl_addrinfo **addr) { CURLcode result = CURLE_OK; const int num_addrs = Curl_num_addresses(*addr); if(num_addrs > 1) { struct Curl_addrinfo **nodes; infof(data, "Shuffling %i addresses", num_addrs); nodes = malloc(num_addrs*sizeof(*nodes)); if(nodes) { int i; unsigned int *rnd; const size_t rnd_size = num_addrs * sizeof(*rnd); /* build a plain array of Curl_addrinfo pointers */ nodes[0] = *addr; for(i = 1; i < num_addrs; i++) { nodes[i] = nodes[i-1]->ai_next; } rnd = malloc(rnd_size); if(rnd) { /* Fisher-Yates shuffle */ if(Curl_rand(data, (unsigned char *)rnd, rnd_size) == CURLE_OK) { struct Curl_addrinfo *swap_tmp; for(i = num_addrs - 1; i > 0; i--) { swap_tmp = nodes[rnd[i] % (i + 1)]; nodes[rnd[i] % (i + 1)] = nodes[i]; nodes[i] = swap_tmp; } /* relink list in the new order */ for(i = 1; i < num_addrs; i++) { nodes[i-1]->ai_next = nodes[i]; } nodes[num_addrs-1]->ai_next = NULL; *addr = nodes[0]; } free(rnd); } else result = CURLE_OUT_OF_MEMORY; free(nodes); } else result = CURLE_OUT_OF_MEMORY; } return result; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl $0x0, -0x14(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rdi callq 0x85bec0 movl %eax, -0x18(%rbp) cmpl $0x1, -0x18(%rbp) jle 0x85c735 movq -0x8(%rbp), %rdi movl -0x18(%rbp), %edx leaq 0x349a2c(%rip), %rsi # 0xba5f7a movb $0x0, %al callq 0x820bf0 leaq 0x69fe9c(%rip), %rax # 0xefc3f8 movq (%rax), %rax movslq -0x18(%rbp), %rdi shlq $0x3, %rdi callq *%rax movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x85c72c movslq -0x18(%rbp), %rax shlq $0x2, %rax movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rcx movq -0x20(%rbp), %rax movq %rcx, (%rax) movl $0x1, -0x24(%rbp) movl -0x24(%rbp), %eax cmpl -0x18(%rbp), %eax jge 0x85c5cd movq -0x20(%rbp), %rax movl -0x24(%rbp), %ecx subl $0x1, %ecx movslq %ecx, %rcx movq (%rax,%rcx,8), %rax movq 0x28(%rax), %rdx movq -0x20(%rbp), %rax movslq -0x24(%rbp), %rcx movq %rdx, (%rax,%rcx,8) movl -0x24(%rbp), %eax addl $0x1, %eax movl %eax, -0x24(%rbp) jmp 0x85c599 leaq 0x69fe24(%rip), %rax # 0xefc3f8 movq (%rax), %rax movq -0x38(%rbp), %rdi callq *%rax movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) je 0x85c713 movq -0x8(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x38(%rbp), %rdx callq 0x820480 cmpl $0x0, %eax jne 0x85c701 movl -0x18(%rbp), %eax subl $0x1, %eax movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) jle 0x85c69f movq -0x20(%rbp), %rax movq %rax, -0x58(%rbp) movq -0x30(%rbp), %rax movslq -0x24(%rbp), %rcx movl (%rax,%rcx,4), %eax movl -0x24(%rbp), %ecx addl $0x1, %ecx xorl %edx, %edx divl %ecx movq -0x58(%rbp), %rax movl %edx, %ecx movq (%rax,%rcx,8), %rax movq %rax, -0x40(%rbp) movq -0x20(%rbp), %rax movslq -0x24(%rbp), %rcx movq (%rax,%rcx,8), %rax movq %rax, -0x48(%rbp) movq -0x20(%rbp), %rax movq %rax, -0x50(%rbp) movq -0x30(%rbp), %rax movslq -0x24(%rbp), %rcx movl (%rax,%rcx,4), %eax movl -0x24(%rbp), %ecx addl $0x1, %ecx xorl %edx, %edx divl %ecx movq -0x50(%rbp), %rax movl %edx, %ecx movq -0x48(%rbp), %rdx movl %ecx, %ecx movq %rdx, (%rax,%rcx,8) movq -0x40(%rbp), %rdx movq -0x20(%rbp), %rax movslq -0x24(%rbp), %rcx movq %rdx, (%rax,%rcx,8) movl -0x24(%rbp), %eax addl $-0x1, %eax movl %eax, -0x24(%rbp) jmp 0x85c60f movl $0x1, -0x24(%rbp) movl -0x24(%rbp), %eax cmpl -0x18(%rbp), %eax jge 0x85c6da movq -0x20(%rbp), %rax movslq -0x24(%rbp), %rcx movq (%rax,%rcx,8), %rcx movq -0x20(%rbp), %rax movl -0x24(%rbp), %edx subl $0x1, %edx movslq %edx, %rdx movq (%rax,%rdx,8), %rax movq %rcx, 0x28(%rax) movl -0x24(%rbp), %eax addl $0x1, %eax movl %eax, -0x24(%rbp) jmp 0x85c6a6 movq -0x20(%rbp), %rax movl -0x18(%rbp), %ecx subl $0x1, %ecx movslq %ecx, %rcx movq (%rax,%rcx,8), %rax movq $0x0, 0x28(%rax) movq -0x20(%rbp), %rax movq (%rax), %rcx movq -0x10(%rbp), %rax movq %rcx, (%rax) leaq 0x69fcf8(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x30(%rbp), %rdi callq *%rax jmp 0x85c71a movl $0x1b, -0x14(%rbp) leaq 0x69fcdf(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x20(%rbp), %rdi callq *%rax jmp 0x85c733 movl $0x1b, -0x14(%rbp) jmp 0x85c735 movl -0x14(%rbp), %eax addq $0x60, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/hostip.c
Curl_http_output_auth
CURLcode Curl_http_output_auth(struct Curl_easy *data, struct connectdata *conn, const char *request, Curl_HttpReq httpreq, const char *path, bool proxytunnel) /* TRUE if this is the request setting up the proxy tunnel */ { CURLcode result = CURLE_OK; struct auth *authhost; struct auth *authproxy; DEBUGASSERT(data); authhost = &data->state.authhost; authproxy = &data->state.authproxy; if( #ifndef CURL_DISABLE_PROXY (conn->bits.httpproxy && conn->bits.proxy_user_passwd) || #endif data->state.aptr.user || data->set.str[STRING_BEARER]) /* continue please */; else { authhost->done = TRUE; authproxy->done = TRUE; return CURLE_OK; /* no authentication with no user or password */ } if(authhost->want && !authhost->picked) /* The app has selected one or more methods, but none has been picked so far by a server round-trip. Then we set the picked one to the want one, and if this is one single bit it'll be used instantly. */ authhost->picked = authhost->want; if(authproxy->want && !authproxy->picked) /* The app has selected one or more methods, but none has been picked so far by a proxy round-trip. Then we set the picked one to the want one, and if this is one single bit it'll be used instantly. */ authproxy->picked = authproxy->want; #ifndef CURL_DISABLE_PROXY /* Send proxy authentication header if needed */ if(conn->bits.httpproxy && (conn->bits.tunnel_proxy == (bit)proxytunnel)) { result = output_auth_headers(data, conn, authproxy, request, path, TRUE); if(result) return result; } else #else (void)proxytunnel; #endif /* CURL_DISABLE_PROXY */ /* we have no proxy so let's pretend we're done authenticating with it */ authproxy->done = TRUE; /* To prevent the user+password to get sent to other than the original host due to a location-follow */ if(Curl_auth_allowed_to_host(data) #ifndef CURL_DISABLE_NETRC || conn->bits.netrc #endif ) result = output_auth_headers(data, conn, authhost, request, path, FALSE); else authhost->done = TRUE; if(((authhost->multipass && !authhost->done) || (authproxy->multipass && !authproxy->done)) && (httpreq != HTTPREQ_GET) && (httpreq != HTTPREQ_HEAD)) { /* Auth is required and we are not authenticated yet. Make a PUT or POST with content-length zero as a "probe". */ conn->bits.authneg = TRUE; } else conn->bits.authneg = FALSE; return result; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movb %r9b, %al movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movl %ecx, -0x24(%rbp) movq %r8, -0x30(%rbp) andb $0x1, %al movb %al, -0x31(%rbp) movl $0x0, -0x38(%rbp) jmp 0x85fc4c movq -0x10(%rbp), %rax addq $0xc30, %rax # imm = 0xC30 addq $0x190, %rax # imm = 0x190 movq %rax, -0x40(%rbp) movq -0x10(%rbp), %rax addq $0xc30, %rax # imm = 0xC30 addq $0x1b0, %rax # imm = 0x1B0 movq %rax, -0x48(%rbp) movq -0x18(%rbp), %rax movl 0x374(%rax), %eax andl $0x1, %eax cmpl $0x0, %eax je 0x85fc9b movq -0x18(%rbp), %rax movl 0x374(%rax), %eax shrl $0x2, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x85fcb7 movq -0x10(%rbp), %rax cmpq $0x0, 0x12e0(%rax) jne 0x85fcb7 movq -0x10(%rbp), %rax cmpq $0x0, 0x930(%rax) je 0x85fcb9 jmp 0x85fce5 movq -0x40(%rbp), %rax movb 0x18(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0x18(%rax) movq -0x48(%rbp), %rax movb 0x18(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0x18(%rax) movl $0x0, -0x4(%rbp) jmp 0x85fe85 movq -0x40(%rbp), %rax cmpq $0x0, (%rax) je 0x85fd09 movq -0x40(%rbp), %rax cmpq $0x0, 0x8(%rax) jne 0x85fd09 movq -0x40(%rbp), %rax movq (%rax), %rcx movq -0x40(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x48(%rbp), %rax cmpq $0x0, (%rax) je 0x85fd2d movq -0x48(%rbp), %rax cmpq $0x0, 0x8(%rax) jne 0x85fd2d movq -0x48(%rbp), %rax movq (%rax), %rcx movq -0x48(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x18(%rbp), %rax movl 0x374(%rax), %eax andl $0x1, %eax cmpl $0x0, %eax je 0x85fd91 movq -0x18(%rbp), %rax movl 0x374(%rax), %eax shrl $0x3, %eax andl $0x1, %eax movb -0x31(%rbp), %cl andb $0x1, %cl movzbl %cl, %ecx cmpl %ecx, %eax jne 0x85fd91 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x48(%rbp), %rdx movq -0x20(%rbp), %rcx movq -0x30(%rbp), %r8 movl $0x1, %r9d callq 0x85fe90 movl %eax, -0x38(%rbp) cmpl $0x0, -0x38(%rbp) je 0x85fd8f movl -0x38(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x85fe85 jmp 0x85fda1 movq -0x48(%rbp), %rax movb 0x18(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0x18(%rax) movq -0x10(%rbp), %rdi callq 0x842d90 testb $0x1, %al jne 0x85fdc3 movq -0x18(%rbp), %rax movl 0x374(%rax), %eax shrl $0x16, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x85fde4 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x40(%rbp), %rdx movq -0x20(%rbp), %rcx movq -0x30(%rbp), %r8 xorl %r9d, %r9d callq 0x85fe90 movl %eax, -0x38(%rbp) jmp 0x85fdf4 movq -0x40(%rbp), %rax movb 0x18(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0x18(%rax) movq -0x40(%rbp), %rax movb 0x18(%rax), %al shrb %al andb $0x1, %al movzbl %al, %eax cmpl $0x0, %eax je 0x85fe18 movq -0x40(%rbp), %rax movb 0x18(%rax), %al andb $0x1, %al movzbl %al, %eax cmpl $0x0, %eax je 0x85fe3c movq -0x48(%rbp), %rax movb 0x18(%rax), %al shrb %al andb $0x1, %al movzbl %al, %eax cmpl $0x0, %eax je 0x85fe66 movq -0x48(%rbp), %rax movb 0x18(%rax), %al andb $0x1, %al movzbl %al, %eax cmpl $0x0, %eax jne 0x85fe66 cmpl $0x0, -0x24(%rbp) je 0x85fe66 cmpl $0x5, -0x24(%rbp) je 0x85fe66 movq -0x18(%rbp), %rax movl 0x374(%rax), %ecx andl $0xfffeffff, %ecx # imm = 0xFFFEFFFF orl $0x10000, %ecx # imm = 0x10000 movl %ecx, 0x374(%rax) jmp 0x85fe7f movq -0x18(%rbp), %rax movl 0x374(%rax), %ecx andl $0xfffeffff, %ecx # imm = 0xFFFEFFFF orl $0x0, %ecx movl %ecx, 0x374(%rax) movl -0x38(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x50, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http.c
Curl_http_range
CURLcode Curl_http_range(struct Curl_easy *data, Curl_HttpReq httpreq) { if(data->state.use_range) { /* * A range is selected. We use different headers whether we're downloading * or uploading and we always let customized headers override our internal * ones if any such are specified. */ if(((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) && !Curl_checkheaders(data, STRCONST("Range"))) { /* if a line like this was already allocated, free the previous one */ free(data->state.aptr.rangeline); data->state.aptr.rangeline = aprintf("Range: bytes=%s\r\n", data->state.range); } else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) && !Curl_checkheaders(data, STRCONST("Content-Range"))) { /* if a line like this was already allocated, free the previous one */ free(data->state.aptr.rangeline); if(data->set.set_resume_from < 0) { /* Upload resume was asked for, but we don't know the size of the remote part so we tell the server (and act accordingly) that we upload the whole file (again) */ data->state.aptr.rangeline = aprintf("Content-Range: bytes 0-%" CURL_FORMAT_CURL_OFF_T "/%" CURL_FORMAT_CURL_OFF_T "\r\n", data->state.infilesize - 1, data->state.infilesize); } else if(data->state.resume_from) { /* This is because "resume" was selected */ curl_off_t total_expected_size = data->state.resume_from + data->state.infilesize; data->state.aptr.rangeline = aprintf("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T "/%" CURL_FORMAT_CURL_OFF_T "\r\n", data->state.range, total_expected_size-1, total_expected_size); } else { /* Range was selected and then we just pass the incoming range and append total size */ data->state.aptr.rangeline = aprintf("Content-Range: bytes %s/%" CURL_FORMAT_CURL_OFF_T "\r\n", data->state.range, data->state.infilesize); } if(!data->state.aptr.rangeline) return CURLE_OUT_OF_MEMORY; } } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq -0x10(%rbp), %rax movl 0x1300(%rax), %eax shrl $0x9, %eax andl $0x1, %eax cmpl $0x0, %eax je 0x8637df cmpl $0x0, -0x14(%rbp) je 0x863644 cmpl $0x5, -0x14(%rbp) jne 0x8636a2 movq -0x10(%rbp), %rdi leaq 0x342d04(%rip), %rsi # 0xba6353 movl $0x5, %edx callq 0x8312b0 cmpq $0x0, %rax jne 0x8636a2 leaq 0x698d9a(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x12b0(%rcx), %rdi callq *%rax movq -0x10(%rbp), %rax movq 0x1158(%rax), %rsi leaq 0x342cb1(%rip), %rdi # 0xba6339 movb $0x0, %al callq 0x817bb0 movq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x12b0(%rax) jmp 0x8637dd cmpl $0x1, -0x14(%rbp) je 0x8636b2 cmpl $0x4, -0x14(%rbp) jne 0x8637db movq -0x10(%rbp), %rdi leaq 0x342c8e(%rip), %rsi # 0xba634b movl $0xd, %edx callq 0x8312b0 cmpq $0x0, %rax jne 0x8637db leaq 0x698d28(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x12b0(%rcx), %rdi callq *%rax movq -0x10(%rbp), %rax cmpq $0x0, 0x310(%rax) jge 0x863731 movq -0x10(%rbp), %rax movq 0x1168(%rax), %rsi subq $0x1, %rsi movq -0x10(%rbp), %rax movq 0x1168(%rax), %rdx leaq 0x342c42(%rip), %rdi # 0xba6359 movb $0x0, %al callq 0x817bb0 movq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x12b0(%rax) jmp 0x8637c2 movq -0x10(%rbp), %rax cmpq $0x0, 0x1160(%rax) je 0x86378e movq -0x10(%rbp), %rax movq 0x1160(%rax), %rax movq -0x10(%rbp), %rcx addq 0x1168(%rcx), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax movq 0x1158(%rax), %rsi movq -0x20(%rbp), %rdx subq $0x1, %rdx movq -0x20(%rbp), %rcx leaq 0x342c03(%rip), %rdi # 0xba637a movb $0x0, %al callq 0x817bb0 movq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x12b0(%rax) jmp 0x8637c0 movq -0x10(%rbp), %rax movq 0x1158(%rax), %rsi movq -0x10(%rbp), %rax movq 0x1168(%rax), %rdx leaq 0x342bf0(%rip), %rdi # 0xba639b movb $0x0, %al callq 0x817bb0 movq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x12b0(%rax) jmp 0x8637c2 movq -0x10(%rbp), %rax cmpq $0x0, 0x12b0(%rax) jne 0x8637d9 movl $0x1b, -0x4(%rbp) jmp 0x8637e6 jmp 0x8637db jmp 0x8637dd jmp 0x8637df movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http.c
Curl_transferencode
CURLcode Curl_transferencode(struct Curl_easy *data) { if(!Curl_checkheaders(data, STRCONST("TE")) && data->set.http_transfer_encoding) { /* When we are to insert a TE: header in the request, we must also insert TE in a Connection: header, so we need to merge the custom provided Connection: header and prevent the original to get sent. Note that if the user has inserted his/her own TE: header we don't do this magic but then assume that the user will handle it all! */ char *cptr = Curl_checkheaders(data, STRCONST("Connection")); #define TE_HEADER "TE: gzip\r\n" Curl_safefree(data->state.aptr.te); if(cptr) { cptr = Curl_copy_header_value(cptr); if(!cptr) return CURLE_OUT_OF_MEMORY; } /* Create the (updated) Connection: header */ data->state.aptr.te = aprintf("Connection: %s%sTE\r\n" TE_HEADER, cptr ? cptr : "", (cptr && *cptr) ? ", ":""); free(cptr); if(!data->state.aptr.te) return CURLE_OUT_OF_MEMORY; } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq -0x10(%rbp), %rdi leaq 0x34012c(%rip), %rsi # 0xba3d83 movl $0x2, %edx callq 0x8312b0 cmpq $0x0, %rax jne 0x863d92 movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x14, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x863d92 movq -0x10(%rbp), %rdi leaq 0x3428be(%rip), %rsi # 0xba6550 movl $0xa, %edx callq 0x8312b0 movq %rax, -0x18(%rbp) leaq 0x698759(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x12d8(%rcx), %rdi callq *%rax movq -0x10(%rbp), %rax movq $0x0, 0x12d8(%rax) cmpq $0x0, -0x18(%rbp) je 0x863cef movq -0x18(%rbp), %rdi callq 0x85f160 movq %rax, -0x18(%rbp) cmpq $0x0, -0x18(%rbp) jne 0x863ced movl $0x1b, -0x4(%rbp) jmp 0x863d99 jmp 0x863cef cmpq $0x0, -0x18(%rbp) je 0x863d00 movq -0x18(%rbp), %rax movq %rax, -0x20(%rbp) jmp 0x863d0d leaq 0x35b4b0(%rip), %rax # 0xbbf1b7 movq %rax, -0x20(%rbp) jmp 0x863d0d movq -0x20(%rbp), %rax movq %rax, -0x30(%rbp) xorl %eax, %eax cmpq $0x0, -0x18(%rbp) movb %al, -0x21(%rbp) je 0x863d31 movq -0x18(%rbp), %rax movsbl (%rax), %eax cmpl $0x0, %eax setne %al movb %al, -0x21(%rbp) movq -0x30(%rbp), %rsi movb -0x21(%rbp), %cl leaq 0x35b478(%rip), %rdx # 0xbbf1b7 leaq 0x30d4ab(%rip), %rax # 0xb711f1 testb $0x1, %cl cmovneq %rax, %rdx leaq 0x342730(%rip), %rdi # 0xba6484 movb $0x0, %al callq 0x817bb0 movq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x12d8(%rax) leaq 0x698690(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x18(%rbp), %rdi callq *%rax movq -0x10(%rbp), %rax cmpq $0x0, 0x12d8(%rax) jne 0x863d90 movl $0x1b, -0x4(%rbp) jmp 0x863d99 jmp 0x863d92 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http.c
Curl_http_statusline
CURLcode Curl_http_statusline(struct Curl_easy *data, struct connectdata *conn) { struct SingleRequest *k = &data->req; data->info.httpcode = k->httpcode; data->info.httpversion = conn->httpversion; if(!data->state.httpversion || data->state.httpversion > conn->httpversion) /* store the lowest server version we encounter */ data->state.httpversion = conn->httpversion; /* * This code executes as part of processing the header. As a * result, it's not totally clear how to interpret the * response code yet as that depends on what other headers may * be present. 401 and 407 may be errors, but may be OK * depending on how authentication is working. Other codes * are definitely errors, so give up here. */ if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET && k->httpcode == 416) { /* "Requested Range Not Satisfiable", just proceed and pretend this is no error */ k->ignorebody = TRUE; /* Avoid appending error msg to good data. */ } if(conn->httpversion == 10) { /* Default action for HTTP/1.0 must be to close, unless we get one of those fancy headers that tell us the server keeps it open for us! */ infof(data, "HTTP 1.0, assume close after body"); connclose(conn, "HTTP/1.0 close after body"); } else if(conn->httpversion == 20 || (k->upgr101 == UPGR101_H2 && k->httpcode == 101)) { DEBUGF(infof(data, "HTTP/2 found, allow multiplexing")); /* HTTP/2 cannot avoid multiplexing since it is a core functionality of the protocol */ conn->bundle->multiuse = BUNDLE_MULTIPLEX; } else if(conn->httpversion >= 11 && !conn->bits.close) { /* If HTTP version is >= 1.1 and connection is persistent */ DEBUGF(infof(data, "HTTP 1.1 or later with persistent connection")); } k->http_bodyless = k->httpcode >= 100 && k->httpcode < 200; switch(k->httpcode) { case 304: /* (quote from RFC2616, section 10.3.5): The 304 response * MUST NOT contain a message-body, and thus is always * terminated by the first empty line after the header * fields. */ if(data->set.timecondition) data->info.timecond = TRUE; /* FALLTHROUGH */ case 204: /* (quote from RFC2616, section 10.2.5): The server has * fulfilled the request but does not need to return an * entity-body ... The 204 response MUST NOT include a * message-body, and thus is always terminated by the first * empty line after the header fields. */ k->size = 0; k->maxdownload = 0; k->http_bodyless = TRUE; break; default: break; } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rax addq $0xd0, %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax movl 0x70(%rax), %ecx movq -0x8(%rbp), %rax movl %ecx, 0x1358(%rax) movq -0x10(%rbp), %rax movzbl 0x57f(%rax), %ecx movq -0x8(%rbp), %rax movl %ecx, 0x1360(%rax) movq -0x8(%rbp), %rax cmpb $0x0, 0x1149(%rax) je 0x86492b movq -0x8(%rbp), %rax movzbl 0x1149(%rax), %eax movq -0x10(%rbp), %rcx movzbl 0x57f(%rcx), %ecx cmpl %ecx, %eax jle 0x86493f movq -0x10(%rbp), %rax movb 0x57f(%rax), %cl movq -0x8(%rbp), %rax movb %cl, 0x1149(%rax) movq -0x8(%rbp), %rax cmpq $0x0, 0x1160(%rax) je 0x864984 movq -0x8(%rbp), %rax movzbl 0x11e0(%rax), %eax cmpl $0x0, %eax jne 0x864984 movq -0x18(%rbp), %rax cmpl $0x1a0, 0x70(%rax) # imm = 0x1A0 jne 0x864984 movq -0x18(%rbp), %rax movw 0xd9(%rax), %cx andw $-0x9, %cx orw $0x8, %cx movw %cx, 0xd9(%rax) movq -0x10(%rbp), %rax movzbl 0x57f(%rax), %eax cmpl $0xa, %eax jne 0x8649b6 movq -0x8(%rbp), %rdi leaq 0x341d3e(%rip), %rsi # 0xba66dd movb $0x0, %al callq 0x820bf0 movq -0x10(%rbp), %rdi movl $0x1, %esi callq 0x849490 jmp 0x864a23 movq -0x10(%rbp), %rax movzbl 0x57f(%rax), %eax cmpl $0x14, %eax je 0x8649dd movq -0x18(%rbp), %rax cmpl $0x2, 0x8c(%rax) jne 0x8649f4 movq -0x18(%rbp), %rax cmpl $0x65, 0x70(%rax) jne 0x8649f4 jmp 0x8649df jmp 0x8649e1 movq -0x10(%rbp), %rax movq 0x548(%rax), %rax movl $0x2, (%rax) jmp 0x864a21 movq -0x10(%rbp), %rax movzbl 0x57f(%rax), %eax cmpl $0xb, %eax jl 0x864a1f movq -0x10(%rbp), %rax movl 0x374(%rax), %eax shrl $0x6, %eax andl $0x1, %eax cmpl $0x0, %eax jne 0x864a1f jmp 0x864a1b jmp 0x864a1d jmp 0x864a1f jmp 0x864a21 jmp 0x864a23 movq -0x18(%rbp), %rcx xorl %eax, %eax cmpl $0x64, 0x70(%rcx) movb %al, -0x19(%rbp) jl 0x864a43 movq -0x18(%rbp), %rax cmpl $0xc8, 0x70(%rax) setl %al movb %al, -0x19(%rbp) movb -0x19(%rbp), %cl movq -0x18(%rbp), %rax movzbl %cl, %edx andl $0x1, %edx movzwl 0xd9(%rax), %ecx shll $0x4, %edx andl $-0x11, %ecx orl %edx, %ecx movw %cx, 0xd9(%rax) movq -0x18(%rbp), %rax movl 0x70(%rax), %eax movl %eax, -0x20(%rbp) subl $0xcc, %eax je 0x864aaa jmp 0x864a79 movl -0x20(%rbp), %eax subl $0x130, %eax # imm = 0x130 jne 0x864add jmp 0x864a85 movq -0x8(%rbp), %rax cmpb $0x0, 0x538(%rax) je 0x864aa8 movq -0x8(%rbp), %rax movb 0x1444(%rax), %cl andb $-0x2, %cl orb $0x1, %cl movb %cl, 0x1444(%rax) jmp 0x864aaa movq -0x18(%rbp), %rax movq $0x0, (%rax) movq -0x18(%rbp), %rax movq $0x0, 0x8(%rax) movq -0x18(%rbp), %rax movw 0xd9(%rax), %cx andw $-0x11, %cx orw $0x10, %cx movw %cx, 0xd9(%rax) jmp 0x864adf jmp 0x864adf xorl %eax, %eax addq $0x20, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http.c
Curl_proxyCONNECT
CURLcode Curl_proxyCONNECT(struct Curl_easy *data, int sockindex, const char *hostname, int remote_port) { CURLcode result; struct connectdata *conn = data->conn; if(!conn->connect_state) { result = connect_init(data, FALSE); if(result) return result; } result = CONNECT(data, sockindex, hostname, remote_port); if(result || Curl_connect_complete(conn)) Curl_connect_done(data); return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movl %ecx, -0x24(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax cmpq $0x0, 0x540(%rax) jne 0x86722e movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x867470 movl %eax, -0x28(%rbp) cmpl $0x0, -0x28(%rbp) je 0x86722c movl -0x28(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x867268 jmp 0x86722e movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi movq -0x20(%rbp), %rdx movl -0x24(%rbp), %ecx callq 0x867610 movl %eax, -0x28(%rbp) cmpl $0x0, -0x28(%rbp) jne 0x867259 movq -0x30(%rbp), %rdi callq 0x867280 testb $0x1, %al jne 0x867259 jmp 0x867262 movq -0x10(%rbp), %rdi callq 0x867340 movl -0x28(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http_proxy.c
trim_headers
static void trim_headers(struct curl_slist *head) { struct curl_slist *l; for(l = head; l; l = l->next) { char *value; /* to read from */ char *store; size_t colon = strcspn(l->data, ":"); Curl_strntolower(l->data, l->data, colon); value = &l->data[colon]; if(!*value) continue; ++value; store = value; /* skip leading whitespace */ while(*value && ISBLANK(*value)) value++; while(*value) { int space = 0; while(*value && ISBLANK(*value)) { value++; space++; } if(space) { /* replace any number of consecutive whitespace with a single space, unless at the end of the string, then nothing */ if(*value) *store++ = ' '; } else *store++ = *value++; } *store = 0; /* null terminate */ } }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax movq %rax, -0x10(%rbp) cmpq $0x0, -0x10(%rbp) je 0x869a6d movq -0x10(%rbp), %rax movq (%rax), %rdi leaq 0x3170de(%rip), %rsi # 0xb809db callq 0x3da90 movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rdi movq -0x10(%rbp), %rax movq (%rax), %rsi movq -0x28(%rbp), %rdx callq 0x830400 movq -0x10(%rbp), %rax movq (%rax), %rax addq -0x28(%rbp), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax cmpb $0x0, (%rax) jne 0x86993a jmp 0x869a5c movq -0x18(%rbp), %rax addq $0x1, %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax movq %rax, -0x20(%rbp) movq -0x18(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x2d(%rbp) je 0x869986 movq -0x18(%rbp), %rax movsbl (%rax), %ecx movb $0x1, %al cmpl $0x20, %ecx movb %al, -0x2e(%rbp) je 0x869980 movq -0x18(%rbp), %rax movsbl (%rax), %eax cmpl $0x9, %eax sete %al movb %al, -0x2e(%rbp) movb -0x2e(%rbp), %al movb %al, -0x2d(%rbp) movb -0x2d(%rbp), %al testb $0x1, %al jne 0x86998f jmp 0x86999d movq -0x18(%rbp), %rax addq $0x1, %rax movq %rax, -0x18(%rbp) jmp 0x86994e jmp 0x86999f movq -0x18(%rbp), %rax cmpb $0x0, (%rax) je 0x869a55 movl $0x0, -0x2c(%rbp) movq -0x18(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x2f(%rbp) je 0x8699eb movq -0x18(%rbp), %rax movsbl (%rax), %ecx movb $0x1, %al cmpl $0x20, %ecx movb %al, -0x30(%rbp) je 0x8699e5 movq -0x18(%rbp), %rax movsbl (%rax), %eax cmpl $0x9, %eax sete %al movb %al, -0x30(%rbp) movb -0x30(%rbp), %al movb %al, -0x2f(%rbp) movb -0x2f(%rbp), %al testb $0x1, %al jne 0x8699f4 jmp 0x869a0b movq -0x18(%rbp), %rax addq $0x1, %rax movq %rax, -0x18(%rbp) movl -0x2c(%rbp), %eax addl $0x1, %eax movl %eax, -0x2c(%rbp) jmp 0x8699b3 cmpl $0x0, -0x2c(%rbp) je 0x869a2e movq -0x18(%rbp), %rax cmpb $0x0, (%rax) je 0x869a2c movq -0x20(%rbp), %rax movq %rax, %rcx addq $0x1, %rcx movq %rcx, -0x20(%rbp) movb $0x20, (%rax) jmp 0x869a50 movq -0x18(%rbp), %rax movq %rax, %rcx addq $0x1, %rcx movq %rcx, -0x18(%rbp) movb (%rax), %cl movq -0x20(%rbp), %rax movq %rax, %rdx addq $0x1, %rdx movq %rdx, -0x20(%rbp) movb %cl, (%rax) jmp 0x86999f movq -0x20(%rbp), %rax movb $0x0, (%rax) movq -0x10(%rbp), %rax movq 0x8(%rax), %rax movq %rax, -0x10(%rbp) jmp 0x8698e4 addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/http_aws_sigv4.c
Curl_pp_sendf
CURLcode Curl_pp_sendf(struct Curl_easy *data, struct pingpong *pp, const char *fmt, ...) { CURLcode result; va_list ap; va_start(ap, fmt); result = Curl_pp_vsendf(data, pp, fmt, ap); va_end(ap); return result; }
pushq %rbp movq %rsp, %rbp subq $0xf0, %rsp testb %al, %al je 0x86c31b movaps %xmm0, -0xc0(%rbp) movaps %xmm1, -0xb0(%rbp) movaps %xmm2, -0xa0(%rbp) movaps %xmm3, -0x90(%rbp) movaps %xmm4, -0x80(%rbp) movaps %xmm5, -0x70(%rbp) movaps %xmm6, -0x60(%rbp) movaps %xmm7, -0x50(%rbp) movq %r9, -0xc8(%rbp) movq %r8, -0xd0(%rbp) movq %rcx, -0xd8(%rbp) movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) leaq -0xf0(%rbp), %rax movq %rax, -0x30(%rbp) leaq 0x10(%rbp), %rax movq %rax, -0x38(%rbp) movl $0x30, -0x3c(%rbp) movl $0x18, -0x40(%rbp) movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx leaq -0x40(%rbp), %rcx callq 0x86c120 movl %eax, -0x1c(%rbp) movl -0x1c(%rbp), %eax addq $0xf0, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/pingpong.c
Curl_pp_flushsend
CURLcode Curl_pp_flushsend(struct Curl_easy *data, struct pingpong *pp) { /* we have a piece of a command still left to send */ struct connectdata *conn = data->conn; ssize_t written; curl_socket_t sock = conn->sock[FIRSTSOCKET]; CURLcode result = Curl_write(data, sock, pp->sendthis + pp->sendsize - pp->sendleft, pp->sendleft, &written); if(result) return result; if(written != (ssize_t)pp->sendleft) { /* only a fraction was sent */ pp->sendleft -= written; } else { pp->sendthis = NULL; pp->sendleft = pp->sendsize = 0; pp->response = Curl_now(); } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax movl 0x1e0(%rax), %eax movl %eax, -0x2c(%rbp) movq -0x10(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x18(%rbp), %rax movq 0x28(%rax), %rdx movq -0x18(%rbp), %rax addq 0x38(%rax), %rdx movq -0x18(%rbp), %rcx xorl %eax, %eax subq 0x30(%rcx), %rax addq %rax, %rdx movq -0x18(%rbp), %rax movq 0x30(%rax), %rcx leaq -0x28(%rbp), %r8 callq 0x820f80 movl %eax, -0x30(%rbp) cmpl $0x0, -0x30(%rbp) je 0x86c95f movl -0x30(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x86c9d8 movq -0x28(%rbp), %rax movq -0x18(%rbp), %rcx cmpq 0x30(%rcx), %rax je 0x86c982 movq -0x28(%rbp), %rdx movq -0x18(%rbp), %rax movq 0x30(%rax), %rcx subq %rdx, %rcx movq %rcx, 0x30(%rax) jmp 0x86c9d1 movq -0x18(%rbp), %rax movq $0x0, 0x28(%rax) movq -0x18(%rbp), %rax movq $0x0, 0x38(%rax) movq -0x18(%rbp), %rax movq $0x0, 0x30(%rax) movq -0x18(%rbp), %rax movq %rax, -0x48(%rbp) callq 0x831130 movq %rax, %rcx movq -0x48(%rbp), %rax movq %rcx, -0x40(%rbp) movl %edx, -0x38(%rbp) movq -0x40(%rbp), %rcx movq %rcx, 0x40(%rax) movq -0x38(%rbp), %rcx movq %rcx, 0x48(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x50, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/pingpong.c
Curl_rename
int Curl_rename(const char *oldpath, const char *newpath) { #ifdef WIN32 /* rename() on Windows doesn't overwrite, so we can't use it here. MoveFileEx() will overwrite and is usually atomic, however it fails when there are open handles to the file. */ const int max_wait_ms = 1000; struct curltime start = Curl_now(); TCHAR *tchar_oldpath = curlx_convert_UTF8_to_tchar((char *)oldpath); TCHAR *tchar_newpath = curlx_convert_UTF8_to_tchar((char *)newpath); for(;;) { timediff_t diff; if(MoveFileEx(tchar_oldpath, tchar_newpath, MOVEFILE_REPLACE_EXISTING)) { curlx_unicodefree(tchar_oldpath); curlx_unicodefree(tchar_newpath); break; } diff = Curl_timediff(Curl_now(), start); if(diff < 0 || diff > max_wait_ms) { curlx_unicodefree(tchar_oldpath); curlx_unicodefree(tchar_newpath); return 1; } Sleep(1); } #else if(rename(oldpath, newpath)) return 1; #endif return 0; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x3e340 cmpl $0x0, %eax je 0x86ca5b movl $0x1, -0x4(%rbp) jmp 0x86ca62 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/rename.c
Curl_sha256it
CURLcode Curl_sha256it(unsigned char *output, const unsigned char *input, const size_t length) { CURLcode result; my_sha256_ctx ctx; result = my_sha256_init(&ctx); if(!result) { my_sha256_update(&ctx, input, curlx_uztoui(length)); my_sha256_final(output, &ctx); } return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) leaq -0x28(%rbp), %rdi callq 0x86cad0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x86cac3 movq -0x10(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x18(%rbp), %rdi callq 0x840870 movq -0x30(%rbp), %rsi movl %eax, %edx leaq -0x28(%rbp), %rdi callq 0x86cb30 movq -0x8(%rbp), %rdi leaq -0x28(%rbp), %rsi callq 0x86cb60 movl -0x1c(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/sha256.c
smb_setup_connection
static CURLcode smb_setup_connection(struct Curl_easy *data, struct connectdata *conn) { struct smb_request *req; /* Initialize the request state */ data->req.p.smb = req = calloc(1, sizeof(struct smb_request)); if(!req) return CURLE_OUT_OF_MEMORY; /* Parse the URL path */ return smb_parse_url_path(data, conn); }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x1, %edi movl $0x18, %esi leaq 0x68f857(%rip), %rax # 0xefc418 callq *(%rax) movq %rax, %rcx movq %rcx, -0x20(%rbp) movq -0x10(%rbp), %rax movq %rcx, 0x198(%rax) cmpq $0x0, -0x20(%rbp) jne 0x86cbe5 movl $0x1b, -0x4(%rbp) jmp 0x86cbf5 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x86d6d0 movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/smb.c
smb_connection_state
static CURLcode smb_connection_state(struct Curl_easy *data, bool *done) { struct connectdata *conn = data->conn; struct smb_conn *smbc = &conn->proto.smbc; struct smb_negotiate_response *nrsp; struct smb_header *h; CURLcode result; void *msg = NULL; if(smbc->state == SMB_CONNECTING) { #ifdef USE_SSL if((conn->handler->flags & PROTOPT_SSL)) { bool ssl_done = FALSE; result = Curl_ssl_connect_nonblocking(data, conn, FALSE, FIRSTSOCKET, &ssl_done); if(result && result != CURLE_AGAIN) return result; if(!ssl_done) return CURLE_OK; } #endif result = smb_send_negotiate(data); if(result) { connclose(conn, "SMB: failed to send negotiate message"); return result; } conn_state(data, SMB_NEGOTIATE); } /* Send the previous message and check for a response */ result = smb_send_and_recv(data, &msg); if(result && result != CURLE_AGAIN) { connclose(conn, "SMB: failed to communicate"); return result; } if(!msg) return CURLE_OK; h = msg; switch(smbc->state) { case SMB_NEGOTIATE: if((smbc->got < sizeof(*nrsp) + sizeof(smbc->challenge) - 1) || h->status) { connclose(conn, "SMB: negotiation failed"); return CURLE_COULDNT_CONNECT; } nrsp = msg; memcpy(smbc->challenge, nrsp->bytes, sizeof(smbc->challenge)); smbc->session_key = smb_swap32(nrsp->session_key); result = smb_send_setup(data); if(result) { connclose(conn, "SMB: failed to send setup message"); return result; } conn_state(data, SMB_SETUP); break; case SMB_SETUP: if(h->status) { connclose(conn, "SMB: authentication failed"); return CURLE_LOGIN_DENIED; } smbc->uid = smb_swap16(h->uid); conn_state(data, SMB_CONNECTED); *done = true; break; default: smb_pop_message(conn); return CURLE_OK; /* ignore */ } smb_pop_message(conn); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq $0x0, -0x48(%rbp) movq -0x28(%rbp), %rax cmpl $0x1, (%rax) jne 0x86cf08 movq -0x20(%rbp), %rax movq 0x398(%rax), %rax movl 0x8c(%rax), %eax andl $0x1, %eax cmpl $0x0, %eax je 0x86cecf movb $0x0, -0x49(%rbp) movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi xorl %ecx, %ecx leaq -0x49(%rbp), %r8 movl %ecx, %edx callq 0x843c40 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x86cebb cmpl $0x51, -0x3c(%rbp) je 0x86cebb movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x86d070 testb $0x1, -0x49(%rbp) jne 0x86cecd movl $0x0, -0x4(%rbp) jmp 0x86d070 jmp 0x86cecf movq -0x10(%rbp), %rdi callq 0x86d870 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x86cefa movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x86d070 movq -0x10(%rbp), %rdi movl $0x2, %esi callq 0x86d8b0 movq -0x10(%rbp), %rdi leaq -0x48(%rbp), %rsi callq 0x86d8e0 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x86cf3d cmpl $0x51, -0x3c(%rbp) je 0x86cf3d movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x86d070 cmpq $0x0, -0x48(%rbp) jne 0x86cf50 movl $0x0, -0x4(%rbp) jmp 0x86d070 movq -0x48(%rbp), %rax movq %rax, -0x38(%rbp) movq -0x28(%rbp), %rax movl (%rax), %eax movl %eax, -0x50(%rbp) subl $0x2, %eax je 0x86cf79 jmp 0x86cf68 movl -0x50(%rbp), %eax subl $0x3, %eax je 0x86d006 jmp 0x86d04e movq -0x28(%rbp), %rax cmpq $0x51, 0x50(%rax) jb 0x86cf8e movq -0x38(%rbp), %rax cmpl $0x0, 0x9(%rax) je 0x86cfa8 movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 movl $0x7, -0x4(%rbp) jmp 0x86d070 movq -0x48(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x28(%rbp), %rax movq -0x30(%rbp), %rcx movq 0x49(%rcx), %rcx movq %rcx, 0x20(%rax) movq -0x30(%rbp), %rax movl 0x34(%rax), %ecx movq -0x28(%rbp), %rax movl %ecx, 0x28(%rax) movq -0x10(%rbp), %rdi callq 0x86da50 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x86cff6 movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x86d070 movq -0x10(%rbp), %rdi movl $0x3, %esi callq 0x86d8b0 jmp 0x86d060 movq -0x38(%rbp), %rax cmpl $0x0, 0x9(%rax) je 0x86d027 movq -0x20(%rbp), %rdi movl $0x1, %esi callq 0x849490 movl $0x43, -0x4(%rbp) jmp 0x86d070 movq -0x38(%rbp), %rax movw 0x20(%rax), %cx movq -0x28(%rbp), %rax movw %cx, 0x2c(%rax) movq -0x10(%rbp), %rdi movl $0x4, %esi callq 0x86d8b0 movq -0x18(%rbp), %rax movb $0x1, (%rax) jmp 0x86d060 movq -0x20(%rbp), %rdi callq 0x86dd50 movl $0x0, -0x4(%rbp) jmp 0x86d070 movq -0x20(%rbp), %rdi callq 0x86dd50 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x50, %rsp popq %rbp retq nopl (%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/smb.c
smb_flush
static CURLcode smb_flush(struct Curl_easy *data) { struct connectdata *conn = data->conn; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; struct smb_conn *smbc = &conn->proto.smbc; ssize_t bytes_written; ssize_t len = smbc->send_size - smbc->sent; CURLcode result; if(!smbc->send_size) return CURLE_OK; result = Curl_write(data, sockfd, data->state.ulbuf + smbc->sent, len, &bytes_written); if(result) return result; if(bytes_written != len) smbc->sent += bytes_written; else smbc->send_size = 0; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax movl 0x1e0(%rax), %eax movl %eax, -0x1c(%rbp) movq -0x18(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax movq 0x40(%rax), %rax movq -0x28(%rbp), %rcx subq 0x48(%rcx), %rax movq %rax, -0x38(%rbp) movq -0x28(%rbp), %rax cmpq $0x0, 0x40(%rax) jne 0x86e00b movl $0x0, -0x4(%rbp) jmp 0x86e072 movq -0x10(%rbp), %rdi movl -0x1c(%rbp), %esi movq -0x10(%rbp), %rax movq 0xc78(%rax), %rdx movq -0x28(%rbp), %rax addq 0x48(%rax), %rdx movq -0x38(%rbp), %rcx leaq -0x30(%rbp), %r8 callq 0x820f80 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x86e043 movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x86e072 movq -0x30(%rbp), %rax cmpq -0x38(%rbp), %rax je 0x86e05f movq -0x30(%rbp), %rcx movq -0x28(%rbp), %rax addq 0x48(%rax), %rcx movq %rcx, 0x48(%rax) jmp 0x86e06b movq -0x28(%rbp), %rax movq $0x0, 0x40(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/smb.c
smb_send_open
static CURLcode smb_send_open(struct Curl_easy *data) { struct smb_request *req = data->req.p.smb; struct smb_nt_create msg; size_t byte_count; if((strlen(req->path) + 1) > sizeof(msg.bytes)) return CURLE_FILESIZE_EXCEEDED; memset(&msg, 0, sizeof(msg)); msg.word_count = SMB_WC_NT_CREATE_ANDX; msg.andx.command = SMB_COM_NO_ANDX_COMMAND; byte_count = strlen(req->path); msg.name_length = smb_swap16((unsigned short)byte_count); msg.share_access = smb_swap32(SMB_FILE_SHARE_ALL); if(data->set.upload) { msg.access = smb_swap32(SMB_GENERIC_READ | SMB_GENERIC_WRITE); msg.create_disposition = smb_swap32(SMB_FILE_OVERWRITE_IF); } else { msg.access = smb_swap32(SMB_GENERIC_READ); msg.create_disposition = smb_swap32(SMB_FILE_OPEN); } msg.byte_count = smb_swap16((unsigned short) ++byte_count); strcpy(msg.bytes, req->path); return smb_send_message(data, SMB_COM_NT_CREATE_ANDX, &msg, sizeof(msg) - sizeof(msg.bytes) + byte_count); }
pushq %rbp movq %rsp, %rbp subq $0x460, %rsp # imm = 0x460 movq %rdi, -0x10(%rbp) movq -0x10(%rbp), %rax movq 0x198(%rax), %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax movq 0x8(%rax), %rdi callq 0x3b8f0 addq $0x1, %rax cmpq $0x400, %rax # imm = 0x400 jbe 0x86e4e3 movl $0x3f, -0x4(%rbp) jmp 0x86e5c6 leaq -0x44b(%rbp), %rdi xorl %esi, %esi movl $0x433, %edx # imm = 0x433 callq 0x3b780 movb $0x18, -0x44b(%rbp) movb $-0x1, -0x44a(%rbp) movq -0x18(%rbp), %rax movq 0x8(%rax), %rdi callq 0x3b8f0 movq %rax, -0x458(%rbp) movq -0x458(%rbp), %rax movw %ax, -0x445(%rbp) movl $0x7, -0x42b(%rbp) movq -0x10(%rbp), %rax movq 0xa92(%rax), %rax shrq $0x1a, %rax andq $0x1, %rax cmpl $0x0, %eax je 0x86e55e movl $0xc0000000, -0x43b(%rbp) # imm = 0xC0000000 movl $0x5, -0x427(%rbp) jmp 0x86e572 movl $0x80000000, -0x43b(%rbp) # imm = 0x80000000 movl $0x1, -0x427(%rbp) movq -0x458(%rbp), %rax addq $0x1, %rax movq %rax, -0x458(%rbp) movw %ax, -0x41a(%rbp) leaq -0x44b(%rbp), %rdi addq $0x33, %rdi movq -0x18(%rbp), %rax movq 0x8(%rax), %rsi callq 0x3d210 movq -0x10(%rbp), %rdi movq -0x458(%rbp), %rcx addq $0x33, %rcx movl $0xa2, %esi leaq -0x44b(%rbp), %rdx callq 0x86dd80 movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x460, %rsp # imm = 0x460 popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/smb.c
ossl_cleanup
static void ossl_cleanup(void) { #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \ !defined(LIBRESSL_VERSION_NUMBER) /* OpenSSL 1.1 deprecates all these cleanup functions and turns them into no-ops in OpenSSL 1.0 compatibility mode */ #else /* Free ciphers and digests lists */ EVP_cleanup(); #ifdef USE_OPENSSL_ENGINE /* Free engine list */ ENGINE_cleanup(); #endif /* Free OpenSSL error strings */ ERR_free_strings(); /* Free thread local error state, destroying hash upon zero refcount */ #ifdef HAVE_ERR_REMOVE_THREAD_STATE ERR_remove_thread_state(NULL); #else ERR_remove_state(0); #endif /* Free all memory allocated by all configuration modules */ CONF_modules_free(); #ifdef HAVE_SSL_COMP_FREE_COMPRESSION_METHODS SSL_COMP_free_compression_methods(); #endif #endif Curl_tls_keylog_close(); }
pushq %rbp movq %rsp, %rbp callq 0x87fed0 popq %rbp retq nopl (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/vtls/openssl.c
ossl_version
static size_t ossl_version(char *buffer, size_t size) { #ifdef LIBRESSL_VERSION_NUMBER #ifdef HAVE_OPENSSL_VERSION char *p; int count; const char *ver = OpenSSL_version(OPENSSL_VERSION); const char expected[] = OSSL_PACKAGE " "; /* ie "LibreSSL " */ if(Curl_strncasecompare(ver, expected, sizeof(expected) - 1)) { ver += sizeof(expected) - 1; } count = msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver); for(p = buffer; *p; ++p) { if(ISBLANK(*p)) *p = '_'; } return count; #else return msnprintf(buffer, size, "%s/%lx.%lx.%lx", OSSL_PACKAGE, (LIBRESSL_VERSION_NUMBER>>28)&0xf, (LIBRESSL_VERSION_NUMBER>>20)&0xff, (LIBRESSL_VERSION_NUMBER>>12)&0xff); #endif #elif defined(OPENSSL_IS_BORINGSSL) #ifdef CURL_BORINGSSL_VERSION return msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, CURL_BORINGSSL_VERSION); #else return msnprintf(buffer, size, OSSL_PACKAGE); #endif #elif defined(HAVE_OPENSSL_VERSION) && defined(OPENSSL_VERSION_STRING) return msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING)); #else /* not LibreSSL, BoringSSL and not using OpenSSL_version */ char sub[3]; unsigned long ssleay_value; sub[2]='\0'; sub[1]='\0'; ssleay_value = OpenSSL_version_num(); if(ssleay_value < 0x906000) { ssleay_value = SSLEAY_VERSION_NUMBER; sub[0]='\0'; } else { if(ssleay_value&0xff0) { int minor_ver = (ssleay_value >> 4) & 0xff; if(minor_ver > 26) { /* handle extended version introduced for 0.9.8za */ sub[1] = (char) ((minor_ver - 1) % 26 + 'a' + 1); sub[0] = 'z'; } else { sub[0] = (char) (minor_ver + 'a' - 1); } } else sub[0]='\0'; } return msnprintf(buffer, size, "%s/%lx.%lx.%lx%s" #ifdef OPENSSL_FIPS "-fips" #endif , OSSL_PACKAGE, (ssleay_value>>28)&0xf, (ssleay_value>>20)&0xff, (ssleay_value>>12)&0xff, sub); #endif /* OPENSSL_IS_BORINGSSL */ }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax movq %rax, -0x18(%rbp) movl $0x6, %edi callq 0x3c6b0 movq -0x20(%rbp), %rdi movq -0x18(%rbp), %rsi movq %rax, %r8 leaq 0x36c0d3(%rip), %rdx # 0xbdde2f leaq 0x3362ac(%rip), %rcx # 0xba800f movb $0x0, %al callq 0x8179a0 cltq addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/vtls/openssl.c
ossl_check_cxn
static int ossl_check_cxn(struct connectdata *conn) { /* SSL_peek takes data out of the raw recv buffer without peeking so we use recv MSG_PEEK instead. Bug #795 */ #ifdef MSG_PEEK char buf; ssize_t nread; nread = recv((RECV_TYPE_ARG1)conn->sock[FIRSTSOCKET], (RECV_TYPE_ARG2)&buf, (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK); if(nread == 0) return 0; /* connection has been closed */ if(nread == 1) return 1; /* connection still in place */ else if(nread == -1) { int err = SOCKERRNO; if(err == EINPROGRESS || #if defined(EAGAIN) && (EAGAIN != EWOULDBLOCK) err == EAGAIN || #endif err == EWOULDBLOCK) return 1; /* connection still in place */ if(err == ECONNRESET || #ifdef ECONNABORTED err == ECONNABORTED || #endif #ifdef ENETDOWN err == ENETDOWN || #endif #ifdef ENETRESET err == ENETRESET || #endif #ifdef ESHUTDOWN err == ESHUTDOWN || #endif #ifdef ETIMEDOUT err == ETIMEDOUT || #endif err == ENOTCONN) return 0; /* connection has been closed */ } #endif return -1; /* connection status unknown */ } /* Selects an OpenSSL crypto engine */ static CURLcode ossl_set_engine(struct Curl_easy *data, const char *engine) { #ifdef USE_OPENSSL_ENGINE ENGINE *e; #if OPENSSL_VERSION_NUMBER >= 0x00909000L e = ENGINE_by_id(engine); #else /* avoid memory leak */ for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) { const char *e_id = ENGINE_get_id(e); if(!strcmp(engine, e_id)) break; } #endif if(!e) { failf(data, "SSL Engine '%s' not found", engine); return CURLE_SSL_ENGINE_NOTFOUND; } if(data->state.engine) { ENGINE_finish(data->state.engine); ENGINE_free(data->state.engine); data->state.engine = NULL; } if(!ENGINE_init(e)) { char buf[256]; ENGINE_free(e); failf(data, "Failed to initialise SSL Engine '%s': %s", engine, ossl_strerror(ERR_get_error(), buf, sizeof(buf))); return CURLE_SSL_ENGINE_INITFAILED; } data->state.engine = e; return CURLE_OK; #else (void)engine; failf(data, "SSL Engine not supported"); return CURLE_SSL_ENGINE_NOTFOUND; #endif } /* Sets engine as default for all SSL operations */ static CURLcode ossl_set_engine_default(struct Curl_easy *data) { #ifdef USE_OPENSSL_ENGINE if(data->state.engine) { if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) { infof(data, "set default crypto engine '%s'", ENGINE_get_id(data->state.engine)); } else { failf(data, "set default crypto engine '%s' failed", ENGINE_get_id(data->state.engine)); return CURLE_SSL_ENGINE_SETFAILED; } } #else (void) data; #endif return CURLE_OK; } /* Return list of OpenSSL crypto engine names. */ static struct curl_slist *ossl_engines_list(struct Curl_easy *data) { struct curl_slist *list = NULL; #ifdef USE_OPENSSL_ENGINE struct curl_slist *beg; ENGINE *e; for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) { beg = curl_slist_append(list, ENGINE_get_id(e)); if(!beg) { curl_slist_free_all(list); return NULL; } list = beg; } #endif (void) data; return list; } #define set_logger(conn, data) \ conn->ssl[0].backend->logger = data static void ossl_closeone(struct Curl_easy *data, struct connectdata *conn, struct ssl_connect_data *connssl) { struct ssl_backend_data *backend = connssl->backend; DEBUGASSERT(backend); if(backend->handle) { char buf[32]; set_logger(conn, data); /* * The conn->sock[0] socket is passed to openssl with SSL_set_fd(). Make * sure the socket is not closed before calling OpenSSL functions that * will use it. */ DEBUGASSERT(conn->sock[FIRSTSOCKET] != CURL_SOCKET_BAD); /* Maybe the server has already sent a close notify alert. Read it to avoid an RST on the TCP connection. */ (void)SSL_read(backend->handle, buf, (int)sizeof(buf)); (void)SSL_shutdown(backend->handle); SSL_set_connect_state(backend->handle); SSL_free(backend->handle); backend->handle = NULL; } if(backend->ctx) { SSL_CTX_free(backend->ctx); backend->ctx = NULL; } } /* * This function is called when an SSL connection is closed. */ static void ossl_close(struct Curl_easy *data, struct connectdata *conn, int sockindex) { ossl_closeone(data, conn, &conn->ssl[sockindex]); #ifndef CURL_DISABLE_PROXY ossl_closeone(data, conn, &conn->proxy_ssl[sockindex]); #endif } /* * This function is called to shut down the SSL layer but keep the * socket open (CCC - Clear Command Channel) */ static int ossl_shutdown(struct Curl_easy *data, struct connectdata *conn, int sockindex) { int retval = 0; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; char buf[256]; /* We will use this for the OpenSSL error buffer, so it has to be at least 256 bytes long. */ unsigned long sslerror; ssize_t nread; int buffsize; int err; bool done = FALSE; struct ssl_backend_data *backend = connssl->backend; int loop = 10; DEBUGASSERT(backend); #ifndef CURL_DISABLE_FTP /* This has only been tested on the proftpd server, and the mod_tls code sends a close notify alert without waiting for a close notify alert in response. Thus we wait for a close notify alert from the server, but we do not send one. Let's hope other servers do the same... */ if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE) (void)SSL_shutdown(backend->handle); #endif if(backend->handle) { buffsize = (int)sizeof(buf); while(!done && loop--) { int what = SOCKET_READABLE(conn->sock[sockindex], SSL_SHUTDOWN_TIMEOUT); if(what > 0) { ERR_clear_error(); /* Something to read, let's do it and hope that it is the close notify alert from the server */ nread = (ssize_t)SSL_read(backend->handle, buf, buffsize); err = SSL_get_error(backend->handle, (int)nread); switch(err) { case SSL_ERROR_NONE: /* this is not an error */ case SSL_ERROR_ZERO_RETURN: /* no more data */ /* This is the expected response. There was no data but only the close notify alert */ done = TRUE; break; case SSL_ERROR_WANT_READ: /* there's data pending, re-invoke SSL_read() */ infof(data, "SSL_ERROR_WANT_READ"); break; case SSL_ERROR_WANT_WRITE: /* SSL wants a write. Really odd. Let's bail out. */ infof(data, "SSL_ERROR_WANT_WRITE"); done = TRUE; break; default: /* openssl/ssl.h says "look at error stack/return value/errno" */ sslerror = ERR_get_error(); failf(data, OSSL_PACKAGE " SSL_read on shutdown: %s, errno %d", (sslerror ? ossl_strerror(sslerror, buf, sizeof(buf)) : SSL_ERROR_to_str(err)), SOCKERRNO); done = TRUE; break; } } else if(0 == what) { /* timeout */ failf(data, "SSL shutdown timeout"); done = TRUE; } else { /* anything that gets here is fatally bad */ failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); retval = -1; done = TRUE; } } /* while()-loop for the select() */ if(data->set.verbose) { #ifdef HAVE_SSL_GET_SHUTDOWN switch(SSL_get_shutdown(backend->handle)) { case SSL_SENT_SHUTDOWN: infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN"); break; case SSL_RECEIVED_SHUTDOWN: infof(data, "SSL_get_shutdown() returned SSL_RECEIVED_SHUTDOWN"); break; case SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN: infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN|" "SSL_RECEIVED__SHUTDOWN"); break; } #endif } SSL_free(backend->handle); backend->handle = NULL; } return retval; } static void ossl_session_free(void *ptr) { /* free the ID */ SSL_SESSION_free(ptr); } /* * This function is called when the 'data' struct is going away. Close * down everything and free all resources! */ static void ossl_close_all(struct Curl_easy *data) { #ifdef USE_OPENSSL_ENGINE if(data->state.engine) { ENGINE_finish(data->state.engine); ENGINE_free(data->state.engine); data->state.engine = NULL; } #else (void)data; #endif #if !defined(HAVE_ERR_REMOVE_THREAD_STATE_DEPRECATED) && \ defined(HAVE_ERR_REMOVE_THREAD_STATE) /* OpenSSL 1.0.1 and 1.0.2 build an error queue that is stored per-thread so we need to clean it here in case the thread will be killed. All OpenSSL code should extract the error in association with the error so clearing this queue here should be harmless at worst. */ ERR_remove_thread_state(NULL); #endif } /* ====================================================== */ /* * Match subjectAltName against the host name. */ static bool subj_alt_hostcheck(struct Curl_easy *data, const char *match_pattern, size_t matchlen, const char *hostname, size_t hostlen, const char *dispname) { #ifdef CURL_DISABLE_VERBOSE_STRINGS (void)dispname; (void)data; #endif if(Curl_cert_hostcheck(match_pattern, matchlen, hostname, hostlen)) { infof(data, " subjectAltName: host \"%s\" matched cert's \"%s\"", dispname, match_pattern); return TRUE; } return FALSE; } /* Quote from RFC2818 section 3.1 "Server Identity" If a subjectAltName extension of type dNSName is present, that MUST be used as the identity. Otherwise, the (most specific) Common Name field in the Subject field of the certificate MUST be used. Although the use of the Common Name is existing practice, it is deprecated and Certification Authorities are encouraged to use the dNSName instead. Matching is performed using the matching rules specified by [RFC2459]. If more than one identity of a given type is present in the certificate (e.g., more than one dNSName name, a match in any one of the set is considered acceptable.) Names may contain the wildcard character * which is considered to match any single domain name component or component fragment. E.g., *.a.com matches foo.a.com but not bar.foo.a.com. f*.com matches foo.com but not bar.com. In some cases, the URI is specified as an IP address rather than a hostname. In this case, the iPAddress subjectAltName must be present in the certificate and must exactly match the IP in the URI. This function is now used from ngtcp2 (QUIC) as well. */ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn, X509 *server_cert) { bool matched = FALSE; int target = GEN_DNS; /* target type, GEN_DNS or GEN_IPADD */ size_t addrlen = 0; STACK_OF(GENERAL_NAME) *altnames; #ifdef ENABLE_IPV6 struct in6_addr addr; #else struct in_addr addr; #endif CURLcode result = CURLE_OK; bool dNSName = FALSE; /* if a dNSName field exists in the cert */ bool iPAddress = FALSE; /* if a iPAddress field exists in the cert */ const char * const hostname = SSL_HOST_NAME(); const char * const dispname = SSL_HOST_DISPNAME(); size_t hostlen = strlen(hostname); #ifdef ENABLE_IPV6 if(conn->bits.ipv6_ip && Curl_inet_pton(AF_INET6, hostname, &addr)) { target = GEN_IPADD; addrlen = sizeof(struct in6_addr); } else #endif if(Curl_inet_pton(AF_INET, hostname, &addr)) { target = GEN_IPADD; addrlen = sizeof(struct in_addr); } /* get a "list" of alternative names */ altnames = X509_get_ext_d2i(server_cert, NID_subject_alt_name, NULL, NULL); if(altnames) { #ifdef OPENSSL_IS_BORINGSSL size_t numalts; size_t i; #else int numalts; int i; #endif bool dnsmatched = FALSE; bool ipmatched = FALSE; /* get amount of alternatives, RFC2459 claims there MUST be at least one, but we don't depend on it... */ numalts = sk_GENERAL_NAME_num(altnames); /* loop through all alternatives - until a dnsmatch */ for(i = 0; (i < numalts) && !dnsmatched; i++) { /* get a handle to alternative name number i */ const GENERAL_NAME *check = sk_GENERAL_NAME_value(altnames, i); if(check->type == GEN_DNS) dNSName = TRUE; else if(check->type == GEN_IPADD) iPAddress = TRUE; /* only check alternatives of the same type the target is */ if(check->type == target) { /* get data and length */ const char *altptr = (char *)ASN1_STRING_get0_data(check->d.ia5); size_t altlen = (size_t) ASN1_STRING_length(check->d.ia5); switch(target) { case GEN_DNS: /* name/pattern comparison */ /* The OpenSSL man page explicitly says: "In general it cannot be assumed that the data returned by ASN1_STRING_data() is null terminated or does not contain embedded nulls." But also that "The actual format of the data will depend on the actual string type itself: for example for an IA5String the data will be ASCII" It has been however verified that in 0.9.6 and 0.9.7, IA5String is always null-terminated. */ if((altlen == strlen(altptr)) && /* if this isn't true, there was an embedded zero in the name string and we cannot match it. */ subj_alt_hostcheck(data, altptr, altlen, hostname, hostlen, dispname)) { dnsmatched = TRUE; } break; case GEN_IPADD: /* IP address comparison */ /* compare alternative IP address if the data chunk is the same size our server IP address is */ if((altlen == addrlen) && !memcmp(altptr, &addr, altlen)) { ipmatched = TRUE; infof(data, " subjectAltName: host \"%s\" matched cert's IP address!", dispname); } break; } } } GENERAL_NAMES_free(altnames); if(dnsmatched || ipmatched) matched = TRUE; } if(matched) /* an alternative name matched */ ; else if(dNSName || iPAddress) { infof(data, " subjectAltName does not match %s", dispname); failf(data, "SSL: no alternative certificate subject name matches " "target host name '%s'", dispname); result = CURLE_PEER_FAILED_VERIFICATION; } else { /* we have to look to the last occurrence of a commonName in the distinguished one to get the most significant one. */ int i = -1; unsigned char *peer_CN = NULL; int peerlen = 0; /* The following is done because of a bug in 0.9.6b */ X509_NAME *name = X509_get_subject_name(server_cert); if(name) { int j; while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0) i = j; } /* we have the name entry and we will now convert this to a string that we can use for comparison. Doing this we support BMPstring, UTF8, etc. */ if(i >= 0) { 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 string manually to avoid the problem. This code can be made conditional in the future when OpenSSL has been fixed. */ if(tmp) { if(ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) { peerlen = ASN1_STRING_length(tmp); if(peerlen >= 0) { peer_CN = OPENSSL_malloc(peerlen + 1); if(peer_CN) { memcpy(peer_CN, ASN1_STRING_get0_data(tmp), peerlen); peer_CN[peerlen] = '\0'; } else result = CURLE_OUT_OF_MEMORY; } } else /* not a UTF8 name */ peerlen = ASN1_STRING_to_UTF8(&peer_CN, tmp); if(peer_CN && (curlx_uztosi(strlen((char *)peer_CN)) != peerlen)) { /* there was a terminating zero before the end of string, this cannot match and we return failure! */ failf(data, "SSL: illegal cert name field"); result = CURLE_PEER_FAILED_VERIFICATION; } } } if(result) /* error already detected, pass through */ ; else if(!peer_CN) { failf(data, "SSL: unable to obtain common name from peer certificate"); result = CURLE_PEER_FAILED_VERIFICATION; } else if(!Curl_cert_hostcheck((const char *)peer_CN, peerlen, hostname, hostlen)) { failf(data, "SSL: certificate subject name '%s' does not match " "target host name '%s'", peer_CN, dispname); result = CURLE_PEER_FAILED_VERIFICATION; } else { infof(data, " common name: %s (matched)", peer_CN); } if(peer_CN) OPENSSL_free(peer_CN); } return result; } #if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \ !defined(OPENSSL_NO_OCSP) static CURLcode verifystatus(struct Curl_easy *data, struct ssl_connect_data *connssl) { int i, ocsp_status; unsigned char *status; const unsigned char *p; CURLcode result = CURLE_OK; OCSP_RESPONSE *rsp = NULL; OCSP_BASICRESP *br = NULL; X509_STORE *st = NULL; STACK_OF(X509) *ch = NULL; struct ssl_backend_data *backend = connssl->backend; X509 *cert; OCSP_CERTID *id = NULL; int cert_status, crl_reason; ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd; int ret; long len; DEBUGASSERT(backend); len = SSL_get_tlsext_status_ocsp_resp(backend->handle, &status); if(!status) { failf(data, "No OCSP response received"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } p = status; rsp = d2i_OCSP_RESPONSE(NULL, &p, len); if(!rsp) { failf(data, "Invalid OCSP response"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } ocsp_status = OCSP_response_status(rsp); if(ocsp_status != OCSP_RESPONSE_STATUS_SUCCESSFUL) { failf(data, "Invalid OCSP response status: %s (%d)", OCSP_response_status_str(ocsp_status), ocsp_status); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } br = OCSP_response_get1_basic(rsp); if(!br) { failf(data, "Invalid OCSP response"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } ch = SSL_get_peer_cert_chain(backend->handle); if(!ch) { failf(data, "Could not get peer certificate chain"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } st = SSL_CTX_get_cert_store(backend->ctx); #if ((OPENSSL_VERSION_NUMBER <= 0x1000201fL) /* Fixed after 1.0.2a */ || \ (defined(LIBRESSL_VERSION_NUMBER) && \ LIBRESSL_VERSION_NUMBER <= 0x2040200fL)) /* The authorized responder cert in the OCSP response MUST be signed by the peer cert's issuer (see RFC6960 section 4.2.2.2). If that's a root cert, no problem, but if it's an intermediate cert OpenSSL has a bug where it expects this issuer to be present in the chain embedded in the OCSP response. So we add it if necessary. */ /* First make sure the peer cert chain includes both a peer and an issuer, and the OCSP response contains a responder cert. */ if(sk_X509_num(ch) >= 2 && sk_X509_num(br->certs) >= 1) { X509 *responder = sk_X509_value(br->certs, sk_X509_num(br->certs) - 1); /* Find issuer of responder cert and add it to the OCSP response chain */ for(i = 0; i < sk_X509_num(ch); i++) { X509 *issuer = sk_X509_value(ch, i); if(X509_check_issued(issuer, responder) == X509_V_OK) { if(!OCSP_basic_add1_cert(br, issuer)) { failf(data, "Could not add issuer cert to OCSP response"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } } } } #endif if(OCSP_basic_verify(br, ch, st, 0) <= 0) { failf(data, "OCSP response verification failed"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } /* Compute the certificate's ID */ cert = SSL_get1_peer_certificate(backend->handle); if(!cert) { failf(data, "Error getting peer certificate"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } for(i = 0; i < sk_X509_num(ch); i++) { X509 *issuer = sk_X509_value(ch, i); if(X509_check_issued(issuer, cert) == X509_V_OK) { id = OCSP_cert_to_id(EVP_sha1(), cert, issuer); break; } } X509_free(cert); if(!id) { failf(data, "Error computing OCSP ID"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } /* Find the single OCSP response corresponding to the certificate ID */ ret = OCSP_resp_find_status(br, id, &cert_status, &crl_reason, &rev, &thisupd, &nextupd); OCSP_CERTID_free(id); if(ret != 1) { failf(data, "Could not find certificate ID in OCSP response"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } /* Validate the corresponding single OCSP response */ if(!OCSP_check_validity(thisupd, nextupd, 300L, -1L)) { failf(data, "OCSP response has expired"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } infof(data, "SSL certificate status: %s (%d)", OCSP_cert_status_str(cert_status), cert_status); switch(cert_status) { case V_OCSP_CERTSTATUS_GOOD: break; case V_OCSP_CERTSTATUS_REVOKED: result = CURLE_SSL_INVALIDCERTSTATUS; failf(data, "SSL certificate revocation reason: %s (%d)", OCSP_crl_reason_str(crl_reason), crl_reason); goto end; case V_OCSP_CERTSTATUS_UNKNOWN: default: result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } end: if(br) OCSP_BASICRESP_free(br); OCSP_RESPONSE_free(rsp); return result; } #endif #endif /* USE_OPENSSL */ /* The SSL_CTRL_SET_MSG_CALLBACK doesn't exist in ancient OpenSSL versions and thus this cannot be done there. */ #ifdef SSL_CTRL_SET_MSG_CALLBACK static const char *ssl_msg_type(int ssl_ver, int msg) { #ifdef SSL2_VERSION_MAJOR if(ssl_ver == SSL2_VERSION_MAJOR) { switch(msg) { case SSL2_MT_ERROR: return "Error"; case SSL2_MT_CLIENT_HELLO: return "Client hello"; case SSL2_MT_CLIENT_MASTER_KEY: return "Client key"; case SSL2_MT_CLIENT_FINISHED: return "Client finished"; case SSL2_MT_SERVER_HELLO: return "Server hello"; case SSL2_MT_SERVER_VERIFY: return "Server verify"; case SSL2_MT_SERVER_FINISHED: return "Server finished"; case SSL2_MT_REQUEST_CERTIFICATE: return "Request CERT"; case SSL2_MT_CLIENT_CERTIFICATE: return "Client CERT"; } } else #endif if(ssl_ver == SSL3_VERSION_MAJOR) { switch(msg) { case SSL3_MT_HELLO_REQUEST: return "Hello request"; case SSL3_MT_CLIENT_HELLO: return "Client hello"; case SSL3_MT_SERVER_HELLO: return "Server hello"; #ifdef SSL3_MT_NEWSESSION_TICKET case SSL3_MT_NEWSESSION_TICKET: return "Newsession Ticket"; #endif case SSL3_MT_CERTIFICATE: return "Certificate"; case SSL3_MT_SERVER_KEY_EXCHANGE: return "Server key exchange"; case SSL3_MT_CLIENT_KEY_EXCHANGE: return "Client key exchange"; case SSL3_MT_CERTIFICATE_REQUEST: return "Request CERT"; case SSL3_MT_SERVER_DONE: return "Server finished"; case SSL3_MT_CERTIFICATE_VERIFY: return "CERT verify"; case SSL3_MT_FINISHED: return "Finished"; #ifdef SSL3_MT_CERTIFICATE_STATUS case SSL3_MT_CERTIFICATE_STATUS: return "Certificate Status"; #endif #ifdef SSL3_MT_ENCRYPTED_EXTENSIONS case SSL3_MT_ENCRYPTED_EXTENSIONS: return "Encrypted Extensions"; #endif #ifdef SSL3_MT_SUPPLEMENTAL_DATA case SSL3_MT_SUPPLEMENTAL_DATA: return "Supplemental data"; #endif #ifdef SSL3_MT_END_OF_EARLY_DATA case SSL3_MT_END_OF_EARLY_DATA: return "End of early data"; #endif #ifdef SSL3_MT_KEY_UPDATE case SSL3_MT_KEY_UPDATE: return "Key update"; #endif #ifdef SSL3_MT_NEXT_PROTO case SSL3_MT_NEXT_PROTO: return "Next protocol"; #endif #ifdef SSL3_MT_MESSAGE_HASH case SSL3_MT_MESSAGE_HASH: return "Message hash"; #endif } } return "Unknown"; } static const char *tls_rt_type(int type) { switch(type) { #ifdef SSL3_RT_HEADER case SSL3_RT_HEADER: return "TLS header"; #endif case SSL3_RT_CHANGE_CIPHER_SPEC: return "TLS change cipher"; case SSL3_RT_ALERT: return "TLS alert"; case SSL3_RT_HANDSHAKE: return "TLS handshake"; case SSL3_RT_APPLICATION_DATA: return "TLS app data"; default: return "TLS Unknown"; } } /* * Our callback from the SSL/TLS layers. */ static void ossl_trace(int direction, int ssl_ver, int content_type, const void *buf, size_t len, SSL *ssl, void *userp) { char unknown[32]; const char *verstr = NULL; struct connectdata *conn = userp; struct ssl_connect_data *connssl = &conn->ssl[0]; struct ssl_backend_data *backend = connssl->backend; struct Curl_easy *data = NULL; DEBUGASSERT(backend); data = backend->logger; if(!conn || !data || !data->set.fdebug || (direction != 0 && direction != 1)) return; switch(ssl_ver) { #ifdef SSL2_VERSION /* removed in recent versions */ case SSL2_VERSION: verstr = "SSLv2"; break; #endif #ifdef SSL3_VERSION case SSL3_VERSION: verstr = "SSLv3"; break; #endif case TLS1_VERSION: verstr = "TLSv1.0"; break; #ifdef TLS1_1_VERSION case TLS1_1_VERSION: verstr = "TLSv1.1"; break; #endif #ifdef TLS1_2_VERSION case TLS1_2_VERSION: verstr = "TLSv1.2"; break; #endif #ifdef TLS1_3_VERSION case TLS1_3_VERSION: verstr = "TLSv1.3"; break; #endif case 0: break; default: msnprintf(unknown, sizeof(unknown), "(%x)", ssl_ver); verstr = unknown; break; } /* Log progress for interesting records only (like Handshake or Alert), skip * all raw record headers (content_type == SSL3_RT_HEADER or ssl_ver == 0). * For TLS 1.3, skip notification of the decrypted inner Content-Type. */ if(ssl_ver #ifdef SSL3_RT_INNER_CONTENT_TYPE && content_type != SSL3_RT_INNER_CONTENT_TYPE #endif ) { const char *msg_name, *tls_rt_name; char ssl_buf[1024]; int msg_type, txt_len; /* the info given when the version is zero is not that useful for us */ ssl_ver >>= 8; /* check the upper 8 bits only below */ /* SSLv2 doesn't seem to have TLS record-type headers, so OpenSSL * always pass-up content-type as 0. But the interesting message-type * is at 'buf[0]'. */ if(ssl_ver == SSL3_VERSION_MAJOR && content_type) tls_rt_name = tls_rt_type(content_type); else tls_rt_name = ""; if(content_type == SSL3_RT_CHANGE_CIPHER_SPEC) { msg_type = *(char *)buf; msg_name = "Change cipher spec"; } else if(content_type == SSL3_RT_ALERT) { msg_type = (((char *)buf)[0] << 8) + ((char *)buf)[1]; msg_name = SSL_alert_desc_string_long(msg_type); } else { msg_type = *(char *)buf; msg_name = ssl_msg_type(ssl_ver, msg_type); } txt_len = msnprintf(ssl_buf, sizeof(ssl_buf), "%s (%s), %s, %s (%d):\n", verstr, direction?"OUT":"IN", tls_rt_name, msg_name, msg_type); if(0 <= txt_len && (unsigned)txt_len < sizeof(ssl_buf)) { Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len); } } Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT : CURLINFO_SSL_DATA_IN, (char *)buf, len); (void) ssl; } #endif #ifdef USE_OPENSSL /* ====================================================== */ #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME # define use_sni(x) sni = (x) #else # define use_sni(x) Curl_nop_stmt #endif /* Check for OpenSSL 1.0.2 which has ALPN support. */ #undef HAS_ALPN #if OPENSSL_VERSION_NUMBER >= 0x10002000L \ && !defined(OPENSSL_NO_TLSEXT) # define HAS_ALPN 1 #endif /* Check for OpenSSL 1.1.0 which has set_{min,max}_proto_version(). */ #undef HAS_MODERN_SET_PROTO_VER #if OPENSSL_VERSION_NUMBER >= 0x10100000L \ && !(defined(LIBRESSL_VERSION_NUMBER) && \ LIBRESSL_VERSION_NUMBER < 0x20600000L) # define HAS_MODERN_SET_PROTO_VER 1 #endif #ifdef HAS_MODERN_SET_PROTO_VER static CURLcode set_ssl_version_min_max(SSL_CTX *ctx, struct connectdata *conn) { /* first, TLS min version... */ long curl_ssl_version_min = SSL_CONN_CONFIG(version); long curl_ssl_version_max; /* convert curl min SSL version option to OpenSSL constant */ #if defined(OPENSSL_IS_BORINGSSL) || defined(LIBRESSL_VERSION_NUMBER) uint16_t ossl_ssl_version_min = 0; uint16_t ossl_ssl_version_max = 0; #else long ossl_ssl_version_min = 0; long ossl_ssl_version_max = 0; #endif switch(curl_ssl_version_min) { case CURL_SSLVERSION_TLSv1: /* TLS 1.x */ case CURL_SSLVERSION_TLSv1_0: ossl_ssl_version_min = TLS1_VERSION; break; case CURL_SSLVERSION_TLSv1_1: ossl_ssl_version_min = TLS1_1_VERSION; break; case CURL_SSLVERSION_TLSv1_2: ossl_ssl_version_min = TLS1_2_VERSION; break; case CURL_SSLVERSION_TLSv1_3: #ifdef TLS1_3_VERSION ossl_ssl_version_min = TLS1_3_VERSION; break; #else return CURLE_NOT_BUILT_IN; #endif } /* CURL_SSLVERSION_DEFAULT means that no option was selected. We don't want to pass 0 to SSL_CTX_set_min_proto_version as it would enable all versions down to the lowest supported by the library. So we skip this, and stay with the library default */ if(curl_ssl_version_min != CURL_SSLVERSION_DEFAULT) { if(!SSL_CTX_set_min_proto_version(ctx, ossl_ssl_version_min)) { return CURLE_SSL_CONNECT_ERROR; } } /* ... then, TLS max version */ curl_ssl_version_max = SSL_CONN_CONFIG(version_max); /* convert curl max SSL version option to OpenSSL constant */ switch(curl_ssl_version_max) { case CURL_SSLVERSION_MAX_TLSv1_0: ossl_ssl_version_max = TLS1_VERSION; break; case CURL_SSLVERSION_MAX_TLSv1_1: ossl_ssl_version_max = TLS1_1_VERSION; break; case CURL_SSLVERSION_MAX_TLSv1_2: ossl_ssl_version_max = TLS1_2_VERSION; break; #ifdef TLS1_3_VERSION case CURL_SSLVERSION_MAX_TLSv1_3: ossl_ssl_version_max = TLS1_3_VERSION; break; #endif case CURL_SSLVERSION_MAX_NONE: /* none selected */ case CURL_SSLVERSION_MAX_DEFAULT: /* max selected */ default: /* SSL_CTX_set_max_proto_version states that: setting the maximum to 0 will enable protocol versions up to the highest version supported by the library */ ossl_ssl_version_max = 0; break; } if(!SSL_CTX_set_max_proto_version(ctx, ossl_ssl_version_max)) { return CURLE_SSL_CONNECT_ERROR; } return CURLE_OK; } #endif /* HAS_MODERN_SET_PROTO_VER */ #ifdef OPENSSL_IS_BORINGSSL typedef uint32_t ctx_option_t; #elif OPENSSL_VERSION_NUMBER >= 0x30000000L typedef uint64_t ctx_option_t; #else typedef long ctx_option_t; #endif #if !defined(HAS_MODERN_SET_PROTO_VER) static CURLcode set_ssl_version_min_max_legacy(ctx_option_t *ctx_options, struct Curl_easy *data, struct connectdata *conn, int sockindex) { long ssl_version = SSL_CONN_CONFIG(version); long ssl_version_max = SSL_CONN_CONFIG(version_max); (void) data; /* In case it's unused. */ switch(ssl_version) { case CURL_SSLVERSION_TLSv1_3: #ifdef TLS1_3_VERSION { struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_backend_data *backend = connssl->backend; DEBUGASSERT(backend); SSL_CTX_set_max_proto_version(backend->ctx, TLS1_3_VERSION); *ctx_options |= SSL_OP_NO_TLSv1_2; } #else (void)sockindex; (void)ctx_options; failf(data, OSSL_PACKAGE " was built without TLS 1.3 support"); return CURLE_NOT_BUILT_IN; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_TLSv1_2: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1_1; #else failf(data, OSSL_PACKAGE " was built without TLS 1.2 support"); return CURLE_NOT_BUILT_IN; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_TLSv1_1: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1; #else failf(data, OSSL_PACKAGE " was built without TLS 1.1 support"); return CURLE_NOT_BUILT_IN; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_TLSv1_0: case CURL_SSLVERSION_TLSv1: break; } switch(ssl_version_max) { case CURL_SSLVERSION_MAX_TLSv1_0: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1_1; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_MAX_TLSv1_1: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1_2; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_MAX_TLSv1_2: #ifdef TLS1_3_VERSION *ctx_options |= SSL_OP_NO_TLSv1_3; #endif break; case CURL_SSLVERSION_MAX_TLSv1_3: #ifdef TLS1_3_VERSION break; #else failf(data, OSSL_PACKAGE " was built without TLS 1.3 support"); return CURLE_NOT_BUILT_IN; #endif } return CURLE_OK; } #endif /* ! HAS_MODERN_SET_PROTO_VER */ /* The "new session" callback must return zero if the session can be removed * or non-zero if the session has been put into the session cache. */ static int ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid) { int res = 0; struct connectdata *conn; struct Curl_easy *data; int sockindex; curl_socket_t *sockindex_ptr; int data_idx = ossl_get_ssl_data_index(); int connectdata_idx = ossl_get_ssl_conn_index(); int sockindex_idx = ossl_get_ssl_sockindex_index(); int proxy_idx = ossl_get_proxy_index(); bool isproxy; if(data_idx < 0 || connectdata_idx < 0 || sockindex_idx < 0 || proxy_idx < 0) return 0; conn = (struct connectdata*) SSL_get_ex_data(ssl, connectdata_idx); data = (struct Curl_easy *) SSL_get_ex_data(ssl, data_idx); /* The sockindex has been stored as a pointer to an array element */ sockindex_ptr = (curl_socket_t*) SSL_get_ex_data(ssl, sockindex_idx); if(!conn || !data || !sockindex_ptr) return 0; sockindex = (int)(sockindex_ptr - conn->sock); isproxy = SSL_get_ex_data(ssl, proxy_idx) ? TRUE : FALSE; if(SSL_SET_OPTION(primary.sessionid)) { bool incache; bool added = FALSE; void *old_ssl_sessionid = NULL; Curl_ssl_sessionid_lock(data); if(isproxy) incache = FALSE; else incache = !(Curl_ssl_getsessionid(data, conn, isproxy, &old_ssl_sessionid, NULL, sockindex)); if(incache) { if(old_ssl_sessionid != ssl_sessionid) { infof(data, "old SSL session ID is stale, removing"); Curl_ssl_delsessionid(data, old_ssl_sessionid); incache = FALSE; } } if(!incache) { if(!Curl_ssl_addsessionid(data, conn, isproxy, ssl_sessionid, 0 /* unknown size */, sockindex, &added)) { if(added) { /* the session has been put into the session cache */ res = 1; } } else failf(data, "failed to store ssl session"); } Curl_ssl_sessionid_unlock(data); } return res; } static CURLcode load_cacert_from_memory(SSL_CTX *ctx, const struct curl_blob *ca_info_blob) { /* these need to be freed at the end */ BIO *cbio = NULL; STACK_OF(X509_INFO) *inf = NULL; /* everything else is just a reference */ int i, count = 0; X509_STORE *cts = NULL; X509_INFO *itmp = NULL; if(ca_info_blob->len > (size_t)INT_MAX) return CURLE_SSL_CACERT_BADFILE; cts = SSL_CTX_get_cert_store(ctx); if(!cts) return CURLE_OUT_OF_MEMORY; cbio = BIO_new_mem_buf(ca_info_blob->data, (int)ca_info_blob->len); if(!cbio) return CURLE_OUT_OF_MEMORY; inf = PEM_X509_INFO_read_bio(cbio, NULL, NULL, NULL); if(!inf) { BIO_free(cbio); return CURLE_SSL_CACERT_BADFILE; } /* add each entry from PEM file to x509_store */ for(i = 0; i < (int)sk_X509_INFO_num(inf); ++i) { itmp = sk_X509_INFO_value(inf, i); if(itmp->x509) { if(X509_STORE_add_cert(cts, itmp->x509)) { ++count; } else { /* set count to 0 to return an error */ count = 0; break; } } if(itmp->crl) { if(X509_STORE_add_crl(cts, itmp->crl)) { ++count; } else { /* set count to 0 to return an error */ count = 0; break; } } } sk_X509_INFO_pop_free(inf, X509_INFO_free); BIO_free(cbio); /* if we didn't end up importing anything, treat that as an error */ return (count > 0 ? CURLE_OK : CURLE_SSL_CACERT_BADFILE); } static CURLcode ossl_connect_step1(struct Curl_easy *data, struct connectdata *conn, int sockindex) { CURLcode result = CURLE_OK; char *ciphers; SSL_METHOD_QUAL SSL_METHOD *req_method = NULL; X509_LOOKUP *lookup = NULL; curl_socket_t sockfd = conn->sock[sockindex]; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; ctx_option_t ctx_options = 0; void *ssl_sessionid = NULL; #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME bool sni; const char * const hostname = SSL_HOST_NAME(); #ifdef ENABLE_IPV6 struct in6_addr addr; #else struct in_addr addr; #endif #endif const long int ssl_version = SSL_CONN_CONFIG(version); #ifdef USE_OPENSSL_SRP const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(primary.authtype); #endif char * const ssl_cert = SSL_SET_OPTION(primary.clientcert); const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob); const struct curl_blob *ca_info_blob = SSL_CONN_CONFIG(ca_info_blob); const char * const ssl_cert_type = SSL_SET_OPTION(cert_type); const char * const ssl_cafile = /* CURLOPT_CAINFO_BLOB overrides CURLOPT_CAINFO */ (ca_info_blob ? NULL : SSL_CONN_CONFIG(CAfile)); const char * const ssl_capath = SSL_CONN_CONFIG(CApath); const bool verifypeer = SSL_CONN_CONFIG(verifypeer); const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile); char error_buffer[256]; struct ssl_backend_data *backend = connssl->backend; bool imported_native_ca = false; DEBUGASSERT(ssl_connect_1 == connssl->connecting_state); DEBUGASSERT(backend); /* Make funny stuff to get random input */ result = ossl_seed(data); if(result) return result; SSL_SET_OPTION_LVALUE(certverifyresult) = !X509_V_OK; /* check to see if we've been told to use an explicit SSL/TLS version */ switch(ssl_version) { case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_TLSv1: case CURL_SSLVERSION_TLSv1_0: case CURL_SSLVERSION_TLSv1_1: case CURL_SSLVERSION_TLSv1_2: case CURL_SSLVERSION_TLSv1_3: /* it will be handled later with the context options */ #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) req_method = TLS_client_method(); #else req_method = SSLv23_client_method(); #endif use_sni(TRUE); break; case CURL_SSLVERSION_SSLv2: failf(data, "No SSLv2 support"); return CURLE_NOT_BUILT_IN; case CURL_SSLVERSION_SSLv3: failf(data, "No SSLv3 support"); return CURLE_NOT_BUILT_IN; default: failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION"); return CURLE_SSL_CONNECT_ERROR; } DEBUGASSERT(!backend->ctx); backend->ctx = SSL_CTX_new(req_method); if(!backend->ctx) { failf(data, "SSL: couldn't create a context: %s", ossl_strerror(ERR_peek_error(), error_buffer, sizeof(error_buffer))); return CURLE_OUT_OF_MEMORY; } #ifdef SSL_MODE_RELEASE_BUFFERS SSL_CTX_set_mode(backend->ctx, SSL_MODE_RELEASE_BUFFERS); #endif #ifdef SSL_CTRL_SET_MSG_CALLBACK if(data->set.fdebug && data->set.verbose) { /* the SSL trace callback is only used for verbose logging */ SSL_CTX_set_msg_callback(backend->ctx, ossl_trace); SSL_CTX_set_msg_callback_arg(backend->ctx, conn); set_logger(conn, data); } #endif /* OpenSSL contains code to work around lots of bugs and flaws in various SSL-implementations. SSL_CTX_set_options() is used to enabled those work-arounds. The man page for this option states that SSL_OP_ALL enables all the work-arounds and that "It is usually safe to use SSL_OP_ALL to enable the bug workaround options if compatibility with somewhat broken implementations is desired." The "-no_ticket" option was introduced in OpenSSL 0.9.8j. It's a flag to disable "rfc4507bis session ticket support". rfc4507bis was later turned into the proper RFC5077: https://datatracker.ietf.org/doc/html/rfc5077 The enabled extension concerns the session management. I wonder how often libcurl stops a connection and then resumes a TLS session. Also, sending the session data is some overhead. I suggest that you just use your proposed patch (which explicitly disables TICKET). If someone writes an application with libcurl and OpenSSL who wants to enable the feature, one can do this in the SSL callback. SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG option enabling allowed proper interoperability with web server Netscape Enterprise Server 2.0.1 which was released back in 1996. Due to CVE-2010-4180, option SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG has become ineffective as of OpenSSL 0.9.8q and 1.0.0c. In order to mitigate CVE-2010-4180 when using previous OpenSSL versions we no longer enable this option regardless of OpenSSL version and SSL_OP_ALL definition. OpenSSL added a work-around for a SSL 3.0/TLS 1.0 CBC vulnerability (https://www.openssl.org/~bodo/tls-cbc.txt). In 0.9.6e they added a bit to SSL_OP_ALL that _disables_ that work-around despite the fact that SSL_OP_ALL is documented to do "rather harmless" workarounds. In order to keep the secure work-around, the SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS bit must not be set. */ ctx_options = SSL_OP_ALL; #ifdef SSL_OP_NO_TICKET ctx_options |= SSL_OP_NO_TICKET; #endif #ifdef SSL_OP_NO_COMPRESSION ctx_options |= SSL_OP_NO_COMPRESSION; #endif #ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG /* mitigate CVE-2010-4180 */ ctx_options &= ~SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG; #endif #ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS /* unless the user explicitly asks to allow the protocol vulnerability we use the work-around */ if(!SSL_SET_OPTION(enable_beast)) ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS; #endif switch(ssl_version) { case CURL_SSLVERSION_SSLv2: case CURL_SSLVERSION_SSLv3: return CURLE_NOT_BUILT_IN; /* "--tlsv<x.y>" options mean TLS >= version <x.y> */ case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_TLSv1: /* TLS >= version 1.0 */ case CURL_SSLVERSION_TLSv1_0: /* TLS >= version 1.0 */ case CURL_SSLVERSION_TLSv1_1: /* TLS >= version 1.1 */ case CURL_SSLVERSION_TLSv1_2: /* TLS >= version 1.2 */ case CURL_SSLVERSION_TLSv1_3: /* TLS >= version 1.3 */ /* asking for any TLS version as the minimum, means no SSL versions allowed */ ctx_options |= SSL_OP_NO_SSLv2; ctx_options |= SSL_OP_NO_SSLv3; #if HAS_MODERN_SET_PROTO_VER /* 1.1.0 */ result = set_ssl_version_min_max(backend->ctx, conn); #else result = set_ssl_version_min_max_legacy(&ctx_options, data, conn, sockindex); #endif if(result != CURLE_OK) return result; break; default: failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION"); return CURLE_SSL_CONNECT_ERROR; } SSL_CTX_set_options(backend->ctx, ctx_options); #ifdef HAS_ALPN if(conn->bits.tls_enable_alpn) { int cur = 0; unsigned char protocols[128]; #ifdef USE_HTTP2 if(data->state.httpwant >= CURL_HTTP_VERSION_2 #ifndef CURL_DISABLE_PROXY && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy) #endif ) { protocols[cur++] = ALPN_H2_LENGTH; memcpy(&protocols[cur], ALPN_H2, ALPN_H2_LENGTH); cur += ALPN_H2_LENGTH; infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2); } #endif protocols[cur++] = ALPN_HTTP_1_1_LENGTH; memcpy(&protocols[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH); cur += ALPN_HTTP_1_1_LENGTH; infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1); /* expects length prefixed preference ordered list of protocols in wire * format */ if(SSL_CTX_set_alpn_protos(backend->ctx, protocols, cur)) { failf(data, "Error setting ALPN"); return CURLE_SSL_CONNECT_ERROR; } } #endif if(ssl_cert || ssl_cert_blob || ssl_cert_type) { if(!result && !cert_stuff(data, backend->ctx, ssl_cert, ssl_cert_blob, ssl_cert_type, SSL_SET_OPTION(key), SSL_SET_OPTION(key_blob), SSL_SET_OPTION(key_type), SSL_SET_OPTION(key_passwd))) result = CURLE_SSL_CERTPROBLEM; if(result) /* failf() is already done in cert_stuff() */ return result; } ciphers = SSL_CONN_CONFIG(cipher_list); if(!ciphers) ciphers = (char *)DEFAULT_CIPHER_SELECTION; if(ciphers) { if(!SSL_CTX_set_cipher_list(backend->ctx, ciphers)) { failf(data, "failed setting cipher list: %s", ciphers); return CURLE_SSL_CIPHER; } infof(data, "Cipher selection: %s", ciphers); } #ifdef HAVE_SSL_CTX_SET_CIPHERSUITES { char *ciphers13 = SSL_CONN_CONFIG(cipher_list13); if(ciphers13) { if(!SSL_CTX_set_ciphersuites(backend->ctx, ciphers13)) { failf(data, "failed setting TLS 1.3 cipher suite: %s", ciphers13); return CURLE_SSL_CIPHER; } infof(data, "TLS 1.3 cipher selection: %s", ciphers13); } } #endif #ifdef HAVE_SSL_CTX_SET_POST_HANDSHAKE_AUTH /* OpenSSL 1.1.1 requires clients to opt-in for PHA */ SSL_CTX_set_post_handshake_auth(backend->ctx, 1); #endif #ifdef HAVE_SSL_CTX_SET_EC_CURVES { char *curves = SSL_CONN_CONFIG(curves); if(curves) { if(!SSL_CTX_set1_curves_list(backend->ctx, curves)) { failf(data, "failed setting curves list: '%s'", curves); return CURLE_SSL_CIPHER; } } } #endif #ifdef USE_OPENSSL_SRP if((ssl_authtype == CURL_TLSAUTH_SRP) && Curl_auth_allowed_to_host(data)) { char * const ssl_username = SSL_SET_OPTION(primary.username); char * const ssl_password = SSL_SET_OPTION(primary.password); infof(data, "Using TLS-SRP username: %s", ssl_username); if(!SSL_CTX_set_srp_username(backend->ctx, ssl_username)) { failf(data, "Unable to set SRP user name"); return CURLE_BAD_FUNCTION_ARGUMENT; } if(!SSL_CTX_set_srp_password(backend->ctx, ssl_password)) { failf(data, "failed setting SRP password"); return CURLE_BAD_FUNCTION_ARGUMENT; } if(!SSL_CONN_CONFIG(cipher_list)) { infof(data, "Setting cipher list SRP"); if(!SSL_CTX_set_cipher_list(backend->ctx, "SRP")) { failf(data, "failed setting SRP cipher list"); return CURLE_SSL_CIPHER; } } } #endif #if defined(USE_WIN32_CRYPTO) /* Import certificates from the Windows root certificate store if requested. https://stackoverflow.com/questions/9507184/ https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L1037 https://datatracker.ietf.org/doc/html/rfc5280 */ if((SSL_CONN_CONFIG(verifypeer) || SSL_CONN_CONFIG(verifyhost)) && (SSL_SET_OPTION(native_ca_store))) { X509_STORE *store = SSL_CTX_get_cert_store(backend->ctx); HCERTSTORE hStore = CertOpenSystemStore(0, TEXT("ROOT")); if(hStore) { PCCERT_CONTEXT pContext = NULL; /* The array of enhanced key usage OIDs will vary per certificate and is declared outside of the loop so that rather than malloc/free each iteration we can grow it with realloc, when necessary. */ CERT_ENHKEY_USAGE *enhkey_usage = NULL; DWORD enhkey_usage_size = 0; /* This loop makes a best effort to import all valid certificates from the MS root store. If a certificate cannot be imported it is skipped. 'result' is used to store only hard-fail conditions (such as out of memory) that cause an early break. */ result = CURLE_OK; for(;;) { X509 *x509; FILETIME now; BYTE key_usage[2]; DWORD req_size; const unsigned char *encoded_cert; #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) char cert_name[256]; #endif pContext = CertEnumCertificatesInStore(hStore, pContext); if(!pContext) break; #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) if(!CertGetNameStringA(pContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, cert_name, sizeof(cert_name))) { strcpy(cert_name, "Unknown"); } infof(data, "SSL: Checking cert \"%s\"", cert_name); #endif encoded_cert = (const unsigned char *)pContext->pbCertEncoded; if(!encoded_cert) continue; GetSystemTimeAsFileTime(&now); if(CompareFileTime(&pContext->pCertInfo->NotBefore, &now) > 0 || CompareFileTime(&now, &pContext->pCertInfo->NotAfter) > 0) continue; /* If key usage exists check for signing attribute */ if(CertGetIntendedKeyUsage(pContext->dwCertEncodingType, pContext->pCertInfo, key_usage, sizeof(key_usage))) { if(!(key_usage[0] & CERT_KEY_CERT_SIGN_KEY_USAGE)) continue; } else if(GetLastError()) continue; /* If enhanced key usage exists check for server auth attribute. * * Note "In a Microsoft environment, a certificate might also have EKU * extended properties that specify valid uses for the certificate." * The call below checks both, and behavior varies depending on what is * found. For more details see CertGetEnhancedKeyUsage doc. */ if(CertGetEnhancedKeyUsage(pContext, 0, NULL, &req_size)) { if(req_size && req_size > enhkey_usage_size) { void *tmp = realloc(enhkey_usage, req_size); if(!tmp) { failf(data, "SSL: Out of memory allocating for OID list"); result = CURLE_OUT_OF_MEMORY; break; } enhkey_usage = (CERT_ENHKEY_USAGE *)tmp; enhkey_usage_size = req_size; } if(CertGetEnhancedKeyUsage(pContext, 0, enhkey_usage, &req_size)) { if(!enhkey_usage->cUsageIdentifier) { /* "If GetLastError returns CRYPT_E_NOT_FOUND, the certificate is good for all uses. If it returns zero, the certificate has no valid uses." */ if((HRESULT)GetLastError() != CRYPT_E_NOT_FOUND) continue; } else { DWORD i; bool found = false; for(i = 0; i < enhkey_usage->cUsageIdentifier; ++i) { if(!strcmp("1.3.6.1.5.5.7.3.1" /* OID server auth */, enhkey_usage->rgpszUsageIdentifier[i])) { found = true; break; } } if(!found) continue; } } else continue; } else continue; x509 = d2i_X509(NULL, &encoded_cert, pContext->cbCertEncoded); if(!x509) continue; /* Try to import the certificate. This may fail for legitimate reasons such as duplicate certificate, which is allowed by MS but not OpenSSL. */ if(X509_STORE_add_cert(store, x509) == 1) { #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) infof(data, "SSL: Imported cert \"%s\"", cert_name); #endif imported_native_ca = true; } X509_free(x509); } free(enhkey_usage); CertFreeCertificateContext(pContext); CertCloseStore(hStore, 0); if(result) return result; } if(imported_native_ca) infof(data, "successfully imported Windows CA store"); else infof(data, "error importing Windows CA store, continuing anyway"); } #endif if(ca_info_blob) { result = load_cacert_from_memory(backend->ctx, ca_info_blob); if(result) { if(result == CURLE_OUT_OF_MEMORY || (verifypeer && !imported_native_ca)) { failf(data, "error importing CA certificate blob"); return result; } /* Only warn if no certificate verification is required. */ infof(data, "error importing CA certificate blob, continuing anyway"); } } if(verifypeer && !imported_native_ca && (ssl_cafile || ssl_capath)) { #if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3) /* OpenSSL 3.0.0 has deprecated SSL_CTX_load_verify_locations */ if(ssl_cafile && !SSL_CTX_load_verify_file(backend->ctx, ssl_cafile)) { /* Fail if we insist on successfully verifying the server. */ failf(data, "error setting certificate file: %s", ssl_cafile); return CURLE_SSL_CACERT_BADFILE; } if(ssl_capath && !SSL_CTX_load_verify_dir(backend->ctx, ssl_capath)) { /* Fail if we insist on successfully verifying the server. */ failf(data, "error setting certificate path: %s", ssl_capath); return CURLE_SSL_CACERT_BADFILE; } #else /* tell OpenSSL where to find CA certificates that are used to verify the server's certificate. */ if(!SSL_CTX_load_verify_locations(backend->ctx, ssl_cafile, ssl_capath)) { /* Fail if we insist on successfully verifying the server. */ failf(data, "error setting certificate verify locations:" " CAfile: %s CApath: %s", ssl_cafile ? ssl_cafile : "none", ssl_capath ? ssl_capath : "none"); return CURLE_SSL_CACERT_BADFILE; } #endif infof(data, " CAfile: %s", ssl_cafile ? ssl_cafile : "none"); infof(data, " CApath: %s", ssl_capath ? ssl_capath : "none"); } #ifdef CURL_CA_FALLBACK if(verifypeer && !ca_info_blob && !ssl_cafile && !ssl_capath && !imported_native_ca) { /* verifying the peer without any CA certificates won't work so use openssl's built-in default as fallback */ SSL_CTX_set_default_verify_paths(backend->ctx); } #endif if(ssl_crlfile) { /* tell OpenSSL where to find CRL file that is used to check certificate * revocation */ lookup = X509_STORE_add_lookup(SSL_CTX_get_cert_store(backend->ctx), X509_LOOKUP_file()); if(!lookup || (!X509_load_crl_file(lookup, ssl_crlfile, X509_FILETYPE_PEM)) ) { failf(data, "error loading CRL file: %s", ssl_crlfile); return CURLE_SSL_CRL_BADFILE; } /* Everything is fine. */ infof(data, "successfully loaded CRL file:"); X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx), X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL); infof(data, " CRLfile: %s", ssl_crlfile); } if(verifypeer) { /* Try building a chain using issuers in the trusted store first to avoid problems with server-sent legacy intermediates. Newer versions of OpenSSL do alternate chain checking by default but we do not know how to determine that in a reliable manner. https://rt.openssl.org/Ticket/Display.html?id=3621&user=guest&pass=guest */ #if defined(X509_V_FLAG_TRUSTED_FIRST) X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx), X509_V_FLAG_TRUSTED_FIRST); #endif #ifdef X509_V_FLAG_PARTIAL_CHAIN if(!SSL_SET_OPTION(no_partialchain) && !ssl_crlfile) { /* Have intermediate certificates in the trust store be treated as trust-anchors, in the same way as self-signed root CA certificates are. This allows users to verify servers using the intermediate cert only, instead of needing the whole chain. Due to OpenSSL bug https://github.com/openssl/openssl/issues/5081 we cannot do partial chains with a CRL check. */ X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx), X509_V_FLAG_PARTIAL_CHAIN); } #endif } /* OpenSSL always tries to verify the peer, this only says whether it should * fail to connect if the verification fails, or if it should continue * anyway. In the latter case the result of the verification is checked with * SSL_get_verify_result() below. */ SSL_CTX_set_verify(backend->ctx, verifypeer ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, NULL); /* Enable logging of secrets to the file specified in env SSLKEYLOGFILE. */ #ifdef HAVE_KEYLOG_CALLBACK if(Curl_tls_keylog_enabled()) { SSL_CTX_set_keylog_callback(backend->ctx, ossl_keylog_callback); } #endif /* Enable the session cache because it's a prerequisite for the "new session" * callback. Use the "external storage" mode to prevent OpenSSL from creating * an internal session cache. */ SSL_CTX_set_session_cache_mode(backend->ctx, SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_NO_INTERNAL); SSL_CTX_sess_set_new_cb(backend->ctx, ossl_new_session_cb); /* give application a chance to interfere with SSL set up. */ if(data->set.ssl.fsslctx) { Curl_set_in_callback(data, true); result = (*data->set.ssl.fsslctx)(data, backend->ctx, data->set.ssl.fsslctxp); Curl_set_in_callback(data, false); if(result) { failf(data, "error signaled by ssl ctx callback"); return result; } } /* Let's make an SSL structure */ if(backend->handle) SSL_free(backend->handle); backend->handle = SSL_new(backend->ctx); if(!backend->handle) { failf(data, "SSL: couldn't create a context (handle)"); return CURLE_OUT_OF_MEMORY; } #if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \ !defined(OPENSSL_NO_OCSP) if(SSL_CONN_CONFIG(verifystatus)) SSL_set_tlsext_status_type(backend->handle, TLSEXT_STATUSTYPE_ocsp); #endif #if defined(OPENSSL_IS_BORINGSSL) && defined(ALLOW_RENEG) SSL_set_renegotiate_mode(backend->handle, ssl_renegotiate_freely); #endif SSL_set_connect_state(backend->handle); backend->server_cert = 0x0; #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME if((0 == Curl_inet_pton(AF_INET, hostname, &addr)) && #ifdef ENABLE_IPV6 (0 == Curl_inet_pton(AF_INET6, hostname, &addr)) && #endif sni) { char *snihost = Curl_ssl_snihost(data, hostname, NULL); if(!snihost || !SSL_set_tlsext_host_name(backend->handle, snihost)) { failf(data, "Failed set SNI"); return CURLE_SSL_CONNECT_ERROR; } } #endif if(!ossl_associate_connection(data, conn, sockindex)) { /* Maybe the internal errors of SSL_get_ex_new_index or SSL_set_ex_data */ failf(data, "SSL: ossl_associate_connection failed: %s", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer))); return CURLE_SSL_CONNECT_ERROR; } if(SSL_SET_OPTION(primary.sessionid)) { Curl_ssl_sessionid_lock(data); if(!Curl_ssl_getsessionid(data, conn, SSL_IS_PROXY() ? TRUE : FALSE, &ssl_sessionid, NULL, sockindex)) { /* we got a session id, use it! */ if(!SSL_set_session(backend->handle, ssl_sessionid)) { Curl_ssl_sessionid_unlock(data); failf(data, "SSL: SSL_set_session failed: %s", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer))); return CURLE_SSL_CONNECT_ERROR; } /* Informational message */ infof(data, "SSL re-using session ID"); } Curl_ssl_sessionid_unlock(data); } #ifndef CURL_DISABLE_PROXY if(conn->proxy_ssl[sockindex].use) { BIO *const bio = BIO_new(BIO_f_ssl()); struct ssl_backend_data *proxy_backend; SSL* handle = NULL; proxy_backend = conn->proxy_ssl[sockindex].backend; DEBUGASSERT(proxy_backend); handle = proxy_backend->handle; DEBUGASSERT(ssl_connection_complete == conn->proxy_ssl[sockindex].state); DEBUGASSERT(handle != NULL); DEBUGASSERT(bio != NULL); BIO_set_ssl(bio, handle, FALSE); SSL_set_bio(backend->handle, bio, bio); } else #endif if(!SSL_set_fd(backend->handle, (int)sockfd)) { /* pass the raw socket into the SSL layers */ failf(data, "SSL: SSL_set_fd failed: %s", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer))); return CURLE_SSL_CONNECT_ERROR; } connssl->connecting_state = ssl_connect_2; return CURLE_OK; } static CURLcode ossl_connect_step2(struct Curl_easy *data, struct connectdata *conn, int sockindex) { int err; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_backend_data *backend = connssl->backend; DEBUGASSERT(ssl_connect_2 == connssl->connecting_state || ssl_connect_2_reading == connssl->connecting_state || ssl_connect_2_writing == connssl->connecting_state); DEBUGASSERT(backend); ERR_clear_error(); err = SSL_connect(backend->handle); #ifndef HAVE_KEYLOG_CALLBACK if(Curl_tls_keylog_enabled()) { /* If key logging is enabled, wait for the handshake to complete and then * proceed with logging secrets (for TLS 1.2 or older). */ ossl_log_tls12_secret(backend->handle, &backend->keylog_done); } #endif /* 1 is fine 0 is "not successful but was shut down controlled" <0 is "handshake was not successful, because a fatal error occurred" */ if(1 != err) { int detail = SSL_get_error(backend->handle, err); if(SSL_ERROR_WANT_READ == detail) { connssl->connecting_state = ssl_connect_2_reading; return CURLE_OK; } if(SSL_ERROR_WANT_WRITE == detail) { connssl->connecting_state = ssl_connect_2_writing; return CURLE_OK; } #ifdef SSL_ERROR_WANT_ASYNC if(SSL_ERROR_WANT_ASYNC == detail) { connssl->connecting_state = ssl_connect_2; return CURLE_OK; } #endif else { /* untreated error */ unsigned long errdetail; char error_buffer[256]=""; CURLcode result; long lerr; int lib; int reason; /* the connection failed, we're not waiting for anything else. */ connssl->connecting_state = ssl_connect_2; /* Get the earliest error code from the thread's error queue and remove the entry. */ errdetail = ERR_get_error(); /* Extract which lib and reason */ lib = ERR_GET_LIB(errdetail); reason = ERR_GET_REASON(errdetail); if((lib == ERR_LIB_SSL) && ((reason == SSL_R_CERTIFICATE_VERIFY_FAILED) || (reason == SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED))) { result = CURLE_PEER_FAILED_VERIFICATION; lerr = SSL_get_verify_result(backend->handle); if(lerr != X509_V_OK) { SSL_SET_OPTION_LVALUE(certverifyresult) = lerr; msnprintf(error_buffer, sizeof(error_buffer), "SSL certificate problem: %s", X509_verify_cert_error_string(lerr)); } else /* strcpy() is fine here as long as the string fits within error_buffer */ strcpy(error_buffer, "SSL certificate verification failed"); } #if (OPENSSL_VERSION_NUMBER >= 0x10101000L && \ !defined(LIBRESSL_VERSION_NUMBER) && \ !defined(OPENSSL_IS_BORINGSSL)) /* SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED is only available on OpenSSL version above v1.1.1, not LibreSSL nor BoringSSL */ else if((lib == ERR_LIB_SSL) && (reason == SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED)) { /* If client certificate is required, communicate the error to client */ result = CURLE_SSL_CLIENTCERT; ossl_strerror(errdetail, error_buffer, sizeof(error_buffer)); } #endif else { result = CURLE_SSL_CONNECT_ERROR; ossl_strerror(errdetail, error_buffer, sizeof(error_buffer)); } /* detail is already set to the SSL error above */ /* If we e.g. use SSLv2 request-method and the server doesn't like us * (RST connection, etc.), OpenSSL gives no explanation whatsoever and * the SO_ERROR is also lost. */ if(CURLE_SSL_CONNECT_ERROR == result && errdetail == 0) { const char * const hostname = SSL_HOST_NAME(); const long int port = SSL_HOST_PORT(); char extramsg[80]=""; int sockerr = SOCKERRNO; if(sockerr && detail == SSL_ERROR_SYSCALL) Curl_strerror(sockerr, extramsg, sizeof(extramsg)); failf(data, OSSL_PACKAGE " SSL_connect: %s in connection to %s:%ld ", extramsg[0] ? extramsg : SSL_ERROR_to_str(detail), hostname, port); return result; } /* Could be a CERT problem */ failf(data, "%s", error_buffer); return result; } }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq -0x10(%rbp), %rax movl 0x1e0(%rax), %edi leaq -0x11(%rbp), %rsi movl $0x1, %edx movl $0x2, %ecx callq 0x3c470 movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) jne 0x871dbd movl $0x0, -0x4(%rbp) jmp 0x871e31 cmpq $0x1, -0x20(%rbp) jne 0x871dcd movl $0x1, -0x4(%rbp) jmp 0x871e31 cmpq $-0x1, -0x20(%rbp) jne 0x871e28 callq 0x3e130 movl (%rax), %eax movl %eax, -0x24(%rbp) cmpl $0x73, -0x24(%rbp) je 0x871dea cmpl $0xb, -0x24(%rbp) jne 0x871df3 movl $0x1, -0x4(%rbp) jmp 0x871e31 cmpl $0x68, -0x24(%rbp) je 0x871e1d cmpl $0x67, -0x24(%rbp) je 0x871e1d cmpl $0x64, -0x24(%rbp) je 0x871e1d cmpl $0x66, -0x24(%rbp) je 0x871e1d cmpl $0x6c, -0x24(%rbp) je 0x871e1d cmpl $0x6e, -0x24(%rbp) je 0x871e1d cmpl $0x6b, -0x24(%rbp) jne 0x871e26 movl $0x0, -0x4(%rbp) jmp 0x871e31 jmp 0x871e28 jmp 0x871e2a movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/vtls/openssl.c
ossl_cert_status_request
static bool ossl_cert_status_request(void) { #if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \ !defined(OPENSSL_NO_OCSP) return TRUE; #else return FALSE; #endif }
pushq %rbp movq %rsp, %rbp movb $0x1, %al andb $0x1, %al popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/vtls/openssl.c
ossl_connect
static CURLcode ossl_connect(struct Curl_easy *data, struct connectdata *conn, int sockindex) { CURLcode result; bool done = FALSE; result = ossl_connect_common(data, conn, sockindex, FALSE, &done); if(result) return result; DEBUGASSERT(done); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) movb $0x0, -0x21(%rbp) movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movl -0x1c(%rbp), %edx xorl %ecx, %ecx leaq -0x21(%rbp), %r8 callq 0x873550 movl %eax, -0x20(%rbp) cmpl $0x0, -0x20(%rbp) je 0x87232e movl -0x20(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x872339 jmp 0x872330 jmp 0x872332 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/vtls/openssl.c
MD4_Update
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size) { MD4_u32plus saved_lo; unsigned long used; saved_lo = ctx->lo; ctx->lo = (saved_lo + size) & 0x1fffffff; if(ctx->lo < saved_lo) ctx->hi++; ctx->hi += (MD4_u32plus)size >> 29; used = saved_lo & 0x3f; if(used) { unsigned long available = 64 - used; if(size < available) { memcpy(&ctx->buffer[used], data, size); return; } memcpy(&ctx->buffer[used], data, available); data = (const unsigned char *)data + available; size -= available; body(ctx, ctx->buffer, 64); } if(size >= 64) { data = body(ctx, data, size & ~(unsigned long)0x3f); size &= 0x3f; } memcpy(ctx->buffer, data, size); }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movq -0x8(%rbp), %rax movl (%rax), %eax movl %eax, -0x1c(%rbp) movl -0x1c(%rbp), %eax addq -0x18(%rbp), %rax andq $0x1fffffff, %rax # imm = 0x1FFFFFFF movl %eax, %ecx movq -0x8(%rbp), %rax movl %ecx, (%rax) movq -0x8(%rbp), %rax movl (%rax), %eax cmpl -0x1c(%rbp), %eax jae 0x87eb9a movq -0x8(%rbp), %rax movl 0x4(%rax), %ecx addl $0x1, %ecx movl %ecx, 0x4(%rax) movq -0x18(%rbp), %rax movl %eax, %ecx shrl $0x1d, %ecx movq -0x8(%rbp), %rax addl 0x4(%rax), %ecx movl %ecx, 0x4(%rax) movl -0x1c(%rbp), %eax andl $0x3f, %eax movl %eax, %eax movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) je 0x87ec3f movl $0x40, %eax subq -0x28(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x18(%rbp), %rax cmpq -0x30(%rbp), %rax jae 0x87ebf5 movq -0x8(%rbp), %rdi addq $0x18, %rdi addq -0x28(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx callq 0x3cb70 jmp 0x87ec80 movq -0x8(%rbp), %rdi addq $0x18, %rdi addq -0x28(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x30(%rbp), %rdx callq 0x3cb70 movq -0x10(%rbp), %rax addq -0x30(%rbp), %rax movq %rax, -0x10(%rbp) movq -0x30(%rbp), %rcx movq -0x18(%rbp), %rax subq %rcx, %rax movq %rax, -0x18(%rbp) movq -0x8(%rbp), %rdi movq -0x8(%rbp), %rsi addq $0x18, %rsi movl $0x40, %edx callq 0x87f060 cmpq $0x40, -0x18(%rbp) jb 0x87ec6b movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx andq $-0x40, %rdx callq 0x87f060 movq %rax, -0x10(%rbp) movq -0x18(%rbp), %rax andq $0x3f, %rax movq %rax, -0x18(%rbp) movq -0x8(%rbp), %rdi addq $0x18, %rdi movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx callq 0x3cb70 addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/md4.c
hostmatch
static bool hostmatch(const char *hostname, size_t hostlen, const char *pattern, size_t patternlen) { const char *pattern_label_end, *wildcard, *hostname_label_end; size_t prefixlen, suffixlen; /* normalize pattern and hostname by stripping off trailing dots */ DEBUGASSERT(patternlen); if(hostname[hostlen-1]=='.') hostlen--; if(pattern[patternlen-1]=='.') patternlen--; wildcard = memchr(pattern, '*', patternlen); if(!wildcard) return pmatch(hostname, hostlen, pattern, patternlen); /* detect IP address as hostname and fail the match if so */ if(Curl_host_is_ipnum(hostname)) return FALSE; /* We require at least 2 dots in the pattern to avoid too wide wildcard match. */ pattern_label_end = memchr(pattern, '.', patternlen); if(!pattern_label_end || (memrchr(pattern, '.', patternlen) == pattern_label_end) || strncasecompare(pattern, "xn--", 4)) return pmatch(hostname, hostlen, pattern, patternlen); hostname_label_end = memchr(hostname, '.', hostlen); if(!hostname_label_end) return FALSE; else { size_t skiphost = hostname_label_end - hostname; size_t skiplen = pattern_label_end - pattern; if(!pmatch(hostname_label_end, hostlen - skiphost, pattern_label_end, patternlen - skiplen)) return FALSE; } /* The wildcard must match at least one character, so the left-most label of the hostname is at least as large as the left-most label of the pattern. */ if(hostname_label_end - hostname < pattern_label_end - pattern) return FALSE; prefixlen = wildcard - pattern; suffixlen = pattern_label_end - (wildcard + 1); return strncasecompare(pattern, hostname, prefixlen) && strncasecompare(wildcard + 1, hostname_label_end - suffixlen, suffixlen) ? TRUE : FALSE; }
pushq %rbp movq %rsp, %rbp subq $0x70, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) jmp 0x87fbaa movq -0x10(%rbp), %rax movq -0x18(%rbp), %rcx subq $0x1, %rcx movsbl (%rax,%rcx), %eax cmpl $0x2e, %eax jne 0x87fbcb movq -0x18(%rbp), %rax addq $-0x1, %rax movq %rax, -0x18(%rbp) movq -0x20(%rbp), %rax movq -0x28(%rbp), %rcx subq $0x1, %rcx movsbl (%rax,%rcx), %eax cmpl $0x2e, %eax jne 0x87fbec movq -0x28(%rbp), %rax addq $-0x1, %rax movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rdi movq -0x28(%rbp), %rdx movl $0x2a, %esi callq 0x3d250 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) jne 0x87fc28 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x20(%rbp), %rdx movq -0x28(%rbp), %rcx callq 0x87fdd0 andb $0x1, %al movb %al, -0x1(%rbp) jmp 0x87fdc3 movq -0x10(%rbp), %rdi callq 0x85c8e0 testb $0x1, %al jne 0x87fc37 jmp 0x87fc40 movb $0x0, -0x1(%rbp) jmp 0x87fdc3 movq -0x20(%rbp), %rdi movq -0x28(%rbp), %rdx movl $0x2e, %esi callq 0x3d250 movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) je 0x87fc8f movq -0x20(%rbp), %rdi movq -0x28(%rbp), %rdx movl $0x2e, %esi callq 0x84eb80 cmpq -0x30(%rbp), %rax je 0x87fc8f movq -0x20(%rbp), %rdi leaq 0x3292e6(%rip), %rsi # 0xba8f66 movl $0x4, %edx callq 0x830290 cmpl $0x0, %eax je 0x87fcae movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x20(%rbp), %rdx movq -0x28(%rbp), %rcx callq 0x87fdd0 andb $0x1, %al movb %al, -0x1(%rbp) jmp 0x87fdc3 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rdx movl $0x2e, %esi callq 0x3d250 movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) jne 0x87fcd4 movb $0x0, -0x1(%rbp) jmp 0x87fdc3 movq -0x40(%rbp), %rax movq -0x10(%rbp), %rcx subq %rcx, %rax movq %rax, -0x58(%rbp) movq -0x30(%rbp), %rax movq -0x20(%rbp), %rcx subq %rcx, %rax movq %rax, -0x60(%rbp) movq -0x40(%rbp), %rdi movq -0x18(%rbp), %rsi subq -0x58(%rbp), %rsi movq -0x30(%rbp), %rdx movq -0x28(%rbp), %rcx subq -0x60(%rbp), %rcx callq 0x87fdd0 testb $0x1, %al jne 0x87fd1c movb $0x0, -0x1(%rbp) jmp 0x87fdc3 jmp 0x87fd1e movq -0x40(%rbp), %rax movq -0x10(%rbp), %rcx subq %rcx, %rax movq -0x30(%rbp), %rcx movq -0x20(%rbp), %rdx subq %rdx, %rcx cmpq %rcx, %rax jge 0x87fd42 movb $0x0, -0x1(%rbp) jmp 0x87fdc3 movq -0x38(%rbp), %rax movq -0x20(%rbp), %rcx subq %rcx, %rax movq %rax, -0x48(%rbp) movq -0x30(%rbp), %rax movq -0x38(%rbp), %rcx addq $0x1, %rcx subq %rcx, %rax movq %rax, -0x50(%rbp) movq -0x20(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x48(%rbp), %rdx callq 0x830290 movl %eax, %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x61(%rbp) je 0x87fda8 movq -0x38(%rbp), %rdi addq $0x1, %rdi movq -0x40(%rbp), %rsi xorl %eax, %eax subq -0x50(%rbp), %rax addq %rax, %rsi movq -0x50(%rbp), %rdx callq 0x830290 cmpl $0x0, %eax setne %al movb %al, -0x61(%rbp) movb -0x61(%rbp), %dl xorl %eax, %eax movl $0x1, %ecx testb $0x1, %dl cmovnel %ecx, %eax cmpl $0x0, %eax setne %al andb $0x1, %al movb %al, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x70, %rsp popq %rbp retq nop
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/vtls/hostcheck.c
Curl_tls_keylog_open
void Curl_tls_keylog_open(void) { char *keylog_file_name; if(!keylog_file_fp) { keylog_file_name = curl_getenv("SSLKEYLOGFILE"); if(keylog_file_name) { keylog_file_fp = fopen(keylog_file_name, FOPEN_APPENDTEXT); if(keylog_file_fp) { #ifdef WIN32 if(setvbuf(keylog_file_fp, NULL, _IONBF, 0)) #else if(setvbuf(keylog_file_fp, NULL, _IOLBF, 4096)) #endif { fclose(keylog_file_fp); keylog_file_fp = NULL; } } Curl_safefree(keylog_file_name); } } }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp cmpq $0x0, 0x687b68(%rip) # 0xf07998 jne 0x87fec4 leaq 0x32912e(%rip), %rdi # 0xba8f6b callq 0x859ed0 movq %rax, -0x8(%rbp) cmpq $0x0, -0x8(%rbp) je 0x87fec2 movq -0x8(%rbp), %rdi leaq 0x2e77a3(%rip), %rsi # 0xb675fb callq 0x3e0f0 movq %rax, 0x687b34(%rip) # 0xf07998 cmpq $0x0, 0x687b2c(%rip) # 0xf07998 je 0x87fea6 movq 0x687b23(%rip), %rdi # 0xf07998 xorl %eax, %eax movl %eax, %esi movl $0x1, %edx movl $0x1000, %ecx # imm = 0x1000 callq 0x3d260 cmpl $0x0, %eax je 0x87fea4 movq 0x687b04(%rip), %rdi # 0xf07998 callq 0x3b980 movq $0x0, 0x687af4(%rip) # 0xf07998 jmp 0x87fea6 jmp 0x87fea8 leaq 0x67c551(%rip), %rax # 0xefc400 movq (%rax), %rax movq -0x8(%rbp), %rdi callq *%rax movq $0x0, -0x8(%rbp) jmp 0x87fec2 jmp 0x87fec4 addq $0x10, %rsp popq %rbp retq nopw (%rax,%rax)
/JKorbelRA[P]CMake/Utilities/cmcurl/lib/vtls/keylog.c
nghttp2_session_detach_idle_stream
void nghttp2_session_detach_idle_stream(nghttp2_session *session, nghttp2_stream *stream) { nghttp2_stream *prev_stream, *next_stream; DEBUGF("stream: detach idle stream(%p)=%d, state=%d\n", stream, stream->stream_id, stream->state); prev_stream = stream->closed_prev; next_stream = stream->closed_next; if (prev_stream) { prev_stream->closed_next = next_stream; } else { session->idle_stream_head = next_stream; } if (next_stream) { next_stream->closed_prev = prev_stream; } else { session->idle_stream_tail = prev_stream; } stream->closed_prev = NULL; stream->closed_next = NULL; --session->num_idle_streams; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) jmp 0x88324e movq -0x10(%rbp), %rax movq 0x80(%rax), %rax movq %rax, -0x18(%rbp) movq -0x10(%rbp), %rax movq 0x88(%rax), %rax movq %rax, -0x20(%rbp) cmpq $0x0, -0x18(%rbp) je 0x883284 movq -0x20(%rbp), %rcx movq -0x18(%rbp), %rax movq %rcx, 0x88(%rax) jmp 0x883293 movq -0x20(%rbp), %rcx movq -0x8(%rbp), %rax movq %rcx, 0xa20(%rax) cmpq $0x0, -0x20(%rbp) je 0x8832ab movq -0x18(%rbp), %rcx movq -0x20(%rbp), %rax movq %rcx, 0x80(%rax) jmp 0x8832ba movq -0x18(%rbp), %rcx movq -0x8(%rbp), %rax movq %rcx, 0xa28(%rax) movq -0x10(%rbp), %rax movq $0x0, 0x80(%rax) movq -0x10(%rbp), %rax movq $0x0, 0x88(%rax) movq -0x8(%rbp), %rax movq 0xa68(%rax), %rcx addq $-0x1, %rcx movq %rcx, 0xa68(%rax) popq %rbp retq
/JKorbelRA[P]CMake/Utilities/cmnghttp2/lib/nghttp2_session.c