diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-07-03 14:34:47 +0200 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-07-06 13:02:29 -0400 |
commit | e1fdffdf9e94dee7de479c155188b80fd41dbcc8 (patch) | |
tree | 59e266c1a5cfc879f2badb983e0a8bc4ed74033c /server/tools/tools_util.h | |
parent | bc1352717c7354005b4e6f70b6a51ed6b5146796 (diff) | |
download | sssd-e1fdffdf9e94dee7de479c155188b80fd41dbcc8.tar.gz sssd-e1fdffdf9e94dee7de479c155188b80fd41dbcc8.tar.bz2 sssd-e1fdffdf9e94dee7de479c155188b80fd41dbcc8.zip |
Check for root before initializing
Also move setting locale to separate function to be called before
anything else to make sure the "Not root" message would be localized.
Diffstat (limited to 'server/tools/tools_util.h')
-rw-r--r-- | server/tools/tools_util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/server/tools/tools_util.h b/server/tools/tools_util.h index 7c66c119..0520731a 100644 --- a/server/tools/tools_util.h +++ b/server/tools/tools_util.h @@ -22,6 +22,16 @@ } \ } while(0) +#define CHECK_ROOT(val, prg_name) do { \ + val = getuid(); \ + if (val != 0) { \ + DEBUG(1, ("Running under %d, must be root\n", val)); \ + ERROR("%s must be run as root\n", prg_name); \ + val = EXIT_FAILURE; \ + goto fini; \ + } \ +} while(0) + enum id_domain { ID_IN_LOCAL = 0, ID_IN_LEGACY_LOCAL, @@ -50,4 +60,6 @@ enum id_domain find_domain_for_id(struct tools_ctx *ctx, uint32_t id, struct sss_domain_info **dom_ret); +int set_locale(void); + #endif /* __TOOLS_UTIL_H__ */ |