aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-01-08 15:31:17 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-01-08 16:17:35 +0200
commit489432d354d88049afe4af54c29965d382d67f7a (patch)
tree84725496a92564824f75f0a2edd5a595411ffab2
parent3325fed2895f079486b88c65409c73153fec306f (diff)
downloadpies-489432d354d88049afe4af54c29965d382d67f7a.tar.gz
pies-489432d354d88049afe4af54c29965d382d67f7a.tar.bz2
Uniformly use grecs memory management functions.
* gnulib.modules: Remove unneded modules. * ident/ident.h: Remove xalloc.h, include errno.h * ident/ident.c: Use standard allocation functions instead of x* * ident/pam.c: Remove. * ident/provider.c: Remove. * ident/system.c: Remove. * src/meta.c: Remove. * src/Makefile.am: Remove meta.c * src/progman.c: Use grecs_* allocation functions instead of x*. (notify): Use wordsplit to expand variables within message. Rename variables: program-name to program_name; canonical-program-name to canonical_program_name. * doc/pies.texi: Update. * src/depmap.c: Use grecs_* allocation functions instead of x*. (depmap_end): New function. * src/diag.c (logmsg_vprintf): Use grecs_txtacc instead of obstack. * src/pies.h (depmap_end): New proto. Remove unused includes. * src/acl.c: Use grecs_* allocation functions instead of x*. * src/ctl.c: Likewise. * src/inetd.c: Likewise. * src/limits.c: Likewise. * src/meta1gram.y: Likewise. * src/meta1lex.l: Likewise. * src/pies.c: Likewise. * src/socket.c: Likewise. * src/sysvinit.c: Likewise. * src/userprivs.c: Likewise.
-rw-r--r--.gitignore1
-rw-r--r--doc/pies.texi10
-rw-r--r--gnulib.modules3
-rw-r--r--ident/ident.c20
-rw-r--r--ident/ident.h4
-rw-r--r--ident/pam.c4
-rw-r--r--ident/provider.c12
-rw-r--r--ident/system.c6
-rw-r--r--src/Makefile.am1
-rw-r--r--src/acl.c22
-rw-r--r--src/ctl.c48
-rw-r--r--src/depmap.c14
-rw-r--r--src/diag.c48
-rw-r--r--src/inetd.c44
-rw-r--r--src/limits.c4
-rw-r--r--src/meta.c127
-rw-r--r--src/meta1gram.y20
-rw-r--r--src/meta1lex.l24
-rw-r--r--src/pies.c28
-rw-r--r--src/pies.h21
-rw-r--r--src/progman.c218
-rw-r--r--src/socket.c4
-rw-r--r--src/sysvinit.c60
-rw-r--r--src/userprivs.c12
24 files changed, 360 insertions, 395 deletions
diff --git a/.gitignore b/.gitignore
index 216d2e5..11f9326 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
1/ABOUT-NLS
1/ABOUT-NLS~ 2/ABOUT-NLS~
2*.a 3*.a
3*.la 4*.la
diff --git a/doc/pies.texi b/doc/pies.texi
index 46e1b91..7ad5008 100644
--- a/doc/pies.texi
+++ b/doc/pies.texi
@@ -1681,8 +1681,8 @@ The table below lists all available variables and their expansions:
1681@caption{Notification Variables} 1681@caption{Notification Variables}
1682@multitable @columnfractions 0.5 0.5 1682@multitable @columnfractions 0.5 0.5
1683@headitem Variable @tab Expansion 1683@headitem Variable @tab Expansion
1684@item canonical-program-name @tab @samp{pies} 1684@item canonical_program_name @tab @samp{pies}
1685@item program-name @tab Program name of the @command{pies} binary. 1685@item program_name @tab Program name of the @command{pies} binary.
1686@item package @tab Package name (@samp{Pies}). 1686@item package @tab Package name (@samp{Pies}).
1687@item instance @tab Instance name (@pxref{instances}). 1687@item instance @tab Instance name (@pxref{instances}).
1688@item version @tab Package version (@value{VERSION}). 1688@item version @tab Package version (@value{VERSION}).
@@ -1712,7 +1712,7 @@ message is used instead:
1712 1712
1713@smallexample 1713@smallexample
1714From: <> 1714From: <>
1715X-Agent: $@{canonical-program-name@} ($@{package@} $@{version@}) 1715X-Agent: $@{canonical_program_name@} ($@{package@} $@{version@})
1716Subject: Component $@{component@} $@{termination@} $@{retcode@}. 1716Subject: Component $@{component@} $@{termination@} $@{retcode@}.
1717 1717
1718@end smallexample 1718@end smallexample
@@ -2299,7 +2299,7 @@ return-code (EX_USAGE, EX_CONFIG) @{
2299 notify "root"; 2299 notify "root";
2300 message <<- EOT 2300 message <<- EOT
2301 From: Pies <> 2301 From: Pies <>
2302 X-Agent: $@{canonical-program-name@} ($@{package@} $@{version@}) 2302 X-Agent: $@{canonical_program_name@} ($@{package@} $@{version@})
2303 Subject: Component $@{component@} disabled. 2303 Subject: Component $@{component@} disabled.
2304 2304
2305 Component "$@{component@}" has terminated with code $@{retcode@}, 2305 Component "$@{component@}" has terminated with code $@{retcode@},
@@ -2307,7 +2307,7 @@ return-code (EX_USAGE, EX_CONFIG) @{
2307 I will not restart it automatically. Please fix its configuration 2307 I will not restart it automatically. Please fix its configuration
2308 and restart it manually at your earliest convenience. 2308 and restart it manually at your earliest convenience.
2309 2309
2310 To restart, run ``$@{program-name@} -R $@{component@}'' 2310 To restart, run ``$@{program_name@} -R $@{component@}''
2311 --- 2311 ---
2312 Wuff-wuff, 2312 Wuff-wuff,
2313 Pies 2313 Pies
diff --git a/gnulib.modules b/gnulib.modules
index 2612e75..9e9d255 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -9,9 +9,6 @@ fprintftime
9gettext 9gettext
10inttostr 10inttostr
11inttypes 11inttypes
12obstack
13progname 12progname
14quotearg 13quotearg
15sysexits 14sysexits
16xalloc
17xvasprintf
diff --git a/ident/ident.c b/ident/ident.c
index dbf3f9b..75d51fa 100644
--- a/ident/ident.c
+++ b/ident/ident.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2015 Sergey Poznyakoff 2 Copyright (C) 2015-2016 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,20 @@
19pies_identity_t 19pies_identity_t
20pies_identity_create (char const *user) 20pies_identity_create (char const *user)
21{ 21{
22 pies_identity_t id = xmalloc (sizeof (*id)); 22 pies_identity_t id = malloc (sizeof (*id));
23 id->provider = NULL; 23 if (id)
24 id->username = xstrdup (user); 24 {
25 id->data = NULL; 25 id->provider = NULL;
26 id->data = NULL;
27 id->username = strdup (user);
28 if (!id)
29 {
30 int ec = errno;
31 free (id);
32 errno = ec;
33 id = NULL;
34 }
35 }
26 return id; 36 return id;
27} 37}
28 38
diff --git a/ident/ident.h b/ident/ident.h
index 313926c..c262f58 100644
--- a/ident/ident.h
+++ b/ident/ident.h
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2015 Sergey Poznyakoff 2 Copyright (C) 2015-2016 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
17#include <config.h> 17#include <config.h>
18#include "xalloc.h" 18#include <errno.h>
19#include "libpies.h" 19#include "libpies.h"
20#include "grecs.h" 20#include "grecs.h"
21#include "identity.h" 21#include "identity.h"
diff --git a/ident/pam.c b/ident/pam.c
index 7302242..96ac02c 100644
--- a/ident/pam.c
+++ b/ident/pam.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2015 Sergey Poznyakoff 2 Copyright (C) 2015-2016 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
@@ -183,7 +183,7 @@ static int
183configure (struct grecs_node *node, pies_identity_provider_t provider) 183configure (struct grecs_node *node, pies_identity_provider_t provider)
184{ 184{
185 int i; 185 int i;
186 struct pam_identity_provider_data *data = xcalloc (1, sizeof (*data)); 186 struct pam_identity_provider_data *data = grecs_calloc (1, sizeof (*data));
187 provider->data = data; 187 provider->data = data;
188 for (i = 0; pam_kw[i].ident; i++) 188 for (i = 0; pam_kw[i].ident; i++)
189 pam_kw[i].varptr = data; 189 pam_kw[i].varptr = data;
diff --git a/ident/provider.c b/ident/provider.c
index dd7fc3d..8b9f076 100644
--- a/ident/provider.c
+++ b/ident/provider.c
@@ -1,5 +1,5 @@
1/* This file is part of GNU Pies. 1/* This file is part of GNU Pies.
2 Copyright (C) 2015 Sergey Poznyakoff 2 Copyright (C) 2015-2016 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
@@ -27,7 +27,7 @@ idmech_copy (void *a, void *b)
27 pies_identity_mechanism_t mb = b; 27 pies_identity_mechanism_t mb = b;
28 28
29 *ma = *mb; 29 *ma = *mb;
30 ma->name = xstrdup (mb->name); 30 ma->name = grecs_strdup (mb->name);
31 return 0; 31 return 0;
32} 32}
33 33
@@ -38,14 +38,14 @@ pies_identity_mechanism_register (pies_identity_mechanism_t mech)
38 38
39 if (!idmech_symtab) 39 if (!idmech_symtab)
40 { 40 {
41 idmech_symtab = grecs_symtab_create (sizeof(*mech), 41 idmech_symtab = grecs_symtab_create (sizeof (*mech),
42 NULL, 42 NULL,
43 NULL, 43 NULL,
44 idmech_copy, 44 idmech_copy,
45 NULL, 45 NULL,
46 NULL); 46 NULL);
47 if (!idmech_symtab) 47 if (!idmech_symtab)
48 grecs_alloc_die(); 48 grecs_alloc_die ();
49 } 49 }
50 50
51 install = 1; 51 install = 1;
@@ -135,8 +135,8 @@ pies_config_provider (struct grecs_node *node)
135 return 1; 135 return 1;
136 } 136 }
137 137
138 prov = xcalloc (1, sizeof (*prov)); 138 prov = grecs_calloc (1, sizeof (*prov));
139 prov->name = xstrdup (name); 139 prov->name = grecs_strdup (name);
140 prov->mech = mp; 140 prov->mech = mp;
141 prov->locus = node->locus; 141 prov->locus = node->locus;