aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README28
-rw-r--r--ckaliases/Makefile.am23
-rw-r--r--ckaliases/ckaliases.c321
-rw-r--r--ckaliases/ckaliases.h71
-rw-r--r--ckaliases/gram.y281
-rw-r--r--ckaliases/lex.l211
-rw-r--r--doc/gsc.texi150
-rwxr-xr-x[-rw-r--r--]rc.d/rc.inet116
8 files changed, 13 insertions, 1088 deletions
diff --git a/README b/README
index 0d01089..b3e623e 100644
--- a/README
+++ b/README
@@ -9,35 +9,9 @@ various utilities I use on my machines. Basically, it was intended
for my own use, but you may find it useful too. All scripts and
programs are under GPL version 3 (or later).
-* Installation
-
- Configure and make:
-
- ./configure [OPTIONS]
- make
- make install
-
- See the file INSTALL for the description of ./configure and its
-generic options. The options and variables specific to GSC are
-described below:
-
---enable-sendfile
- Attempt to use sendfile(2) when possible
-
---enable-modules
- Enable only modules from XMODLIST. This is not fully supported yet.
-
---with-sendmail-version=VERSION
- Build .cf files for the given version of Sendmail.
-
---with-sendmail-cfdir=DIR
- Specify full name of Sendmail cf directory (e.g.:
- /usr/src/sendmail-8.13.1/cf/cf). Use this option only if
- `--with-sendmail-version' does not work.
-
* Documentation
- Full documentation is shipped in doc subdirectory
+ Complete documentation is shipped in doc subdirectory
* Bug reporting.
diff --git a/ckaliases/Makefile.am b/ckaliases/Makefile.am
deleted file mode 100644
index 12f531c..0000000
--- a/ckaliases/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-# This file is part of GSC
-# Copyright (C) 2005, 2006, 2007 Sergey Poznyakoff
-#
-# GSC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GSC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GSC. If not, see <http://www.gnu.org/licenses/>.
-
-AM_YFLAGS=-vtd
-AM_LFLAGS=-d
-sbin_PROGRAMS=ckaliases
-noinst_HEADERS=gram.h
-ckaliases_SOURCES=gram.y lex.l ckaliases.c ckaliases.h
-LDADD=../lib/libgsc.a ../gnu/libgnu.a
-INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gnu -I../gnu
diff --git a/ckaliases/ckaliases.c b/ckaliases/ckaliases.c
deleted file mode 100644
index d77e62d..0000000
--- a/ckaliases/ckaliases.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* ckaliases - verify syntax of sendmail-style alias files
- Copyright (C) 2005, 2007 Sergey Poznyakoff
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "ckaliases.h"
-
-#ifndef CHAR_BIT
-# define CHAR_BIT 8
-#endif
-#define BITS_PER_WORD (sizeof(unsigned)*CHAR_BIT)
-#define MAXTABLE 32767
-
-#define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD)
-#define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD)))
-#define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD)))
-#define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0)
-
-/* given n by n matrix of bits R, modify its contents
- to be the transitive closure of what was given. */
-
-void
-TC (unsigned *R, int n)
-{
- register int rowsize;
- register unsigned mask;
- register unsigned *rowj;
- register unsigned *rp;
- register unsigned *rend;
- register unsigned *ccol;
-
- unsigned *relend;
- unsigned *cword;
- unsigned *rowi;
-
- rowsize = WORDSIZE (n) * sizeof (unsigned);
- relend = (unsigned *) ((char *) R + (n * rowsize));
-
- cword = R;
- mask = 1;
- rowi = R;
- while (rowi < relend)
- {
- ccol = cword;
- rowj = R;
-
- while (rowj < relend)
- {
- if (*ccol & mask)
- {
- rp = rowi;
- rend = (unsigned *) ((char *) rowj + rowsize);
-
- while (rowj < rend)
- *rowj++ |= *rp++;
- }
- else
- {
- rowj = (unsigned *) ((char *) rowj + rowsize);
- }
-
- ccol = (unsigned *) ((char *) ccol + rowsize);
- }
-
- mask <<= 1;
- if (mask == 0)
- {
- mask = 1;
- cword++;
- }
- rowi = (unsigned *) ((char *) rowi + rowsize);
- }
-}
-
-
-void
-slist_add (SLIST **plist, char *str)
-{
- struct string_list *p = xmalloc (sizeof (*p));
- p->str = str;
- p->next = NULL;
-
- if (!*plist)
- {
- *plist = xmalloc (sizeof (**plist));
- (*plist)->head = NULL;
- }
-
- if ((*plist)->head == NULL)
- {
- (*plist)->head = p;
- (*plist)->count = 0;
- }
- else
- {
- (*plist)->tail->next = p;
- (*plist)->count++;
- }
- (*plist)->tail = p;
-}
-
-void
-slist_append (SLIST **pdst, SLIST *src)
-{
- struct string_list *tail;
-
- if (!*pdst)
- {
- *pdst = xmalloc (sizeof (**pdst));
- (*pdst)->head = NULL;
- (*pdst)->count = 0;
- }
-
- if ((*pdst)->head = NULL)
- (*pdst)->head = src->head;
-
- for (tail = src->tail; tail->next; tail = tail->next)
- ;
-
- (*pdst)->tail = tail;
- (*pdst)->count += src->count;
-}
-
-char *
-slist_member (SLIST *plist, char *name)
-{
- struct string_list *p;
-
- if (plist)
- for (p = plist->head; p; p = p->next)
- if (p->str && strcmp (p->str, name) == 0)
- return p->str;
- return NULL;
-}
-
-void
-slist_destroy (SLIST **plist)
-{
- struct string_list *p;
- if (!plist || !*plist)
- return;
- p = (*plist)->head;
- while (p)
- {
- struct string_list *next = p->next;
- free (p);
- p = next;
- }
- free (*plist);
- *plist = NULL;
-}
-
-
-typedef struct
-{
- char *name;
- SLIST *exp;
-} ALIAS;
-
-struct obstack alias_stk;
-unsigned alias_count;
-ALIAS *aliases;
-
-void
-regalias (char *name, SLIST *exp)
-{
- ALIAS a;
- a.name = name;
- a.exp = exp;
- obstack_grow (&alias_stk, &a, sizeof a);
- alias_count++;
-}
-
-void
-begin_aliases ()
-{
- obstack_init (&alias_stk);
-}
-
-static int
-alias_cmp (const void *a, const void *b)
-{
- return strcmp (((ALIAS *) a)->name, ((ALIAS *) b)->name);
-}
-
-static int
-alias_cmp2 (const void *a, const void *b)
-{
- char *aname = ((ALIAS *) a)->name;
- char *bname = ((ALIAS *) b)->name;
- int rc;
- int alen;
- int blen;
- char *p;
-
- if ((p = strchr (aname, '@')) && slist_member (cw_list, p + 1))
- alen = p - aname;
- else
- alen = strlen (aname);
-
- if ((p = strchr (bname, '@')) && slist_member (cw_list, p + 1))
- blen = p - bname;
- else
- blen = strlen (bname);
-
- if (alen == blen)
- return memcmp (aname, bname, alen);
-
- return strcmp (aname, bname);
-}
-
-void
-end_aliases ()
-{
- int i;
- aliases = obstack_finish (&alias_stk);
- qsort (aliases, alias_count, sizeof aliases[0], alias_cmp);
- for (i = 1; i < alias_count; i++)
- if (alias_cmp (aliases + i - 1, aliases + i) == 0)
- {
- error (0, 0, "alias `%s' multiply defined", aliases[i].name);
- error_count++;
- }
-}
-
-
-int
-find_alias (char *name)
-{
- ALIAS a, *p;
-
- if (!name)
- return -1;
- a.name = name;
- p = bsearch (&a, aliases, alias_count, sizeof aliases[0], alias_cmp2);
- return p ? p - aliases : -1;
-}
-
-
-static void
-alias_setbit (unsigned *r, unsigned rowsize, unsigned row, unsigned col)
-{
- SETBIT (r + rowsize * row, col);
-}
-
-static int
-alias_bitisset (unsigned *r, unsigned rowsize, unsigned row, unsigned col)
-{
- return BITISSET (r + rowsize * row, col);
-}
-
-
-void
-mark_connected (unsigned *r, unsigned size)
-{
- int i;
-
- for (i = 0; i < alias_count; i++)
- {
- if (aliases[i].exp)
- {
- struct string_list *p;
- for (p = aliases[i].exp->head; p; p = p->next)
- {
- int n = find_alias (p->str);
- if (n >= 0)
- alias_setbit (r, size, i, n);
- }
- }
- }
-}
-
-void
-check_circular_deps (unsigned *r, unsigned size)
-{
- int i;
-
- for (i = 0; i < alias_count; i++)
- {
- if (alias_bitisset (r, size, i, i))
- {
- error (0, 0, "%s: circular dependency", aliases[i].name);
- error_count++;
- }
- }
-}
-
-void
-check_aliases ()
-{
- size_t size;
- unsigned *r;
-
- /* Allocate matrix */
- size = (alias_count + BITS_PER_WORD - 1) / BITS_PER_WORD;
- r = xmalloc (alias_count * size * sizeof (*r));
- memset (r, 0, alias_count * size * sizeof (*r));
-
- /* First pass: mark directly connected entries */
- mark_connected (r, size);
-
- /* Compute transitive closure of the matrix r */
- TC (r, alias_count);
-
- /* Third pass: check for circular deps */
- check_circular_deps (r, size);
-
- if (verbose)
- printf ("%lu aliases\n", alias_count);
-}
diff --git a/ckaliases/ckaliases.h b/ckaliases/ckaliases.h
deleted file mode 100644
index d3e053c..0000000
--- a/ckaliases/ckaliases.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ckaliases - verify syntax of sendmail-style alias files
- Copyright (C) 2005 Sergey Poznyakoff
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#define obstack_chunk_alloc malloc
-#define obstack_chunk_free free
-#include <obstack.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include "getopt.h"
-#include "progname.h"
-#include "error.h"
-#include "xalloc.h"
-
-extern char *file_name;
-extern int line_num;
-extern int error_count;
-
-void init_lex ();
-void lex_debug (int n);
-void openaliases (char *name);
-void openaliases_prefix (char *prefix, char *name);
-
-struct string_list
-{
- struct string_list *next;
- char *str;
-};
-
-typedef struct slist
-{
- struct string_list *head, *tail;
- int count;
-} SLIST;
-
-void slist_add (SLIST ** plist, char *str);
-void slist_append (SLIST ** pdst, SLIST * src);
-char *slist_member (SLIST * plist, char *name);
-void slist_destroy (SLIST ** plist);
-
-void read_include (SLIST ** plist, char *name);
-
-void regalias (char *name, SLIST * exp);
-void begin_aliases (void);
-void end_aliases (void);
-
-extern SLIST *cw_list;
-extern int verbose;
diff --git a/ckaliases/gram.y b/ckaliases/gram.y
deleted file mode 100644
index dd323be..0000000
--- a/ckaliases/gram.y
+++ /dev/null
@@ -1,281 +0,0 @@
-%{
-/* ckaliases - verify syntax of sendmail-style alias files
- Copyright (C) 2005, 2007 Sergey Poznyakoff
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "ckaliases.h"
-
-SLIST *cw_list; /* List of domain names pertaining to Sendmail 'w' class */
-static int restricted; /* prohibit use of `special' aliases (pipes,
- file redirections and includes */
-int verbose; /* Verbose mode */
-int error_count; /* Number of errors detected so far */
-%}
-
-%union {
- char *string;
- SLIST *slist;
-};
-
-%token <string> IDENT EMAIL STRING LHS
-%token CONT
-%token EOL
-%token INCLUDE
-
-%type <string> string lhs
-%type <slist> rhs emails email
-
-%%
-
-input : list
- ;
-
-list : alias
- | list EOL alias
- | list error EOL
- {
- yyclearin;
- yyerrok;
- }
- ;
-
-alias : /* empty */
- | lhs rhs
- {
- regalias ($1, $2);
- }
- ;
-
-lhs : LHS ':'
- ;
-
-rhs : emails
- | rhs CONT emails
- {
- slist_append (&$1, $3);
- $$ = $1;
- }
- ;
-
-emails: email
- | emails ',' email
- {
- slist_append (&$1, $3);
- $$ = $1;
- }
- ;
-
-email : string
- {
- if (restricted && ($1[0] == '|' || $1[0] == '/'))
- {
- yyerror ("Construct not allowed");
- YYERROR;
- }
- $$ = NULL;
- slist_add (&$$, $1);
- }
- | EMAIL
- {
- $$ = NULL;
- slist_add (&$$, $1);
- }
- | INCLUDE string
- {
- if (restricted)
- {
- yyerror ("Include statement is not allowed");
- YYERROR;
- }
- $$ = NULL;
- read_include (&$$, $2);
- }
- ;
-
-string: IDENT
- | STRING
- ;
-
-%%
-
-int
-yyerror (char *s)
-{
- error_at_line (0, 0, file_name, line_num, "%s", s);
- error_count++;
-}
-
-
-void
-usage ()
-{
- printf ("usage: ckaliases [OPTIONS] [FILES...]\n");
- printf ("OPTIONS and FILES may be interspered.\n");
- printf ("Valid options are:\n");
- printf (" -d,--debug=SPEC Set debug level. SPEC consists of the following\n");
- printf (" letters:\n");
- printf (" y enable parser debugging\n");
- printf (" l enable lexical analizer debugging\n");
- printf (" Upper-case variants are also accepted. Prepending\n");
- printf (" a letter with '-' reverts its sense\n");
- printf (" -f, --files-from=FILE\n");
- printf (" Read names of alias files from FILE\n");
- printf (" -h, --help Display this help list\n");
- printf (" -r, --restrict Restrict alias file syntax to aliases only (i.e.\n");
- printf (" prohibit use of pipes and file redirections\n");
- printf (" -u, --unrestrict Revert the effect of the previous -r option\n");
- printf (" -v, --verbose Verbose mode\n");
- printf (" -V, --version print program version and exit\n");
- printf (" -w FILE Read contents of Sendmail `w' class from the given\n");
- printf (" file.\n");
- printf ("\n");
- printf ("Report bugs to <%s>\n", PACKAGE_BUGREPORT);
-}
-
-struct option options[] = {
- { "debug", required_argument, NULL, 'd' },
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "restrict", no_argument, NULL, 'r' },
- { "unrestrict", no_argument, NULL, 'u' },
- { "verbose", no_argument, NULL, 'v' },
- { "files-from", required_argument, NULL, 'f' },
- { NULL }
-};
-
-int
-main (int argc, char **argv)
-{
- char *p;
- int c;
- int file_count = 0;
- int true = 1;
- char *cwfile = "/etc/mail/sendmail.cw";
- SLIST *file_list; /* List of files to be read */
- struct string_list *s;
-
- begin_aliases ();
- init_lex ();
- program_name = argv[0];
- while ((c = getopt_long (argc, argv, "-d:f:hp:ruvw:", options, NULL)) != EOF)
- {
- switch (c)
- {
- case 1:
- if (!cw_list)
- read_include (&cw_list, cwfile);
- openaliases (optarg);
- yyparse ();
- file_count++;
- break;
-
- case 'd':
- for (p = optarg; *p; p++)
- {
- switch (*p)
- {
- case '-':
- true = 0;
- break;
-
- case 'y':
- case 'Y':
- yydebug = true;
- true = 1;
- break;
-
- case 'l':
- case 'L':
- lex_debug (true);
- true = 1;
- break;
-
- default:
- error (1, 0, "%s: unknown debug option %c", argv[0]);
- }
- }
- break;
-
- case 'f':
- if (!cw_list)
- read_include (&cw_list, cwfile);
- file_list = NULL;
- read_include (&file_list, optarg);
- if (file_list)
- {
- for (s = file_list->head; s; s = s->next)
- {
- openaliases_prefix (optarg, s->str);
- yyparse ();
- file_count++;
- }
- slist_destroy (&file_list);
- }
- break;
-
- case 'h':
- usage ();
- exit (0);
-
- case 'r':
- restricted = 1;
- break;
-
- case 'u':
- restricted = 0;
- break;
-
- case 'v':
- verbose++;
- break;
-
- case 'V':
- gsc_version ("ckaliases");
- exit (0);
-
- case 'w':
- if (file_count)
- error (1, 0, "-w must be used before first non-option argument");
- cwfile = optarg;
- break;
-
- default:
- exit (1);
- }
- }
-
- argc -= optind;
- argv += optind;
-
- if (!cw_list)
- read_include (&cw_list, cwfile);
- while (argc--)
- {
- openaliases (*argv++);
- yyparse ();
- file_count++;
- }
-
- if (!file_count)
- error (1, 0, "no files specified");
-
- if (verbose)
- printf ("%d files\n", file_count);
- end_aliases ();
- check_aliases ();
- if (verbose)
- printf ("%lu errors\n", error_count);
- exit (error_count!=0);
-}
diff --git a/ckaliases/lex.l b/ckaliases/lex.l
deleted file mode 100644
index ba48a9c..0000000
--- a/ckaliases/lex.l
+++ /dev/null
@@ -1,211 +0,0 @@
-%{
-/* ckaliases - verify syntax of sendmail-style alias files
- Copyright (C) 2005, 2007 Sergey Poznyakoff
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "ckaliases.h"
-#include "gram.h"
-
-static void line_begin (void);
-static void line_add (char *text, size_t len);
-static void line_add_unescape (char *text, size_t len);
-static void line_finish (void);
-
-struct obstack string_stk;
-
-char *file_name;
-int line_num;
-
-%}
-
-
-%x STR
-IDENT [a-zA-Z0-9_\-+\./]+
-WS [ \t]
-SPEC [:@\\]
-%%
- /* Comments */
-#.*\n { line_num++; return EOL; }
- /* White space */
-^{WS}+\n { line_num++; return EOL; }
-{WS}+ ;
- /* Names and emails */
-:include: return INCLUDE;
-^{IDENT} {
- line_begin ();
- line_add (yytext, yyleng);
- line_finish ();
- return LHS; }
-{IDENT}@{IDENT} {
- line_begin ();
- line_add (yytext, yyleng);
- line_finish ();
- return EMAIL; }
-{IDENT} { line_begin ();
- line_add (yytext, yyleng);
- line_finish ();
- return IDENT; }
- /* Quoted strings */
-\"[^\\"\n]*\" { line_begin ();
- line_add (yytext, yyleng);
- line_finish ();
- return STRING; }
-\"[^\\"\n]*\\. { BEGIN (STR);
- line_begin ();
- line_add_unescape (yytext + 1, yyleng - 1); }
-<STR>[^\\"\n]*\\. { line_add_unescape (yytext, yyleng); }
-<STR>[^\\"\n]*\" { BEGIN (INITIAL);
- if (yyleng > 1)
- line_add (yytext, yyleng - 1);
- line_finish ();
- return STRING; }
- /* Other characters */
-{SPEC} return yytext[0];
-\\\n { line_num++; }
-\n{WS}+/[^ \t\n] { line_num++; return CONT; }
-\n { line_num++; return EOL; }
-, return yytext[0];
-. { error_at_line (0, 0, file_name, line_num,
- "Stray character %03o in alias file", yytext[0]);
- error_count++; }
-%%
-
-int
-yywrap ()
-{
- fclose (yyin);
- return 1;
-}
-
-static char escape_transtab[] = "\\\\a\ab\bf\fn\nr\rt\t";
-
-int
-unescape_char (int c)
-{
- char *p;
-
- for (p = escape_transtab; *p; p += 2)
- {
- if (*p == c)
- return p[1];
- }
- return c;
-}
-
-void
-line_add (char *text, size_t len)
-{
- obstack_grow (&string_stk, text, len);
-}
-
-void
-line_add_unescape (char *text, size_t len)
-{
- char c;
- obstack_grow (&string_stk, text, len - 2);
- c = unescape_char (text[len - 1]);
- obstack_1grow (&string_stk, c);
-}
-
-void
-line_begin ()
-{
-}
-
-void
-line_finish ()
-{
- obstack_1grow (&string_stk, 0);
- yylval.string = obstack_finish (&string_stk);
-}
-
-void
-openaliases (char *name)
-{
- yyin = fopen (name, "r");
- if (!yyin)
- error (1, errno, "cannot open file `%s'", name);
- file_name = name;
- line_num = 0;
-}
-
-void
-openaliases_prefix (char *prefix, char *name)
-{
- char *fullname = NULL;
- struct stat st;
-
- if (stat (prefix, &st))
- error (1, errno, "cannot stat `%s'", prefix);
-
- if (!S_ISDIR (st.st_mode))
- {
- char *p = strrchr (prefix, '/');
- if (p)
- *p = 0;
- else
- prefix = ".";
- }
- asprintf (&fullname, "%s/%s", prefix, name);
- openaliases (fullname);
- free (fullname);
-}
-
-void
-init_lex ()
-{
- obstack_init (&string_stk);
- yy_flex_debug = 0;
-}
-
-void
-lex_debug (int debug)
-{
- yy_flex_debug = debug;
-}
-
-void
-read_include (SLIST **plist, char *name)
-{
- char *p;
- char buffer[256];
- FILE *fp = fopen (name, "r");
-
- if (!fp)
- {
- error_at_line (0, 0, file_name, line_num,
- "cannot open include file `%s': %s",
- name, strerror (errno));
- error_count++;
- return;
- }
-
- while (p = fgets (buffer, sizeof buffer, fp))
- {
- char *q;
-
- while (*p && isspace (*p))
- p++;
- if (*p == '#')
- continue;
- for (q = p + strlen (p) - 1; q > p && isspace (*q); q--)
- ;
- q[1] = 0;
- if (*p)
- slist_add (plist, strdup (p));
- }
- fclose (fp);
-}
-
diff --git a/doc/gsc.texi b/doc/gsc.texi
index ad7c127..ac7018e 100644
--- a/doc/gsc.texi
+++ b/doc/gsc.texi
@@ -113,7 +113,6 @@ Source Tree Utilities
Root Utilities
-* ckaliases:: Check MTA alias files.
* bind replication:: A Framework for Replicating Master @command{bind} Server.
* firewall:: M4 Wrappers For Setting Firewalls.
* session-cleanup:: Manage PHP Sessions.
@@ -800,160 +799,11 @@ cases, though not always. Such files should probably be inspected after
This chapter describes a set of utilities useful in system administration.
@menu
-* ckaliases:: Check MTA alias files.
* bind replication:: A Framework for Replicating Master @command{bind} Server.
* firewall:: M4 Wrappers For Setting Firewalls.
* session-cleanup:: Manage PHP Sessions.
@end menu
-@node ckaliases
-@section ckaliases
-
-@pindex ckaliases
- @command{Ckaliases} checks one or several
-@command{sendmail}-style alias files for consistency. Following
-checks are performed:
-
-@enumerate 1
-@item Transitivity check
- This check discovers eventual circular dependencies.
-
-@item Use of prohibited aliases
-@end enumerate
-
- The program returns 0 if all checks pass successfully. Otherwise,
-it diagnoses encountered problems and exits with error code 1.
-
-@cindex @option{--files-from}, ckaliases option
-@cindex @option{-f}, ckaliases option
-@cindex ckaliases, @option{--files-from} command line option
-@cindex ckaliases, @option{-f} command line option
- The program takes a list of alias files to be checked from its command
-line. Additionally, the command line option @option{--files-from}
-(@option{-f}) can be used to read the list of file names from a
-plain-text file. Such a file must contain one file name per
-line. Empty lines and lines beginning with @samp{#} are ignored. Any
-file name that does not begin with a @samp{/} is searched in the same
-directory where the list file resides. For example, assuming that the file
-@file{/etc/mailman/LIST} contains:
-
-@smallexample
-mailman
-mailman-test
-@end smallexample
-
-@noindent
-then, the following invocation
-
-@smallexample
-$ ckaliases /etc/mail/aliases --files-from=/etc/mailman/LIST
-@end smallexample
-
-@noindent
-instructs @command{ckaliases} to process files
-@file{/etc/mail/aliases}, @file{/etc/mailman/mailman} and
-@file{/etc/mailman/mailman-test}, in that order.
-
- In any case, if several alias files are supplied,
-@command{ckaliases} treats them as parts of a single alias file.
-
-@cindex @option{-w}, ckaliases option
-@cindex ckaliases, @option{-w} command line option
- Before processing its input files, @command{ckaliases} reads
-definitions of Sendmail @code{w} class from file
-@file{/etc/mail/sendmail.cw}, or from a file specified using
-@option{-w} command line option. For example, running
-
-@smallexample
-ckaliases -w /etc/mail/local-domains aliases
-@end smallexample
-
-@noindent
-instructs @command{ckaliases} to use @file{/etc/mail/local-domains}.
-
-@cindex @option{-r}, ckaliases option
-@cindex @option{--restrict}, ckaliases option
-@cindex ckaliases, @option{-r} command line option
-@cindex ckaliases, @option{--restrict} command line option
-@cindex @option{-u}, ckaliases option
-@cindex @option{--unrestrict}, ckaliases option
-@cindex ckaliases, @option{-u} command line option
-@cindex ckaliases, @option{--unrestrict} command line option
- By default, the program allows any valid Sendmail constructions
-in its input files. To restrict the input syntax to plain aliases only,
-i.e. to prohibit use of pipes and file redirections, use
-@option{--restrict} (@option{-r}) command line option. This option
-affects any file names following it. To cances the restriction, use
-@option{--unrestrict} (@option{-u}) option. For example:
-
-@smallexample
-ckaliases aliases -r local -u global
-@end smallexample
-
-@noindent
-This command restricts @file{local} to plain aliases only, while
-allowing any aliases in files @file{aliases} and @file{global}.
-
-@cindex @option{-v}, ckaliases option
-@cindex @option{--verbose}, ckaliases option
-@cindex ckaliases, @option{-v} command line option
-@cindex ckaliases, @option{--verbose} command line option
-@cindex @option{-d}, ckaliases option
-@cindex @option{--debug}, ckaliases option
-@cindex ckaliases, @option{-d} command line option
-@cindex ckaliases, @option{--debug} command line option
- Two options are provided to help trace and debug program
-actions. First, @option{--verbose} (@option{-v}) increases the verbosity
-level. Secondly, @option{--debug} (@option{-d}) enables debugging
-mode. This option takes a mandatory argument, a string specifying part
-or parts of the program to debug. The characters valid in this string are:
-
-@table @asis
-@item l or L
- Enable lexical analyzer debugging information.
-
-@item y or Y
- Enable debugging input grammar analyzer (parser).
-@end table
-
- Any of these characters can be prefixed with @samp{-} (a dash),
-to disable corresponding debugging feature, e.g. @code{-d y-l}.
-
-@cindex @option{-h}, ckaliases option
-@cindex @option{--help}, ckaliases option
-@cindex ckaliases, @option{-h} command line option
-@cindex ckaliases, @option{--help} command line option
- Finally, two usual informational options are available. The
-@option{--help} (@option{-h}) displays a short usage summary, and
-@option{--verbose} (@option{-v}) shows the program version number and
-short reference to its copying conditions.
-
-@subheading Example of @command{ckaliases} usage
-
-@cindex @command{ckaliases}, example
- The following @file{/etc/mail/Makefile} rule constructs
-@file{aliases} from several input files, provided that these are
-valid alias files:
-
-@smallexample
-@group
-aliases: .depend Aliases mailman/LISTS /com/mailer/aliases
- ckaliases Aliases -f mailman/LISTS -r /com/mailer/aliases
- @@(echo "# WARNING: DO NOT EDIT THIS FILE!!!"; \
- cat Aliases;\
- cat mailman/LISTS | \
- (cd mailman; \
- while read name; \
- do \
- case $$name in \
- \#*) ;; \
- *) cat $$name;; \
- esac;\
- done);\
- cat /com/mailer/aliases) > aliases
-@end group
-@end smallexample
-
@node bind replication
@section bind replication
@UNREVISED{}
diff --git a/rc.d/rc.inet1 b/rc.d/rc.inet1
index 69eba74..b050eea 100644..100755
--- a/rc.d/rc.inet1
+++ b/rc.d/rc.inet1
@@ -17,6 +17,10 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
+# Additional scripts to be run at the start and end of this one:
+prologue_hook=
+epilogue_hook=
+
############### Configurable part. Tailor to suit your needs #################
# Ethernet setup:
# A list of interfaces to be configured. If a name contains colons (:) replace
@@ -38,12 +42,12 @@ route_1="add -net 192.168.10.0 netmask 255.255.255.224 gw 192.168.10.10 metric 2
################# !!! NOTHING TO MODIFY BELOW THIS LINE !!! ###################
-HOSTNAME=`cat /etc/HOSTNAME`
-
start() {
+ test -r /etc/mactab && /sbin/nameif
+ test -n "$prologue_hook" && $prologue_hook start
for iface in $if_list
do
- ifname=`echo $iface|sed 's/_/:/g'`
+ ifname=`echo $iface|sed 's/__/-/g;s/_/:/g'`
eval ifconfig_args=\$if_${iface}
if [ -n "${ifconfig_args}" ]; then
/sbin/ifconfig $ifname $ifconfig_args
@@ -66,14 +70,18 @@ start() {
/sbin/route $route_args
fi
done
+
+ test -n "$epilogue_hook" && $epilogue_hook start
}
stop() {
+ test -n "$epilogue_hook" && $epilogue_hook stop
for iface in $if_list
do
- ifname=`echo $iface|sed 's/_/:/g'`
+ ifname=`echo $iface|sed 's/__/-/g;s/_/:/g'`
/sbin/ifconfig $ifname down
done