aboutsummaryrefslogtreecommitdiff
path: root/lib/libmf.h
blob: 463d7710c8ba94b2a131dcdc655eb077d416c3d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* This file is part of Mailfromd.
   Copyright (C) 2005, 2006, 2008 Sergey Poznyakoff

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */

#include <stdio.h>
#include <gettext.h>
#include <mailutils/types.h>
#include <mailutils/cfg.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>

#define _(String) gettext(String)
#define N_(String) String

#if defined HAVE_SYSCONF && defined _SC_OPEN_MAX
# define getmaxfd() sysconf(_SC_OPEN_MAX)
#elif defined (HAVE_GETDTABLESIZE)
# define getmaxfd() getdtablesize()
#else
# define getmaxfd() 256
#endif

void mailfromd_version(const char *progname, FILE *stream);
void mf_init_nls (void);
int parse_time_interval(const char *str, time_t *pint, const char **endp);

void dict_init(mu_assoc_t *dict);
char *dict_install(mu_assoc_t dict, const char *name, const char *value);
void dict_destroy(mu_assoc_t *dict);
char *dict_getsym(void *data, const char *str);


struct mf_privs {
	char *user;
	int allgroups;
	mu_list_t groups;
};

int switch_to_privs (uid_t uid, gid_t gid, mu_list_t retain_groups);
int get_user_groups (mu_list_t *pgrouplist, const char *user);

void mf_priv_setup (struct mf_privs *);
void mf_epriv_setup (struct mf_privs *);


char **config_array_to_argv (mu_config_value_t *val, mu_debug_t debug);
char *config_array_to_string (mu_config_value_t *val, mu_debug_t debug);

int config_cb_timeout (struct timeval *pt, mu_debug_t debug,
		       mu_config_value_t *val);

void mf_proctitle_init (int argc, char *argv[], char *env[]);
void mf_proctitle_format (const char *fmt, ...);


Return to:

Send suggestions and report system problems to the System administrator.