Deleted Added
full compact
util.c (168515) util.c (173340)
1/*
1/*
2 * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 */
13
14#include <sendmail.h>
15
3 * All rights reserved.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 */
13
14#include <sendmail.h>
15
16SM_RCSID("@(#)$Id: util.c,v 8.410 2006/12/18 18:36:44 ca Exp $")
16SM_RCSID("@(#)$Id: util.c,v 8.413 2007/09/26 23:29:11 ca Exp $")
17
18#include <sm/sendmail.h>
19#include <sysexits.h>
20#include <sm/xtrap.h>
21
22/*
23** NEWSTR -- Create a copy of a C string
24**

--- 1124 unchanged lines hidden (view full) ---

1149 slop = 1;
1150 }
1151
1152 if (dead)
1153 break;
1154
1155 /* output last part */
1156 if (l[0] == '.' && slop == 0 &&
17
18#include <sm/sendmail.h>
19#include <sysexits.h>
20#include <sm/xtrap.h>
21
22/*
23** NEWSTR -- Create a copy of a C string
24**

--- 1124 unchanged lines hidden (view full) ---

1149 slop = 1;
1150 }
1151
1152 if (dead)
1153 break;
1154
1155 /* output last part */
1156 if (l[0] == '.' && slop == 0 &&
1157 bitnset(M_XDOT, mci->mci_mailer->m_flags))
1157 bitnset(M_XDOT, mci->mci_mailer->m_flags) &&
1158 !bitset(MCIF_INLONGLINE, mci->mci_flags))
1158 {
1159 if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '.') ==
1160 SM_IO_EOF)
1161 {
1162 dead = true;
1163 break;
1164 }
1165 if (TrafficLogFile != NULL)
1166 (void) sm_io_putc(TrafficLogFile,
1167 SM_TIME_DEFAULT, '.');
1168 }
1169 else if (l[0] == 'F' && slop == 0 &&
1170 bitset(PXLF_MAPFROM, pxflags) &&
1171 strncmp(l, "From ", 5) == 0 &&
1159 {
1160 if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '.') ==
1161 SM_IO_EOF)
1162 {
1163 dead = true;
1164 break;
1165 }
1166 if (TrafficLogFile != NULL)
1167 (void) sm_io_putc(TrafficLogFile,
1168 SM_TIME_DEFAULT, '.');
1169 }
1170 else if (l[0] == 'F' && slop == 0 &&
1171 bitset(PXLF_MAPFROM, pxflags) &&
1172 strncmp(l, "From ", 5) == 0 &&
1172 bitnset(M_ESCFROM, mci->mci_mailer->m_flags))
1173 bitnset(M_ESCFROM, mci->mci_mailer->m_flags) &&
1174 !bitset(MCIF_INLONGLINE, mci->mci_flags))
1173 {
1174 if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '>') ==
1175 SM_IO_EOF)
1176 {
1177 dead = true;
1178 break;
1179 }
1180 if (TrafficLogFile != NULL)
1181 (void) sm_io_putc(TrafficLogFile,
1182 SM_TIME_DEFAULT, '>');
1183 }
1184 PUTX(p);
1185 if (dead)
1186 break;
1187
1188 if (TrafficLogFile != NULL)
1189 (void) sm_io_putc(TrafficLogFile, SM_TIME_DEFAULT,
1190 '\n');
1175 {
1176 if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '>') ==
1177 SM_IO_EOF)
1178 {
1179 dead = true;
1180 break;
1181 }
1182 if (TrafficLogFile != NULL)
1183 (void) sm_io_putc(TrafficLogFile,
1184 SM_TIME_DEFAULT, '>');
1185 }
1186 PUTX(p);
1187 if (dead)
1188 break;
1189
1190 if (TrafficLogFile != NULL)
1191 (void) sm_io_putc(TrafficLogFile, SM_TIME_DEFAULT,
1192 '\n');
1191 if ((!bitset(PXLF_NOADDEOL, pxflags) || !noeol) &&
1192 sm_io_fputs(mci->mci_out, SM_TIME_DEFAULT,
1193 mci->mci_mailer->m_eol) == SM_IO_EOF)
1193 if ((!bitset(PXLF_NOADDEOL, pxflags) || !noeol))
1194 {
1194 {
1195 dead = true;
1196 break;
1195 mci->mci_flags &= ~MCIF_INLONGLINE;
1196 if (sm_io_fputs(mci->mci_out, SM_TIME_DEFAULT,
1197 mci->mci_mailer->m_eol) == SM_IO_EOF)
1198 {
1199 dead = true;
1200 break;
1201 }
1197 }
1202 }
1203 else
1204 mci->mci_flags |= MCIF_INLONGLINE;
1205
1198 if (l < end && *l == '\n')
1199 {
1200 if (*++l != ' ' && *l != '\t' && *l != '\0' &&
1201 bitset(PXLF_HEADER, pxflags))
1202 {
1203 if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT,
1204 ' ') == SM_IO_EOF)
1205 {

--- 1602 unchanged lines hidden (view full) ---

2808int
2809count_open_connections(hostaddr)
2810 SOCKADDR *hostaddr;
2811{
2812 int i, n;
2813
2814 if (hostaddr == NULL)
2815 return 0;
1206 if (l < end && *l == '\n')
1207 {
1208 if (*++l != ' ' && *l != '\t' && *l != '\0' &&
1209 bitset(PXLF_HEADER, pxflags))
1210 {
1211 if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT,
1212 ' ') == SM_IO_EOF)
1213 {

--- 1602 unchanged lines hidden (view full) ---

2816int
2817count_open_connections(hostaddr)
2818 SOCKADDR *hostaddr;
2819{
2820 int i, n;
2821
2822 if (hostaddr == NULL)
2823 return 0;
2816 n = 0;
2824
2825 /*
2826 ** Initialize to 1 instead of 0 because this code gets called
2827 ** before proc_list_add() gets called, so we (the daemon child
2828 ** for this connection) don't count ourselves.
2829 */
2830
2831 n = 1;
2817 for (i = 0; i < ProcListSize; i++)
2818 {
2819 if (ProcListVec[i].proc_pid == NO_PID)
2820 continue;
2821 if (hostaddr->sa.sa_family !=
2822 ProcListVec[i].proc_hostaddr.sa.sa_family)
2823 continue;
2824#if NETINET

--- 14 unchanged lines hidden ---
2832 for (i = 0; i < ProcListSize; i++)
2833 {
2834 if (ProcListVec[i].proc_pid == NO_PID)
2835 continue;
2836 if (hostaddr->sa.sa_family !=
2837 ProcListVec[i].proc_hostaddr.sa.sa_family)
2838 continue;
2839#if NETINET

--- 14 unchanged lines hidden ---