- else {
- /* The first character of the first line is the
- * overall response. If there's another character
- * on that line it is not correct. */
- if(line == 1) {
- if(i == 0) {
- /* Now get the value and set the
- * return value accordingly */
- if(recvbuf[i] == 'A') {
- DEBUG(D_acl)
- debug_printf("DCC: Overall result = A\treturning OK\n");
- Ustrcpy(dcc_return_text, "Mail accepted by DCC");
- dcc_result = US"A";
- retval = OK;
- }
- else if(recvbuf[i] == 'R') {
- DEBUG(D_acl)
- debug_printf("DCC: Overall result = R\treturning FAIL\n");
- dcc_result = US"R";
- retval = FAIL;
- if(sender_host_name) {
- log_write(0, LOG_MAIN, "H=%s [%s] F=<%s>: rejected by DCC", sender_host_name, sender_host_address, sender_address);
- }
- else {
- log_write(0, LOG_MAIN, "H=[%s] F=<%s>: rejected by DCC", sender_host_address, sender_address);
- }
- Ustrncpy(dcc_return_text, dcc_reject_message, Ustrlen(dcc_reject_message) + 1);
- }
- else if(recvbuf[i] == 'S') {
- DEBUG(D_acl)
- debug_printf("DCC: Overall result = S\treturning OK\n");
- Ustrcpy(dcc_return_text, "Not all recipients accepted by DCC");
- /* Since we're in an ACL we want a global result
- * so we accept for all */
- dcc_result = US"A";
- retval = OK;
- }
- else if(recvbuf[i] == 'G') {
- DEBUG(D_acl)
- debug_printf("DCC: Overall result = G\treturning FAIL\n");
- Ustrcpy(dcc_return_text, "Greylisted by DCC");
- dcc_result = US"G";
- retval = FAIL;
- }
- else if(recvbuf[i] == 'T') {
- DEBUG(D_acl)
- debug_printf("DCC: Overall result = T\treturning DEFER\n");
- retval = DEFER;
- log_write(0,LOG_MAIN,"Temporary error with DCC: %s\n", recvbuf);
- Ustrcpy(dcc_return_text, "Temporary error with DCC");
- dcc_result = US"T";
- }
- else {
- DEBUG(D_acl)
- debug_printf("DCC: Overall result = something else\treturning DEFER\n");
- retval = DEFER;
- log_write(0,LOG_MAIN,"Unknown DCC response: %s\n", recvbuf);
- Ustrcpy(dcc_return_text, "Unknown DCC response");
- dcc_result = US"T";
- }
- }
- else {
- /* We're on the first line but not on the first character,
- * there must be something wrong. */
- DEBUG(D_acl) debug_printf("DCC: Line = %d but i = %d != 0"
- " character is %c - This is wrong!\n", line, i, recvbuf[i]);
- log_write(0,LOG_MAIN,"Wrong header from DCC, output is %s\n", recvbuf);
- }
- }
- else if(line == 2) {
- /* On the second line we get a list of
- * answers for each recipient. We don't care about
- * it because we're in an acl and take the
- * global result. */
- }
- else if(line > 2) {
- /* 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)) {
- dcc_header_str[k] = recvbuf[i];
- k++;
- }
- else {
- DEBUG(D_acl) debug_printf("DCC: We got more output than we can store"
- " in the X-DCC header. Truncating at 120 characters.\n");
- }
- }
- else {
- /* Wrong line number. There must be a problem with the output. */
- DEBUG(D_acl)
- debug_printf("DCC: Wrong line number in output. Line number is %d\n", line);
- }
+ }
+ if(line > 2)
+ {
+ /* The third and following lines are the X-DCC header, so we store it in
+ dcc_header_str up to our limit. */
+ /* check if buffer contains the end of the header .."\n\n" and truncate it */
+ if ((big_buffer[dcc_resplen-1] == '\n') &&
+ (big_buffer[dcc_resplen-2] == '\n'))
+ dcc_resplen -= 2;
+ dcc_resplen -= bufoffset;
+ if (dcc_header_str->ptr + dcc_resplen > DCC_HEADER_LIMIT)
+ {
+ dcc_resplen = DCC_HEADER_LIMIT - dcc_header_str->ptr;
+ DEBUG(D_acl) debug_printf("DCC: We got more output than we can store"
+ "in the X-DCC header. Truncating at 120 characters.\n");