]>
Commit | Line | Data |
---|---|---|
b1d4f8e1 LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | #pragma once | |
4 | ||
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | ***/ | |
23 | ||
24 | #include <sys/types.h> | |
25 | #include <stdbool.h> | |
26 | ||
27 | bool uid_is_valid(uid_t uid); | |
28 | ||
29 | static inline bool gid_is_valid(gid_t gid) { | |
30 | return uid_is_valid((uid_t) gid); | |
31 | } | |
32 | ||
33 | int parse_uid(const char *s, uid_t* ret_uid); | |
34 | ||
35 | static inline int parse_gid(const char *s, gid_t *ret_gid) { | |
36 | return parse_uid(s, (uid_t*) ret_gid); | |
37 | } | |
38 | ||
b1d4f8e1 LP |
39 | char* getlogname_malloc(void); |
40 | char* getusername_malloc(void); | |
41 | ||
42 | int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home, const char **shell); | |
43 | int get_group_creds(const char **groupname, gid_t *gid); | |
44 | ||
45 | char* uid_to_name(uid_t uid); | |
46 | char* gid_to_name(gid_t gid); | |
47 | ||
48 | int in_gid(gid_t gid); | |
49 | int in_group(const char *name); | |
50 | ||
51 | int get_home_dir(char **ret); | |
52 | int get_shell(char **_ret); | |
53 | ||
54 | int reset_uid_gid(void); | |
e929bee0 LP |
55 | |
56 | int take_etc_passwd_lock(const char *root); |