Go to the documentation of this file.
39 #ifndef CURL_DISABLE_POP3
41 #ifdef HAVE_NETINET_IN_H
42 #include <netinet/in.h>
44 #ifdef HAVE_ARPA_INET_H
45 #include <arpa/inet.h>
48 #include <sys/utsname.h>
58 #if (defined(NETWARE) && defined(__NOVELL_LIBC__))
60 #define in_addr_t unsigned long
105 const char *initresp);
184 #define pop3_to_pop3s(x) Curl_nop_stmt
202 if(
len >= 4 && !memcmp(
"-ERR", line, 4)) {
211 if(
len >= 1 && !memcmp(line,
".", 1))
222 if(
len >= 3 && !memcmp(
"+OK", line, 3)) {
229 if(
len >= 1 && !memcmp(
"+", line, 1)) {
247 char *message = NULL;
250 for(message =
buffer + 2; *message ==
' ' || *message ==
'\t'; message++)
254 for(
len = strlen(message);
len--;)
255 if(message[
len] !=
'\r' && message[
len] !=
'\n' && message[
len] !=
' ' &&
256 message[
len] !=
'\t')
276 #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
278 static const char *
const names[] = {
293 if(pop3c->
state != newstate)
294 infof(conn->
data,
"POP3 %p state change from %s to %s\n",
295 (
void *)pop3c, names[pop3c->state], names[newstate]);
298 pop3c->state = newstate;
399 #ifndef CURL_DISABLE_CRYPTO_AUTH
439 snprintf(&secret[2 *
i], 3,
"%02x", digest[
i]);
459 const char *initresp)
521 #ifndef CURL_DISABLE_CRYPTO_AUTH
532 infof(conn->
data,
"No known authentication mechanisms supported!\n");
550 struct POP3 *pop3 =
data->req.protop;
557 if(pop3->
id[0] !=
'\0')
565 if(pop3->
id[0] !=
'\0')
607 const char *line =
data->state.buffer;
608 size_t len = strlen(line);
613 if(pop3code !=
'+') {
614 failf(
data,
"Got unexpected pop3-server response");
619 if(
len >= 4 && line[
len - 2] ==
'>') {
621 for(
i = 3;
i <
len - 2; ++
i) {
624 size_t timestamplen =
len - 1 -
i;
658 const char *line =
data->state.buffer;
659 size_t len = strlen(line);
665 if(pop3code ==
'*') {
667 if(
len >= 4 && !memcmp(line,
"STLS", 4))
671 else if(
len >= 4 && !memcmp(line,
"USER", 4))
675 else if(
len >= 5 && !memcmp(line,
"SASL ", 5)) {
685 unsigned int mechbit;
688 (*line ==
' ' || *line ==
'\t' ||
689 *line ==
'\r' || *line ==
'\n')) {
699 for(wordlen = 0; wordlen <
len && line[wordlen] !=
' ' &&
700 line[wordlen] !=
'\t' && line[wordlen] !=
'\r' &&
701 line[wordlen] !=
'\n';)
706 if(mechbit && llen == wordlen)
714 else if(pop3code ==
'+') {
751 if(pop3code !=
'+') {
784 #ifndef CURL_DISABLE_CRYPTO_AUTH
805 #ifndef CURL_DISABLE_CRYPTO_AUTH
815 if(pop3code !=
'+') {
816 failf(
data,
"Authentication failed: %d", pop3code);
836 if(pop3code !=
'+') {
837 failf(
data,
"Access denied. %c", pop3code);
859 if(pop3code !=
'+') {
860 failf(
data,
"Access denied. %c", pop3code);
877 struct POP3 *pop3 =
data->req.protop;
883 if(pop3code !=
'+') {
907 if(!
data->set.opt_no_body) {
954 switch(pop3c->
state) {
971 #ifndef CURL_DISABLE_CRYPTO_AUTH
1113 struct POP3 *pop3 =
data->req.protop;
1121 connclose(conn,
"POP3 done with bad status");
1156 *dophase_done =
FALSE;
1253 else if(*dophase_done) {
1275 bool connected =
FALSE;
1279 data->req.size = -1;
1291 if(!
result && *dophase_done)
1331 while(*
ptr && *
ptr !=
'=')
1336 while(*
ptr && *
ptr !=
';')
1382 struct POP3 *pop3 =
data->req.protop;
1383 const char *
path =
data->state.path;
1399 struct POP3 *pop3 =
data->req.protop;
1424 bool strip_dot =
FALSE;
1433 for(
i = 0;
i < nread;
i++) {
1434 size_t prev = pop3c->
eob;
1438 if(pop3c->
eob == 0) {
1452 else if(pop3c->
eob == 3)
1461 if(pop3c->
eob == 1 || pop3c->
eob == 4)
1472 else if(pop3c->
eob == 3) {
1489 if(prev && prev >= pop3c->
eob) {
1493 while(prev && pop3c->
strip) {
1502 strip_dot ? prev - 1 : prev);
static CURLcode pop3_regular_transfer(struct connectdata *conn, bool *done)
int Curl_pp_getsock(struct pingpong *pp, curl_socket_t *socks, int numsocks)
#define Curl_ssl_connect_nonblocking(x, y, z)
UNITTEST_START char * ptr
void Curl_setup_transfer(struct connectdata *conn, int sockindex, curl_off_t size, bool getheader, curl_off_t *bytecountp, int writesockindex, curl_off_t *writecountp)
#define POP3_TYPE_CLEARTEXT
CURLcode Curl_pp_readresp(curl_socket_t sockfd, struct pingpong *pp, int *code, size_t *size)
unsigned int curlx_uztoui(size_t uznum)
static CURLcode pop3_perform_starttls(struct connectdata *conn)
static CURLcode pop3_doing(struct connectdata *conn, bool *dophase_done)
#define Curl_safefree(ptr)
static void pop3_get_message(char *buffer, char **outptr)
CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, int code, saslprogress *progress)
static int pop3_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks)
static CURLcode pop3_perform_command(struct connectdata *conn)
bool(* endofresp)(struct connectdata *conn, char *ptr, size_t len, int *code)
UNITTEST_START int * value
static CURLcode pop3_parse_url_path(struct connectdata *conn)
void Curl_sasl_init(struct SASL *sasl, const struct SASLproto *params)
union connectdata::@34 proto
static CURLcode pop3_done(struct connectdata *conn, CURLcode status, bool premature)
CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn, bool force_ir, saslprogress *progress)
static CURLcode pop3_perform(struct connectdata *conn, bool *connected, bool *dophase_done)
const struct Curl_handler * handler
ROSLIB_DECL std::string command(const std::string &cmd)
CURLcode Curl_urldecode(struct Curl_easy *data, const char *string, size_t length, char **ostring, size_t *olen, bool reject_ctrl)
static CURLcode pop3_perform_user(struct connectdata *conn)
bool Curl_pp_moredata(struct pingpong *pp)
bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn)
static CURLcode pop3_perform_authentication(struct connectdata *conn)
#define calloc(nbelem, size)
struct curl_httppost * last
static CURLcode pop3_state_command_resp(struct connectdata *conn, int pop3code, pop3state instate)
void Curl_pgrsSetDownloadCounter(struct Curl_easy *data, curl_off_t size)
static CURLcode pop3_setup_connection(struct connectdata *conn)
const struct Curl_handler Curl_handler_pop3s
CURLcode Curl_pp_sendf(struct pingpong *pp, const char *fmt,...)
static CURLcode pop3_continue_auth(struct connectdata *conn, const char *resp)
memcpy(filename, filename1, strlen(filename1))
static CURLcode pop3_parse_custom_request(struct connectdata *conn)
void Curl_pgrsSetUploadSize(struct Curl_easy *data, curl_off_t size)
curl_pp_transfer transfer
CURLcode Curl_client_write(struct connectdata *conn, int type, char *ptr, size_t len)
void Curl_pp_init(struct pingpong *pp)
static CURLcode pop3_block_statemach(struct connectdata *conn)
int Curl_MD5_final(MD5_context *context, unsigned char *result)
const MD5_params Curl_DIGEST_MD5[1]
static CURLcode pop3_connect(struct connectdata *conn, bool *done)
#define SASL_AUTH_DEFAULT
CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl, const char *value, size_t len)
static CURLcode pop3_perform_apop(struct connectdata *conn)
int Curl_MD5_update(MD5_context *context, const unsigned char *data, unsigned int len)
static CURLcode pop3_state_user_resp(struct connectdata *conn, int pop3code, pop3state instate)
static CURLcode pop3_do(struct connectdata *conn, bool *done)
static CURLcode pop3_perform_upgrade_tls(struct connectdata *conn)
CURLcode Curl_pp_flushsend(struct pingpong *pp)
CURLcode Curl_pop3_write(struct connectdata *conn, char *str, size_t nread)
CURLcode Curl_pp_disconnect(struct pingpong *pp)
static CURLcode pop3_state_capa_resp(struct connectdata *conn, int pop3code, pop3state instate)
CURLcode Curl_pp_statemach(struct pingpong *pp, bool block)
static const struct SASLproto saslpop3
static CURLcode pop3_state_apop_resp(struct connectdata *conn, int pop3code, pop3state instate)
static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len, int *resp)
struct ssl_connect_data ssl[2]
#define strncasecompare(a, b, c)
static CURLcode pop3_statemach_act(struct connectdata *conn)
static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done)
static CURLcode pop3_perform_capa(struct connectdata *conn)
unsigned int Curl_sasl_decode_mech(const char *ptr, size_t maxlen, size_t *len)
static CURLcode pop3_dophase_done(struct connectdata *conn, bool connected)
MD5_context * Curl_MD5_init(const MD5_params *md5params)
static CURLcode pop3_perform_quit(struct connectdata *conn)
struct connectdata * conn
static CURLcode pop3_state_auth_resp(struct connectdata *conn, int pop3code, pop3state instate)
static CURLcode pop3_state_servergreet_resp(struct connectdata *conn, int pop3code, pop3state instate)
const struct Curl_handler Curl_handler_pop3
static CURLcode pop3_state_pass_resp(struct connectdata *conn, int pop3code, pop3state instate)
static CURLcode pop3_init(struct connectdata *conn)
void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused)
#define PROTOPT_URLOPTIONS
void Curl_pgrsSetDownloadSize(struct Curl_easy *data, curl_off_t size)
UNITTEST_START int result
static CURLcode pop3_disconnect(struct connectdata *conn, bool dead)
static CURLcode pop3_parse_url_options(struct connectdata *conn)
static CURLcode pop3_state_starttls_resp(struct connectdata *conn, int pop3code, pop3state instate)
#define PROTOPT_CLOSEACTION
CURLcode(* statemach_act)(struct connectdata *conn)
void Curl_pgrsSetUploadCounter(struct Curl_easy *data, curl_off_t size)
#define PROTOPT_NOURLQUERY
static CURLcode pop3_perform_auth(struct connectdata *conn, const char *mech, const char *initresp)
static void state(struct connectdata *conn, pop3state newstate)
@ CURLE_WEIRD_SERVER_REPLY
rc_tagdetect_client
Author(s): Monika Florek-Jasinska
, Raphael Schaller
autogenerated on Sun May 15 2022 02:25:00