* 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
SSL_CTX *ctx = NULL;
SSL_METHOD *meth = NULL;
X509 *cert;
- char buf[2048];
int error;
/* Init SSL library */
/*
* 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 -
* 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>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/wait.h>
#ifdef HAVE_CRYPTO
#include <openssl/ssl.h>
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;
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
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;
static void
run_queue(struct queue *queue)
{
- struct qitem *it;
if (LIST_EMPTY(&queue->queue))
return;
{
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);
* with dotforwardhandler()
*/
static int
-dotforwardhandler()
+dotforwardhandler(void)
{
pid_t pid;
fd_set rfds;
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);
waitpid(-1, NULL, 0);
}
}
+ return(0);
}
/*
* 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;
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);
} 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;
goto failure;
}
} else if (mode & ISPIPE) { /* pipe delivery */
- if (fwrite(line, 1, linelen, pipe) != linelen) {
+ if (fwrite(line, 1, linelen, mypipe) != linelen) {
goto failure;
}
}
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));
if (mode & ISMAILBOX) { /* mailbox delivery */
close(mbox);
} else if (mode & ISPIPE) { /* pipe delivery */
- pclose(pipe);
+ pclose(mypipe);
}
_exit(1);
}
* 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
/* 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 */