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: a11545e7270fcd53340ab1e25f926d77918d180f $
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: a11545e7270fcd53340ab1e25f926d77918d180f $")
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);
37ssize_t rad_filename_make_safe(UNUSED request_t *request, char *out, size_t outlen,
38 char const *in, UNUSED void *arg);
40ssize_t rad_filename_escape(UNUSED request_t *request, char *out, size_t outlen,
41 char const *in, UNUSED void *arg);
43
44uint32_t rad_pps(uint32_t *past, uint32_t *present, time_t *then, struct timeval *now);
45int rad_expand_xlat(request_t *request, char const *cmd,
46 int max_argc, char const *argv[], bool can_fail,
47 size_t argv_buflen, char *argv_buf);
48
49int rad_seuid(uid_t uid);
50int rad_segid(gid_t gid);
51
52void rad_suid_set_down_uid(uid_t uid);
53void rad_suid_up(void);
54void rad_suid_down(void);
57
58#ifdef __cplusplus
59}
60#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
ssize_t rad_filename_make_safe(UNUSED request_t *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
Ensures that a filename cannot walk up the directory structure.
Definition util.c:90
void rad_suid_up(void)
Definition util.c:796
bool rad_suid_is_down_permanent(void)
Return whether we've permanently dropped root privileges.
Definition util.c:817
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:851
uint32_t rad_pps(uint32_t *past, uint32_t *present, time_t *then, struct timeval *now)
Definition util.c:429
int rad_filename_box_escape(fr_value_box_t *vb, UNUSED void *uxtc)
Definition util.c:282
void rad_suid_down(void)
Definition util.c:800
int rad_filename_box_make_safe(fr_value_box_t *vb, UNUSED void *uxtc)
Definition util.c:161
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:479
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:206
void rad_suid_down_permanent(void)
Definition util.c:805
int rad_seuid(uid_t uid)
Alter the effective user id.
Definition util.c:829
void rad_suid_set_down_uid(uid_t uid)
Definition util.c:792
static size_t char ** out
Definition value.h:1024