summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2008-11-17 21:32:24 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2008-11-17 21:32:24 +0000
commitff27942b5003c934d6b5d4eeade7741606acaa20 (patch)
tree2a716879d1c94e32b8c60396d3af938949cb66db
parent55ca27e9a8916842b5ac6a2a238df74406c96fb1 (diff)
- err() -> fatal()
- printf() -> log_debug() - be more verbose in debug mode
-rw-r--r--usr.sbin/smtpd/forward.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/forward.c b/usr.sbin/smtpd/forward.c
index 43a17ed8116..7f4403ef79a 100644
--- a/usr.sbin/smtpd/forward.c
+++ b/usr.sbin/smtpd/forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: forward.c,v 1.2 2008/11/05 12:14:45 sobrado Exp $ */
+/* $OpenBSD: forward.c,v 1.3 2008/11/17 21:32:23 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -68,6 +68,7 @@ forwards_get(struct aliaseslist *aliases, char *username)
if (fp == NULL)
return 0;
+ log_debug("+ opening forward file %s", pathname);
/* make sure ~/ is not writable by anyone but owner */
if (stat(pw->pw_dir, &sb) == -1)
goto bad;
@@ -87,12 +88,13 @@ forwards_get(struct aliaseslist *aliases, char *username)
else {
/* EOF without EOL, copy and add the NUL */
if ((lbuf = malloc(len + 1)) == NULL)
- err(1, NULL);
+ fatal("malloc");
memcpy(lbuf, buf, len);
lbuf[len] = '\0';
buf = lbuf;
}
- printf("%s\n", buf);
+
+ log_debug("\tforward: %s", buf);
if (! alias_parse(&alias, buf)) {
log_debug("bad entry in ~/.forward");
continue;
@@ -104,7 +106,7 @@ forwards_get(struct aliaseslist *aliases, char *username)
}
aliasp = calloc(1, sizeof(struct alias));
if (aliasp == NULL)
- err(1, "calloc");
+ fatal("calloc");
*aliasp = alias;
TAILQ_INSERT_HEAD(aliases, aliasp, entry);
@@ -114,6 +116,7 @@ forwards_get(struct aliaseslist *aliases, char *username)
return 1;
bad:
+ log_debug("+ forward file error, probably bad perms/mode");
if (fp != NULL)
fclose(fp);
return 0;