summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 4494cff..35501e0 100644
--- a/eval.c
+++ b/eval.c
@@ -18,6 +18,8 @@
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
+#include <grp.h>
+#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -226,6 +228,30 @@ bool eval_uid(const struct expr *expr, struct eval_state *state) {
}
/**
+ * -nogroup test.
+ */
+bool eval_nogroup(const struct expr *expr, struct eval_state *state) {
+ const struct stat *statbuf = fill_statbuf(state);
+ if (!statbuf) {
+ return false;
+ }
+
+ return getgrgid(statbuf->st_gid) == NULL;
+}
+
+/**
+ * -nouser test.
+ */
+bool eval_nouser(const struct expr *expr, struct eval_state *state) {
+ const struct stat *statbuf = fill_statbuf(state);
+ if (!statbuf) {
+ return false;
+ }
+
+ return getpwuid(statbuf->st_uid) == NULL;
+}
+
+/**
* -delete action.
*/
bool eval_delete(const struct expr *expr, struct eval_state *state) {