Fix ACL crash for non-existing user.
[pwmd.git] / src / rcfile.h
blob5335c326f1c5a07fde8cbc846082ba8c01780c2b
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef RCFILE_H
21 #define RCFILE_H
23 #include <pthread.h>
24 #include <sys/types.h>
25 #include "util-slist.h"
27 /* This is a string so ealier versions of glib can be used. */
28 #define DEFAULT_ITERATION_PROGRESS "2000"
30 #define INVALID_PRIORITY "-99"
32 struct config_section_s
34 char *name;
35 struct slist_s *params;
38 #define INVOKING_UID 0
39 #define INVOKING_GID 1
40 #define INVOKING_TLS 2
42 struct invoking_user_s
44 int type;
45 int not;
46 union {
47 uid_t uid;
48 char *id;
50 struct invoking_user_s *next;
53 #ifdef HAVE_MLOCKALL
54 int disable_mlock;
55 #endif
56 char *logfile;
57 char *rcfile;
58 char *homedir;
59 int max_recursion_depth;
60 int disable_list_and_dump;
61 struct slist_s *global_config;
62 int log_syslog;
63 pthread_mutex_t rcfile_mutex;
64 pthread_cond_t rcfile_cond;
65 pthread_t rcfile_tid;
66 struct invoking_user_s *invoking_users;
68 void free_invoking_users (struct invoking_user_s *);
69 struct slist_s *config_parse (const char *filename, int reload);
70 void config_clear_keys ();
71 void config_free (struct slist_s *config);
73 char *config_get_value (const char *section, const char *what);
74 long config_get_long (const char *section, const char *what);
75 unsigned long config_get_ulong (const char *section, const char *what);
76 int config_get_boolean (const char *section, const char *what);
77 int config_get_integer (const char *section, const char *what);
78 char *config_get_string (const char *section, const char *what);
79 char **config_get_list (const char *section, const char *what);
80 long long config_get_longlong (const char *section, const char *what);
81 unsigned long long config_get_ulonglong (const char *section,
82 const char *what);
84 int config_set_list_param (struct slist_s **config, const char *section,
85 const char *name, const char *value);
86 char **config_get_list_param (struct slist_s *config, const char *section,
87 const char *what, int *exists);
88 int config_set_int_param (struct slist_s **config, const char *section,
89 const char *name, const char *value);
90 int config_get_int_param (struct slist_s *config, const char *section,
91 const char *name, int *exists);
92 int config_get_bool_param (struct slist_s *config, const char *section,
93 const char *name, int *exists);
94 int config_set_bool_param (struct slist_s **config, const char *section,
95 const char *name, const char *value);
97 #endif