main.c (dovecot-2.3.16) | : | main.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 115 | skipping to change at line 115 | |||
msg = t_strdup_printf("451 %s %s\r\n" | msg = t_strdup_printf("451 %s %s\r\n" | |||
"421 4.3.2 %s Shutting down due to fatal error\r\n", | "421 4.3.2 %s Shutting down due to fatal error\r\n", | |||
error_code, error_msg, hostname); | error_code, error_msg, hostname); | |||
if (write(fd_out, msg, strlen(msg)) < 0) { | if (write(fd_out, msg, strlen(msg)) < 0) { | |||
if (errno != EAGAIN && errno != EPIPE) | if (errno != EAGAIN && errno != EPIPE) | |||
i_error("write(client) failed: %m"); | i_error("write(client) failed: %m"); | |||
} | } | |||
} | } | |||
static bool | ||||
extract_input_data_field(const unsigned char **data, size_t *data_len, | ||||
const char **value_r) | ||||
{ | ||||
size_t value_len = 0; | ||||
if (*data_len == 0) | ||||
return FALSE; | ||||
if (**data == '\0') { | ||||
value_len = 1; | ||||
} else { | ||||
*value_r = t_strndup(*data, *data_len); | ||||
value_len = strlen(*value_r) + 1; | ||||
} | ||||
if (value_len > *data_len) { | ||||
*data = &uchar_nul; | ||||
*data_len = 0; | ||||
} else { | ||||
*data = *data + value_len; | ||||
*data_len = *data_len - value_len; | ||||
} | ||||
return TRUE; | ||||
} | ||||
static int | static int | |||
client_create_from_input(const struct mail_storage_service_input *input, | client_create_from_input(const struct mail_storage_service_input *input, | |||
int fd_in, int fd_out, const buffer_t *input_buf, | int fd_in, int fd_out, const buffer_t *input_buf, | |||
const char **error_r) | const char **error_r) | |||
{ | { | |||
struct mail_storage_service_user *user; | struct mail_storage_service_user *user; | |||
struct mail_user *mail_user; | struct mail_user *mail_user; | |||
struct submission_settings *set; | struct submission_settings *set; | |||
const char *errstr; | const char *errstr; | |||
const char *helo = NULL; | const char *helo = NULL; | |||
struct smtp_proxy_data proxy_data; | ||||
const unsigned char *data; | const unsigned char *data; | |||
size_t data_len; | size_t data_len; | |||
if (mail_storage_service_lookup_next(storage_service, input, | if (mail_storage_service_lookup_next(storage_service, input, | |||
&user, &mail_user, error_r) <= 0) { | &user, &mail_user, error_r) <= 0) { | |||
send_error(fd_out, my_hostname, | send_error(fd_out, my_hostname, | |||
"4.7.0", MAIL_ERRSTR_CRITICAL_MSG); | "4.7.0", MAIL_ERRSTR_CRITICAL_MSG); | |||
return -1; | return -1; | |||
} | } | |||
restrict_access_allow_coredumps(TRUE); | restrict_access_allow_coredumps(TRUE); | |||
skipping to change at line 165 | skipping to change at line 192 | |||
send_error(fd_out, set->hostname, | send_error(fd_out, set->hostname, | |||
"4.3.5", MAIL_ERRSTR_CRITICAL_MSG); | "4.3.5", MAIL_ERRSTR_CRITICAL_MSG); | |||
mail_user_deinit(&mail_user); | mail_user_deinit(&mail_user); | |||
mail_storage_service_user_unref(&user); | mail_storage_service_user_unref(&user); | |||
return -1; | return -1; | |||
} | } | |||
/* parse input data */ | /* parse input data */ | |||
data = NULL; | data = NULL; | |||
data_len = 0; | data_len = 0; | |||
i_zero(&proxy_data); | ||||
if (input_buf != NULL && input_buf->used > 0) { | if (input_buf != NULL && input_buf->used > 0) { | |||
size_t len = input_buf->used, helo_len = 0; | ||||
data = input_buf->data; | data = input_buf->data; | |||
data_len = input_buf->used; | ||||
if (len > 0) { | if (extract_input_data_field(&data, &data_len, &helo) && | |||
if (*data == '\0') { | extract_input_data_field(&data, &data_len, | |||
helo_len = 1; | &proxy_data.helo)) { | |||
} else { | /* nothing to do */ | |||
helo = t_strndup(data, len); | ||||
helo_len = strlen(helo) + 1; | ||||
} | ||||
} | } | |||
/* NOTE: actually, pipelining the AUTH command is stricly | /* NOTE: actually, pipelining the AUTH command is stricly | |||
speaking not allowed, but we support it anyway. | speaking not allowed, but we support it anyway. | |||
*/ | */ | |||
if (len > helo_len) { | ||||
data = data + helo_len; | ||||
data_len = len - helo_len; | ||||
} | ||||
} | } | |||
(void)client_create(fd_in, fd_out, mail_user, | (void)client_create(fd_in, fd_out, mail_user, | |||
user, set, helo, data, data_len); | user, set, helo, &proxy_data, data, data_len); | |||
return 0; | return 0; | |||
} | } | |||
static void main_stdio_run(const char *username) | static void main_stdio_run(const char *username) | |||
{ | { | |||
struct mail_storage_service_input input; | struct mail_storage_service_input input; | |||
buffer_t *input_buf; | buffer_t *input_buf; | |||
const char *value, *error, *input_base64; | const char *value, *error, *input_base64; | |||
i_zero(&input); | i_zero(&input); | |||
End of changes. 8 change blocks. | ||||
14 lines changed or deleted | 34 lines changed or added |