1 /* This file is part of GNU Radius.
2    Copyright (C) 2000,2001,2002,2003,2004,2005,2007 Free Software Foundation, Inc.
3 
4    Written by Sergey Poznyakoff
5 
6    GNU Radius is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10 
11    GNU Radius is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public
17    License along with GNU Radius; if not, write to the Free
18    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19    Boston, MA 02110-1301 USA. */
20 
21 #if defined(HAVE_CONFIG_H)
22 # include <config.h>
23 #endif
24 #include <radlib.h>
25 
26 char    *grad_config_dir;
27 char    *grad_log_dir;
28 char    *grad_acct_dir;
29 char    *grad_utmp_file;
30 char    *grad_wtmp_file;
31 char    *grad_stat_file;
32 char    *grad_msgid_file;
33 char    *grad_pid_dir;
34 char    *grad_bug_report_address = "bug-gnu-radius@gnu.org";
35 
36 void
grad_path_init()37 grad_path_init()
38 {
39         if (!grad_config_dir)
40                 grad_config_dir = grad_estrdup(RADIUS_DIR);
41         if (!grad_log_dir)
42                 grad_log_dir = grad_estrdup(RADLOG_DIR);
43         if (!grad_acct_dir)
44                 grad_acct_dir = grad_estrdup(RADACCT_DIR);
45         if (!grad_pid_dir)
46                 grad_pid_dir = grad_estrdup(RADPID_DIR);
47 
48         grad_free(grad_utmp_file);
49         grad_utmp_file = grad_mkfilename(grad_log_dir, RADUTMP);
50 
51         grad_free(grad_wtmp_file);
52         grad_wtmp_file = grad_mkfilename(grad_log_dir, RADWTMP);
53 
54         grad_free(grad_stat_file);
55         grad_stat_file = grad_mkfilename(grad_log_dir, RADSTAT);
56 
57 	grad_free(grad_msgid_file);
58 	grad_msgid_file = grad_mkfilename(grad_log_dir, RADMSGID);
59 }
60 
61 void
grad_path_free()62 grad_path_free()
63 {
64 	grad_destroy((void**)&grad_config_dir);
65 	grad_destroy((void**)&grad_log_dir);
66 	grad_destroy((void**)&grad_acct_dir);
67 	grad_destroy((void**)&grad_utmp_file);
68 	grad_destroy((void**)&grad_wtmp_file);
69 	grad_destroy((void**)&grad_stat_file);
70 	grad_destroy((void**)&grad_msgid_file);
71 	grad_destroy((void**)&grad_pid_dir);
72 }
73