summaryrefslogtreecommitdiff
path: root/libexec/spamd/spamd.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /libexec/spamd/spamd.c
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (diff)
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'libexec/spamd/spamd.c')
-rw-r--r--libexec/spamd/spamd.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c
index 87d5eeffe9f..ea6a06f15d4 100644
--- a/libexec/spamd/spamd.c
+++ b/libexec/spamd/spamd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd.c,v 1.121 2015/01/13 23:22:33 millert Exp $ */
+/* $OpenBSD: spamd.c,v 1.122 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2002-2007 Bob Beck. All rights reserved.
@@ -17,10 +17,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
+#include <sys/signal.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -35,6 +36,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <netdb.h>
@@ -101,7 +103,7 @@ void getcaddr(struct con *);
void gethelo(char *, size_t, char *);
int read_configline(FILE *);
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
struct syslog_data sdata = SYSLOG_DATA_INIT;
char *nreply = "450";
char *spamd = "spamd IP-based SPAM blocker";
@@ -147,6 +149,8 @@ int syncrecv;
int syncsend;
#define MAXTIME 400
+#define MAXIMUM(a,b) (((a)>(b))?(a):(b))
+
void
usage(void)
{
@@ -1382,16 +1386,16 @@ jail:
int max, n;
int writers;
- max = MAX(s, conflisten);
+ max = MAXIMUM(s, conflisten);
if (syncrecv)
- max = MAX(max, syncfd);
- max = MAX(max, conffd);
- max = MAX(max, trapfd);
+ max = MAXIMUM(max, syncfd);
+ max = MAXIMUM(max, conffd);
+ max = MAXIMUM(max, trapfd);
time(&t);
for (i = 0; i < maxcon; i++)
if (con[i].fd != -1)
- max = MAX(max, con[i].fd);
+ max = MAXIMUM(max, con[i].fd);
if (max > omax) {
free(fdsr);