Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
b3204e6d
Commit
b3204e6d
authored
12 years ago
by
Steve Holme
Browse files
Options
Downloads
Patches
Plain Diff
pop3.c: Minor code tidy up
Minor tidy up of comments and layout prior to next part of imap work.
parent
f6f6f278
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/pop3.c
+54
-51
54 additions, 51 deletions
lib/pop3.c
with
54 additions
and
51 deletions
lib/pop3.c
+
54
−
51
View file @
b3204e6d
...
...
@@ -92,17 +92,16 @@ static CURLcode pop3_parse_url_path(struct connectdata *conn);
static
CURLcode
pop3_parse_custom_request
(
struct
connectdata
*
conn
);
static
CURLcode
pop3_regular_transfer
(
struct
connectdata
*
conn
,
bool
*
done
);
static
CURLcode
pop3_do
(
struct
connectdata
*
conn
,
bool
*
done
);
static
CURLcode
pop3_done
(
struct
connectdata
*
conn
,
CURLcode
,
bool
premature
);
static
CURLcode
pop3_done
(
struct
connectdata
*
conn
,
CURLcode
status
,
bool
premature
);
static
CURLcode
pop3_connect
(
struct
connectdata
*
conn
,
bool
*
done
);
static
CURLcode
pop3_disconnect
(
struct
connectdata
*
conn
,
bool
dead
);
static
CURLcode
pop3_multi_statemach
(
struct
connectdata
*
conn
,
bool
*
done
);
static
int
pop3_getsock
(
struct
connectdata
*
conn
,
curl_socket_t
*
socks
,
int
numsocks
);
static
CURLcode
pop3_doing
(
struct
connectdata
*
conn
,
bool
*
dophase_done
);
static
CURLcode
pop3_setup_connection
(
struct
connectdata
*
conn
);
static
CURLcode
pop3_doing
(
struct
connectdata
*
conn
,
bool
*
dophase_done
);
static
CURLcode
pop3_setup_connection
(
struct
connectdata
*
conn
);
/*
* POP3 protocol handler.
...
...
@@ -338,6 +337,7 @@ static int pop3_endofresp(struct pingpong *pp, int *resp)
/* This is the ONLY way to change POP3 state! */
static
void
state
(
struct
connectdata
*
conn
,
pop3state
newstate
)
{
struct
pop3_conn
*
pop3c
=
&
conn
->
proto
.
pop3c
;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
/* for debug purposes */
static
const
char
*
const
names
[]
=
{
...
...
@@ -361,13 +361,12 @@ static void state(struct connectdata *conn, pop3state newstate)
"QUIT"
,
/* LAST */
};
#endif
struct
pop3_conn
*
pop3c
=
&
conn
->
proto
.
pop3c
;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
if
(
pop3c
->
state
!=
newstate
)
infof
(
conn
->
data
,
"POP3 %p state change from %s to %s
\n
"
,
pop3c
,
names
[
pop3c
->
state
],
names
[
newstate
]);
#endif
pop3c
->
state
=
newstate
;
}
...
...
@@ -643,6 +642,7 @@ static CURLcode pop3_state_auth_plain_resp(struct connectdata *conn,
if
(
!
result
)
state
(
conn
,
POP3_AUTH
);
}
Curl_safefree
(
plainauth
);
}
}
...
...
@@ -679,6 +679,7 @@ static CURLcode pop3_state_auth_login_resp(struct connectdata *conn,
if
(
!
result
)
state
(
conn
,
POP3_AUTH_LOGIN_PASSWD
);
}
Curl_safefree
(
authuser
);
}
}
...
...
@@ -715,6 +716,7 @@ static CURLcode pop3_state_auth_login_password_resp(struct connectdata *conn,
if
(
!
result
)
state
(
conn
,
POP3_AUTH
);
}
Curl_safefree
(
authpasswd
);
}
}
...
...
@@ -769,6 +771,7 @@ static CURLcode pop3_state_auth_cram_resp(struct connectdata *conn,
if
(
!
result
)
state
(
conn
,
POP3_AUTH
);
}
Curl_safefree
(
rplyb64
);
}
...
...
@@ -1012,6 +1015,44 @@ static CURLcode pop3_state_pass_resp(struct connectdata *conn,
return
result
;
}
/* Start the DO phase for the command */
static
CURLcode
pop3_command
(
struct
connectdata
*
conn
)
{
CURLcode
result
=
CURLE_OK
;
struct
pop3_conn
*
pop3c
=
&
conn
->
proto
.
pop3c
;
const
char
*
command
=
NULL
;
/* Calculate the default command */
if
(
pop3c
->
mailbox
[
0
]
==
'\0'
||
conn
->
data
->
set
.
ftp_list_only
)
{
command
=
"LIST"
;
if
(
pop3c
->
mailbox
[
0
]
!=
'\0'
)
{
/* Message specific LIST so skip the BODY transfer */
struct
FTP
*
pop3
=
conn
->
data
->
state
.
proto
.
pop3
;
pop3
->
transfer
=
FTPTRANSFER_INFO
;
}
}
else
command
=
"RETR"
;
/* Send the command */
if
(
pop3c
->
mailbox
[
0
]
!=
'\0'
)
result
=
Curl_pp_sendf
(
&
conn
->
proto
.
pop3c
.
pp
,
"%s %s"
,
(
pop3c
->
custom
&&
pop3c
->
custom
[
0
]
!=
'\0'
?
pop3c
->
custom
:
command
),
pop3c
->
mailbox
);
else
result
=
Curl_pp_sendf
(
&
conn
->
proto
.
pop3c
.
pp
,
(
pop3c
->
custom
&&
pop3c
->
custom
[
0
]
!=
'\0'
?
pop3c
->
custom
:
command
));
if
(
result
)
return
result
;
state
(
conn
,
POP3_COMMAND
);
return
result
;
}
/* For command responses */
static
CURLcode
pop3_state_command_resp
(
struct
connectdata
*
conn
,
int
pop3code
,
...
...
@@ -1068,44 +1109,6 @@ static CURLcode pop3_state_command_resp(struct connectdata *conn,
return
result
;
}
/* Start the DO phase for the command */
static
CURLcode
pop3_command
(
struct
connectdata
*
conn
)
{
CURLcode
result
=
CURLE_OK
;
struct
pop3_conn
*
pop3c
=
&
conn
->
proto
.
pop3c
;
const
char
*
command
=
NULL
;
/* Calculate the default command */
if
(
pop3c
->
mailbox
[
0
]
==
'\0'
||
conn
->
data
->
set
.
ftp_list_only
)
{
command
=
"LIST"
;
if
(
pop3c
->
mailbox
[
0
]
!=
'\0'
)
{
/* Message specific LIST so skip the BODY transfer */
struct
FTP
*
pop3
=
conn
->
data
->
state
.
proto
.
pop3
;
pop3
->
transfer
=
FTPTRANSFER_INFO
;
}
}
else
command
=
"RETR"
;
/* Send the command */
if
(
pop3c
->
mailbox
[
0
]
!=
'\0'
)
result
=
Curl_pp_sendf
(
&
conn
->
proto
.
pop3c
.
pp
,
"%s %s"
,
(
pop3c
->
custom
&&
pop3c
->
custom
[
0
]
!=
'\0'
?
pop3c
->
custom
:
command
),
pop3c
->
mailbox
);
else
result
=
Curl_pp_sendf
(
&
conn
->
proto
.
pop3c
.
pp
,
(
pop3c
->
custom
&&
pop3c
->
custom
[
0
]
!=
'\0'
?
pop3c
->
custom
:
command
));
if
(
result
)
return
result
;
state
(
conn
,
POP3_COMMAND
);
return
result
;
}
static
CURLcode
pop3_statemach_act
(
struct
connectdata
*
conn
)
{
CURLcode
result
;
...
...
@@ -1298,16 +1301,17 @@ static CURLcode pop3_connect(struct connectdata *conn, bool *done)
pp
->
conn
=
conn
;
if
(
conn
->
handler
->
flags
&
PROTOPT_SSL
)
{
/* BLOCKING */
/* POP3S is simply pop3 with SSL for the control channel */
/* so perform the SSL initialization for this socket */
result
=
Curl_ssl_connect
(
conn
,
FIRSTSOCKET
);
if
(
result
)
return
result
;
}
Curl_pp_init
(
pp
);
/* init the response reader stuff */
/* Initialise the response reader stuff */
Curl_pp_init
(
pp
);
/* When we connect, we start in the state where we await the server greet
response */
/* Start off waiting for the server greeting response */
state
(
conn
,
POP3_SERVERGREET
);
if
(
data
->
state
.
used_interface
==
Curl_if_multi
)
...
...
@@ -1590,7 +1594,6 @@ static CURLcode pop3_regular_transfer(struct connectdata *conn,
result
=
pop3_perform
(
conn
,
&
connected
,
dophase_done
);
if
(
CURLE_OK
==
result
)
{
if
(
!*
dophase_done
)
/* The DO phase has not completed yet */
return
CURLE_OK
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment