aheinecke@404: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik aheinecke@404: * Software engineering by Intevation GmbH aheinecke@404: * aheinecke@404: * This file is Free Software under the GNU GPL (v>=2) aheinecke@404: * and comes with ABSOLUTELY NO WARRANTY! aheinecke@404: * See LICENSE.txt for details. aheinecke@404: */ aheinecke@321: #ifndef COMMON_UTIL_H aheinecke@321: #define COMMON_UTIL_H aheinecke@321: /* @file util.h aheinecke@321: * @brief The usual useful stuff that fit nowhere else aheinecke@321: */ aheinecke@321: #include aheinecke@321: aheinecke@505: #ifdef __cplusplus aheinecke@505: extern "C" { aheinecke@505: #endif aheinecke@505: aheinecke@321: /**@brief Check if the current process is running with elevated privileges. aheinecke@321: * aheinecke@321: * Elevates the current process token to check if it is marked as elevated. wilde@323: * Uses TokenElevation on windows and checks effective UID on Linux. aheinecke@321: * aheinecke@321: * @returns true if the current process is elevated.*/ aheinecke@321: bool is_elevated(); wilde@323: aheinecke@505: /**@brief Check if the user is in the administrators group. aheinecke@505: * aheinecke@505: * The function checks if the account that startet this process aheinecke@505: * belongs to a user that is a member of the Administrators group. aheinecke@505: * aheinecke@505: * @returns True if the user is in the admin group. False otherwise or on error. aheinecke@505: */ aheinecke@505: bool is_admin(); aheinecke@505: aheinecke@505: #ifdef __cplusplus aheinecke@505: } aheinecke@505: #endif aheinecke@505: aheinecke@321: #endif // COMMON_UTIL_H