summaryrefslogtreecommitdiffstats
path: root/server/tools/tools_util.h
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-07-03 14:34:47 +0200
committerSimo Sorce <ssorce@redhat.com>2009-07-06 13:02:29 -0400
commite1fdffdf9e94dee7de479c155188b80fd41dbcc8 (patch)
tree59e266c1a5cfc879f2badb983e0a8bc4ed74033c /server/tools/tools_util.h
parentbc1352717c7354005b4e6f70b6a51ed6b5146796 (diff)
downloadsssd-e1fdffdf9e94dee7de479c155188b80fd41dbcc8.tar.gz
sssd-e1fdffdf9e94dee7de479c155188b80fd41dbcc8.tar.xz
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.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/tools/tools_util.h b/server/tools/tools_util.h
index 7c66c119d..0520731ad 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__ */