Deleted Added
full compact
srvrsmtp.c (141858) srvrsmtp.c (147078)
1/*
1/*
2 * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 1998-2005 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#if MILTER
16# include <libmilter/mfapi.h>
17# include <libmilter/mfdef.h>
18#endif /* MILTER */
19
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#if MILTER
16# include <libmilter/mfapi.h>
17# include <libmilter/mfdef.h>
18#endif /* MILTER */
19
20SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.902 2004/11/18 21:46:01 ca Exp $")
20SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.906 2005/03/16 00:36:09 ca Exp $")
21
22#include <sys/time.h>
23#include <sm/fdset.h>
24
25#if SASL || STARTTLS
26# include "sfsasl.h"
27#endif /* SASL || STARTTLS */
28#if SASL

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

75
76#if SASL
77# if SASL >= 20000
78static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
79 char *_remoteip, char *_localip,
80 char *_auth_id, sasl_ssf_t *_ext_ssf));
81
82# define RESET_SASLCONN \
21
22#include <sys/time.h>
23#include <sm/fdset.h>
24
25#if SASL || STARTTLS
26# include "sfsasl.h"
27#endif /* SASL || STARTTLS */
28#if SASL

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

75
76#if SASL
77# if SASL >= 20000
78static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
79 char *_remoteip, char *_localip,
80 char *_auth_id, sasl_ssf_t *_ext_ssf));
81
82# define RESET_SASLCONN \
83 result = reset_saslconn(&conn, AuthRealm, remoteip, localip, auth_id, \
84 &ext_ssf); \
85 if (result != SASL_OK) \
86 { \
87 /* This is pretty fatal */ \
88 goto doquit; \
89 }
83 do \
84 { \
85 result = reset_saslconn(&conn, AuthRealm, remoteip, \
86 localip, auth_id, &ext_ssf); \
87 if (result != SASL_OK) \
88 sasl_ok = false; \
89 } while (0)
90
91# else /* SASL >= 20000 */
92static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
93 struct sockaddr_in *_saddr_r,
94 struct sockaddr_in *_saddr_l,
95 sasl_external_properties_t *_ext_ssf));
96# define RESET_SASLCONN \
90
91# else /* SASL >= 20000 */
92static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
93 struct sockaddr_in *_saddr_r,
94 struct sockaddr_in *_saddr_l,
95 sasl_external_properties_t *_ext_ssf));
96# define RESET_SASLCONN \
97 result = reset_saslconn(&conn, AuthRealm, &saddr_r, &saddr_l, &ext_ssf); \
98 if (result != SASL_OK) \
99 { \
100 /* This is pretty fatal */ \
101 goto doquit; \
102 }
97 do \
98 { \
99 result = reset_saslconn(&conn, AuthRealm, &saddr_r, \
100 &saddr_l, &ext_ssf); \
101 if (result != SASL_OK) \
102 sasl_ok = false; \
103 } while (0)
103
104# endif /* SASL >= 20000 */
105#endif /* SASL */
106
107extern ENVELOPE BlankEnvelope;
108
109#define NBADRCPTS \
110 do \

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

659 ** set local/remote IP
660 ** XXX Cyrus SASL v1 only supports IPv4
661 **
662 ** XXX where exactly are these used/required?
663 ** Kerberos_v4
664 */
665
666# if SASL >= 20000
104
105# endif /* SASL >= 20000 */
106#endif /* SASL */
107
108extern ENVELOPE BlankEnvelope;
109
110#define NBADRCPTS \
111 do \

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

660 ** set local/remote IP
661 ** XXX Cyrus SASL v1 only supports IPv4
662 **
663 ** XXX where exactly are these used/required?
664 ** Kerberos_v4
665 */
666
667# if SASL >= 20000
668 localip[0] = remoteip[0] = '\0';
667# if NETINET || NETINET6
668 in = macvalue(macid("{daemon_family}"), e);
669 if (in != NULL && (
670# if NETINET6
671 strcmp(in, "inet6") == 0 ||
672# endif /* NETINET6 */
673 strcmp(in, "inet") == 0))
674 {

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

742 macid("{auth_author}"), NULL);
743# endif /* 0 */
744
745 /* set properties */
746 (void) memset(&ssp, '\0', sizeof ssp);
747
748 /* XXX should these be options settable via .cf ? */
749 /* ssp.min_ssf = 0; is default due to memset() */
669# if NETINET || NETINET6
670 in = macvalue(macid("{daemon_family}"), e);
671 if (in != NULL && (
672# if NETINET6
673 strcmp(in, "inet6") == 0 ||
674# endif /* NETINET6 */
675 strcmp(in, "inet") == 0))
676 {

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

744 macid("{auth_author}"), NULL);
745# endif /* 0 */
746
747 /* set properties */
748 (void) memset(&ssp, '\0', sizeof ssp);
749
750 /* XXX should these be options settable via .cf ? */
751 /* ssp.min_ssf = 0; is default due to memset() */
750# if STARTTLS
751# endif /* STARTTLS */
752 {
753 ssp.max_ssf = MaxSLBits;
754 ssp.maxbufsize = MAXOUTLEN;
755 }
756 ssp.security_flags = SASLOpts & SASL_SEC_MASK;
757 sasl_ok = sasl_setprop(conn, SASL_SEC_PROPS, &ssp) == SASL_OK;
758
759 if (sasl_ok)

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

