X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/a466d09b249d5018ecb0f1ec45adba545c02c75b..bfe645c1570343d3adca657ab67998e122ca8792:/src/src/dcc.c diff --git a/src/src/dcc.c b/src/src/dcc.c index 44c0c009a..b03690ca6 100644 --- a/src/src/dcc.c +++ b/src/src/dcc.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) Wolfgang Breyha 2005-2013 +/* Copyright (c) Wolfgang Breyha 2005 - 2015 * Vienna University Computer Center * wbreyha@gmx.net * See the file NOTICE for conditions of use and distribution. @@ -45,9 +45,11 @@ int flushbuffer (int socket, uschar *buffer) return retval; } -int dcc_process(uschar **listptr) { +int +dcc_process(uschar **listptr) +{ int sep = 0; - uschar *list = *listptr; + const uschar *list = *listptr; FILE *data_file; uschar *dcc_default_ip_option = US"127.0.0.1"; uschar *dcc_helo_option = US"localhost"; @@ -142,18 +144,18 @@ int dcc_process(uschar **listptr) { bzero(opts,sizeof(opts)); Ustrncpy(opts, dccifd_options, sizeof(opts)-1); /* if $acl_m_dcc_override_client_ip is set use it */ - if (((override_client_ip = expand_string(US"$acl_m_dcc_override_client_ip")) != NULL) && + if (((override_client_ip = expand_string(US"$acl_m_dcc_override_client_ip")) != NULL) && (override_client_ip[0] != '\0')) { Ustrncpy(client_ip, override_client_ip, sizeof(client_ip)-1); DEBUG(D_acl) debug_printf("DCC: Client IP (overridden): %s\n", client_ip); - } + } else if(sender_host_address) { /* else if $sender_host_address is available use that? */ Ustrncpy(client_ip, sender_host_address, sizeof(client_ip)-1); DEBUG(D_acl) debug_printf("DCC: Client IP (sender_host_address): %s\n", client_ip); - } + } else { /* sender_host_address is NULL which means it comes from localhost */ Ustrncpy(client_ip, dcc_default_ip_option, sizeof(client_ip)-1); @@ -449,7 +451,7 @@ int dcc_process(uschar **listptr) { /* The third and following lines are the X-DCC header, * so we store it in dcc_header_str. */ /* check if we don't get more than we can handle */ - if(k < sizeof(dcc_header_str)) { + if(k < sizeof(dcc_header_str)) { dcc_header_str[k] = recvbuf[i]; k++; }