Deleted Added
full compact
mci.c (111826) mci.c (120259)
1/*
2 * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 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 *
1/*
2 * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 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 * $FreeBSD: head/contrib/sendmail/src/mci.c 120259 2003-09-19 23:14:57Z gshapiro $
12 */
13
14#include <sendmail.h>
15
13 */
14
15#include <sendmail.h>
16
16SM_RCSID("@(#)$Id: mci.c,v 8.205.2.3 2003/01/07 03:56:19 ca Exp $")
17SM_RCSID("@(#)$Id: mci.c,v 8.205.2.4 2003/03/31 17:35:27 ca Exp $")
17
18#if NETINET || NETINET6
19# include <arpa/inet.h>
20#endif /* NETINET || NETINET6 */
21
22#include <dirent.h>
23
24static int mci_generate_persistent_path __P((const char *, char *,

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

543 p += strlen(p);
544 if (mci == NULL)
545 {
546 (void) sm_snprintf(p, SPACELEFT(buf, p), "NULL");
547 goto printit;
548 }
549 (void) sm_snprintf(p, SPACELEFT(buf, p), "flags=%lx", mci->mci_flags);
550 p += strlen(p);
18
19#if NETINET || NETINET6
20# include <arpa/inet.h>
21#endif /* NETINET || NETINET6 */
22
23#include <dirent.h>
24
25static int mci_generate_persistent_path __P((const char *, char *,

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

544 p += strlen(p);
545 if (mci == NULL)
546 {
547 (void) sm_snprintf(p, SPACELEFT(buf, p), "NULL");
548 goto printit;
549 }
550 (void) sm_snprintf(p, SPACELEFT(buf, p), "flags=%lx", mci->mci_flags);
551 p += strlen(p);
552
553 /*
554 ** The following check is just for paranoia. It protects the
555 ** assignment in the if() clause. If there's not some minimum
556 ** amount of space we can stop right now. The check will not
557 ** trigger as long as sizeof(buf)=4000.
558 */
559
560 if (p >= buf + sizeof(buf) - 4)
561 goto printit;
551 if (mci->mci_flags != 0)
552 {
553 struct mcifbits *f;
554
562 if (mci->mci_flags != 0)
563 {
564 struct mcifbits *f;
565
555 *p++ = '<';
566 *p++ = '<'; /* protected above */
556 for (f = MciFlags; f->mcif_bit != 0; f++)
557 {
558 if (!bitset(f->mcif_bit, mci->mci_flags))
559 continue;
560 (void) sm_strlcpyn(p, SPACELEFT(buf, p), 2,
561 f->mcif_name, ",");
562 p += strlen(p);
563 }

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

1147 ** persistent information.
1148 */
1149
1150 do
1151 {
1152 if (hostptr != host)
1153 *(hostptr++) = '.';
1154 start = end;
567 for (f = MciFlags; f->mcif_bit != 0; f++)
568 {
569 if (!bitset(f->mcif_bit, mci->mci_flags))
570 continue;
571 (void) sm_strlcpyn(p, SPACELEFT(buf, p), 2,
572 f->mcif_name, ",");
573 p += strlen(p);
574 }

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

1158 ** persistent information.
1159 */
1160
1161 do
1162 {
1163 if (hostptr != host)
1164 *(hostptr++) = '.';
1165 start = end;
1155 while (*(start - 1) != '/')
1166 while (start > pathname && *(start - 1) != '/')
1156 start--;
1157
1158 if (*end == '.')
1159 end--;
1160
1161 for (scan = start; scan <= end; scan++)
1162 *(hostptr++) = *scan;
1163
1164 end = start - 2;
1167 start--;
1168
1169 if (*end == '.')
1170 end--;
1171
1172 for (scan = start; scan <= end; scan++)
1173 *(hostptr++) = *scan;
1174
1175 end = start - 2;
1165 } while (*end == '.');
1176 } while (end > pathname && *end == '.');
1166
1167 *hostptr = '\0';
1168
1169 /*
1170 ** Do something with the file containing the persistent
1171 ** information.
1172 */
1173

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

1347 }
1348 }
1349
1350 return 0;
1351}
1352/*
1353** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname
1354**
1177
1178 *hostptr = '\0';
1179
1180 /*
1181 ** Do something with the file containing the persistent
1182 ** information.
1183 */
1184

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

1358 }
1359 }
1360
1361 return 0;
1362}
1363/*
1364** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname
1365**
1355** Given `host', convert from a.b.c to $QueueDir/.hoststat/c./b./a,
1366** Given `host', convert from a.b.c to $HostStatDir/c./b./a,
1356** putting the result into `path'. if `createflag' is set, intervening
1357** directories will be created as needed.
1358**
1359** Parameters:
1360** host -- host name to convert from.
1361** path -- place to store result.
1362** pathlen -- length of path buffer.
1363** createflag -- if set, create intervening directories as

--- 124 unchanged lines hidden ---
1367** putting the result into `path'. if `createflag' is set, intervening
1368** directories will be created as needed.
1369**
1370** Parameters:
1371** host -- host name to convert from.
1372** path -- place to store result.
1373** pathlen -- length of path buffer.
1374** createflag -- if set, create intervening directories as

--- 124 unchanged lines hidden ---