mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-10-31 05:22:26 +01:00 
			
		
		
		
	added chunking advertising to ehlo response
Change-Id: I89b4c3e8bc1228d42ff97d4f47f2178e3b603723 Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
		| @@ -68,6 +68,7 @@ struct _parse_rule config_parse_rules[] = | ||||
|    { "clamd_socket", "string", (void*) string_parser, offsetof(struct __config, clamd_socket), CLAMD_SOCKET, MAXVAL-1}, | ||||
|    { "debug", "integer", (void*) int_parser, offsetof(struct __config, debug), "0", sizeof(int)}, | ||||
|    { "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)}, | ||||
|    { "enable_chunking", "integer", (void*) int_parser, offsetof(struct __config, enable_chunking), "0", sizeof(int)}, | ||||
|    { "enable_cjk", "integer", (void*) int_parser, offsetof(struct __config, enable_cjk), "0", sizeof(int)}, | ||||
|    { "enable_folders", "integer", (void*) int_parser, offsetof(struct __config, enable_folders), "0", sizeof(int)}, | ||||
|    { "encrypt_messages", "integer", (void*) int_parser, offsetof(struct __config, encrypt_messages), "1", sizeof(int)}, | ||||
|   | ||||
| @@ -25,6 +25,7 @@ struct __config { | ||||
|  | ||||
|    int encrypt_messages; | ||||
|  | ||||
|    int enable_chunking; | ||||
|    int tls_enable; | ||||
|    char pemfile[MAXVAL]; | ||||
|    char cipher_list[MAXVAL]; | ||||
|   | ||||
| @@ -320,7 +320,7 @@ void initialise_configuration(){ | ||||
|    initrules(data.folder_rules); | ||||
|  | ||||
|    if(cfg.tls_enable > 0 && data.ctx == NULL && init_ssl() == OK){ | ||||
|       snprintf(data.starttls, sizeof(data.starttls)-1, "250-STARTTLS\r\n"); | ||||
|       snprintf(data.starttls, sizeof(data.starttls)-1, SMTP_EXTENSION_STARTTLS); | ||||
|    } | ||||
|  | ||||
|    if(open_database(&sdata, &cfg) == ERR){ | ||||
|   | ||||
| @@ -22,11 +22,16 @@ | ||||
|  | ||||
| void process_command_ehlo_lhlo(struct session_data *sdata, struct __data *data, int *protocol_state, char *resp, int resplen, struct __config *cfg){ | ||||
|    char tmpbuf[MAXBUFSIZE]; | ||||
|    char extensions[SMALLBUFSIZE]; | ||||
|  | ||||
|    memset(extensions, 0, sizeof(extensions)); | ||||
|  | ||||
|    if(*protocol_state == SMTP_STATE_INIT) *protocol_state = SMTP_STATE_HELO; | ||||
|  | ||||
|    if(sdata->tls == 0) snprintf(tmpbuf, sizeof(tmpbuf)-1, SMTP_RESP_250_EXTENSIONS, cfg->hostid, data->starttls); | ||||
|    else snprintf(tmpbuf, sizeof(tmpbuf)-1, SMTP_RESP_250_EXTENSIONS, cfg->hostid, ""); | ||||
|    if(sdata->tls == 0) snprintf(extensions, sizeof(extensions)-1, "%s", data->starttls); | ||||
|    if(cfg->enable_chunking == 1) strncat(extensions, SMTP_EXTENSION_CHUNKING, sizeof(extensions)-strlen(extensions)-2); | ||||
|  | ||||
|    snprintf(tmpbuf, sizeof(tmpbuf)-1, SMTP_RESP_250_EXTENSIONS, cfg->hostid, extensions); | ||||
|  | ||||
|    strncat(resp, tmpbuf, resplen-strlen(resp)); | ||||
| } | ||||
|   | ||||
| @@ -36,6 +36,9 @@ | ||||
| #define SMTP_RESP_250_OK "250 Ok\r\n" | ||||
| #define SMTP_RESP_250_EXTENSIONS "250-%s\r\n250-PIPELINING\r\n%s250-SIZE\r\n250 8BITMIME\r\n" | ||||
|  | ||||
| #define SMTP_EXTENSION_STARTTLS "250-STARTTLS\r\n" | ||||
| #define SMTP_EXTENSION_CHUNKING "250-CHUNKING\r\n" | ||||
|  | ||||
| #define SMTP_RESP_354_DATA_OK "354 Send mail data; end it with <CRLF>.<CRLF>\r\n" | ||||
|  | ||||
| #define SMTP_RESP_421_ERR "421 %s Error: timed out\r\n" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user