aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-10-22 23:03:24 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-10-23 00:42:30 +0300
commit21ffba77b92f79a59c62728ede4ad7a4ecb5a0ee (patch)
treec3204285a3ba57d590d815c682f1113b6f48d834
parenteb8797c9a28f3f4e238bad89b56d331492df7828 (diff)
downloadpies-21ffba77b92f79a59c62728ede4ad7a4ecb5a0ee.tar.gz
pies-21ffba77b92f79a59c62728ede4ad7a4ecb5a0ee.tar.bz2
Switch to the latest Grecs.
* Makefile.am (ChangeLog): Use git2chg.awk to build it. * NEWS: Update. * bootstrap.conf (gnulib_modules): Grecs does not depend on gnulib any more. * configure.ac: Version 1.2.90. Define GRECS_HOST_PROJECT_INCLUDES, remove grecs Makefiles from AC_CONFIG_FILES: it is now done by GRECS_SETUP itself. * gnulib.modules (gitlog-to-changelog,argp): Remove. (configmake): New module. * grecs: Update to a52ab6c6. * lib/libpies.h: Remove redefinitions of _() and N_(). * src/Makefile.am: Update for the recent grecs. * src/acl.c: Rewrite using Grecs support for lists and symtabs. * src/acl.h: Likewise. * src/diag.c: Likewise. * src/inetd.c: Likewise. * src/meta1gram.y: Likewise. * src/meta1lex.h: Likewise. * src/meta1lex.l: Likewise. * src/pies.c: Likewise. * src/pies.h: Likewise. * src/progman.c: Likewise. * src/userprivs.c: Likewise.
-rw-r--r--Makefile.am42
-rw-r--r--NEWS8
-rw-r--r--bootstrap.conf9
-rw-r--r--configure.ac9
-rw-r--r--gnulib.modules3
m---------grecs0
-rw-r--r--lib/libpies.h6
-rw-r--r--src/.gitignore1
-rw-r--r--src/Makefile.am17
-rw-r--r--src/acl.c206
-rw-r--r--src/acl.h4
-rw-r--r--src/cmdline.opt193
-rw-r--r--src/diag.c40
-rw-r--r--src/inetd.c18
-rw-r--r--src/meta1gram.y47
-rw-r--r--src/meta1lex.h3
-rw-r--r--src/meta1lex.l55
-rw-r--r--src/pies.c329
-rw-r--r--src/pies.h12
-rw-r--r--src/progman.c86
-rw-r--r--src/userprivs.c49
21 files changed, 562 insertions, 575 deletions
diff --git a/Makefile.am b/Makefile.am
index b3c49a2..de4bf81 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
1# This file is part of GNU Pies. 1# This file is part of GNU Pies.
2# Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff 2# Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
3# 3#
4# GNU Pies is free software; you can redistribute it and/or modify 4# GNU Pies is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -34,37 +34,19 @@ alpha:
34alphacheck: 34alphacheck:
35 $(MAKE) distcheck distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"` 35 $(MAKE) distcheck distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"`
36 36
37# Define the following variables in order to use the ChangeLog rule below: 37# Name of the previous ChangeLog file.
38# prev_change_log [optional] Name of the previous ChangeLog file.
39# gen_start_date [optional] Start ChangeLog from this date.
40# changelog_dir [mandatory] Directory where to create ChangeLog
41prev_change_log = ChangeLog.mfd 38prev_change_log = ChangeLog.mfd
39# Start Git ChangeLog from this date.
42gen_start_date = 2009-09-04 40gen_start_date = 2009-09-04
43changelog_dir = .
44 41
45.PHONY: ChangeLog 42.PHONY: ChangeLog
46ChangeLog: 43ChangeLog:
47 @if test -d .git; then \ 44 $(AM_V_GEN)if test -d .git; then \
48 cmd=$(top_srcdir)/build-aux/gitlog-to-changelog; \ 45 git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \
49 if test -n "$(gen_start_date)"; then \ 46 awk -f $(top_srcdir)/@GRECS_SUBDIR@/build-aux/git2chg.awk \
50 cmd="$$cmd --since=\"$(gen_start_date)\""; \ 47 -vsince=\"$(gen_start_date)\" -vappend=\"$(prev_change_log)\" \
51 fi; \ 48 > ChangeLog.tmp; \
52 $$cmd --format='%s%n%n%b%n' | \ 49 cmp ChangeLog ChangeLog.tmp > /dev/null 2>&1 || \
53 sed '/<unknown>$$/d' | fmt -s > $(changelog_dir)/cl-t; \ 50 mv ChangeLog.tmp ChangeLog; \
54 if test -n "$(prev_change_log)" && test -f "$(prev_change_log)"; \ 51 rm -f ChangeLog.tmp; \
55 then \
56 echo "" >> $(changelog_dir)/cl-t; \
57 cat "$(prev_change_log)" | \
58 sed '/^Local Variables:/,/^End:/d' >> $(changelog_dir)/cl-t; \
59 fi; \
60 echo "Local Variables:" >> $(changelog_dir)/cl-t; \
61 echo "mode: change-log" >> $(changelog_dir)/cl-t; \
62 echo "version-control: never" >> $(changelog_dir)/cl-t; \
63 echo "buffer-read-only: t" >> $(changelog_dir)/cl-t; \
64 echo "End:" >> $(changelog_dir)/cl-t; \
65 echo "" >> $(changelog_dir)/cl-t; \
66 sed -n '1,/^[^#]/s/^#//p' $(top_srcdir)/Makefile.am \
67 >> $(changelog_dir)/cl-t; \
68 rm -f $(changelog_dir)/ChangeLog; \
69 mv $(changelog_dir)/cl-t $(changelog_dir)/ChangeLog; \
70 fi 52 fi
diff --git a/NEWS b/NEWS
index d4b2392..9bc6609 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,13 @@
1GNU Pies NEWS -- history of user-visible changes. 2009-12-11 1GNU Pies NEWS -- history of user-visible changes. 2011-10-23
2Copyright (C) 2009, 2010 Sergey Poznyakoff 2Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3See the end of file for copying conditions. 3See the end of file for copying conditions.
4 4
5Please send Pies bug reports to <bug-pies@gnu.org> or 5Please send Pies bug reports to <bug-pies@gnu.org> or
6<bug-pies@gnu.org.ua> 6<bug-pies@gnu.org.ua>
7 7
8 8
9Version 1.2.90 (Git)
10
9Version 1.2, 2009-12-11 11Version 1.2, 2009-12-11
10 12
11* First release as a GNU package. 13* First release as a GNU package.
@@ -72,7 +74,7 @@ part of Mailfromd (http://mailfromd.software.gnu.org.ua).
72========================================================================= 74=========================================================================
73Copyright information: 75Copyright information:
74 76
75Copyright (C) 2009 Sergey Poznyakoff 77Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
76 78
77 Permission is granted to anyone to make or distribute verbatim copies 79 Permission is granted to anyone to make or distribute verbatim copies
78 of this document as received, in any medium, provided that the 80 of this document as received, in any medium, provided that the
diff --git a/bootstrap.conf b/bootstrap.conf
index 364978b..492aa78 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -1,5 +1,5 @@
1# Bootstrap configuration for GNU Pies. -*- shell-script -*- 1# Bootstrap configuration for GNU Pies. -*- shell-script -*-
2# Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff 2# Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
3# 3#
4# GNU Pies is free software; you can redistribute it and/or modify 4# GNU Pies is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -31,11 +31,12 @@ if [ -n "$MODAVOID" ]; then
31fi 31fi
32 32
33# gnulib modules used by this package. 33# gnulib modules used by this package.
34gnulib_modules=`grep -h '^[^#]' gnulib.modules grecs/gnulib.modules | sort | uniq` 34gnulib_modules=`grep -h '^[^#]' gnulib.modules | sort | uniq`
35 35
36NLS_MARKERS="\ 36NLS_MARKERS="\
37 mu_error:1" 37 mu_error:1\
38 38 grecs_error:3\
39 grecs_warning:3"
39 40
40# Additional xgettext options to use. Use "\\\newline" to break lines. 41# Additional xgettext options to use. Use "\\\newline" to break lines.
41if [ -n "$NLS_MARKERS" ]; then 42if [ -n "$NLS_MARKERS" ]; then
diff --git a/configure.ac b/configure.ac
index a8848dd..0c1d2b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
1# This file is part of GNU Pies. -*- autoconf -*- 1# This file is part of GNU Pies. -*- autoconf -*-
2# Copyright (C) 2009, 2010 Sergey Poznyakoff 2# Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3# 3#
4# GNU Pies is free software; you can redistribute it and/or modify 4# GNU Pies is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
15# along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. 15# along with GNU Pies. If not, see <http://www.gnu.org/licenses/>.
16 16
17AC_PREREQ([2.63]) 17AC_PREREQ([2.63])
18AC_INIT([GNU Pies], [1.2], [bug-pies@gnu.org.ua]) 18AC_INIT([GNU Pies], [1.2.90], [bug-pies@gnu.org.ua])
19AC_CONFIG_SRCDIR([src/pies.h]) 19AC_CONFIG_SRCDIR([src/pies.h])
20AC_CONFIG_AUX_DIR([build-aux]) 20AC_CONFIG_AUX_DIR([build-aux])
21AC_CONFIG_HEADERS([config.h]) 21AC_CONFIG_HEADERS([config.h])
@@ -57,7 +57,8 @@ AC_CHECK_FUNCS([alarm dup2 gethostbyname memmove memset select setenv socket str
57gl_INIT 57gl_INIT
58 58
59# Grecs 59# Grecs
60GRECS_SETUP 60GRECS_SETUP([grecs],[tests git2chg getopt])
61GRECS_HOST_PROJECT_INCLUDES='-I$(top_srcdir)/gnu -I$(top_builddir)/gnu'
61 62
62# Test for setproctitle 63# Test for setproctitle
63MF_PROCTITLE 64MF_PROCTITLE
@@ -85,8 +86,6 @@ IMPRIMATUR_INIT
85 86
86AC_CONFIG_FILES([Makefile 87AC_CONFIG_FILES([Makefile
87 gnu/Makefile 88 gnu/Makefile
88 grecs/Makefile
89 grecs/src/Makefile
90 lib/Makefile 89 lib/Makefile
91 src/Makefile 90 src/Makefile
92 doc/Makefile 91 doc/Makefile
diff --git a/gnulib.modules b/gnulib.modules
index d62e1a3..1e01a93 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -1,12 +1,11 @@
1# List of gnulib modules needed for Pies. 1# List of gnulib modules needed for Pies.
2# A module name per line. Empty lines and comments are ignored. 2# A module name per line. Empty lines and comments are ignored.
3 3
4argp
5c-ctype 4c-ctype
6c-strcase 5c-strcase
6configmake
7fprintftime 7fprintftime
8gettext 8gettext
9gitlog-to-changelog
10inttostr 9inttostr
11inttypes 10inttypes
12obstack 11obstack
diff --git a/grecs b/grecs
Subproject edcc575bcdc9e50bdb79f422ad0f11dc79f3eaa Subproject a52ab6c6c38e1dca047ada4d60249fb323942f0
diff --git a/lib/libpies.h b/lib/libpies.h
index 04910d5..d071846 100644
--- a/lib/libpies.h
+++ b/lib/libpies.h
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -19,10 +19,6 @@
19#include <gettext.h> 19#include <gettext.h>
20 20
21 21
22#define _(String) gettext(String)
23#define N_(String) String
24
25
26#if defined HAVE_SYSCONF && defined _SC_OPEN_MAX 22#if defined HAVE_SYSCONF && defined _SC_OPEN_MAX
27# define getmaxfd() sysconf(_SC_OPEN_MAX) 23# define getmaxfd() sysconf(_SC_OPEN_MAX)
28#elif defined (HAVE_GETDTABLESIZE) 24#elif defined (HAVE_GETDTABLESIZE)
diff --git a/src/.gitignore b/src/.gitignore
index 18a7111..4ad4290 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,3 +1,4 @@
1cmdline.h
1inetd 2inetd
2meta1gram.c 3meta1gram.c
3meta1gram.h 4meta1gram.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 19c6483..455b2c2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
1# This file is part of GNU Pies. 1# This file is part of GNU Pies.
2# Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff 2# Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
3# 3#
4# GNU Pies is free software; you can redistribute it and/or modify 4# GNU Pies is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -35,25 +35,34 @@ pies_SOURCES = \
35 35
36noinst_HEADERS = \ 36noinst_HEADERS = \
37 acl.h\ 37 acl.h\
38 cmdline.h\
38 meta1gram.h\ 39 meta1gram.h\
39 meta1lex.h\ 40 meta1lex.h\
40 pies.h 41 pies.h
41 42
42meta1lex.c: meta1gram.h 43meta1lex.c: meta1gram.h
43 44
45BUILT_SOURCES=cmdline.h
46
44incdir=$(pkgdatadir)/$(VERSION)/include 47incdir=$(pkgdatadir)/$(VERSION)/include
45inc_DATA = pp-setup 48inc_DATA = pp-setup
46EXTRA_DIST = pp-setup inetd.in 49EXTRA_DIST = cmdline.opt pp-setup inetd.in
50
51SUFFIXES=.opt .c .h
52.opt.h:
53 $(AM_V_GEN)m4 -s $(top_srcdir)/@GRECS_SUBDIR@/build-aux/getopt.m4 $< > $@
54
55cmdline.h: cmdline.opt
47 56
48INCLUDES = \ 57INCLUDES = \
49 -I$(top_srcdir)/lib\ 58 -I$(top_srcdir)/lib\
50 -I$(top_srcdir)/gnu\ 59 -I$(top_srcdir)/gnu\
51 -I$(top_builddir)/gnu\ 60 -I$(top_builddir)/gnu\
52 -I$(top_srcdir)/grecs/src 61 @GRECS_INCLUDES@
53 62
54LDADD = \ 63LDADD = \
55 ../lib/libpies.a\ 64 ../lib/libpies.a\
56 ../grecs/src/libgrecs.a\ 65 @GRECS_LDADD@\
57 ../gnu/libgnu.a\ 66 ../gnu/libgnu.a\
58 $(MF_PROCTITLE_LIBS) 67 $(MF_PROCTITLE_LIBS)
59 68
diff --git a/src/acl.c b/src/acl.c
index a0ee85e..dc459f5 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies 1/* This file is part of GNU Pies
2 Copyright (C) 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@
25#include <netinet/in.h> 25#include <netinet/in.h>
26#include <arpa/inet.h> 26#include <arpa/inet.h>
27#include <netdb.h> 27#include <netdb.h>
28#include <hash.h>
29 28
30struct pies_sockaddr 29struct pies_sockaddr
31{ 30{
@@ -40,15 +39,15 @@ struct acl_entry
40 int allow; 39 int allow;
41 int authenticated; 40 int authenticated;
42 pies_acl_t acl; 41 pies_acl_t acl;
43 gl_list_t groups; 42 struct grecs_list *groups;
44 gl_list_t sockaddrs; 43 struct grecs_list *sockaddrs;
45}; 44};
46 45
47struct pies_acl 46struct pies_acl
48{ 47{
49 char *name; 48 char *name;
50 grecs_locus_t locus; 49 grecs_locus_t locus;
51 gl_list_t list; 50 struct grecs_list *list;
52}; 51};
53 52
54 53
@@ -61,14 +60,18 @@ pies_acl_create (const char *name, grecs_locus_t *locus)
61 pies_acl_t acl = xmalloc (sizeof (acl[0])); 60 pies_acl_t acl = xmalloc (sizeof (acl[0]));
62 acl->name = name ? xstrdup (name) : NULL; 61 acl->name = name ? xstrdup (name) : NULL;
63 acl->locus = *locus; 62 acl->locus = *locus;
64 acl->list = gl_list_create_empty(&gl_linked_list_implementation, 63 acl->list = grecs_list_create ();
65 NULL,
66 NULL,
67 NULL,
68 false);
69 return acl; 64 return acl;
70} 65}
71 66
67void
68pies_acl_free (pies_acl_t acl)
69{
70 free (acl->name);
71 grecs_list_free (acl->list);
72 free (acl);
73}
74
72static struct pies_sockaddr * 75static struct pies_sockaddr *
73create_acl_sockaddr (int family, int len) 76create_acl_sockaddr (int family, int len)
74{ 77{
@@ -189,24 +192,24 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value)
189 else 192 else
190 sptr->netmask = 0xfffffffful; 193 sptr->netmask = 0xfffffffful;
191 } 194 }
192 gl_list_add_last (entry->sockaddrs, sptr); 195 grecs_list_append (entry->sockaddrs, sptr);
193 return 0; 196 return 0;
194} 197}
195 198
196static int 199static int
197_parse_from (struct acl_entry *entry, size_t argc, const grecs_value_t *argv) 200_parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
198{ 201{
199 if (argc == 0) 202 if (argc == 0)
200 return 0; 203 return 0;
201 else if (argv->type == GRECS_TYPE_LIST) 204 else if (argv[0]->type == GRECS_TYPE_LIST)
202 { 205 {
203 grecs_error (&entry->locus, 0, _("expected `from', but found list")); 206 grecs_error (&entry->locus, 0, _("expected `from', but found list"));
204 return 1; 207 return 1;
205 } 208 }
206 else if (strcmp (argv->v.string, "from")) 209 else if (strcmp (argv[0]->v.string, "from"))
207 { 210 {
208 grecs_error (&entry->locus, 0, _("expected `from', but found `%s'"), 211 grecs_error (&entry->locus, 0, _("expected `from', but found `%s'"),
209 argv->v.string); 212 argv[0]->v.string);
210 return 1; 213 return 1;
211 } 214 }
212 argc--; 215 argc--;
@@ -219,24 +222,19 @@ _parse_from (struct acl_entry *entry, size_t argc, const grecs_value_t *argv)
219 return 1; 222 return 1;
220 } 223 }
221 224
222 entry->sockaddrs = gl_list_create_empty(&gl_linked_list_implementation, 225 entry->sockaddrs = grecs_list_create ();
223 NULL, 226 if (argv[0]->type == GRECS_TYPE_STRING)
224 NULL,
225 NULL,
226 false);
227 if (argv->type == GRECS_TYPE_STRING)
228 { 227 {
229 if (_parse_sockaddr (entry, argv)) 228 if (_parse_sockaddr (entry, argv[0]))
230 return 1; 229 return 1;
231 } 230 }
232 else 231 else
233 { 232 {
234 gl_list_iterator_t itr = gl_list_iterator (argv->v.list);
235 const void *p;
236 int rc = 0; 233 int rc = 0;
237 while (gl_list_iterator_next (&itr, &p, NULL)) 234 struct grecs_list_entry *ep;
238 rc += _parse_sockaddr (entry, (const grecs_value_t*) p); 235
239 gl_list_iterator_free (&itr); 236 for (ep = argv[0]->v.list->head; ep; ep = ep->next)
237 rc += _parse_sockaddr (entry, (const grecs_value_t*) ep->data);
240 if (rc) 238 if (rc)
241 return rc; 239 return rc;
242 } 240 }
@@ -250,11 +248,11 @@ _parse_from (struct acl_entry *entry, size_t argc, const grecs_value_t *argv)
250} 248}
251 249
252static int 250static int
253_parse_sub_acl (struct acl_entry *entry, size_t argc, grecs_value_t *argv) 251_parse_sub_acl (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
254{ 252{
255 if (argc == 0) 253 if (argc == 0)
256 return 0; 254 return 0;
257 if (strcmp (argv->v.string, "acl") == 0) 255 if (strcmp (argv[0]->v.string, "acl") == 0)
258 { 256 {
259 argc--; 257 argc--;
260 argv++; 258 argv++;
@@ -265,19 +263,19 @@ _parse_sub_acl (struct acl_entry *entry, size_t argc, grecs_value_t *argv)
265 return 1; 263 return 1;
266 } 264 }
267 265
268 if (argv->type != GRECS_TYPE_STRING) 266 if (argv[0]->type != GRECS_TYPE_STRING)
269 { 267 {
270 grecs_error (&entry->locus, 0, 268 grecs_error (&entry->locus, 0,
271 _("expected string, but found list")); 269 _("expected string, but found list"));
272 return 1; 270 return 1;
273 } 271 }
274 272
275 entry->acl = pies_acl_lookup (argv->v.string); 273 entry->acl = pies_acl_lookup (argv[0]->v.string);
276 274
277 if (!entry->acl) 275 if (!entry->acl)
278 { 276 {
279 grecs_error (&entry->locus, 0, _("ACL not defined: `%s'"), 277 grecs_error (&entry->locus, 0, _("ACL not defined: `%s'"),
280 argv->v.string); 278 argv[0]->v.string);
281 return 1; 279 return 1;
282 } 280 }
283 argc--; 281 argc--;
@@ -287,9 +285,9 @@ _parse_sub_acl (struct acl_entry *entry, size_t argc, grecs_value_t *argv)
287} 285}
288 286
289static int 287static int
290_parse_group (struct acl_entry *entry, size_t argc, grecs_value_t * argv) 288_parse_group (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
291{ 289{
292 if (strcmp (argv->v.string, "group") == 0) 290 if (strcmp (argv[0]->v.string, "group") == 0)
293 { 291 {
294 argc--; 292 argc--;
295 argv++; 293 argv++;
@@ -299,17 +297,13 @@ _parse_group (struct acl_entry *entry, size_t argc, grecs_value_t * argv)
299 _("expected group list, but found end of statement")); 297 _("expected group list, but found end of statement"));
300 return 1; 298 return 1;
301 } 299 }
302 if (argv->type == GRECS_TYPE_STRING) 300 if (argv[0]->type == GRECS_TYPE_STRING)
303 { 301 {
304 entry->groups = gl_list_create_empty(&gl_linked_list_implementation, 302 entry->groups = grecs_list_create ();
305 NULL, 303 grecs_list_append (entry->groups, xstrdup (argv[0]->v.string));
306 NULL,
307 NULL,
308 false);
309 gl_list_add_last (entry->groups, (void *) argv->v.string);
310 } 304 }
311 else 305 else
312 entry->groups = argv->v.list; 306 entry->groups = argv[0]->v.list;
313 argc--; 307 argc--;
314 argv++; 308 argv++;
315 } 309 }
@@ -317,11 +311,11 @@ _parse_group (struct acl_entry *entry, size_t argc, grecs_value_t * argv)
317} 311}
318 312
319static int 313static int
320_parse_acl (struct acl_entry *entry, size_t argc, grecs_value_t *argv) 314_parse_acl (struct acl_entry *entry, size_t argc, grecs_value_t **argv)
321{ 315{
322 if (assert_grecs_value_type (&entry->locus, argv, GRECS_TYPE_STRING)) 316 if (assert_grecs_value_type (&entry->locus, argv[0], GRECS_TYPE_STRING))
323 return 1; 317 return 1;
324 else if (_parse_token (entry, argv) == 0) 318 else if (_parse_token (entry, argv[0]) == 0)
325 return _parse_sub_acl (entry, argc - 1, argv + 1); 319 return _parse_sub_acl (entry, argc - 1, argv + 1);
326 else 320 else
327 return _parse_group (entry, argc, argv); 321 return _parse_group (entry, argc, argv);
@@ -356,7 +350,7 @@ parse_acl_line (grecs_locus_t *locus, int allow, pies_acl_t acl,
356 grecs_error (locus, 0, _("unexpected list")); 350 grecs_error (locus, 0, _("unexpected list"));
357 return 1; 351 return 1;
358 } 352 }
359 gl_list_add_last (acl->list, entry); 353 grecs_list_append (acl->list, entry);
360 return 0; 354 return 0;
361} 355}
362 356
@@ -373,7 +367,6 @@ _acl_common_section_parser (enum grecs_callback_command cmd,
373 int flag) 367 int flag)
374{ 368{
375 pies_acl_t acl; 369 pies_acl_t acl;
376 grecs_locus_t defn_loc;
377 const char *tag = NULL; 370 const char *tag = NULL;
378 int has_value = 0; 371 int has_value = 0;
379 372
@@ -412,15 +405,8 @@ _acl_common_section_parser (enum grecs_callback_command cmd,
412 return 1; 405 return 1;
413 } 406 }
414 acl = pies_acl_create (tag, locus); 407 acl = pies_acl_create (tag, locus);
415 if (tag && pies_acl_install (acl, &defn_loc)) 408 if (tag && (acl = pies_acl_install (acl)) == NULL)
416 { 409 return 1;
417 grecs_error (locus, 0,
418 _("redefinition of ACL %s"),
419 value->v.string);
420 grecs_error (&defn_loc, 0,
421 _("location of the previous definition"));
422 return 1;
423 }
424 if (pacl) 410 if (pacl)
425 *pacl = acl; 411 *pacl = acl;
426 break; 412 break;
@@ -570,11 +556,10 @@ _acl_check (struct acl_entry *ent, struct acl_input *input)
570 556
571 if (ent->groups) 557 if (ent->groups)
572 { 558 {
573 const void *p; 559 struct grecs_list_entry *ep;
574 gl_list_iterator_t itr = gl_list_iterator (ent->groups); 560
575 while (result && gl_list_iterator_next (&itr, &p, NULL)) 561 for (ep = ent->groups->head; result && ep; ep = ep->next)
576 result = match_group (input->groups, p); 562 result = match_group (input->groups, ep->data);
577 gl_list_iterator_free (&itr);
578 if (!result) 563 if (!result)
579 return result; 564 return result;
580 } 565 }
@@ -585,16 +570,15 @@ _acl_check (struct acl_entry *ent, struct acl_input *input)
585 570
586 if (ent->sockaddrs) 571 if (ent->sockaddrs)
587 { 572 {
588 const void *p; 573 struct grecs_list_entry *ep;
589 gl_list_iterator_t itr = gl_list_iterator (ent->sockaddrs); 574
590 result = 0; 575 result = 0;
591 while (gl_list_iterator_next (&itr, &p, NULL)) 576 for (ep = ent->sockaddrs->head; ep; ep = ep->next)
592 { 577 {
593 result = _check_sockaddr ((struct pies_sockaddr *)p, input); 578 result = _check_sockaddr ((struct pies_sockaddr *)ep->data, input);
594 if (result) 579 if (result)
595 break; 580 break;
596 } 581 }
597 gl_list_iterator_free (&itr);
598 } 582 }
599 583
600 return result; 584 return result;
@@ -604,7 +588,7 @@ static int
604_acl_check_cb (struct acl_entry *ent, struct acl_input *input, int *pres) 588_acl_check_cb (struct acl_entry *ent, struct acl_input *input, int *pres)
605{ 589{
606 int result = _acl_check (ent, input); 590 int result = _acl_check (ent, input);
607 debug (1, ("%s:%d: %s", ent->locus.file, ent->locus.line, 591 debug (1, ("%s:%d: %s", ent->locus.beg.file, ent->locus.beg.line,
608 /* TRANSLATORS: `MATCHES' is the verb `match' in 2nd person. 592 /* TRANSLATORS: `MATCHES' is the verb `match' in 2nd person.
609 E.g., in French: CONCORD AVEC */ 593 E.g., in French: CONCORD AVEC */
610 result ? _("MATCHES") : _("does not match"))); 594 result ? _("MATCHES") : _("does not match")));
@@ -622,12 +606,11 @@ pies_acl_check (pies_acl_t acl, struct acl_input *input, int result)
622{ 606{
623 if (acl) 607 if (acl)
624 { 608 {
625 const void *p; 609 struct grecs_list_entry *ep;
626 gl_list_iterator_t itr = gl_list_iterator (acl->list); 610
627 while (gl_list_iterator_next (&itr, &p, NULL) 611 for (ep = acl->list->head; ep; ep = ep->next)
628 && !_acl_check_cb ((struct acl_entry *)p, input, &result)) 612 if (_acl_check_cb ((struct acl_entry *)ep->data, input, &result))
629 ; 613 break;
630 gl_list_iterator_free (&itr);
631 } 614 }
632 return result; 615 return result;
633} 616}
@@ -635,43 +618,78 @@ pies_acl_check (pies_acl_t acl, struct acl_input *input, int result)
635 618
636/* Hash table */ 619/* Hash table */
637 620
638static Hash_table *acl_table; 621static struct grecs_symtab *acl_table;
639 622
640/* Calculate the hash of a string. */ 623/* Calculate the hash of a string. */
641static size_t 624static unsigned
642acl_hasher (void const *data, size_t n_buckets) 625acl_hasher (void *data, unsigned long n_buckets)
643{ 626{
644 const struct pies_acl *p = data; 627 const struct pies_acl *p = data;
645 return hash_string (p->name, n_buckets); 628 return grecs_hash_string (p->name, n_buckets);
646} 629}
647 630
648/* Compare two strings for equality. */ 631/* Compare two strings for equality. */
649static bool 632static int
650acl_compare (void const *data1, void const *data2) 633acl_compare (void const *data1, void const *data2)
651{ 634{
652 const struct pies_acl *p1 = data1; 635 const struct pies_acl *p1 = data1;
653 const struct pies_acl *p2 = data2; 636 const struct pies_acl *p2 = data2;
654 return strcasecmp (p1->name, p2->name) == 0; 637 return strcasecmp (p1->name, p2->name);
655} 638}
656 639
657int 640static int
658pies_acl_install (pies_acl_t acl, grecs_locus_t * locus) 641acl_copy (void *a, void *b)
642{
643 const struct pies_acl *pb = b;
644
645 memcpy (a, b, sizeof (struct pies_acl));
646 memset (b, 0, sizeof (struct pies_acl));
647 return 0;
648}
649
650static void
651acl_free_entry (void *p)
652{
653 pies_acl_free (p);
654}
655
656pies_acl_t
657pies_acl_install (pies_acl_t acl)
659{ 658{
660 pies_acl_t ret; 659 pies_acl_t ret;
661 if (!((acl_table 660 int install = 1;
662 || (acl_table = hash_initialize (0, 0, 661
663 acl_hasher, 662 if (!acl_table)
664 acl_compare, 0)))
665 && (ret = hash_insert (acl_table, acl))))
666 xalloc_die ();
667
668 if (ret != acl)
669 { 663 {
670 if (locus) 664 acl_table = grecs_symtab_create(sizeof (struct pies_acl),
671 *locus = ret->locus; 665 acl_hasher,
672 return 1; 666 acl_compare,
667 acl_copy,
668 NULL,
669 acl_free_entry);
670 if (!acl_table)
671 xalloc_die ();
673 } 672 }
674 return 0; 673
674 ret = grecs_symtab_lookup_or_install (acl_table, acl, &install);
675
676 if (!ret)
677 {
678 logmsg (LOG_ERR, _("cannot install acl: %s"), strerror (errno));
679 exit (1);
680 }
681
682 if (!install)
683 {
684 grecs_error (&acl->locus, 0,
685 _("redefinition of ACL %s"),
686 ret->name);
687 grecs_error (&ret->locus, 0,
688 _("location of the previous definition"));
689 ret = NULL;
690 }
691 pies_acl_free (acl);
692 return ret;
675} 693}
676 694
677pies_acl_t 695pies_acl_t
@@ -681,5 +699,5 @@ pies_acl_lookup (const char *name)
681 if (!acl_table) 699 if (!acl_table)
682 return NULL; 700 return NULL;
683 samp.name = (char *) name; 701 samp.name = (char *) name;
684 return hash_lookup (acl_table, &samp); 702 return grecs_symtab_lookup_or_install (acl_table, &samp, NULL);
685} 703}
diff --git a/src/acl.h b/src/acl.h
index 65dcf40..c8e4d07 100644
--- a/src/acl.h
+++ b/src/acl.h
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies 1/* This file is part of GNU Pies
2 Copyright (C) 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ int pies_acl_check (pies_acl_t acl, struct acl_input *input, int result);
30int parse_acl_line (grecs_locus_t *locus, int allow, pies_acl_t acl, 30int parse_acl_line (grecs_locus_t *locus, int allow, pies_acl_t acl,
31 grecs_value_t *value); 31 grecs_value_t *value);
32pies_acl_t pies_acl_lookup (const char *name); 32pies_acl_t pies_acl_lookup (const char *name);
33int pies_acl_install (pies_acl_t acl, grecs_locus_t * locus); 33pies_acl_t pies_acl_install (pies_acl_t acl);
34 34
35int assert_grecs_value_type (grecs_locus_t *locus, 35int assert_grecs_value_type (grecs_locus_t *locus,
36 const grecs_value_t *value, int type); 36 const grecs_value_t *value, int type);
diff --git a/src/cmdline.opt b/src/cmdline.opt
new file mode 100644
index 0000000..31fcf20
--- /dev/null
+++ b/src/cmdline.opt
@@ -0,0 +1,193 @@
1/* This file is part of GNU Pies. -*- c -*-
2 Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
3
4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 GNU Pies is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */
16
17OPTIONS_BEGIN("pies",
18 [<process invocation and execution supervisor>],
19 [<>],
20 [<gnu>],
21 [<copyright_year=2011>],
22 [<copyright_holder=Sergey Poznyakoff>])
23
24GROUP(Operation Mode)
25
26OPTION(config-file,c,FILE,
27 [<use FILE instead of the default configuration>])
28BEGIN
29 add_config (current_syntax, optarg);
30END
31
32OPTION(config-help,,,
33 [<show configuration file summary>])
34BEGIN
35 config_help ();
36 exit (0);
37END
38
39OPTION(,E,,
40 [<preprocess config and exit>])
41BEGIN
42 preprocess_only = 1;
43END
44
45OPTION(force,,,
46 [<force startup even if another instance may be running>])
47BEGIN
48 force_option = 1;
49END
50
51OPTION(foreground,,,
52 [<remain in foreground>])
53BEGIN
54 log_to_stderr_only = 1;
55 foreground = 1;
56END
57
58OPTION(inetd,i,,
59 [<run in inetd mode>])
60BEGIN
61 if (!instance)
62 instance = "inetd";
63 current_syntax = CONF_INETD;
64 inetd_mode = 1;
65END
66
67OPTION(instance,,NAME,
68 [<set instance name>])
69BEGIN
70 instance = optarg;
71END
72
73OPTION(rate,,NUMBER,
74 [<set default maximum rate for inetd-style components>])
75BEGIN
76 char *p;
77 default_max_rate = strtoul (optarg, &p, 10);
78 if (*p)
79 {
80 logmsg (LOG_ERR, _("not a number: %s"), optarg);
81 exit (EX_USAGE);
82 }
83END
84
85OPTION(stderr,,,
86 [<log to stderr>])
87BEGIN
88 log_to_stderr_only = 1;
89END
90
91OPTION(syntax,,[<{pies|inetd|meta1}>],
92 [<expect configuration files in the given syntax>])
93BEGIN
94 if (str_to_config_syntax (optarg, &current_syntax))
95 {
96 logmsg (LOG_ERR, _("unknown syntax type: %s"), optarg);
97 exit (EX_USAGE);
98 }
99END
100
101OPTION(syslog,,,
102 [<log to syslog>])
103BEGIN
104 log_to_stderr_only = 0;
105END
106
107OPTION(lint,t,,
108 [<parse configuration file and exit>])
109BEGIN
110 log_to_stderr_only = 1;
111 lint_mode = 1;
112END
113
114GROUP(Preprocessor)
115
116OPTION(define,D,[<NAME[=VALUE]>],
117 [<define a preprocessor symbol NAME as having VALUE or empty>])
118BEGIN
119 add_pp_option ("-D", optarg);
120END
121
122OPTION(undefine,U,NAME,
123 [<undefine a preprocessor symbol NAME>])
124BEGIN
125 add_pp_option ("-U", optarg);
126END
127
128GROUP(Component Management)
129
130OPTION(reload,r,,
131 [<reload the running instance of pies>])
132ALIAS(hup)
133BEGIN
134 log_to_stderr_only = 1;
135 command = COM_RELOAD;
136END
137
138OPTION(restart-component,R,,
139 [<restart components named in the command line>])
140BEGIN
141 log_to_stderr_only = 1;
142 command = COM_RESTART;
143END
144
145OPTION(status,s,,
146 [<display info about the running instance>])
147BEGIN
148 log_to_stderr_only = 1;
149 command = COM_STATUS;
150END
151
152OPTION(stop,S,,
153 [<stop the running instance>])
154BEGIN
155 log_to_stderr_only = 1;
156 command = COM_STOP;
157END
158
159GROUP(Debugging and Additional Diagnostics)
160
161OPTION(dump-depmap,,,
162 [<dump dependency map>])
163BEGIN
164 log_to_stderr_only = 1;
165 command = COM_DUMP_DEPMAP;
166END
167
168OPTION(dump-prereq,,,
169 [<dump prerequisite charts>])
170BEGIN
171 log_to_stderr_only = 1;
172 command = COM_DUMP_PREREQ;
173END
174
175OPTION(source-info,,,
176 [<show source info with debugging messages>])
177BEGIN
178 source_info_option = 1;
179END
180
181OPTION(debug,x,LEVEL,
182 [<set debug verbosity level>])
183BEGIN
184 debug_level = strtoul (optarg, NULL, 0);
185END
186
187OPTIONS_END
188
189void
190parse_options(int argc, char *argv[], int *index)
191{
192 GETOPT(argc, argv, *index)
193}
diff --git a/src/diag.c b/src/diag.c
index 53bc044..fe057d0 100644
--- a/src/diag.c
+++ b/src/diag.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -125,15 +125,43 @@ logmsg_printf (int prio, const char *fmt, ...)
125void 125void
126grecs_print_diag (grecs_locus_t *locus, int err, int errcode, const char *msg) 126grecs_print_diag (grecs_locus_t *locus, int err, int errcode, const char *msg)
127{ 127{
128 char *locstr = NULL;
129
128 if (locus) 130 if (locus)
129 { 131 {
132 size_t size = 0;
133
134 if (locus->beg.col == 0)
135 grecs_asprintf (&locstr, &size, "%s:%u",
136 locus->beg.file,
137 locus->beg.line);
138 else if (strcmp (locus->beg.file, locus->end.file))
139 grecs_asprintf (&locstr, &size, "%s:%u.%u-%s:%u.%u",
140 locus->beg.file,
141 locus->beg.line, locus->beg.col,
142 locus->end.file,
143 locus->end.line, locus->end.col);
144 else if (locus->beg.line != locus->end.line)
145 grecs_asprintf (&locstr, &size, "%s:%u.%u-%u.%u",
146 locus->beg.file,
147 locus->beg.line, locus->beg.col,
148 locus->end.line, locus->end.col);
149 else
150 grecs_asprintf (&locstr, &size, "%s:%u.%u-%u",
151 locus->beg.file,
152 locus->beg.line, locus->beg.col,
153 locus->end.col);
154 }
155
156 if (locstr)
157 {
130 if (errcode) 158 if (errcode)
131 logmsg (err ? LOG_ERR : LOG_WARNING, "%s:%lu: %s: %s", 159 logmsg (err ? LOG_ERR : LOG_WARNING, "%s: %s: %s",
132 locus->file, (unsigned long)locus->line, msg, 160 locstr, msg, strerror (errcode));
133 strerror (errcode));
134 else 161 else
135 logmsg (err ? LOG_ERR : LOG_WARNING, "%s:%lu: %s", 162 logmsg (err ? LOG_ERR : LOG_WARNING, "%s: %s",
136 locus->file, (unsigned long)locus->line, msg); 163 locstr, msg);
164 free (locstr);
137 } 165 }
138 else 166 else
139 { 167 {
diff --git a/src/inetd.c b/src/inetd.c
index 012266a..1d7798d 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -28,11 +28,11 @@
28 28
29#define IFLD_MIN_COUNT 6 /* Minimum number of fields in entry */ 29#define IFLD_MIN_COUNT 6 /* Minimum number of fields in entry */
30 30
31/* FIXME: Duplicated in grex-lex.l */ 31/* FIXME: Copied from grecs/src/tree.c */
32static void 32static void
33listel_dispose(const void *el) 33listel_dispose(void *el)
34{ 34{
35 free((void*)el); 35 free(el);
36} 36}
37 37
38#define TCPMUX_PREFIX_STR "tcpmux/" 38#define TCPMUX_PREFIX_STR "tcpmux/"
@@ -281,13 +281,9 @@ inetd_conf_file (const char *file)
281 comp->privs.user = xstrdup (user); /* FIXME: memory leak */ 281 comp->privs.user = xstrdup (user); /* FIXME: memory leak */
282 if (group) 282 if (group)
283 { 283 {
284 comp->privs.groups = 284 comp->privs.groups = grecs_list_create ();
285 gl_list_create_empty (&gl_linked_list_implementation, 285 comp->privs.groups->free_entry = listel_dispose;
286 NULL, 286 grecs_list_append (comp->privs.groups, xstrdup (group));
287 NULL,
288 listel_dispose,
289 true);
290 gl_list_add_last (comp->privs.groups, xstrdup (group));
291 } 287 }
292 288
293 comp->program = xstrdup (ws.ws_wordv[IFLD_SERVER_PATH]); 289 comp->program = xstrdup (ws.ws_wordv[IFLD_SERVER_PATH]);
diff --git a/src/meta1gram.y b/src/meta1gram.y
index 6256448..deaf382 100644
--- a/src/meta1gram.y
+++ b/src/meta1gram.y
@@ -1,6 +1,6 @@
1%{ 1%{
2/* MeTA1 configuration parser for GNU Pies. 2/* MeTA1 configuration parser for GNU Pies.
3 Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff 3 Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
4 4
5 GNU Pies is free software; you can redistribute it and/or modify 5 GNU Pies is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -20,8 +20,10 @@
20 configuration statements. */ 20 configuration statements. */
21 21
22#include "pies.h" 22#include "pies.h"
23#include "grecs-locus.h"
23#include "meta1lex.h" 24#include "meta1lex.h"
24 25#include "meta1gram.h"
26
25#define META1_QUEUE_DIR() \ 27#define META1_QUEUE_DIR() \
26 (meta1_queue_dir ? meta1_queue_dir : "/var/spool/meta1") 28 (meta1_queue_dir ? meta1_queue_dir : "/var/spool/meta1")
27 29
@@ -51,7 +53,7 @@ meta1_stmt_create (enum meta1_stmt_type type, const char *ident)
51 p->next = NULL; 53 p->next = NULL;
52 p->type = type; 54 p->type = type;
53 p->ident = ident; 55 p->ident = ident;
54 p->locus = meta1_locus; 56 p->locus = meta1lloc;
55 return p; 57 return p;
56} 58}
57 59
@@ -84,9 +86,12 @@ reverse (struct meta1_stmt *in)
84static void meta1_translate (struct meta1_stmt *); 86static void meta1_translate (struct meta1_stmt *);
85%} 87%}
86 88
89%error-verbose
90%locations
91
87%union { 92%union {
88 char *string; 93 char *string;
89 gl_list_t list; 94 struct grecs_list *list;
90 grecs_value_t *value; 95 grecs_value_t *value;
91 struct meta1_stmt *stmt; 96 struct meta1_stmt *stmt;
92} 97}
@@ -168,29 +173,25 @@ value : string
168string : META1_IDENT 173string : META1_IDENT
169 | slist 174 | slist
170 { 175 {
171 const void *p; 176 struct grecs_list_entry *ep;
172 gl_list_iterator_t itr = gl_list_iterator ($1);
173
174 meta1_line_begin (); 177 meta1_line_begin ();
175 while (gl_list_iterator_next (&itr, &p, NULL)) 178 for (ep = $1->head; ep; ep = ep->next)
176 meta1_line_add (p, strlen (p)); 179 {
177 gl_list_iterator_free (&itr); 180 const char *p = ep->data;
181 meta1_line_add (p, strlen (p));
182 }
178 $$ = meta1_line_finish (); 183 $$ = meta1_line_finish ();
179 } 184 }
180 ; 185 ;
181 186
182slist : META1_STRING 187slist : META1_STRING
183 { 188 {
184 $$ = gl_list_create_empty (&gl_linked_list_implementation, 189 $$ = grecs_list_create ();
185 NULL, 190 grecs_list_append ($$, $1);
186 NULL,
187 NULL,
188 true);
189 gl_list_add_last ($$, $1);
190 } 191 }
191 | slist META1_STRING 192 | slist META1_STRING
192 { 193 {
193 gl_list_add_last ($1, $2); 194 grecs_list_append ($1, $2);
194 $$ = $1; 195 $$ = $1;
195 } 196 }
196 ; 197 ;
@@ -207,16 +208,12 @@ list : '{' values '}'
207 208
208values : value 209values : value
209 { 210 {
210 $$ = gl_list_create_empty (&gl_linked_list_implementation, 211 $$ = grecs_list_create ();
211 NULL, 212 grecs_list_append ($$, $1);
212 NULL,
213 NULL,
214 true);
215 gl_list_add_last ($$, $1);
216 } 213 }
217 | values ',' value 214 | values ',' value
218 { 215 {
219 gl_list_add_last ($1, $3); 216 grecs_list_append ($1, $3);
220 $$ = $1; 217 $$ = $1;
221 } 218 }
222 ; 219 ;
@@ -229,7 +226,7 @@ opt_sc : /* empty */
229int 226int
230yyerror (char *s) 227yyerror (char *s)
231{ 228{
232 meta1_parse_error ("%s", s); 229 grecs_error (&yylloc, 0, "%s", s);
233 return 0; 230 return 0;
234} 231}
235 232
diff --git a/src/meta1lex.h b/src/meta1lex.h
index 0f7c75d..213fb40 100644
--- a/src/meta1lex.h
+++ b/src/meta1lex.h
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2009, 2010, 2009 Sergey Poznyakoff 2 Copyright (C) 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */ 15 along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */
16 16
17extern grecs_locus_t meta1_locus;
18extern size_t meta1_error_count; 17extern size_t meta1_error_count;
19extern char *meta1_queue_dir; 18extern char *meta1_queue_dir;
20 19
diff --git a/src/meta1lex.l b/src/meta1lex.l
index 4eca9e2..7faaf41 100644
--- a/src/meta1lex.l
+++ b/src/meta1lex.l
@@ -1,7 +1,7 @@
1/* MeTA1 configuration lexer for GNU Pies. -*- c -*- */ 1/* MeTA1 configuration lexer for GNU Pies. -*- c -*- */
2%top { 2%top {
3/* MeTA1 configuration lexer for GNU Pies. 3/* MeTA1 configuration lexer for GNU Pies.
4 Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff 4 Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
5 5
6 GNU Pies is free software; you can redistribute it and/or modify 6 GNU Pies is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
@@ -26,16 +26,27 @@
26 26
27%{ 27%{
28#include "pies.h" 28#include "pies.h"
29#include "grecs-locus.h"
29#include "meta1gram.h" 30#include "meta1gram.h"
30#include "meta1lex.h" 31#include "meta1lex.h"
31 32
32grecs_locus_t meta1_locus; 33static struct grecs_locus_point meta1_locus_point;
33size_t meta1_error_count;
34struct obstack meta1_stk; 34struct obstack meta1_stk;
35int meta1_stk_init; 35int meta1_stk_init;
36char *meta1_queue_dir; 36char *meta1_queue_dir;
37
38#define yylval meta1lval 37#define yylval meta1lval
38
39#define YY_USER_ACTION do \
40 { \
41 if (YYSTATE == 0) \
42 { \
43 meta1lloc.beg = meta1_locus_point; \
44 meta1lloc.beg.col++; \
45 } \
46 meta1_locus_point.col += yyleng; \
47 meta1lloc.end = meta1_locus_point; \
48 } \
49 while (0);
39%} 50%}
40 51
41%x COMMENT STR 52%x COMMENT STR
@@ -45,10 +56,10 @@ X [0-9a-fA-F]
45"/*" BEGIN (COMMENT); 56"/*" BEGIN (COMMENT);
46<COMMENT>[^*\n]* /* eat anything that's not a '*' */ 57<COMMENT>[^*\n]* /* eat anything that's not a '*' */
47<COMMENT>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */ 58<COMMENT>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
48<COMMENT>\n ++meta1_locus.line; 59<COMMENT>\n grecs_locus_point_advance_line(meta1_locus_point);
49<COMMENT>"*"+"/" BEGIN (INITIAL); 60<COMMENT>"*"+"/" BEGIN (INITIAL);
50 /* End-of-line comments */ 61 /* End-of-line comments */
51#.*\n { meta1_locus.line++; } 62#.*\n grecs_locus_point_advance_line(meta1_locus_point);
52#.* /* end-of-file comment */; 63#.* /* end-of-file comment */;
53 /* Number */ 64 /* Number */
540[xX]{X}+ | 650[xX]{X}+ |
@@ -82,18 +93,18 @@ X [0-9a-fA-F]
82 yylval.string = meta1_line_finish (); 93 yylval.string = meta1_line_finish ();
83 return META1_STRING; } 94 return META1_STRING; }
84<STR>[^\\"\n]*\n { BEGIN (INITIAL); 95<STR>[^\\"\n]*\n { BEGIN (INITIAL);
85 meta1_parse_error (_("newline in a string")); 96 grecs_error (&meta1lloc, 0, _("newline in a string"));
86 meta1_line_add (yytext, yyleng - 1); 97 meta1_line_add (yytext, yyleng - 1);
87 yylval.string = meta1_line_finish (); 98 yylval.string = meta1_line_finish ();
88 return META1_STRING; } 99 return META1_STRING; }
89 /* Other tokens */ 100 /* Other tokens */
90[ \t\f][ \t\f]* ; 101[ \t\f][ \t\f]* ;
91\n { meta1_locus.line++; } 102\n grecs_locus_point_advance_line(meta1_locus_point);
92[,;{}=] return yytext[0]; 103[,;{}=] return yytext[0];
93. { if (isascii (yytext[0]) && isprint (yytext[0])) 104. { if (isascii (yytext[0]) && isprint (yytext[0]))
94 meta1_parse_error (_("stray character %c"), yytext[0]); 105 grecs_error (&meta1lloc, 0, _("stray character %c"), yytext[0]);
95 else 106 else
96 meta1_parse_error (_("stray character \\%03o"), 107 grecs_error (&meta1lloc, 0, _("stray character \\%03o"),
97 (unsigned char) yytext[0]); } 108 (unsigned char) yytext[0]); }
98%% 109%%
99 110
@@ -135,7 +146,7 @@ unescape_to_line (int c)
135 { 146 {
136 t = unescape_char (c); 147 t = unescape_char (c);
137 if (t == c && t != '\\' && t != '\"') 148 if (t == c && t != '\\' && t != '\"')
138 meta1_parse_error (_("unknown escape sequence '\\%c'"), c); 149 grecs_error (&meta1lloc, 0, _("unknown escape sequence '\\%c'"), c);
139 } 150 }
140 obstack_1grow (&meta1_stk, t); 151 obstack_1grow (&meta1_stk, t);
141} 152}
@@ -182,20 +193,6 @@ meta1_string (const char *str, size_t len)
182} 193}
183 194
184void 195void
185meta1_parse_error (const char *fmt, ...)
186{
187 va_list ap;
188
189 logmsg_printf (LOG_ERR, "%s:%lu: ", meta1_locus.file,
190 (unsigned long) meta1_locus.line);
191 va_start (ap, fmt);
192 logmsg_vprintf (LOG_ERR, fmt, ap);
193 va_end (ap);
194 logmsg_printf (LOG_ERR, "\n");
195 meta1_error_count++;
196}
197
198void
199meta1_lexer_set_debug () 196meta1_lexer_set_debug ()
200{ 197{
201 char *p = getenv ("META1_DEBUG_LEX"); 198 char *p = getenv ("META1_DEBUG_LEX");
@@ -217,15 +214,17 @@ meta1_config_parse (const char *name)
217 _("%s: cannot open file: %s"), name, strerror (errno)); 214 _("%s: cannot open file: %s"), name, strerror (errno));
218 return 1; 215 return 1;
219 } 216 }
220 meta1_locus.file = meta1_string (name, strlen (name)); 217 meta1_locus_point.file = meta1_string (name, strlen (name));
221 meta1_locus.line = 1; 218 meta1_locus_point.line = 1;
219 meta1_locus_point.col = 0;
222 meta1_lexer_set_debug (); 220 meta1_lexer_set_debug ();
223 meta1_parser_set_debug (); 221 meta1_parser_set_debug ();
224 222
225 yyrestart (fp); 223 yyrestart (fp);
224 grecs_error_count = 0;
226 rc = meta1parse (); 225 rc = meta1parse ();
227 fclose (fp); 226 fclose (fp);
228 if (meta1_error_count) 227 if (grecs_error_count)
229 rc = 1; 228 rc = 1;
230 return rc; 229 return rc;
231} 230}
diff --git a/src/pies.c b/src/pies.c
index 112bfb6..cc2c26b 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -26,7 +26,18 @@ int log_facility = LOG_USER;
26char *log_tag; 26char *log_tag;
27struct pies_privs pies_privs; 27struct pies_privs pies_privs;
28int foreground; 28int foreground;
29int command; 29
30enum pies_command {
31 COM_START,
32 COM_RESTART,
33 COM_RELOAD,
34 COM_STATUS,
35 COM_STOP,
36 COM_DUMP_PREREQ,
37 COM_DUMP_DEPMAP
38};
39
40enum pies_command command;
30char *statedir = DEFAULT_STATE_DIR; 41char *statedir = DEFAULT_STATE_DIR;
31char *instance; 42char *instance;
32char *pidfile; 43char *pidfile;
@@ -145,14 +156,11 @@ stderr_closed_p ()
145} 156}
146 157
147 158
148#define GRECS_VALUE_IS_EMPTY(val) \
149 (!(val) || ((val)->type == GRECS_TYPE_STRING && !(val)->v.string))
150
151int 159int
152assert_grecs_value_type (grecs_locus_t *locus, 160assert_grecs_value_type (grecs_locus_t *locus,
153 const grecs_value_t *value, int type) 161 const grecs_value_t *value, int type)
154{ 162{
155 if (GRECS_VALUE_IS_EMPTY (value)) 163 if (GRECS_VALUE_EMPTY_P (value))
156 { 164 {
157 grecs_error (locus, 0, _("expected %s"), 165 grecs_error (locus, 0, _("expected %s"),
158 grecs_data_type_string (type)); 166 grecs_data_type_string (type));
@@ -412,9 +420,9 @@ _get_array_arg (grecs_value_t *val, int num, grecs_locus_t *locus)
412{ 420{
413 if (num < val->v.arg.c) 421 if (num < val->v.arg.c)
414 { 422 {
415 if (assert_grecs_value_type (locus, &val->v.arg.v[num], 423 if (assert_grecs_value_type (locus, val->v.arg.v[num],
416 GRECS_TYPE_STRING) == 0) 424 GRECS_TYPE_STRING) == 0)
417 return val->v.arg.v[num].v.string; 425 return val->v.arg.v[num]->v.string;
418 } 426 }
419 return NULL; 427 return NULL;
420} 428}
@@ -422,7 +430,7 @@ _get_array_arg (grecs_value_t *val, int num, grecs_locus_t *locus)
422const char * 430const char *
423_get_list_arg (grecs_value_t *val, int num, grecs_locus_t *locus) 431_get_list_arg (grecs_value_t *val, int num, grecs_locus_t *locus)
424{ 432{
425 grecs_value_t *elt = (grecs_value_t *) gl_list_get_at (val->v.list, num); 433 grecs_value_t *elt = (grecs_value_t *) grecs_list_index (val->v.list, num);
426 if (!elt) 434 if (!elt)
427 { 435 {
428 grecs_error (locus, 0, _("cannot get list item")); 436 grecs_error (locus, 0, _("cannot get list item"));
@@ -445,7 +453,7 @@ return_code_section_parser (enum grecs_callback_command cmd,
445 switch (cmd) 453 switch (cmd)
446 { 454 {
447 case grecs_callback_section_begin: 455 case grecs_callback_section_begin:
448 if (GRECS_VALUE_IS_EMPTY (value)) 456 if (GRECS_VALUE_EMPTY_P (value))
449 { 457 {
450 grecs_error (locus, 0, _("missing tag")); 458 grecs_error (locus, 0, _("missing tag"));
451 return 1; 459 return 1;
@@ -463,7 +471,7 @@ return_code_section_parser (enum grecs_callback_command cmd,
463 break; 471 break;
464 472
465 case GRECS_TYPE_LIST: 473 case GRECS_TYPE_LIST:
466 count = gl_list_size (value->v.list); 474 count = grecs_list_size (value->v.list);
467 act = create_action (comp, locus, value, count, _get_list_arg); 475 act = create_action (comp, locus, value, count, _get_list_arg);
468 } 476 }
469 *(struct component **) cb_data = comp; 477 *(struct component **) cb_data = comp;
@@ -497,9 +505,9 @@ config_array_to_argv (grecs_value_t *val, grecs_locus_t *locus, size_t *pargc)
497 argv = xcalloc (argc + 1, sizeof (argv[0])); 505 argv = xcalloc (argc + 1, sizeof (argv[0]));
498 for (i = j = 0; i < argc; i++) 506 for (i = j = 0; i < argc; i++)
499 { 507 {
500 if (assert_grecs_value_type (locus, &val->v.arg.v[i], GRECS_TYPE_STRING) 508 if (assert_grecs_value_type (locus, val->v.arg.v[i], GRECS_TYPE_STRING)
501 == 0) 509 == 0)
502 argv[j++] = xstrdup (val->v.arg.v[i].v.string); 510 argv[j++] = xstrdup (val->v.arg.v[i]->v.string);
503 } 511 }
504 argv[j] = NULL; 512 argv[j] = NULL;
505 if (pargc) 513 if (pargc)
@@ -702,12 +710,12 @@ _cb_redir (enum grecs_callback_command cmd,
702 break; 710 break;
703 711
704 case GRECS_TYPE_ARRAY: 712 case GRECS_TYPE_ARRAY:
705 if (assert_grecs_value_type (locus, &value->v.arg.v[0], 713 if (assert_grecs_value_type (locus, value->v.arg.v[0],
706 GRECS_TYPE_STRING)) 714 GRECS_TYPE_STRING))
707 return 0; 715 return 0;
708 if (strtotok (redirtab, value->v.arg.v[0].v.string, &res)) 716 if (strtotok (redirtab, value->v.arg.v[0]->v.string, &res))
709 grecs_error (locus, 0, _("%s: unrecognised redirector type"), 717 grecs_error (locus, 0, _("%s: unrecognised redirector type"),
710 value->v.arg.v[0].v.string); 718 value->v.arg.v[0]->v.string);
711 else 719 else
712 { 720 {
713 if (res != redir_null) 721 if (res != redir_null)
@@ -717,7 +725,7 @@ _cb_redir (enum grecs_callback_command cmd,
717 grecs_error (locus, 0, _("wrong number of arguments")); 725 grecs_error (locus, 0, _("wrong number of arguments"));
718 return 0; 726 return 0;
719 } 727 }
720 if (assert_grecs_value_type (locus, &value->v.arg.v[1], 728 if (assert_grecs_value_type (locus, value->v.arg.v[1],
721 GRECS_TYPE_STRING)) 729 GRECS_TYPE_STRING))
722 return 0; 730 return 0;
723 731
@@ -727,18 +735,18 @@ _cb_redir (enum grecs_callback_command cmd,
727 break; 735 break;
728 736
729 case redir_syslog: 737 case redir_syslog:
730 if (string_to_syslog_priority (value->v.arg.v[1].v.string, 738 if (string_to_syslog_priority (value->v.arg.v[1]->v.string,
731 &rp->v.prio)) 739 &rp->v.prio))
732 { 740 {
733 grecs_error (locus, 0, 741 grecs_error (locus, 0,
734 _("unknown syslog priority `%s'"), 742 _("unknown syslog priority `%s'"),
735 value->v.arg.v[1].v.string); 743 value->v.arg.v[1]->v.string);
736 return 0; 744 return 0;
737 } 745 }
738 break; 746 break;
739 747
740 case redir_file: 748 case redir_file:
741 rp->v.file = xstrdup (value->v.arg.v[1].v.string); 749 rp->v.file = xstrdup (value->v.arg.v[1]->v.string);
742 break; 750 break;
743 } 751 }
744 } 752 }
@@ -910,12 +918,11 @@ _cb_flags (enum grecs_callback_command cmd,
910 918
911 case GRECS_TYPE_LIST: 919 case GRECS_TYPE_LIST:
912 { 920 {
913 const void *p; 921 struct grecs_list_entry *ep;
914 gl_list_iterator_t itr = gl_list_iterator (value->v.list); 922
915 923 for (ep = value->v.list->head; ep; ep = ep->next)
916 while (gl_list_iterator_next (&itr, &p, NULL))
917 { 924 {
918 const grecs_value_t *vp = p; 925 const grecs_value_t *vp = ep->data;
919 if (assert_grecs_value_type (locus, vp, GRECS_TYPE_STRING)) 926 if (assert_grecs_value_type (locus, vp, GRECS_TYPE_STRING))
920 return 1; 927 return 1;
921 if (str_to_cf (vp->v.string, flags)) 928 if (str_to_cf (vp->v.string, flags))
@@ -1560,7 +1567,6 @@ struct grecs_keyword pies_keywords[] = {
1560void 1567void
1561config_init () 1568config_init ()
1562{ 1569{
1563 grecs_set_keywords (pies_keywords);
1564 grecs_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR, 1570 grecs_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR,
1565 DEFAULT_INCLUDE_DIR, NULL); 1571 DEFAULT_INCLUDE_DIR, NULL);
1566 grecs_log_to_stderr = log_to_stderr_only; 1572 grecs_log_to_stderr = log_to_stderr_only;
@@ -1579,219 +1585,14 @@ config_help ()
1579 /* TRANSLATORS: do not translate words between ` and ' */ 1585 /* TRANSLATORS: do not translate words between ` and ' */
1580 N_("Configuration file structure for pies.\n" 1586 N_("Configuration file structure for pies.\n"
1581 "For more information, use `info pies configuration'."); 1587 "For more information, use `info pies configuration'.");
1582 grecs_format_docstring (stdout, docstring, 0); 1588 grecs_print_docstring (docstring, 0, stdout);
1583 grecs_format_statement_array (stdout, pies_keywords, 1, 0); 1589 grecs_print_statement_array (pies_keywords, 1, 0, stdout);
1584} 1590}
1585 1591
1586
1587const char *program_version = "pies (" PACKAGE_STRING ")";
1588const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
1589static char doc[] = N_("pies -- process invocation and execution supervisor");
1590static char args_doc[] = "";
1591
1592enum
1593{
1594 OPT_FOREGROUND = 256,
1595 OPT_SYNTAX,
1596 OPT_SYSLOG,
1597 OPT_STDERR,
1598 OPT_DUMP_PREREQ,
1599 OPT_DUMP_DEPMAP,
1600 OPT_FORCE,
1601 OPT_CONFIG_HELP,
1602 OPT_SOURCE_INFO,
1603 OPT_RATE,
1604 OPT_INSTANCE
1605};
1606
1607#define OPT_RESTART 'R'
1608#define OPT_RELOAD 'r'
1609#define OPT_STATUS 's'
1610#define OPT_STOP 'S'
1611
1612static struct argp_option options[] = {
1613#define GRP 0
1614 {NULL, 0, NULL, 0, N_("Operation Mode"), GRP},
1615 {"foreground", OPT_FOREGROUND, 0, 0, N_("remain in foreground"), GRP + 1},
1616 {"stderr", OPT_STDERR, NULL, 0, N_("log to stderr"),},
1617 {"syslog", OPT_SYSLOG, NULL, 0, N_("log to syslog"),},
1618 {"force", OPT_FORCE, NULL, 0,
1619 N_("force startup even if another instance may be running"), GRP + 1},
1620 {"lint", 't', NULL, 0,
1621 N_("parse configuration file and exit"), GRP + 1},
1622 {NULL, 'E', NULL, 0,
1623 N_("preprocess config and exit"), GRP + 1},
1624 {"inetd", 'i', NULL, 0,
1625 N_("run in inetd mode"), GRP + 1},
1626 {"config-file", 'c', N_("FILE"), 0,
1627 N_("use FILE instead of the default configuration"), GRP + 1},
1628 {"config-help", OPT_CONFIG_HELP, NULL, 0,
1629 N_("show configuration file summary"), GRP + 1},
1630 {"syntax", OPT_SYNTAX, "{pies|inetd|meta1}", 0,
1631 N_("expect configuration files in the given syntax"), GRP+1 },
1632 {"rate", OPT_RATE, N_("NUMBER"), 0,
1633 N_("set default maximum rate for inetd-style components"),
1634 GRP + 1},
1635 {"instance", OPT_INSTANCE, N_("NAME"), 0,
1636 N_("set instance name"),
1637 GRP + 1},
1638#undef GRP
1639
1640#define GRP 5
1641 {NULL, 0, NULL, 0, N_("Preprocessor"), GRP},
1642 {"define", 'D', N_("NAME[=VALUE]"), 0,
1643 N_("define a preprocessor symbol NAME as having VALUE, or empty"), GRP+1 },
1644 {"undefine", 'U', N_("NAME"), 0,
1645 N_("undefine a preprocessor symbol NAME"), GRP+1 },
1646#undef GRP
1647
1648#define GRP 10
1649 {NULL, 0, NULL, 0, N_("Component Management"), GRP},
1650 {"restart-component", OPT_RESTART, NULL, 0,
1651 N_("restart components named in the command line"), GRP + 1},
1652 {"reload", OPT_RELOAD, NULL, 0,
1653 N_("reload the running instance of pies "), GRP + 1},
1654 {"hup", 0, NULL, OPTION_ALIAS},
1655 {"status", OPT_STATUS, NULL, 0,
1656 N_("display info about the running instance "), GRP + 1},
1657 {"stop", OPT_STOP, NULL, 0,
1658 N_("stop the running instance "), GRP + 1},
1659#undef GRP
1660
1661#define GRP 20
1662 {NULL, 0, NULL, 0, N_("Debugging and Additional Diagnostics"), GRP},
1663 {"debug", 'x', N_("LEVEL"), 0,
1664 N_("set debug verbosity level"), GRP + 1},
1665 {"source-info", OPT_SOURCE_INFO, NULL, 0,
1666 N_("show source info with debugging messages"), GRP + 1},
1667 {"dump-prereq", OPT_DUMP_PREREQ, NULL, 0,
1668 N_("dump prerequisite charts"), GRP + 1},
1669 {"dump-depmap", OPT_DUMP_DEPMAP, NULL, 0,
1670 N_("dump dependency map"), GRP + 1},
1671#undef GRP
1672 {NULL}
1673};
1674
1675static enum config_syntax current_syntax = CONF_PIES; 1592static enum config_syntax current_syntax = CONF_PIES;
1676 1593
1677static error_t 1594#include "cmdline.h"
1678parse_opt (int key, char *arg, struct argp_state *state)
1679{
1680 char *p;
1681
1682 switch (key)
1683 {
1684 case 'c':
1685 add_config (current_syntax, arg);
1686 break;
1687
1688 case 'D':
1689 add_pp_option ("-D", arg);
1690 break;
1691
1692 case 'U':
1693 add_pp_option ("-U", arg);
1694 break;
1695
1696 case 'E':
1697 preprocess_only = 1;
1698 break;
1699
1700 case 'i':
1701 if (!instance)
1702 instance = "inetd";
1703 current_syntax = CONF_INETD;
1704 inetd_mode = 1;
1705 break;
1706
1707 case 't':
1708 log_to_stderr_only = 1;
1709 lint_mode = 1;
1710 break;
1711
1712 case OPT_CONFIG_HELP:
1713 config_help ();
1714 exit (0);
1715
1716 case OPT_FOREGROUND:
1717 log_to_stderr_only = 1;
1718 foreground = 1;
1719 break;
1720
1721 case OPT_INSTANCE:
1722 instance = arg;
1723 break;
1724
1725 case OPT_SYNTAX:
1726 if (str_to_config_syntax (arg, &current_syntax))
1727 {
1728 logmsg (LOG_ERR, _("unknown syntax type: %s"), arg);
1729 exit (EX_USAGE);
1730 }
1731 break;
1732
1733 case OPT_RELOAD:
1734 case OPT_STATUS:
1735 case OPT_STOP:
1736 case OPT_RESTART:
1737 case OPT_DUMP_PREREQ:
1738 case OPT_DUMP_DEPMAP:
1739 log_to_stderr_only = 1;
1740 command = key;
1741 break;
1742
1743 case OPT_SYSLOG:
1744 log_to_stderr_only = 0;
1745 break;
1746
1747 case OPT_STDERR:
1748 log_to_stderr_only = 1;
1749 break;
1750
1751 case 'x':
1752 debug_level = strtoul (arg, NULL, 0);
1753 break;
1754
1755 case OPT_RATE:
1756 default_max_rate = strtoul (arg, &p, 10);
1757 if (*p)
1758 {
1759 logmsg (LOG_ERR, _("not a number: %s"), arg);
1760 exit (EX_USAGE);
1761 }
1762 break;
1763
1764 case OPT_SOURCE_INFO:
1765 source_info_option = 1;
1766 break;
1767
1768 case OPT_FORCE:
1769 force_option = 1;
1770 break;
1771
1772 case ARGP_KEY_INIT:
1773 break;
1774
1775 case ARGP_KEY_FINI:
1776 break;
1777
1778 default:
1779 return ARGP_ERR_UNKNOWN;
1780 }
1781 return 0;
1782}
1783
1784static struct argp argp = {
1785 options,
1786 parse_opt,
1787 args_doc,
1788 doc,
1789 NULL,
1790 NULL,
1791 NULL
1792};
1793 1595
1794
1795#define ACTION_CONT 0 1596#define ACTION_CONT 0
1796#define ACTION_STOP 1 1597#define ACTION_STOP 1
1797#define ACTION_RESTART 2 1598#define ACTION_RESTART 2
@@ -2156,34 +1957,6 @@ set_mailer_argcv ()
2156} 1957}
2157 1958
2158 1959
2159const char version_etc_copyright[] =
2160 /* Do *not* mark this string for translation. %s is a copyright
2161 symbol suitable for this locale */
2162 "Copyright %s 2009 Sergey Poznyakoff";
2163
2164
2165static void
2166version (FILE *stream, struct argp_state *state)
2167{
2168 fprintf (stream, "%s (%s) %s\n", PACKAGE, PACKAGE_NAME, PACKAGE_VERSION);
2169 /* TRANSLATORS: Translate "(C)" to the copyright symbol
2170 (C-in-a-circle), if this symbol is available in the user's
2171 locale. Otherwise, do not translate "(C)"; leave it as-is. */
2172 fprintf (stream, version_etc_copyright, _("(C)"));
2173
2174 fputs (_("\
2175\n\
2176License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
2177This is free software: you are free to change and redistribute it.\n\
2178There is NO WARRANTY, to the extent permitted by law.\n\
2179\n\
2180"),
2181 stream);
2182
2183 /* TRANSLATORS: %s denotes an author name. */
2184 fprintf (stream, _("Written by %s.\n"), "Sergey Poznyakoff");
2185}
2186
2187static char * 1960static char *
2188mkfilename (const char *dir, const char *name, const char *suf) 1961mkfilename (const char *dir, const char *name, const char *suf)
2189{ 1962{
@@ -2248,10 +2021,8 @@ main (int argc, char **argv)
2248 diag_setup (DIAG_TO_SYSLOG | (stderr_closed_p () ? 0 : DIAG_TO_STDERR)); 2021 diag_setup (DIAG_TO_SYSLOG | (stderr_closed_p () ? 0 : DIAG_TO_STDERR));
2249 2022
2250 config_init (); 2023 config_init ();
2251 argp_program_version_hook = version; 2024 parse_options (argc, argv, &index);
2252 if (argp_parse (&argp, argc, argv, 0, &index, NULL)) 2025
2253 exit (EX_USAGE);
2254
2255 if (!instance) 2026 if (!instance)
2256 { 2027 {
2257 instance = strrchr (program_name, '/'); 2028 instance = strrchr (program_name, '/');
@@ -2289,10 +2060,14 @@ main (int argc, char **argv)
2289 switch (file->syntax) 2060 switch (file->syntax)
2290 { 2061 {
2291 case CONF_PIES: 2062 case CONF_PIES:
2292 if (grecs_parse (file->name)) 2063 {
2293 exit (EX_CONFIG); 2064 struct grecs_node *tree = grecs_parse (file->name);
2294 break; 2065 if (!tree || grecs_tree_process (tree, pies_keywords))
2295 2066 exit (EX_CONFIG);
2067 grecs_tree_free (tree);
2068 break;
2069 }
2070
2296 case CONF_INETD: 2071 case CONF_INETD:
2297 if (inetd_parse_conf (file->name)) 2072 if (inetd_parse_conf (file->name))
2298 exit (EX_CONFIG); 2073 exit (EX_CONFIG);
@@ -2317,7 +2092,7 @@ main (int argc, char **argv)
2317 /* Re-setup logging: it might have been reset in the config file */ 2092 /* Re-setup logging: it might have been reset in the config file */
2318 diag_setup (log_to_stderr_only ? DIAG_TO_STDERR : 0); 2093 diag_setup (log_to_stderr_only ? DIAG_TO_STDERR : 0);
2319 2094
2320 if (argc != index && command != 'R') 2095 if (argc != index && command != COM_RESTART)
2321 { 2096 {
2322 logmsg (LOG_ERR, "extra command line arguments"); 2097 logmsg (LOG_ERR, "extra command line arguments");
2323 exit (EX_CONFIG); 2098 exit (EX_CONFIG);
@@ -2326,26 +2101,26 @@ main (int argc, char **argv)
2326 progman_build_depmap (); 2101 progman_build_depmap ();
2327 switch (command) 2102 switch (command)
2328 { 2103 {
2329 case OPT_RESTART: 2104 case COM_RESTART:
2330 pies_priv_setup (&pies_privs); 2105 pies_priv_setup (&pies_privs);
2331 if (pies_umask) 2106 if (pies_umask)
2332 umask (pies_umask); 2107 umask (pies_umask);
2333 exit (request_restart_components (argv + index)); 2108 exit (request_restart_components (argv + index));
2334 2109
2335 case OPT_RELOAD: 2110 case COM_RELOAD:
2336 exit (pies_reload ()); 2111 exit (pies_reload ());
2337 2112
2338 case OPT_STATUS: 2113 case COM_STATUS:
2339 exit (pies_status ()); 2114 exit (pies_status ());
2340 2115
2341 case OPT_STOP: 2116 case COM_STOP:
2342 exit (pies_stop ()); 2117 exit (pies_stop ());
2343 2118
2344 case OPT_DUMP_PREREQ: 2119 case COM_DUMP_PREREQ:
2345 progman_dump_prereq (); 2120 progman_dump_prereq ();
2346 exit (0); 2121 exit (0);
2347 2122
2348 case OPT_DUMP_DEPMAP: 2123 case COM_DUMP_DEPMAP:
2349 progman_dump_depmap (); 2124 progman_dump_depmap ();
2350 exit (0); 2125 exit (0);
2351 2126
diff --git a/src/pies.h b/src/pies.h
index 6be870b..73b0583 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2008, 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@
42#include <signal.h> 42#include <signal.h>
43#include <time.h> 43#include <time.h>
44#include <sysexits.h> 44#include <sysexits.h>
45#include <argp.h> 45#include <ctype.h>
46 46
47#include <grecs.h> 47#include <grecs.h>
48#include <wordsplit.h> 48#include <wordsplit.h>
@@ -117,7 +117,7 @@ struct pies_privs
117{ 117{
118 char *user; 118 char *user;
119 int allgroups; 119 int allgroups;
120 gl_list_t groups; 120 struct grecs_list *groups;
121}; 121};
122 122
123enum pies_comp_mode 123enum pies_comp_mode
@@ -166,8 +166,8 @@ struct component
166 char **argv; /* Program command line */ 166 char **argv; /* Program command line */
167 char **env; /* Program environment */ 167 char **env; /* Program environment */
168 char *dir; /* Working directory */ 168 char *dir; /* Working directory */
169 gl_list_t prereq; /* Prerequisites */ 169 struct grecs_list *prereq; /* Prerequisites */
170 gl_list_t depend; /* Dependency targets */ 170 struct grecs_list *depend; /* Dependency targets */
171 int flags; /* CF_ bitmask */ 171 int flags; /* CF_ bitmask */
172 size_t max_instances; /* Maximum number of simultaneously running 172 size_t max_instances; /* Maximum number of simultaneously running
173 instances */ 173 instances */
@@ -375,7 +375,7 @@ char *sockaddr_to_astr (const struct sockaddr *sa, int salen);
375 375
376 376
377/* userprivs.c */ 377/* userprivs.c */
378int switch_to_privs (uid_t uid, gid_t gid, gl_list_t retain_groups); 378int switch_to_privs (uid_t uid, gid_t gid, struct grecs_list *retain_groups);
379 379
380void pies_priv_setup (struct pies_privs *); 380void pies_priv_setup (struct pies_privs *);
381void pies_epriv_setup (struct pies_privs *); 381void pies_epriv_setup (struct pies_privs *);
diff --git a/src/progman.c b/src/progman.c
index 4420a21..d24ea1a 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2007, 2008, 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2007, 2008, 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -15,7 +15,6 @@
15 along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */ 15 along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */
16 16
17#include "pies.h" 17#include "pies.h"
18#include <hash.h>
19 18
20enum prog_type 19enum prog_type
21 { 20 {
@@ -89,7 +88,7 @@ static size_t numcomp;
89static struct prog *proghead, *progtail; 88static struct prog *proghead, *progtail;
90static pies_depmap_t depmap; 89static pies_depmap_t depmap;
91static int recompute_alarm; 90static int recompute_alarm;
92static Hash_table *conn_tab; 91static struct grecs_symtab *conn_tab;
93 92
94void 93void
95progman_iterate_comp (int (*fun) (struct component *, void *), void *data) 94progman_iterate_comp (int (*fun) (struct component *, void *), void *data)
@@ -357,10 +356,10 @@ prog_rebuild_prerequisites (struct prog *prog)
357 356
358 if (comp->prereq) 357 if (comp->prereq)
359 { 358 {
360 depc = gl_list_size (comp->prereq); 359 depc = grecs_list_size (comp->prereq);
361 if (depc == 1) 360 if (depc == 1)
362 { 361 {
363 const char *item = gl_list_get_at (comp->prereq, 0); 362 const char *item = grecs_list_index (comp->prereq, 0);
364 if (strcmp (item, "all") == 0) 363 if (strcmp (item, "all") == 0)
365 { 364 {
366 dep_all = 1; 365 dep_all = 1;
@@ -370,7 +369,7 @@ prog_rebuild_prerequisites (struct prog *prog)
370 } 369 }
371 else if (strcmp (item, "none") == 0) 370 else if (strcmp (item, "none") == 0)
372 { 371 {
373 gl_list_free (comp->prereq); 372 grecs_list_free (comp->prereq);
374 comp->prereq = NULL; 373 comp->prereq = NULL;
375 } 374 }
376 } 375 }
@@ -392,13 +391,10 @@ prog_rebuild_prerequisites (struct prog *prog)
392 } 391 }
393 else 392 else
394 { 393 {
395 const void *p; 394 struct grecs_list_entry *ep;
396 gl_list_iterator_t itr = gl_list_iterator (comp->prereq); 395
397 while (gl_list_iterator_next (&itr, &p, NULL)) 396 for (ep = comp->prereq->head; ep; ep = ep->next)
398 { 397 prog->prereq[depc++] = (char*) ep->data;
399 prog->prereq[depc++] = (char*) p;
400 }
401 gl_list_iterator_free (&itr);
402 } 398 }
403 } 399 }
404 prog->prereq[depc] = NULL; 400 prog->prereq[depc] = NULL;
@@ -521,10 +517,10 @@ open_redirector (struct prog *master, int stream)
521} 517}
522 518
523 519
524static size_t 520static unsigned
525conn_class_hasher (void const *data, size_t n_buckets) 521conn_class_hasher (void *data, unsigned long n_buckets)
526{ 522{
527 struct conn_class const *pcclass = data; 523 struct conn_class *pcclass = data;
528 unsigned char const *tag = (unsigned char const *)pcclass->tag; 524 unsigned char const *tag = (unsigned char const *)pcclass->tag;
529 size_t value = 0; 525 size_t value = 0;
530 unsigned char ch; 526 unsigned char ch;
@@ -542,15 +538,15 @@ conn_class_hasher (void const *data, size_t n_buckets)
542} 538}
543 539
544/* Compare two strings for equality. */ 540/* Compare two strings for equality. */
545static bool 541static int
546conn_class_compare (void const *data1, void const *data2) 542conn_class_compare (void const *data1, void const *data2)
547{ 543{
548 struct conn_class const *p1 = data1; 544 struct conn_class const *p1 = data1;
549 struct conn_class const *p2 = data2; 545 struct conn_class const *p2 = data2;
550 546
551 return p1->sa_len == p2->sa_len && 547 return !(p1->sa_len == p2->sa_len &&
552 memcmp (&p1->sa_storage, &p2->sa_storage, p1->sa_len) == 0 && 548 memcmp (&p1->sa_storage, &p2->sa_storage, p1->sa_len) == 0 &&
553 strcmp (p1->tag, p2->tag) == 0; 549 strcmp (p1->tag, p2->tag) == 0);
554} 550}
555 551
556static void 552static void
@@ -559,11 +555,20 @@ conn_class_free (void *data)
559 free (data); 555 free (data);
560} 556}
561 557
558static int
559conn_class_copy(void *a, void *b)
560{
561 memcpy(a, b, sizeof(struct conn_class));
562 memset(a, 0, sizeof(struct conn_class));
563 return 0;
564}
565
562static struct conn_class * 566static struct conn_class *
563conn_class_lookup (const char *tag, 567conn_class_lookup (const char *tag,
564 union pies_sockaddr_storage const *sa_storage_ptr, 568 union pies_sockaddr_storage const *sa_storage_ptr,
565 size_t sa_len) 569 size_t sa_len)
566{ 570{
571 int install = 1;
567 struct conn_class *probe, *ret; 572 struct conn_class *probe, *ret;
568 573
569 probe = xmalloc (sizeof (probe[0])); 574 probe = xmalloc (sizeof (probe[0]));
@@ -586,17 +591,20 @@ conn_class_lookup (const char *tag,
586 } 591 }
587 592
588 probe->count = 0; 593 probe->count = 0;
594 if (!conn_tab)
595 {
596 conn_tab = grecs_symtab_create(sizeof (struct conn_class),
597 conn_class_hasher,
598 conn_class_compare,
599 conn_class_copy,
600 NULL,
601 conn_class_free);
602 if (!conn_tab)
603 xalloc_die ();
604 }
589 605
590 if (!((conn_tab 606 ret = grecs_symtab_lookup_or_install (conn_tab, probe, &install);
591 || (conn_tab = hash_initialize (0, 0, 607 free (probe);
592 conn_class_hasher,
593 conn_class_compare,
594 conn_class_free)))
595 && (ret = hash_insert (conn_tab, probe))))
596 xalloc_die ();
597
598 if (probe != ret)
599 free (probe);
600 return ret; 608 return ret;
601} 609}
602 610
@@ -1411,16 +1419,14 @@ progman_accept (int socket)
1411void 1419void
1412component_fixup_depend (struct component *comp) 1420component_fixup_depend (struct component *comp)
1413{ 1421{
1414 const void *p; 1422 struct grecs_list_entry *ep;
1415 gl_list_iterator_t itr;
1416 1423
1417 if (comp->depend == NULL) 1424 if (comp->depend == NULL)
1418 return; 1425 return;
1419 1426
1420 itr = gl_list_iterator (comp->depend); 1427 for (ep = comp->depend->head; ep; ep = ep->next)
1421 while (gl_list_iterator_next (&itr, &p, NULL))
1422 { 1428 {
1423 const char *tag = p; 1429 const char *tag = ep->data;
1424 struct component *tgt; 1430 struct component *tgt;
1425 1431
1426 tgt = progman_lookup_component (tag); 1432 tgt = progman_lookup_component (tag);
@@ -1434,16 +1440,12 @@ component_fixup_depend (struct component *comp)
1434 } 1440 }
1435 if (!tgt->prereq) 1441 if (!tgt->prereq)
1436 { 1442 {
1437 tgt->prereq = gl_list_create_empty(&gl_linked_list_implementation, 1443 tgt->prereq = grecs_list_create();
1438 NULL,
1439 NULL,
1440 NULL,
1441 false);
1442 } 1444 }
1443 /* FIXME: memory allocation */ 1445 /* FIXME: memory allocation */
1444 gl_list_add_last (tgt->prereq, xstrdup (comp->tag)); 1446 grecs_list_append (tgt->prereq, xstrdup (comp->tag));
1445 } 1447 }
1446 gl_list_free (comp->depend); 1448 grecs_list_free (comp->depend);
1447 comp->depend = NULL; 1449 comp->depend = NULL;
1448} 1450}
1449 1451
diff --git a/src/userprivs.c b/src/userprivs.c
index b224a00..3270905 100644
--- a/src/userprivs.c
+++ b/src/userprivs.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2007, 2008, 2009, 2010 Sergey Poznyakoff 2 Copyright (C) 2007, 2008, 2009, 2010, 2011 Sergey Poznyakoff
3 3
4 GNU Pies is free software; you can redistribute it and/or modify 4 GNU Pies is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -38,30 +38,23 @@ str_dispose (const void *elt)
38 free ((void*)elt); 38 free ((void*)elt);
39} 39}
40 40
41gl_list_t 41struct grecs_list *
42get_user_groups (gl_list_t init_list, const char *user) 42get_user_groups (struct grecs_list *init_list, const char *user)
43{ 43{
44 int rc; 44 int rc;
45 struct group *gr; 45 struct group *gr;
46 gl_list_t list; 46 struct grecs_list *list;
47 47
48 list = gl_list_create_empty(&gl_linked_list_implementation, 48 list = grecs_list_create();
49 str_eq,
50 NULL,
51 str_dispose,
52 false);
53 49
54 if (init_list) 50 if (init_list)
55 { 51 {
56 const void *p; 52 struct grecs_list_entry *ep;
57 gl_list_iterator_t itr = gl_list_iterator (init_list); 53
58 while (gl_list_iterator_next (&itr, &p, NULL)) 54 for (ep = init_list->head; ep; ep = ep->next)
59 { 55 {
60 char *s = xstrdup (p); 56 grecs_list_append (list, xstrdup ((char*)ep->data));
61 if (!gl_list_add_last (list, s))
62 free (s);
63 } 57 }
64 gl_list_iterator_free (&itr);
65 } 58 }
66 59
67 setgrent (); 60 setgrent ();
@@ -71,9 +64,7 @@ get_user_groups (gl_list_t init_list, const char *user)
71 for (p = gr->gr_mem; *p; p++) 64 for (p = gr->gr_mem; *p; p++)
72 if (strcmp (*p, user) == 0) 65 if (strcmp (*p, user) == 0)
73 { 66 {
74 char *s = xstrdup (gr->gr_name); 67 grecs_list_append (list, xstrdup (gr->gr_name));
75 if (!gl_list_add_last (list, s))
76 free (s);
77 break; 68 break;
78 } 69 }
79 } 70 }
@@ -83,33 +74,33 @@ get_user_groups (gl_list_t init_list, const char *user)
83 74
84/* Switch to the given UID/GID */ 75/* Switch to the given UID/GID */
85int 76int
86switch_to_privs (uid_t uid, gid_t gid, gl_list_t retain_groups) 77switch_to_privs (uid_t uid, gid_t gid, struct grecs_list *retain_groups)
87{ 78{
88 int rc = 0; 79 int rc = 0;
89 gid_t *emptygidset; 80 gid_t *emptygidset;
90 size_t size = 1, j = 1; 81 size_t size = 1, j = 1;
91 82
92 /* Create a list of supplementary groups */ 83 /* Create a list of supplementary groups */
93 size = 1 + (retain_groups ? gl_list_size (retain_groups) : 0); 84 size = 1 + (retain_groups ? grecs_list_size (retain_groups) : 0);
94 emptygidset = xcalloc (size, sizeof emptygidset[0]); 85 emptygidset = xcalloc (size, sizeof emptygidset[0]);
95 emptygidset[0] = gid ? gid : getegid (); 86 emptygidset[0] = gid ? gid : getegid ();
96 87
97 if (retain_groups) 88 if (retain_groups)
98 { 89 {
99 const void *p; 90 struct grecs_list_entry *ep;
100 gl_list_iterator_t itr = gl_list_iterator (retain_groups); 91
101 while (gl_list_iterator_next (&itr, &p, NULL)) 92 for (ep = retain_groups->head; ep; ep = ep->next)
102 { 93 {
103 struct group *group = getgrnam ((const char*)p); 94 const char *grname = ep->data;
95 struct group *group = getgrnam (grname);
104 if (!group) 96 if (!group)
105 { 97 {
106 logmsg (LOG_ERR, _("unknown group: %s"), (const char*)p); 98 logmsg (LOG_ERR, _("unknown group: %s"), grname);
107 free (emptygidset); 99 free (emptygidset);
108 return 1; 100 return 1;
109 } 101 }
110 emptygidset[j++] = group->gr_gid; 102 emptygidset[j++] = group->gr_gid;
111 } 103 }
112 gl_list_iterator_free (&itr);
113 } 104 }
114 105
115 /* Reset group permissions */ 106 /* Reset group permissions */
@@ -209,7 +200,7 @@ void
209pies_priv_setup (struct pies_privs *privs) 200pies_priv_setup (struct pies_privs *privs)
210{ 201{
211 struct passwd *pw; 202 struct passwd *pw;
212 gl_list_t grplist = 0; 203 struct grecs_list *grplist = 0;
213 204
214 if (!privs || !privs->user) 205 if (!privs || !privs->user)
215 return; 206 return;
@@ -227,7 +218,7 @@ pies_priv_setup (struct pies_privs *privs)
227 grplist ? grplist : privs->groups)) 218 grplist ? grplist : privs->groups))
228 exit (EX_SOFTWARE); 219 exit (EX_SOFTWARE);
229 if (grplist) 220 if (grplist)
230 gl_list_free (grplist); 221 grecs_list_free (grplist);
231} 222}
232 223
233 224

Return to:

Send suggestions and report system problems to the System administrator.