Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 673986 | Differences between
and this patch

Collapse All | Expand All

(-)a/sendmail/deliver.c (-5 / +3 lines)
Lines 6274-6281 Link Here
6274
				tlslogerr(LOG_WARNING, "client");
6274
				tlslogerr(LOG_WARNING, "client");
6275
		}
6275
		}
6276
6276
6277
		SSL_free(clt_ssl);
6277
		SM_SSL_FREE(clt_ssl);
6278
		clt_ssl = NULL;
6279
		return EX_SOFTWARE;
6278
		return EX_SOFTWARE;
6280
	}
6279
	}
6281
	mci->mci_ssl = clt_ssl;
6280
	mci->mci_ssl = clt_ssl;
Lines 6287-6294 Link Here
6287
		return EX_OK;
6286
		return EX_OK;
6288
6287
6289
	/* failure */
6288
	/* failure */
6290
	SSL_free(clt_ssl);
6289
	SM_SSL_FREE(clt_ssl);
6291
	clt_ssl = NULL;
6292
	return EX_SOFTWARE;
6290
	return EX_SOFTWARE;
6293
}
6291
}
6294
/*
6292
/*
Lines 6309-6315 Link Here
6309
6307
6310
	if (!bitset(MCIF_TLSACT, mci->mci_flags))
6308
	if (!bitset(MCIF_TLSACT, mci->mci_flags))
6311
		return EX_OK;
6309
		return EX_OK;
6312
	r = endtls(mci->mci_ssl, "client");
6310
	r = endtls(&mci->mci_ssl, "client");
6313
	mci->mci_flags &= ~MCIF_TLSACT;
6311
	mci->mci_flags &= ~MCIF_TLSACT;
6314
	return r;
6312
	return r;
6315
}
6313
}
(-)a/sendmail/macro.c (+27 lines)
Lines 362-367 Link Here
362
}
362
}
363
363
364
/*
364
/*
365
**  MACTABCLEAR -- clear entire macro table
366
**
367
**	Parameters:
368
**		mac -- Macro table.
369
**
370
**	Returns:
371
**		none.
372
**
373
**	Side Effects:
374
**		clears entire mac structure including rpool pointer!
375
*/
376
377
void
378
mactabclear(mac)
379
	MACROS_T *mac;
380
{
381
	int i;
382
383
	if (mac->mac_rpool == NULL)
384
	{
385
		for (i = 0; i < MAXMACROID; i++)
386
	    		SM_FREE_CLR(mac->mac_table[i]);
387
	}
388
	memset((char *) mac, '\0', sizeof(*mac));
389
}
390
391
/*
365
**  MACDEFINE -- bind a macro name to a value
392
**  MACDEFINE -- bind a macro name to a value
366
**
393
**
367
**	Set a macro to a value, with fancy storage management.
394
**	Set a macro to a value, with fancy storage management.
(-)a/sendmail/mci.c (+38 lines)
Lines 25-30 Link Here
25
						  int, bool));
25
						  int, bool));
26
static bool	mci_load_persistent __P((MCI *));
26
static bool	mci_load_persistent __P((MCI *));
27
static void	mci_uncache __P((MCI **, bool));
27
static void	mci_uncache __P((MCI **, bool));
28
static void	mci_clear __P((MCI *));
28
static int	mci_lock_host_statfile __P((MCI *));
29
static int	mci_lock_host_statfile __P((MCI *));
29
static int	mci_read_persistent __P((SM_FILE_T *, MCI *));
30
static int	mci_read_persistent __P((SM_FILE_T *, MCI *));
30
31
Lines 253-258 Link Here
253
	SM_FREE_CLR(mci->mci_status);
254
	SM_FREE_CLR(mci->mci_status);
254
	SM_FREE_CLR(mci->mci_rstatus);
255
	SM_FREE_CLR(mci->mci_rstatus);
255
	SM_FREE_CLR(mci->mci_heloname);
256
	SM_FREE_CLR(mci->mci_heloname);
257
 	mci_clear(mci);
256
	if (mci->mci_rpool != NULL)
258
	if (mci->mci_rpool != NULL)
257
	{
259
	{
258
		sm_rpool_free(mci->mci_rpool);
260
		sm_rpool_free(mci->mci_rpool);
Lines 315-320 Link Here
315
}
317
}
316
318
317
/*
319
/*
320
**  MCI_CLEAR -- clear mci
321
**
322
**	Parameters:
323
**		mci -- the connection to clear.
324
**
325
**	Returns:
326
**		none.
327
*/
328
329
static void
330
mci_clear(mci)
331
	MCI *mci;
