diff options
author | Alberto Gonzalez Iniesta <agi@inittab.org> | 2016-12-27 18:25:47 +0100 |
---|---|---|
committer | Alberto Gonzalez Iniesta <agi@inittab.org> | 2016-12-27 18:25:47 +0100 |
commit | 79f3537f69e125f19f59c36aa090120a63186a54 (patch) | |
tree | 2089a3b7dac990841dbc2e4d9b2f535b82dbb0af /src/openvpn/platform.h | |
parent | f2137fedb30cb87448eb03b2f288920df6187571 (diff) | |
parent | 3a2bbdb05ca6a6996e424c9fb225cb0d53804125 (diff) |
Merge tag 'upstream/2.4.0'
Upstream version 2.4.0
Diffstat (limited to 'src/openvpn/platform.h')
-rw-r--r-- | src/openvpn/platform.h | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/src/openvpn/platform.h b/src/openvpn/platform.h index fe2685a..62396a9 100644 --- a/src/openvpn/platform.h +++ b/src/openvpn/platform.h @@ -5,7 +5,7 @@ * packet encryption, packet authentication, and * packet compression. * - * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> + * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -55,10 +55,10 @@ struct platform_state_user { #if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID) - const char *username; - struct passwd *pw; + const char *username; + struct passwd *pw; #else - int dummy; + int dummy; #endif }; @@ -66,75 +66,82 @@ struct platform_state_user { struct platform_state_group { #if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID) - const char *groupname; - struct group *gr; + const char *groupname; + struct group *gr; #else - int dummy; + int dummy; #endif }; -bool platform_user_get (const char *username, struct platform_state_user *state); -void platform_user_set (const struct platform_state_user *state); +bool platform_user_get(const char *username, struct platform_state_user *state); -bool platform_group_get (const char *groupname, struct platform_state_group *state); -void platform_group_set (const struct platform_state_group *state); +void platform_user_set(const struct platform_state_user *state); + +bool platform_group_get(const char *groupname, struct platform_state_group *state); + +void platform_group_set(const struct platform_state_group *state); /* * Extract UID or GID */ static inline int -platform_state_user_uid (const struct platform_state_user *s) +platform_state_user_uid(const struct platform_state_user *s) { #if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID) - if (s->pw) - return s->pw->pw_uid; + if (s->pw) + { + return s->pw->pw_uid; + } #endif - return -1; + return -1; } static inline int -platform_state_group_gid (const struct platform_state_group *s) +platform_state_group_gid(const struct platform_state_group *s) { #if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID) - if (s->gr) - return s->gr->gr_gid; + if (s->gr) + { + return s->gr->gr_gid; + } #endif - return -1; + return -1; } -void platform_chroot (const char *path); +void platform_chroot(const char *path); -void platform_nice (int niceval); +void platform_nice(int niceval); -unsigned int platform_getpid (void); +unsigned int platform_getpid(void); -void platform_mlockall (bool print_msg); /* Disable paging */ +void platform_mlockall(bool print_msg); /* Disable paging */ -int platform_chdir (const char* dir); +int platform_chdir(const char *dir); /* interpret the status code returned by execve() */ -bool platform_system_ok (int stat); +bool platform_system_ok(int stat); -int platform_access (const char *path, int mode); +int platform_access(const char *path, int mode); -void platform_sleep_milliseconds (unsigned int n); +void platform_sleep_milliseconds(unsigned int n); -void platform_sleep_until_signal (void); +void platform_sleep_until_signal(void); /* delete a file, return true if succeeded */ -bool platform_unlink (const char *filename); +bool platform_unlink(const char *filename); -int platform_putenv (char *string); +int platform_putenv(char *string); -FILE *platform_fopen (const char *path, const char *mode); -int platform_open (const char *path, int flags, int mode); +FILE *platform_fopen(const char *path, const char *mode); + +int platform_open(const char *path, int flags, int mode); #ifdef _WIN32 typedef struct _stat platform_stat_t; #else typedef struct stat platform_stat_t; #endif -int platform_stat (const char *path, platform_stat_t *buf); +int platform_stat(const char *path, platform_stat_t *buf); -#endif +#endif /* ifndef PLATFORM_H */ |