From: Matthias Schmidt Date: Mon, 4 Feb 2008 08:58:54 +0000 (+0000) Subject: o Remove per-user config file support X-Git-Tag: v2.0.1~1185 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/5c4cbc76abf483148a8fd6dc356bd49ba7fdd413 o Remove per-user config file support o Remove old-style-connect with gethostbyname() etc. It was #ifdefed out and getaddrinfo() will do the job. --- diff --git a/libexec/dma/Makefile b/libexec/dma/Makefile index 22d67a47d3..0d30c4e1d6 100644 --- a/libexec/dma/Makefile +++ b/libexec/dma/Makefile @@ -1,7 +1,7 @@ -# $DragonFly: src/libexec/dma/Makefile,v 1.2 2008/02/02 23:57:35 swildner Exp $ +# $DragonFly: src/libexec/dma/Makefile,v 1.3 2008/02/04 08:58:54 matthias Exp $ # -CFLAGS+= -DHAVE_CRYPTO -DHAVE_INET6 +CFLAGS+= -DHAVE_CRYPTO CFLAGS+= -I${.CURDIR} DPADD= ${LIBSSL} ${LIBCRYPTO} diff --git a/libexec/dma/dma.8 b/libexec/dma/dma.8 index e9a63a3dcb..1fb168e4f1 100644 --- a/libexec/dma/dma.8 +++ b/libexec/dma/dma.8 @@ -29,9 +29,9 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $DragonFly: src/libexec/dma/dma.8,v 1.4 2008/02/03 19:07:45 matthias Exp $ +.\" $DragonFly: src/libexec/dma/dma.8,v 1.5 2008/02/04 08:58:54 matthias Exp $ .\" -.Dd February 3, 2008 +.Dd February 4, 2008 .Dt DMA 8 .Os .Sh NAME @@ -116,8 +116,6 @@ virtusertable .Pp These three files are stored per default in .Pa /etc/dma . -However every user can install it's own config files in -.Pa $HOME/.dma . .Sh FILE FORMAT Every file contains parameters of the form .Sq name value . @@ -175,18 +173,12 @@ Just stick with the default. Path to the .Sq virtusertable file. -If you have your config in -.Pa $HOME/.dma -be sure to change this path accordingly. .It Ic AUTHPATH Xo (string, default=/etc/dma/auth.conf) .Xc Path to the .Sq auth.conf file. -If you have your config in -.Pa $HOME/.dma -be sure to change this path accordingly. .It Ic VIRTUAL Xo (boolean, default=commented) .Xc diff --git a/libexec/dma/dma.c b/libexec/dma/dma.c index dd408aac33..6c910a009e 100644 --- a/libexec/dma/dma.c +++ b/libexec/dma/dma.c @@ -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.2 2008/02/03 18:41:40 matthias Exp $ + * $DragonFly: src/libexec/dma/dma.c,v 1.3 2008/02/04 08:58:54 matthias Exp $ */ #include @@ -825,11 +825,9 @@ main(int argc, char **argv) { char *sender = NULL; char tag[255]; - char confpath[PATH_MAX]; struct qitem *it; struct queue queue; struct queue lqueue; - struct stat sb; int i, ch; int nodot = 0, doqueue = 0, showq = 0; @@ -895,13 +893,7 @@ main(int argc, char **argv) errx(1, "Cannot allocate enough memory"); memset(config, 0, sizeof(struct config)); - - /* Check if the user has its own config files */ - snprintf(confpath, PATH_MAX, "%s/.dma/dma.conf", getenv("HOME")); - if (stat(confpath, &sb) < 0) - snprintf(confpath, PATH_MAX, "%s", CONF_PATH); - - if (parse_conf(confpath, config) < 0) { + if (parse_conf(CONF_PATH, config) < 0) { free(config); errx(1, "reading config file"); } diff --git a/libexec/dma/net.c b/libexec/dma/net.c index b8ab7ccc46..7373aaa405 100644 --- a/libexec/dma/net.c +++ b/libexec/dma/net.c @@ -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.2 2008/02/03 11:06:17 matthias Exp $ + * $DragonFly: src/libexec/dma/net.c,v 1.3 2008/02/04 08:58:54 matthias Exp $ */ #include @@ -184,14 +184,9 @@ smtp_login(struct qitem *it, int fd, char *login, char* password) static int open_connection(struct qitem *it, const char *host) { -#ifdef HAVE_INET6 struct addrinfo hints, *res, *res0; char servname[128]; const char *errmsg = NULL; -#else - struct hostent *hn; - struct sockaddr_in addr; -#endif int fd, error = 0, port; if (config->port != 0) @@ -199,7 +194,6 @@ open_connection(struct qitem *it, const char *host) else port = SMTP_PORT; -#ifdef HAVE_INET6 /* Shamelessly taken from getaddrinfo(3) */ memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; @@ -235,36 +229,6 @@ open_connection(struct qitem *it, const char *host) return (-1); } freeaddrinfo(res0); -#else - memset(&addr, 0, sizeof(addr)); - fd = socket(AF_INET, SOCK_STREAM, 0); - addr.sin_family = AF_INET; - - addr.sin_port = htons(port); - error = inet_pton(AF_INET, host, &addr.sin_addr); - if (error < 0) { - syslog(LOG_ERR, "%s: remote delivery deferred: " - "address conversion failed: %m", it->queueid); - return (1); - } - hn = gethostbyname(host); - if (hn == NULL) { - syslog(LOG_ERR, "%s: remote delivery deferred: cannot resolve " - "hostname (%s) %m", it->queueid, host); - return (-1); - } else { - memcpy(&addr.sin_addr, hn->h_addr, sizeof(struct in_addr)); - if (hn->h_length != 4) - return (-1); - } - - error = connect(fd, (struct sockaddr *) &addr, sizeof(addr)); - if (error < 0) { - syslog(LOG_ERR, "%s: remote delivery deferred: " - "connection failed : %m", it->queueid); - return (-1); - } -#endif return (fd); }