332
{
333
	if (mci == NULL)
334
		return;
335
336
	mci->mci_maxsize = 0;
337
	mci->mci_min_by = 0;
338
	mci->mci_deliveries = 0;
339
#if SASL
340
	if (bitset(MCIF_AUTHACT, mci->mci_flags))
341
		sasl_dispose(&mci->mci_conn);
342
#endif
343
#if STARTTLS
344
	if (bitset(MCIF_TLSACT, mci->mci_flags) && mci->mci_ssl != NULL)
345
		SM_SSL_FREE(mci->mci_ssl);
346
#endif
347
348
	/* which flags to preserve? */
349
	mci->mci_flags &= MCIF_CACHED;
350
	mactabclear(&mci->mci_macro);
351
}
352
353
354
/*
318
**  MCI_GET -- get information about a particular host
355
**  MCI_GET -- get information about a particular host
319
**
356
**
320
**	Parameters:
357
**	Parameters:
Lines 419-424 Link Here
419
			mci->mci_errno = 0;
456
			mci->mci_errno = 0;
420
			mci->mci_exitstat = EX_OK;
457
			mci->mci_exitstat = EX_OK;
421
		}
458
		}
459
	 	mci_clear(mci);
422
	}
460
	}
423
461
424
	return mci;
462
	return mci;
(-)a/sendmail/sendmail.h (-1 / +10 lines)
Lines 1186-1191 Link Here
1186
#define macid(name)  macid_parse(name, NULL)
1186
#define macid(name)  macid_parse(name, NULL)
1187
extern char	*macname __P((int));
1187
extern char	*macname __P((int));
1188
extern char	*macvalue __P((int, ENVELOPE *));
1188
extern char	*macvalue __P((int, ENVELOPE *));
1189
extern void	mactabclear __P((MACROS_T *));
1189
extern int	rscheck __P((char *, char *, char *, ENVELOPE *, int, int, char *, char *, ADDRESS *, char **));
1190
extern int	rscheck __P((char *, char *, char *, ENVELOPE *, int, int, char *, char *, ADDRESS *, char **));
1190
extern int	rscap __P((char *, char *, char *, ENVELOPE *, char ***, char *, int));
1191
extern int	rscap __P((char *, char *, char *, ENVELOPE *, char ***, char *, int));
1191
extern void	setclass __P((int, char *));
1192
extern void	setclass __P((int, char *));
Lines 2002-2008 Link Here
2002
extern void	setclttls __P((bool));
2003
extern void	setclttls __P((bool));
2003
extern bool	initsrvtls __P((bool));
2004
extern bool	initsrvtls __P((bool));
2004
extern int	tls_get_info __P((SSL *, bool, char *, MACROS_T *, bool));
2005
extern int	tls_get_info __P((SSL *, bool, char *, MACROS_T *, bool));
2005
extern int	endtls __P((SSL *, char *));
2006
#define SM_SSL_FREE(ssl)			\
2007
	do {					\
2008
		if (ssl != NULL)		\
2009
		{				\
2010
			SSL_free(ssl);		\
2011
			ssl = NULL;		\
2012
		}				\
2013
	} while (0)
2014
extern int	endtls __P((SSL **, char *));
2006
extern void	tlslogerr __P((int, const char *));
2015
extern void	tlslogerr __P((int, const char *));
2007
2016
2008
2017
(-)a/sendmail/srvrsmtp.c (-7 / +4 lines)
Lines 2122-2129 Link Here
2122
			if (get_tls_se_options(e, srv_ssl, true) != 0)
2122
			if (get_tls_se_options(e, srv_ssl, true) != 0)
2123
			{
2123
			{
2124
				message("454 4.3.3 TLS not available: error setting options");
2124
				message("454 4.3.3 TLS not available: error setting options");
2125
				SSL_free(srv_ssl);
2125
				SM_SSL_FREE(srv_ssl);
2126
				srv_ssl = NULL;
2127
				goto tls_done;
2126
				goto tls_done;
2128
			}
2127
			}
2129
2128
Lines 2145-2152 Link Here
2145
			    SSL_set_wfd(srv_ssl, wfd) <= 0)
2144
			    SSL_set_wfd(srv_ssl, wfd) <= 0)
2146
			{
2145
			{
2147
				message("454 4.3.3 TLS not available: error set fd");
2146
				message("454 4.3.3 TLS not available: error set fd");
2148
				SSL_free(srv_ssl);
2147
				SM_SSL_FREE(srv_ssl);
2149
				srv_ssl = NULL;
2150
				goto tls_done;
2148
				goto tls_done;
2151
			}
2149
			}
2152
			if (!smtps)
2150
			if (!smtps)
Lines 2188-2195 Link Here
2188
						tlslogerr(LOG_WARNING, "server");
2186
						tlslogerr(LOG_WARNING, "server");
2189
				}
2187
				}
2190
				tls_ok_srv = false;
2188
				tls_ok_srv = false;
2191
				SSL_free(srv_ssl);
2189
				SM_SSL_FREE(srv_ssl);
2192
				srv_ssl = NULL;
2193
2190
2194
				/*
2191
				/*
2195
				**  according to the next draft of
2192
				**  according to the next draft of
Lines 3416-3422 Link Here
3416
			/* shutdown TLS connection */
