dma: adjust syslog logging levels
authorSimon Schubert <corecode@dragonflybsd.org>
Thu, 16 Jul 2009 09:40:39 +0000 (11:40 +0200)
committerSimon Schubert <corecode@dragonflybsd.org>
Thu, 16 Jul 2009 14:13:07 +0000 (16:13 +0200)
Most invocations of syslog used LOG_ERR.  Clearly this is not good
practise.  Adjust the levels to be reasonable.

libexec/dma/crypto.c
libexec/dma/dma.c
libexec/dma/net.c

index d6bba40..7e5f292 100644 (file)
@@ -100,7 +100,7 @@ smtp_init_crypto(struct qitem *it, int fd, int feature)
 
        ctx = SSL_CTX_new(meth);
        if (ctx == NULL) {
-               syslog(LOG_ERR, "%s: remote delivery deferred:"
+               syslog(LOG_WARNING, "%s: remote delivery deferred:"
                       " SSL init failed: %m", it->queueid);
                return (2);
        }
@@ -134,7 +134,7 @@ smtp_init_crypto(struct qitem *it, int fd, int feature)
 
        config->ssl = SSL_new(ctx);
        if (config->ssl == NULL) {
-               syslog(LOG_ERR, "%s: remote delivery deferred:"
+               syslog(LOG_NOTICE, "%s: remote delivery deferred:"
                       " SSL struct creation failed:", it->queueid);
                return (2);
        }
@@ -146,7 +146,7 @@ smtp_init_crypto(struct qitem *it, int fd, int feature)
        error = SSL_set_fd(config->ssl, fd);
        if (error == 0) {
                error = SSL_get_error(config->ssl, error);
-               syslog(LOG_ERR, "%s: remote delivery deferred:"
+               syslog(LOG_NOTICE, "%s: remote delivery deferred:"
                       " SSL set fd failed (%d): %m", it->queueid, error);
                return (2);
        }
@@ -162,7 +162,7 @@ smtp_init_crypto(struct qitem *it, int fd, int feature)
        /* Get peer certificate */
        cert = SSL_get_peer_certificate(config->ssl);
        if (cert == NULL) {
-               syslog(LOG_ERR, "%s: remote delivery deferred:"
+               syslog(LOG_WARNING, "%s: remote delivery deferred:"
                       " Peer did not provide certificate: %m", it->queueid);
        }
        X509_free(cert);
@@ -267,7 +267,7 @@ smtp_auth_md5(struct qitem *it, int fd, char *login, char *password)
        /* Send AUTH command according to RFC 2554 */
        send_remote_command(fd, "AUTH CRAM-MD5");
        if (read_remote(fd, sizeof(buffer), buffer) != 3) {
-               syslog(LOG_ERR, "%s: smarthost authentification:"
+               syslog(LOG_INFO, "%s: smarthost authentification:"
                       " AUTH cram-md5 not available: %s", it->queueid,
                       neterr);
                /* if cram-md5 is not available */
@@ -297,7 +297,7 @@ smtp_auth_md5(struct qitem *it, int fd, char *login, char *password)
        /* send answer */
        send_remote_command(fd, "%s", temp);
        if (read_remote(fd, 0, NULL) != 2) {
-               syslog(LOG_ERR, "%s: remote delivery deferred:"
+               syslog(LOG_WARNING, "%s: remote delivery deferred:"
                                " AUTH cram-md5 failed: %s", it->queueid,
                                neterr);
                return (-2);
index 063c6b2..dbb93ba 100644 (file)
@@ -555,7 +555,7 @@ bounce(struct qitem *it, const char *reason)
 
        /* Don't bounce bounced mails */
        if (it->sender[0] == 0) {
-               syslog(LOG_CRIT, "%s: delivery panic: can't bounce a bounce",
+               syslog(LOG_INFO, "%s: can not bounce a bounce message, discarding",
                       it->queueid);
                exit(1);
        }
@@ -659,7 +659,7 @@ deliver_local(struct qitem *it, const char **errmsg)
 
        error = snprintf(fn, sizeof(fn), "%s/%s", _PATH_MAILDIR, it->addr);
        if (error < 0 || (size_t)error >= sizeof(fn)) {
-               syslog(LOG_ERR, "%s: local delivery deferred: %m",
+               syslog(LOG_NOTICE, "%s: local delivery deferred: %m",
                       it->queueid);
                return (1);
        }
@@ -667,21 +667,21 @@ deliver_local(struct qitem *it, const char **errmsg)
        /* mailx removes users mailspool file if empty, so open with O_CREAT */
        mbox = open_locked(fn, O_WRONLY | O_APPEND | O_CREAT);
        if (mbox < 0) {
-               syslog(LOG_ERR, "%s: local delivery deferred: can not open `%s': %m",
+               syslog(LOG_NOTICE, "%s: local delivery deferred: can not open `%s': %m",
                       it->queueid, fn);
                return (1);
        }
        mboxlen = lseek(mbox, 0, SEEK_CUR);
 
        if (fseek(it->queuef, it->hdrlen, SEEK_SET) != 0) {
-               syslog(LOG_ERR, "%s: local delivery deferred: can not seek: %m",
+               syslog(LOG_NOTICE, "%s: local delivery deferred: can not seek: %m",
                       it->queueid);
                return (1);
        }
 
        error = snprintf(line, sizeof(line), "From %s\t%s", it->sender, ctime(&now));
        if (error < 0 || (size_t)error >= sizeof(line)) {
-               syslog(LOG_ERR, "%s: local delivery deferred: can not write header: %m",
+               syslog(LOG_NOTICE, "%s: local delivery deferred: can not write header: %m",
                       it->queueid);
                return (1);
        }
@@ -1090,7 +1090,7 @@ main(int argc, char **argv)
        argv += optind;
        opterr = 1;
 
-       openlog(tag, LOG_PID | LOG_PERROR, LOG_MAIL);
+       openlog(tag, LOG_PID, LOG_MAIL);
        set_username();
 
        config = malloc(sizeof(struct config));
index 943a8df..9364077 100644 (file)
@@ -217,7 +217,7 @@ smtp_login(struct qitem *it, int fd, char *login, char* password)
                /* Send AUTH command according to RFC 2554 */
                send_remote_command(fd, "AUTH LOGIN");
                if (read_remote(fd, 0, NULL) != 3) {
-                       syslog(LOG_ERR, "%s: remote delivery deferred:"
+                       syslog(LOG_NOTICE, "%s: remote delivery deferred:"
                                        " AUTH login not available: %s",
                                        it->queueid, neterr);
                        return (1);
@@ -229,7 +229,7 @@ smtp_login(struct qitem *it, int fd, char *login, char* password)
 
                send_remote_command(fd, "%s", temp);
                if (read_remote(fd, 0, NULL) != 3) {
-                       syslog(LOG_ERR, "%s: remote delivery deferred:"
+                       syslog(LOG_NOTICE, "%s: remote delivery deferred:"
                                        " AUTH login failed: %s", it->queueid,
                                        neterr);
                        return (-1);
@@ -242,18 +242,18 @@ smtp_login(struct qitem *it, int fd, char *login, char* password)
                send_remote_command(fd, "%s", temp);
                res = read_remote(fd, 0, NULL);
                if (res == 5) {
-                       syslog(LOG_ERR, "%s: remote delivery failed:"
+                       syslog(LOG_NOTICE, "%s: remote delivery failed:"
                                        " Authentication failed: %s",
                                        it->queueid, neterr);
                        return (-1);
                } else if (res != 2) {
-                       syslog(LOG_ERR, "%s: remote delivery failed:"
+                       syslog(LOG_NOTICE, "%s: remote delivery failed:"
                                        " AUTH password failed: %s",
                                        it->queueid, neterr);
                        return (-1);
                }
        } else {
-               syslog(LOG_ERR, "%s: non-encrypted SMTP login is disabled in config, so skipping it. ",
+               syslog(LOG_WARNING, "%s: non-encrypted SMTP login is disabled in config, so skipping it. ",
                                it->queueid);
                return (1);
        }
@@ -284,7 +284,7 @@ open_connection(struct qitem *it, const char *host)
        snprintf(servname, sizeof(servname), "%d", port);
        error = getaddrinfo(host, servname, &hints, &res0);
        if (error) {
-               syslog(LOG_ERR, "%s: remote delivery deferred: "
+               syslog(LOG_NOTICE, "%s: remote delivery deferred: "
                       "%s: %m", it->queueid, gai_strerror(error));
                return (-1);
        }
@@ -304,7 +304,7 @@ open_connection(struct qitem *it, const char *host)
                break;
        }
        if (fd < 0) {
-               syslog(LOG_ERR, "%s: remote delivery deferred: %s (%s:%s)",
+               syslog(LOG_NOTICE, "%s: remote delivery deferred: %s (%s:%s)",
                        it->queueid, errmsg, host, servname);
                freeaddrinfo(res0);
                return (-1);
@@ -349,7 +349,7 @@ deliver_remote(struct qitem *it, const char **errmsg)
        config->features |= NOSSL;
        res = read_remote(fd, 0, NULL);
        if (res != 2) {
-               syslog(LOG_INFO, "%s: Invalid initial response: %i",
+               syslog(LOG_WARNING, "%s: Invalid initial response: %i",
                        it->queueid, res);
                return(1);
        }
@@ -368,7 +368,7 @@ deliver_remote(struct qitem *it, const char **errmsg)
 
        send_remote_command(fd, "EHLO %s", hostname());
        if (read_remote(fd, 0, NULL) != 2) {
-               syslog(LOG_ERR, "%s: remote delivery deferred: "
+               syslog(LOG_WARNING, "%s: remote delivery deferred: "
                       " EHLO failed: %s", it->queueid, neterr);
                asprintf(errmsgc, "%s did not like our EHLO:\n%s",
                    host, neterr);
@@ -402,7 +402,7 @@ deliver_remote(struct qitem *it, const char **errmsg)
                }
                /* SMTP login is not available, so try without */
                else if (error > 0)
-                       syslog(LOG_ERR, "%s: SMTP login not available."
+                       syslog(LOG_WARNING, "%s: SMTP login not available."
                                        " Try without", it->queueid);
        }
 
@@ -415,7 +415,7 @@ deliver_remote(struct qitem *it, const char **errmsg)
                    host, neterr); \
                return (-1); \
        } else if (res != exp) { \
-               syslog(LOG_ERR, "%s: remote delivery deferred: " \
+               syslog(LOG_NOTICE, "%s: remote delivery deferred: " \
                       c " failed: %s", it->queueid, neterr); \
                return (1); \
        }
@@ -458,7 +458,7 @@ deliver_remote(struct qitem *it, const char **errmsg)
                        linelen++;
 
                if (send_remote_command(fd, "%s", line) != (ssize_t)linelen+1) {
-                       syslog(LOG_ERR, "%s: remote delivery deferred: "
+                       syslog(LOG_NOTICE, "%s: remote delivery deferred: "
                                "write error", it->queueid);
                        error = 1;
                        goto out;
@@ -470,7 +470,7 @@ deliver_remote(struct qitem *it, const char **errmsg)
 
        send_remote_command(fd, "QUIT");
        if (read_remote(fd, 0, NULL) != 2)
-               syslog(LOG_WARNING, "%s: remote delivery succeeded but "
+               syslog(LOG_INFO, "%s: remote delivery succeeded but "
                       "QUIT failed: %s", it->queueid, neterr);
 out: