]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
mlmmj: get rid of getlistaddr code
authorBaptiste Daroussin <bapt@FreeBSD.org>
Thu, 28 Oct 2021 16:21:07 +0000 (18:21 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Thu, 28 Oct 2021 16:21:07 +0000 (18:21 +0200)
include/getlistaddr.h [deleted file]
src/Makefile.am
src/getlistaddr.c [deleted file]
src/mlmmj.c

diff --git a/include/getlistaddr.h b/include/getlistaddr.h
deleted file mode 100644 (file)
index cee8177..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2002, 2003 Mads Martin Joergensen <mmj at mmj.dk>
- *
- * $Id$
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef GETLISTADDR_H
-#define GETLISTADDR_H
-
-char *getlistaddr(const char *listdir);
-
-#endif /* GETLISTADDR_H */
index cbe2c83df9165b7b5b9d9c92668991db72741dcb..3af5d559b0babb3291988e1962b0a06994f8e6ee 100644 (file)
@@ -12,7 +12,7 @@ bin_SCRIPTS = mlmmj-make-ml
 EXTRA_DIST = mlmmj-make-ml
 
 mlmmj_send_SOURCES = mlmmj.c mlmmj-send.c writen.c mail-functions.c itoa.c chomp.c \
-                     incindexfile.c checkwait_smtpreply.c getlistaddr.c \
+                     incindexfile.c checkwait_smtpreply.c  \
                     mylocking.c init_sockfd.c strgen.c random-int.c \
                     print-version.c log_error.c mygetline.c memory.c \
                     controls.c getaddrsfromfd.c readn.c \
@@ -23,7 +23,7 @@ mlmmj_receive_SOURCES = mlmmj-receive.c writen.c random-int.c strgen.c \
                        log_oper.c mylocking.c readn.c
 
 mlmmj_process_SOURCES = mlmmj.c mlmmj-process.c writen.c find_email_adr.c \
-                       incindexfile.c itoa.c getlistaddr.c chomp.c \
+                       incindexfile.c itoa.c  chomp.c \
                        mylocking.c listcontrol.c random-int.c strgen.c \
                        print-version.c send_help.c prepstdreply.c \
                        do_all_the_voodoo_here.c mygetline.c gethdrline.c \
@@ -32,27 +32,27 @@ mlmmj_process_SOURCES = mlmmj.c mlmmj-process.c writen.c find_email_adr.c \
                        send_list.c readn.c getlistdelim.c unistr.c
 
 mlmmj_sub_SOURCES = mlmmj.c mlmmj-sub.c writen.c mylocking.c \
-                       getlistaddr.c chomp.c random-int.c strgen.c \
+                        chomp.c random-int.c strgen.c \
                        subscriberfuncs.c print-version.c \
                        log_error.c mygetline.c prepstdreply.c memory.c \
                        controls.c readn.c getlistdelim.c \
                        unistr.c
 
 mlmmj_unsub_SOURCES = mlmmj.c mlmmj-unsub.c writen.c mylocking.c \
-                       getlistaddr.c chomp.c subscriberfuncs.c random-int.c \
+                        chomp.c subscriberfuncs.c random-int.c \
                        strgen.c print-version.c log_error.c mygetline.c \
                        prepstdreply.c memory.c controls.c readn.c \
                        getlistdelim.c unistr.c
                        
 mlmmj_bounce_SOURCES = mlmmj.c mlmmj-bounce.c print-version.c log_error.c \
                       subscriberfuncs.c strgen.c random-int.c writen.c \
-                      prepstdreply.c mygetline.c chomp.c getlistaddr.c \
+                      prepstdreply.c mygetline.c chomp.c  \
                       memory.c find_email_adr.c gethdrline.c readn.c \
                       getlistdelim.c unistr.c controls.c
 
 mlmmj_maintd_SOURCES = mlmmj.c mlmmj-maintd.c print-version.c log_error.c mygetline.c \
                       strgen.c random-int.c chomp.c writen.c memory.c \
-                      send_digest.c getlistaddr.c dumpfd2fd.c \
+                      send_digest.c  dumpfd2fd.c \
                       mylocking.c log_oper.c readn.c getlistdelim.c \
                       prepstdreply.c gethdrline.c unistr.c controls.c
 
diff --git a/src/getlistaddr.c b/src/getlistaddr.c
deleted file mode 100644 (file)
index 29e853e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002, 2003 Mads Martin Joergensen <mmj at mmj.dk>
- *
- * $Id$
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "getlistaddr.h"
-#include "chomp.h"
-#include "log_error.h"
-#include "mygetline.h"
-#include "strgen.h"
-#include "memory.h"
-
-char *getlistaddr(const char *listdir)
-{
-       char *tmpstr;
-       int listnamefd;
-
-       tmpstr = concatstr(2, listdir, "/control/listaddress");;
-       if((listnamefd = open(tmpstr, O_RDONLY)) < 0) {
-               log_error(LOG_ARGS, "Could not open '%s'", tmpstr);
-               exit(EXIT_FAILURE);
-       }
-       myfree(tmpstr);
-
-       tmpstr = mygetline(listnamefd);
-
-       if(tmpstr == NULL){
-               log_error(LOG_ARGS, "FATAL. Could not get listaddress "
-                                   "in %s/control/listaddress", listdir);
-               exit(EXIT_FAILURE);
-       }
-
-       if(strchr(tmpstr, '@') == NULL) {
-               log_error(LOG_ARGS, "FATAL. No @ sign in listaddress");
-               exit(EXIT_FAILURE);
-       }
-
-       chomp(tmpstr);
-       close(listnamefd);
-
-       return tmpstr;
-}
index 0a53c4d87133829567c02b0de809e0894d4f56e1..d1c350e91fbf9d17fb46c1460d2ea4d04f9b7510 100644 (file)
 #include <err.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "memory.h"
 #include "strgen.h"
 #include "mlmmj.h"
-#include "getlistaddr.h"
 #include "getlistdelim.h"
+#include "controls.h"
 
 void
 mlmmj_list_init(struct mlmmj_list *list)
@@ -70,7 +71,9 @@ mlmmj_list_open(struct mlmmj_list *list)
                return (false);
        }
 
-       list->addr = getlistaddr(list->dir);
+       list->addr = ctrlvalue(list, "listaddress");
+       if (list->addr == NULL || strchr(list->addr, '@') == NULL)
+               errx(EXIT_FAILURE, "Invalid list address");
        list->delim = getlistdelim(list->dir);
        if (!splitlistaddr(list->addr, &list->name, &list->fqdn)) {
                errx(EXIT_FAILURE, "%s: is not a valid mailing list address,"