Silence warnings.
authorSascha Wildner <swildner@dragonflybsd.org>
Tue, 30 Sep 2008 17:47:21 +0000 (17:47 +0000)
committerSascha Wildner <swildner@dragonflybsd.org>
Tue, 30 Sep 2008 17:47:21 +0000 (17:47 +0000)
libexec/dma/base64.c
libexec/dma/crypto.c
libexec/dma/dma.c
libexec/dma/dma.h
libexec/dma/net.c

index f140027..b5b03a5 100644 (file)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $DragonFly: src/libexec/dma/base64.c,v 1.2 2008/09/02 15:11:49 matthias Exp $
+ * $DragonFly: src/libexec/dma/base64.c,v 1.3 2008/09/30 17:47:21 swildner Exp $
  */
 
 #include <stdlib.h>
 #include <string.h>
 
-int base64_encode(const void *data, int size, char **str);
+#include "dma.h"
 
 static char base64_chars[] =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
index 9182137..d355b73 100644 (file)
@@ -32,7 +32,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $DragonFly: src/libexec/dma/crypto.c,v 1.3 2008/09/02 15:11:49 matthias Exp $
+ * $DragonFly: src/libexec/dma/crypto.c,v 1.4 2008/09/30 17:47:21 swildner Exp $
  */
 
 #ifdef HAVE_CRYPTO
@@ -91,7 +91,6 @@ smtp_init_crypto(struct qitem *it, int fd, int feature)
        SSL_CTX *ctx = NULL;
        SSL_METHOD *meth = NULL;
        X509 *cert;
-       char buf[2048];
        int error;
 
        /* Init SSL library */
@@ -173,15 +172,16 @@ smtp_init_crypto(struct qitem *it, int fd, int feature)
 /*
  * hmac_md5() taken out of RFC 2104.  This RFC was written by H. Krawczyk,
  * M. Bellare and R. Canetti.
- */ 
+ *
+ * text      pointer to data stream
+ * text_len  length of data stream
+ * key       pointer to authentication key
+ * key_len   length of authentication key
+ * digest    caller digest to be filled int
+ */
 void
