mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-10-31 15:22:26 +01:00 
			
		
		
		
	process rcpt to addresses if they end .${hostid}
This commit is contained in:
		| @@ -195,6 +195,8 @@ void trimBuffer(char *s){ | |||||||
| int extractEmail(char *rawmail, char *email){ | int extractEmail(char *rawmail, char *email){ | ||||||
|    char *p; |    char *p; | ||||||
|  |  | ||||||
|  |    memset(email, 0, SMALLBUFSIZE); | ||||||
|  |  | ||||||
|    p = strchr(rawmail, '<'); |    p = strchr(rawmail, '<'); | ||||||
|    if(p){ |    if(p){ | ||||||
|       snprintf(email, SMALLBUFSIZE-1, "%s", p+1); |       snprintf(email, SMALLBUFSIZE-1, "%s", p+1); | ||||||
|   | |||||||
							
								
								
									
										39
									
								
								src/parser.c
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								src/parser.c
									
									
									
									
									
								
							| @@ -18,7 +18,8 @@ | |||||||
|  |  | ||||||
| struct _state parse_message(struct session_data *sdata, int take_into_pieces, struct __config *cfg){ | struct _state parse_message(struct session_data *sdata, int take_into_pieces, struct __config *cfg){ | ||||||
|    FILE *f; |    FILE *f; | ||||||
|    char buf[MAXBUFSIZE]; |    int i, len; | ||||||
|  |    char *p, buf[MAXBUFSIZE], puf[SMALLBUFSIZE]; | ||||||
|    struct _state state; |    struct _state state; | ||||||
|  |  | ||||||
|    init_state(&state); |    init_state(&state); | ||||||
| @@ -30,6 +31,42 @@ struct _state parse_message(struct session_data *sdata, int take_into_pieces, st | |||||||
|    } |    } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |    if(sdata->num_of_rcpt_to > 0){ | ||||||
|  |       for(i=0; i<sdata->num_of_rcpt_to; i++){ | ||||||
|  |          extractEmail(sdata->rcptto[i], puf); | ||||||
|  |  | ||||||
|  |          if(strlen(puf) > 5){ | ||||||
|  |             p = strstr(puf, cfg->hostid); | ||||||
|  |             if(p && *(p-1) == '.'){ | ||||||
|  |  | ||||||
|  |                *(p-1) = ' '; | ||||||
|  |                *p = '\0'; | ||||||
|  |  | ||||||
|  |                len = strlen(puf); | ||||||
|  |  | ||||||
|  |                if(does_it_seem_like_an_email_address(puf) == 1){ | ||||||
|  |  | ||||||
|  |                   if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: processing rcpt to address: *%s*", sdata->ttmpfile, puf); | ||||||
|  |  | ||||||
|  |                   if(strlen(state.b_to) < MAXBUFSIZE-len-1){ | ||||||
|  |                      if(is_string_on_list(state.rcpt, puf) == 0){ | ||||||
|  |                         append_list(&(state.rcpt), puf); | ||||||
|  |                         memcpy(&(state.b_to[strlen(state.b_to)]), puf, len); | ||||||
|  |  | ||||||
|  |                         if(strlen(state.b_to) < MAXBUFSIZE-len-1){ | ||||||
|  |                            split_email_address(puf); | ||||||
|  |                            memcpy(&(state.b_to[strlen(state.b_to)]), puf, len); | ||||||
|  |                         } | ||||||
|  |                      } | ||||||
|  |                   } | ||||||
|  |  | ||||||
|  |                } | ||||||
|  |             } | ||||||
|  |          } | ||||||
|  |  | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  |  | ||||||
|    if(take_into_pieces == 1){ |    if(take_into_pieces == 1){ | ||||||
|       state.mfd = open(sdata->tmpframe, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR); |       state.mfd = open(sdata->tmpframe, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR); | ||||||
|       if(state.mfd == -1){ |       if(state.mfd == -1){ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user