GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/smtpd/smtpd/../delivery_mda.c Lines: 0 7 0.0 %
Date: 2017-11-07 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: delivery_mda.c,v 1.9 2015/01/20 17:37:54 deraadt Exp $	*/
2
3
/*
4
 * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
5
 *
6
 * Permission to use, copy, modify, and distribute this software for any
7
 * purpose with or without fee is hereby granted, provided that the above
8
 * copyright notice and this permission notice appear in all copies.
9
 *
10
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
 */
18
19
#include <sys/types.h>
20
#include <sys/queue.h>
21
#include <sys/tree.h>
22
#include <sys/socket.h>
23
24
#include <ctype.h>
25
#include <err.h>
26
#include <event.h>
27
#include <fcntl.h>
28
#include <imsg.h>
29
#include <paths.h>
30
#include <stdio.h>
31
#include <stdlib.h>
32
#include <string.h>
33
#include <unistd.h>
34
#include <limits.h>
35
36
#include "smtpd.h"
37
#include "log.h"
38
39
extern char	**environ;
40
41
/* mda backend */
42
static void delivery_mda_open(struct deliver *);
43
44
struct delivery_backend delivery_backend_mda = {
45
	0, delivery_mda_open
46
};
47
48
49
static void
50
delivery_mda_open(struct deliver *deliver)
51
{
52
	char	*environ_new[2];
53
54
	environ_new[0] = "PATH=" _PATH_DEFPATH;
55
	environ_new[1] = (char *)NULL;
56
	environ = environ_new;
57
	execle("/bin/sh", "/bin/sh", "-c", deliver->to, (char *)NULL,
58
	    environ_new);
59
	perror("execle");
60
	_exit(1);
61
}