summaryrefslogtreecommitdiff
path: root/gnu/dist/postfix/src/util
diff options
context:
space:
mode:
authorheas <heas@NetBSD.org>2004-03-27 16:31:19 +0000
committerheas <heas@NetBSD.org>2004-03-27 16:31:19 +0000
commitf32166d8a91a2c82316a00a40ee4842e27ec245d (patch)
tree23fa8e0342da03f7dc80d4e582d0351d2a2f3724 /gnu/dist/postfix/src/util
parent5f1ffa71fcd47bffcc5eb3f23221d6570b558e8f (diff)
merge from 2.0.19 import
Diffstat (limited to 'gnu/dist/postfix/src/util')
-rw-r--r--gnu/dist/postfix/src/util/Makefile.in19
-rw-r--r--gnu/dist/postfix/src/util/inet_connect.c3
-rw-r--r--gnu/dist/postfix/src/util/inet_listen.c5
-rw-r--r--gnu/dist/postfix/src/util/match_ops.c14
-rw-r--r--gnu/dist/postfix/src/util/sys_defs.h5
5 files changed, 38 insertions, 8 deletions
diff --git a/gnu/dist/postfix/src/util/Makefile.in b/gnu/dist/postfix/src/util/Makefile.in
index 4167dfff018..d1d841bb545 100644
--- a/gnu/dist/postfix/src/util/Makefile.in
+++ b/gnu/dist/postfix/src/util/Makefile.in
@@ -26,7 +26,7 @@ SRCS = alldig.c argv.c argv_split.c attr_print0.c attr_print64.c \
unix_connect.c unix_listen.c unix_trigger.c unsafe.c username.c \
valid_hostname.c vbuf.c vbuf_print.c vstream.c vstream_popen.c \
vstring.c vstring_vstream.c watchdog.c writable.c write_buf.c \
- write_wait.c strcasecmp.c nvtable.c host_port.c
+ write_wait.c strcasecmp.c nvtable.c host_port.c sane_connect.c
OBJS = alldig.o argv.o argv_split.o attr_print0.o attr_print64.o \
attr_scan0.o attr_scan64.o base64_code.o basename.o binhash.o \
chroot_uid.o clean_env.o close_on_exec.o concatenate.o ctable.o \
@@ -54,7 +54,7 @@ OBJS = alldig.o argv.o argv_split.o attr_print0.o attr_print64.o \
unix_connect.o unix_listen.o unix_trigger.o unsafe.o username.o \
valid_hostname.o vbuf.o vbuf_print.o vstream.o vstream_popen.o \
vstring.o vstring_vstream.o watchdog.o writable.o write_buf.o \
- write_wait.o nvtable.o $(STRCASE) host_port.o
+ write_wait.o nvtable.o host_port.o sane_connect.o $(STRCASE)
HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \
connect.h ctable.h dict.h dict_db.h dict_dbm.h dict_env.h \
dict_ht.h dict_ldap.h dict_mysql.h dict_ni.h dict_nis.h \
@@ -72,7 +72,7 @@ HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \
split_at.h stat_as.h stringops.h sys_defs.h timed_connect.h \
timed_wait.h trigger.h username.h valid_hostname.h vbuf.h \
vbuf_print.h vstream.h vstring.h vstring_vstream.h watchdog.h \
- nvtable.h host_port.h
+ nvtable.h host_port.h sane_connect.h
TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
stream_test.c dup2_pass_on_exec.c
WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \
@@ -739,6 +739,9 @@ file_limit.o: iostuff.h
find_inet.o: find_inet.c
find_inet.o: sys_defs.h
find_inet.o: msg.h
+find_inet.o: stringops.h
+find_inet.o: vstring.h
+find_inet.o: vbuf.h
find_inet.o: find_inet.h
fsspace.o: fsspace.c
fsspace.o: sys_defs.h
@@ -805,6 +808,7 @@ inet_connect.o: msg.h
inet_connect.o: find_inet.h
inet_connect.o: inet_util.h
inet_connect.o: iostuff.h
+inet_connect.o: sane_connect.h
inet_connect.o: connect.h
inet_connect.o: timed_connect.h
inet_listen.o: inet_listen.c
@@ -916,6 +920,7 @@ msg_syslog.o: stringops.h
msg_syslog.o: msg.h
msg_syslog.o: msg_output.h
msg_syslog.o: msg_syslog.h
+msg_syslog.o: safe.h
msg_vstream.o: msg_vstream.c
msg_vstream.o: sys_defs.h
msg_vstream.o: vstream.h
@@ -1036,6 +1041,10 @@ sane_accept.o: sane_accept.c
sane_accept.o: sys_defs.h
sane_accept.o: msg.h
sane_accept.o: sane_accept.h
+sane_connect.o: sane_connect.c
+sane_connect.o: sys_defs.h
+sane_connect.o: msg.h
+sane_connect.o: sane_connect.h
sane_link.o: sane_link.c
sane_link.o: sys_defs.h
sane_link.o: msg.h
@@ -1143,9 +1152,11 @@ timed_connect.o: timed_connect.c
timed_connect.o: sys_defs.h
timed_connect.o: msg.h
timed_connect.o: iostuff.h
+timed_connect.o: sane_connect.h
timed_connect.o: timed_connect.h
timed_read.o: timed_read.c
timed_read.o: sys_defs.h
+timed_read.o: msg.h
timed_read.o: iostuff.h
timed_wait.o: timed_wait.c
timed_wait.o: sys_defs.h
@@ -1154,6 +1165,7 @@ timed_wait.o: posix_signals.h
timed_wait.o: timed_wait.h
timed_write.o: timed_write.c
timed_write.o: sys_defs.h
+timed_write.o: msg.h
timed_write.o: iostuff.h
translit.o: translit.c
translit.o: sys_defs.h
@@ -1174,6 +1186,7 @@ unix_connect.o: unix_connect.c
unix_connect.o: sys_defs.h
unix_connect.o: msg.h
unix_connect.o: iostuff.h
+unix_connect.o: sane_connect.h
unix_connect.o: connect.h
unix_connect.o: timed_connect.h
unix_listen.o: unix_listen.c
diff --git a/gnu/dist/postfix/src/util/inet_connect.c b/gnu/dist/postfix/src/util/inet_connect.c
index 152e498461e..3c76734cdda 100644
--- a/gnu/dist/postfix/src/util/inet_connect.c
+++ b/gnu/dist/postfix/src/util/inet_connect.c
@@ -63,6 +63,7 @@
#include "find_inet.h"
#include "inet_util.h"
#include "iostuff.h"
+#include "sane_connect.h"
#include "connect.h"
#include "timed_connect.h"
@@ -114,7 +115,7 @@ int inet_connect(const char *addr, int block_mode, int timeout)
*/
else {
non_blocking(sock, block_mode);
- if (connect(sock, (struct sockaddr *) & sin, sizeof(sin)) < 0
+ if (sane_connect(sock, (struct sockaddr *) & sin, sizeof(sin)) < 0
&& errno != EINPROGRESS) {
close(sock);
return (-1);
diff --git a/gnu/dist/postfix/src/util/inet_listen.c b/gnu/dist/postfix/src/util/inet_listen.c
index 91347c95ab4..2a846b39b8d 100644
--- a/gnu/dist/postfix/src/util/inet_listen.c
+++ b/gnu/dist/postfix/src/util/inet_listen.c
@@ -116,5 +116,8 @@ int inet_listen(const char *addr, int backlog, int block_mode)
int inet_accept(int fd)
{
- return (sane_accept(fd, (struct sockaddr *) 0, (SOCKADDR_SIZE *) 0));
+ struct sockaddr_in sin;
+ SOCKADDR_SIZE len = sizeof(sin);
+
+ return (sane_accept(fd, (struct sockaddr *) & sin, &len));
}
diff --git a/gnu/dist/postfix/src/util/match_ops.c b/gnu/dist/postfix/src/util/match_ops.c
index 1bde84abdfa..ea615d7c557 100644
--- a/gnu/dist/postfix/src/util/match_ops.c
+++ b/gnu/dist/postfix/src/util/match_ops.c
@@ -69,7 +69,7 @@
#endif
#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffff
+#define INADDR_NONE 0xffffffff
#endif
/* Utility library. */
@@ -139,7 +139,7 @@ int match_hostname(int flags, const char *name, const char *pattern)
if (strchr(pattern, ':') != 0) {
temp = lowercase(mystrdup(name));
match = 0;
- for (entry = temp; /* void */ ; entry = next) {
+ for (entry = temp; *entry != 0; entry = next) {
if ((match = (dict_lookup(pattern, entry) != 0)) != 0)
break;
if (dict_errno != 0)
@@ -207,6 +207,7 @@ int match_hostaddr(int unused_flags, const char *addr, const char *pattern)
unsigned long mask_bits;
unsigned long net_bits;
unsigned long addr_bits;
+ struct in_addr net_addr;
if (msg_verbose)
msg_info("%s: %s ~? %s", myname, addr, pattern);
@@ -242,7 +243,14 @@ int match_hostaddr(int unused_flags, const char *addr, const char *pattern)
if (addr_bits == INADDR_NONE)
msg_fatal("%s: bad address argument: %s", myname, addr);
mask_bits = htonl((0xffffffff) << (BITS_PER_ADDR - mask_shift));
- return ((addr_bits & mask_bits) == (net_bits & mask_bits));
+ if ((addr_bits & mask_bits) == net_bits)
+ return (1);
+ if (net_bits & ~mask_bits) {
+ net_addr.s_addr = (net_bits & mask_bits);
+ msg_fatal("net/mask pattern %s has a non-null host portion; "
+ "specify %s/%d if this is really what you want",
+ pattern, inet_ntoa(net_addr), mask_shift);
+ }
}
return (0);
}
diff --git a/gnu/dist/postfix/src/util/sys_defs.h b/gnu/dist/postfix/src/util/sys_defs.h
index d1735d9f8fa..1e3b4ee4250 100644
--- a/gnu/dist/postfix/src/util/sys_defs.h
+++ b/gnu/dist/postfix/src/util/sys_defs.h
@@ -98,7 +98,9 @@
#define NORETURN void
#define PRINTFLIKE(x,y)
#define SCANFLIKE(x,y)
+#ifndef NO_NETINFO
#define HAS_NETINFO
+#endif
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
@@ -185,6 +187,7 @@ extern int opterr; /* XXX use <getopt.h> */
#define USE_STATFS
#define STATFS_IN_SYS_MOUNT_H
#define HAS_POSIX_REGEXP
+#define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE
#endif
/*
@@ -260,6 +263,7 @@ extern int opterr;
#define LOCAL_CONNECT stream_connect
#define LOCAL_TRIGGER stream_trigger
#define HAS_VOLATILE_LOCKS
+#define BROKEN_READ_SELECT_ON_TCP_SOCKET
/*
* Allow build environment to override paths.
*/
@@ -463,6 +467,7 @@ extern int initgroups(const char *, int);
#define DBM_NO_TRAILING_NULL /* XXX check */
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
+#define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE
#endif
#if defined(IRIX5)