4613** hostname -- host name
4614** various connection data
4615**
4616** Returns:
4617** SASL result
4618*/
4619
4620static int
752 {
753 ssp.max_ssf = MaxSLBits;
754 ssp.maxbufsize = MAXOUTLEN;
755 }
756 ssp.security_flags = SASLOpts & SASL_SEC_MASK;
757 sasl_ok = sasl_setprop(conn, SASL_SEC_PROPS, &ssp) == SASL_OK;
758
759 if (sasl_ok)

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

4613** hostname -- host name
4614** various connection data
4615**
4616** Returns:
4617** SASL result
4618*/
4619
4620static int
4621reset_saslconn(sasl_conn_t ** conn, char *hostname,
4621reset_saslconn(sasl_conn_t **conn, char *hostname,
4622# if SASL >= 20000
4623 char *remoteip, char *localip,
4624 char *auth_id, sasl_ssf_t * ext_ssf)
4625# else /* SASL >= 20000 */
4622# if SASL >= 20000
4623 char *remoteip, char *localip,
4624 char *auth_id, sasl_ssf_t * ext_ssf)
4625# else /* SASL >= 20000 */
4626 struct sockaddr_in * saddr_r, struct sockaddr_in * saddr_l,
4626 struct sockaddr_in *saddr_r, struct sockaddr_in *saddr_l,
4627 sasl_external_properties_t * ext_ssf)
4628# endif /* SASL >= 20000 */
4629{
4630 int result;
4631
4632 sasl_dispose(conn);
4633# if SASL >= 20000
4634 result = sasl_server_new("smtp", hostname, NULL, NULL, NULL,

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

4641 result = sasl_server_new("smtp", hostname, NULL, NULL, 0,
4642 conn);
4643# endif /* SASL >= 20000 */
4644 if (result != SASL_OK)
4645 return result;
4646
4647# if SASL >= 20000
4648# if NETINET || NETINET6
4627 sasl_external_properties_t * ext_ssf)
4628# endif /* SASL >= 20000 */
4629{
4630 int result;
4631
4632 sasl_dispose(conn);
4633# if SASL >= 20000
4634 result = sasl_server_new("smtp", hostname, NULL, NULL, NULL,

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

4641 result = sasl_server_new("smtp", hostname, NULL, NULL, 0,
4642 conn);
4643# endif /* SASL >= 20000 */
4644 if (result != SASL_OK)
4645 return result;
4646
4647# if SASL >= 20000
4648# if NETINET || NETINET6
4649 if (remoteip != NULL)
4649 if (remoteip != NULL && *remoteip != '\0')
4650 result = sasl_setprop(*conn, SASL_IPREMOTEPORT, remoteip);
4651 if (result != SASL_OK)
4652 return result;
4653
4650 result = sasl_setprop(*conn, SASL_IPREMOTEPORT, remoteip);
4651 if (result != SASL_OK)
4652 return result;
4653
4654 if (localip != NULL)
4654 if (localip != NULL && *localip != '\0')
4655 result = sasl_setprop(*conn, SASL_IPLOCALPORT, localip);
4656 if (result != SASL_OK)
4657 return result;
4658# endif /* NETINET || NETINET6 */
4659
4660 result = sasl_setprop(*conn, SASL_SSF_EXTERNAL, ext_ssf);
4661 if (result != SASL_OK)
4662 return result;

--- 24 unchanged lines hidden ---
4655 result = sasl_setprop(*conn, SASL_IPLOCALPORT, localip);
4656 if (result != SASL_OK)
4657 return result;
4658# endif /* NETINET || NETINET6 */
4659
4660 result = sasl_setprop(*conn, SASL_SSF_EXTERNAL, ext_ssf);
4661 if (result != SASL_OK)
4662 return result;

--- 24 unchanged lines hidden ---