-hmac_md5(text, text_len, key, key_len, digest)
-unsigned char*  text;                /* pointer to data stream */
-int             text_len;            /* length of data stream */
-unsigned char*  key;                 /* pointer to authentication key */
-int             key_len;             /* length of authentication key */
-caddr_t         digest;              /* caller digest to be filled in */
-
+hmac_md5(unsigned char *text, int text_len, unsigned char *key, int key_len,
+    caddr_t digest)
 {
         MD5_CTX context;
         unsigned char k_ipad[65];    /* inner padding -
index 598b629..70cb8ae 100644 (file)
@@ -31,7 +31,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $DragonFly: src/libexec/dma/dma.c,v 1.4 2008/09/16 17:57:22 matthias Exp $
+ * $DragonFly: src/libexec/dma/dma.c,v 1.5 2008/09/30 17:47:21 swildner Exp $
  */
 
 #include <sys/ipc.h>
@@ -41,6 +41,7 @@
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 
 #ifdef HAVE_CRYPTO
 #include <openssl/ssl.h>
@@ -79,8 +80,8 @@ static int daemonize = 1;
 struct config *config;
 int controlsocket_df, clientsocket_df, controlsocket_wl, clientsocket_wl, semkey;
 
-static void *
-release_children()
+static void
+release_children(void)
 {
        struct sembuf sema;
        int null = 0;
@@ -254,8 +255,8 @@ add_recp(struct queue *queue, const char *str, const char *sender, int expand)
                                FD_SET(controlsocket_df, &rfds);
 
                                /* wait for incoming redirects and pipes */
-                               while (ret =select(controlsocket_df + 1,
-                                   &rfds, NULL, NULL, NULL)) {
+                               while ((ret = select(controlsocket_df + 1,
+                                   &rfds, NULL, NULL, NULL))) {
                                        /*
                                         * Receive back list of mailboxnames
                                         * and/or emailadresses
@@ -781,9 +782,9 @@ deliver_local(struct qitem *it, const char **errmsg)
        char fn[PATH_MAX+1];
        int len;
        uint8_t mode = 0, fail = 0;
-       size_t linelen;
+       ssize_t linelen;
        time_t now = time(NULL);
-       char *username;
+       char *username = NULL;
        struct sembuf sema;
 
 
@@ -1474,7 +1475,6 @@ fail:
 static void
 run_queue(struct queue *queue)
 {
-       struct qitem *it;
        if (LIST_EMPTY(&queue->queue))
                return;
 
@@ -1513,12 +1513,10 @@ parseandexecute(int argc, char **argv)
 {
        char *sender = NULL;
        char tag[255];
-       struct qitem *it;
        struct queue queue;
        struct queue lqueue;
        int i, ch;
        int nodot = 0, doqueue = 0, showq = 0;
-       uint8_t null = 0, recipient_add_success = 0;
 
        atexit(deltmp);
        LIST_INIT(&queue.queue);
@@ -1679,7 +1677,7 @@ parseandexecute(int argc, char **argv)
  * with dotforwardhandler()
  */
 static int
-dotforwardhandler()
+dotforwardhandler(void)
 {
        pid_t pid;
        fd_set rfds;
@@ -1740,8 +1738,8 @@ dotforwardhandler()
                                memset(line, 0, 2048);
                                fgets(line, sizeof(line), forward);
                                /* FIXME allow comments? */
-                               if ((target = strtok(line, "\t\n")) != NULL)
-                               if (strncmp(target, "|", 1) == 0) {
+                               if (((target = strtok(line, "\t\n")) != NULL) &&
+                                   (strncmp(target, "|", 1) == 0)) {
                                        /* if first char is a '|', the line is a pipe */
                                        stmt = ISPIPE;
                                        write(clientsocket_df, &stmt, 1);
@@ -1772,6 +1770,7 @@ dotforwardhandler()
                        waitpid(-1, NULL, 0);
                }
        }
+       return(0);
 }
 
 /*
@@ -1779,7 +1778,8 @@ dotforwardhandler()
  * to a pipe in a user context and communicates with deliver_local()
  */
 static int
-write_to_local_user() {
+write_to_local_user(void)
+{
        pid_t pid;
        int length;
        size_t linelen;
@@ -1788,13 +1788,10 @@ write_to_local_user() {
        while (read(clientsocket_wl, &length, sizeof(length))) {
                char *target;
                uint8_t mode, fail = 0;
-               char fn[PATH_MAX+1];
                char line[1000];
-               int mbox;
-               off_t mboxlen;
-               FILE *pipe;
-               int error;
-               pid_t pid;
+               int mbox = 0;
+               off_t mboxlen = 0;
+               FILE *mypipe = NULL;
                struct passwd *userentry;
 
                target = calloc(1, length + 1);
@@ -1916,7 +1913,7 @@ write_to_local_user() {
                } else if (mode & ISPIPE) {
                        /* if mode is mailbox, popen pipe */
                        fflush(NULL);
-                       if ((pipe = popen(target, "w")) == NULL) {
+                       if ((mypipe = popen(target, "w")) == NULL) {
                                fail = errno;
                                write(clientsocket_wl, &fail, sizeof(fail));
                                fail = 0;
@@ -1947,7 +1944,7 @@ write_to_local_user() {
                                        goto failure;
                                }
                        } else if (mode & ISPIPE) { /* pipe delivery */
-                               if (fwrite(line, 1, linelen, pipe) != linelen) {
+                               if (fwrite(line, 1, linelen, mypipe) != linelen) {
                                        goto failure;
                                }
                        }
@@ -1959,7 +1956,7 @@ write_to_local_user() {
                if (mode & ISMAILBOX) { /* mailbox delivery */
                        close(mbox);
                } else if (mode & ISPIPE) { /* pipe delivery */
-                       pclose(pipe);
+                       pclose(mypipe);
                }
                /* send ack and exit */
                write(clientsocket_wl, &fail, sizeof(fail));
@@ -1977,7 +1974,7 @@ chop:
                if (mode & ISMAILBOX) { /* mailbox delivery */
                        close(mbox);
                } else if (mode & ISPIPE) { /* pipe delivery */
-                       pclose(pipe);
+                       pclose(mypipe);
                }
                _exit(1);
        }
index 273bf8e..eda7865 100644 (file)
@@ -32,7 +32,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $DragonFly: src/libexec/dma/dma.h,v 1.7 2008/09/16 17:57:23 matthias Exp $
+ * $DragonFly: src/libexec/dma/dma.h,v 1.8 2008/09/30 17:47:21 swildner Exp $
  */
 
 #ifndef DMA_H
@@ -154,6 +154,8 @@ extern int parse_authfile(const char *);
 
 /* crypto.c */
 #ifdef HAVE_CRYPTO
+extern void hmac_md5(unsigned char *, int, unsigned char *, int, caddr_t);
+extern int smtp_auth_md5(struct qitem *, int, char *, char *);
 extern int smtp_init_crypto(struct qitem *, int, int);
 #endif /* HAVE_CRYPTO */
 
index 394dff0..1b0f176 100644 (file)
@@ -32,7 +32,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $DragonFly: src/libexec/dma/net.c,v 1.8 2008/09/16 17:57:23 matthias Exp $
+ * $DragonFly: src/libexec/dma/net.c,v 1.9 2008/09/30 17:47:21 swildner Exp $
  */
 
 #include <sys/param.h>
@@ -47,6 +47,7 @@
 #include <openssl/ssl.h>
 #endif /* HAVE_CRYPTO */
 
+#include <err.h>
 #include <netdb.h>
 #include <setjmp.h>
 #include <signal.h>