The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: 973af3fd19549eaeb25489fa60fe9f76a20def00 $
20 *
21 * @file lib/server/util.h
22 * @brief Various utility functions
23 *
24 * @copyright 2000,2006 The FreeRADIUS server project
25 */
26RCSIDH(util_h, "$Id: 973af3fd19549eaeb25489fa60fe9f76a20def00 $")
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <pwd.h>
33#include <grp.h>
34#include <freeradius-devel/util/talloc.h>
35
36void (*reset_signal(int signo, void (*func)(int)))(int);
38ssize_t rad_filename_escape(UNUSED request_t *request, char *out, size_t outlen,
39 char const *in, UNUSED void *arg);
41
42uint32_t rad_pps(uint32_t *past, uint32_t *present, time_t *then, struct timeval *now);
43int rad_expand_xlat(request_t *request, char const *cmd,
44 int max_argc, char const *argv[], bool can_fail,
45 size_t argv_buflen, char *argv_buf);
46
47int rad_seuid(uid_t uid);
48int rad_segid(gid_t gid);
49
50void rad_suid_set_down_uid(uid_t uid);
51void rad_suid_up(void);
52void rad_suid_down(void);
55
56#ifdef __cplusplus
57}
58#endif
#define RCSIDH(h, id)
Definition build.h:488
#define UNUSED
Definition build.h:317
static fr_slen_t in
Definition dict.h:884
unsigned int uint32_t
long int ssize_t
void rad_suid_up(void)
Definition util.c:767
bool rad_suid_is_down_permanent(void)
Return whether we've permanently dropped root privileges.
Definition util.c:788
void(*)(int) reset_signal(int signo, void(*func)(int))
Definition util.h:36
int rad_segid(gid_t gid)
Alter the effective user id.
Definition util.c:822
uint32_t rad_pps(uint32_t *past, uint32_t *present, time_t *then, struct timeval *now)
Definition util.c:400
int rad_filename_box_escape(fr_value_box_t *vb, UNUSED void *uxtc)
Definition util.c:253
void rad_suid_down(void)
Definition util.c:771
int rad_filename_box_make_safe(fr_value_box_t *vb, UNUSED void *uxtc)
Definition util.c:131
int rad_expand_xlat(request_t *request, char const *cmd, int max_argc, char const *argv[], bool can_fail, size_t argv_buflen, char *argv_buf)
Split string into words and expand each one.
Definition util.c:450
ssize_t rad_filename_escape(UNUSED request_t *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
Escapes the raw string such that it should be safe to use as part of a file path.
Definition util.c:178
void rad_suid_down_permanent(void)
Definition util.c:776
int rad_seuid(uid_t uid)
Alter the effective user id.
Definition util.c:800
void rad_suid_set_down_uid(uid_t uid)
Definition util.c:763
static size_t char ** out
Definition value.h:1030