diff --git a/lib/utils_base.c b/lib/utils_base.c
index db21ea15b47a746d0762fddca98129a4b1ce589b..da281286d80332624d54bae62f22bf41dd39e7ca 100644 (file)
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
data[j] = '\0';
return data;
}
+
+int np_check_if_root(void) { return (geteuid() == 0); }
+
+int np_warn_if_not_root(void) {
+ int status = np_check_if_root();
+ if(!status) {
+ printf(_("Warning: "));
+ printf(_("This plugin must be either run as root or setuid root.\n"));
+ printf(_("To run as root, you can use a tool like sudo.\n"));
+ printf(_("To set the setuid permissions, use the command:\n"));
+ // XXX could we use something like progname?
+ printf("\tchmod u+s yourpluginfile\n");
+ }
+ return status;
+}