3413
			/* shutdown TLS connection */
3417
			if (tls_active)
3414
			if (tls_active)
3418
			{
3415
			{
3419
				(void) endtls(srv_ssl, "server");
3416
				(void) endtls(&srv_ssl, "server");
3420
				tls_active = false;
3417
				tls_active = false;
3421
			}
3418
			}
3422
#endif /* STARTTLS */
3419
#endif /* STARTTLS */
(-)a/sendmail/tls.c (-5 / +8 lines)
Lines 1624-1630 Link Here
1624
**  ENDTLS -- shutdown secure connection
1624
**  ENDTLS -- shutdown secure connection
1625
**
1625
**
1626
**	Parameters:
1626
**	Parameters:
1627
**		ssl -- SSL connection information.
1627
**		pssl -- pointer to TLS session context
1628
**		side -- server/client (for logging).
1628
**		side -- server/client (for logging).
1629
**
1629
**
1630
**	Returns:
1630
**	Returns:
Lines 1632-1643 Link Here
1632
*/
1632
*/
1633
1633
1634
int
1634
int
1635
endtls(ssl, side)
1635
endtls(pssl, side)
1636
	SSL *ssl;
1636
	SSL **pssl;
1637
	char *side;
1637
	char *side;
1638
{
1638
{
1639
	int ret = EX_OK;
1639
	int ret = EX_OK;
1640
	SSL *ssl;
1640
1641
1642
	SM_REQUIRE(pssl != NULL);
1643
 	ret = EX_OK;
1644
	ssl = *pssl;
1641
	if (ssl != NULL)
1645
	if (ssl != NULL)
1642
	{
1646
	{
1643
		int r;
1647
		int r;
Lines 1703-1710 Link Here
1703
			ret = EX_SOFTWARE;
1707
			ret = EX_SOFTWARE;
1704
		}
1708
		}
1705
# endif /* !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER > 0x0090602fL */
1709
# endif /* !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER > 0x0090602fL */
1706
		SSL_free(ssl);
1710
		SM_SSL_FREE(*pssl);
1707
		ssl = NULL;
1708
	}
1711
	}
1709
	return ret;
1712
	return ret;
1710
}
1713
}

Return to bug 673986