idn: rename the files to idn.[ch] and hold all IDN functions

Closes #10094
This commit is contained in:
Daniel Stenberg 2022-12-14 14:49:59 +01:00
parent 301812bec2
commit cc0aaf6e82
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 220 additions and 221 deletions

View file

@ -83,6 +83,7 @@
#include "bufref.h"
#include "curl_sasl.h"
#include "warnless.h"
#include "idn.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@ -105,7 +106,7 @@ static CURLcode smtp_setup_connection(struct Curl_easy *data,
static CURLcode smtp_parse_url_options(struct connectdata *conn);
static CURLcode smtp_parse_url_path(struct Curl_easy *data);
static CURLcode smtp_parse_custom_request(struct Curl_easy *data);
static CURLcode smtp_parse_address(struct Curl_easy *data, const char *fqma,
static CURLcode smtp_parse_address(const char *fqma,
char **address, struct hostname *host);
static CURLcode smtp_perform_auth(struct Curl_easy *data, const char *mech,
const struct bufref *initresp);
@ -541,7 +542,7 @@ static CURLcode smtp_perform_command(struct Curl_easy *data)
/* Parse the mailbox to verify into the local address and host name
parts, converting the host name to an IDN A-label if necessary */
result = smtp_parse_address(data, smtp->rcpt->data,
result = smtp_parse_address(smtp->rcpt->data,
&address, &host);
if(result)
return result;
@ -615,7 +616,7 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
/* Parse the FROM mailbox into the local address and host name parts,
converting the host name to an IDN A-label if necessary */
result = smtp_parse_address(data, data->set.str[STRING_MAIL_FROM],
result = smtp_parse_address(data->set.str[STRING_MAIL_FROM],
&address, &host);
if(result)
return result;
@ -653,7 +654,7 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
/* Parse the AUTH mailbox into the local address and host name parts,
converting the host name to an IDN A-label if necessary */
result = smtp_parse_address(data, data->set.str[STRING_MAIL_AUTH],
result = smtp_parse_address(data->set.str[STRING_MAIL_AUTH],
&address, &host);
if(result) {
free(from);
@ -790,7 +791,7 @@ static CURLcode smtp_perform_rcpt_to(struct Curl_easy *data)
/* Parse the recipient mailbox into the local address and host name parts,
converting the host name to an IDN A-label if necessary */
result = smtp_parse_address(data, smtp->rcpt->data,
result = smtp_parse_address(smtp->rcpt->data,
&address, &host);
if(result)
return result;
@ -1782,8 +1783,8 @@ static CURLcode smtp_parse_custom_request(struct Curl_easy *data)
* calling function deems it to be) then the input will simply be returned in
* the address part with the host name being NULL.
*/
static CURLcode smtp_parse_address(struct Curl_easy *data, const char *fqma,
char **address, struct hostname *host)
static CURLcode smtp_parse_address(const char *fqma, char **address,
struct hostname *host)
{
CURLcode result = CURLE_OK;
size_t length;
@ -1807,7 +1808,7 @@ static CURLcode smtp_parse_address(struct Curl_easy *data, const char *fqma,
host->name = host->name + 1;
/* Attempt to convert the host name to IDN ACE */
(void) Curl_idnconvert_hostname(data, host);
(void) Curl_idnconvert_hostname(host);
/* If Curl_idnconvert_hostname() fails then we shall attempt to continue
and send the host name using UTF-8 rather than as 7-bit ACE (which is