3
Jakub Hrozek <jhrozek@redhat.com>
4
Simo Sorce <ssorce@redhat.com>
6
Copyright (C) 2009 Red Hat
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#ifndef __TOOLS_UTIL_H__
24
#define __TOOLS_UTIL_H__
28
#include "util/util.h"
30
#define CHECK_ROOT(val, prg_name) do { \
33
DEBUG(1, ("Running under %d, must be root\n", val)); \
34
ERROR("%s must be run as root\n", prg_name); \
41
struct tevent_context *ev;
42
struct confdb_ctx *confdb;
43
struct sysdb_ctx *sysdb;
45
struct sss_names_ctx *snctx;
46
struct sss_domain_info *local;
50
struct sysdb_handle *handle;
51
bool transaction_done;
55
int init_sss_tools(struct tools_ctx **_tctx);
57
void usage(poptContext pc, const char *error);
62
int parse_name_domain(struct tools_ctx *tctx,
63
const char *fullname);
65
int id_in_range(uint32_t id,
66
struct sss_domain_info *dom);
68
int parse_groups(TALLOC_CTX *mem_ctx,
72
int parse_group_name_domain(struct tools_ctx *tctx,
75
int check_group_names(struct tools_ctx *tctx,
79
int create_homedir(TALLOC_CTX *mem_ctx,
85
mode_t default_umask);
87
int create_mail_spool(TALLOC_CTX *mem_ctx,
90
uid_t uid, gid_t gid);
92
int remove_homedir(TALLOC_CTX *mem_ctx,
96
uid_t uid, bool force);
99
int remove_tree(const char *root);
101
int copy_tree(const char *src_root,
102
const char *dst_root,
103
uid_t uid, gid_t gid);
105
int selinux_file_context(const char *dst_name);
106
int reset_selinux_file_context(void);
108
#endif /* __TOOLS_UTIL_H__ */