|
|
2c83a8 |
From 444c282364a9d25f30942ceffdd5a52dd2b7183d Mon Sep 17 00:00:00 2001
|
|
|
2c83a8 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
2c83a8 |
Date: Mon, 14 Dec 2015 16:21:29 +0100
|
|
|
2c83a8 |
Subject: [PATCH] dd: make function uid_in_group() public
|
|
|
2c83a8 |
|
|
|
2c83a8 |
Related to rhbz#1277849
|
|
|
2c83a8 |
|
|
|
2c83a8 |
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
2c83a8 |
---
|
|
|
2c83a8 |
src/include/internal_libreport.h | 9 +++++++++
|
|
|
2c83a8 |
src/lib/dump_dir.c | 4 +---
|
|
|
2c83a8 |
2 files changed, 10 insertions(+), 3 deletions(-)
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
|
|
|
2c83a8 |
index 651e339..70eb299 100644
|
|
|
2c83a8 |
--- a/src/include/internal_libreport.h
|
|
|
2c83a8 |
+++ b/src/include/internal_libreport.h
|
|
|
2c83a8 |
@@ -816,6 +816,15 @@ int delete_dump_dir_possibly_using_abrtd(const char *dump_dir_name);
|
|
|
2c83a8 |
#define steal_directory libreport_steal_directory
|
|
|
2c83a8 |
struct dump_dir *steal_directory(const char *base_dir, const char *dump_dir_name);
|
|
|
2c83a8 |
|
|
|
2c83a8 |
+/* Resolves if the given user is in given group
|
|
|
2c83a8 |
+ *
|
|
|
2c83a8 |
+ * @param uid user ID
|
|
|
2c83a8 |
+ * @param gid group ID
|
|
|
2c83a8 |
+ * @returns TRUE in case the user is in the group otherwise returns FALSE
|
|
|
2c83a8 |
+ */
|
|
|
2c83a8 |
+#define uid_in_group libreport_uid_in_group
|
|
|
2c83a8 |
+bool uid_in_group(uid_t uid, gid_t gid);
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
/* Tries to open dump_dir_name with writing access. If function needs to steal
|
|
|
2c83a8 |
* directory calls ask_continue(new base dir, dump dir) callback to ask user
|
|
|
2c83a8 |
* for permission. If ask_continue param is NULL the function thinks that an
|
|
|
2c83a8 |
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
|
|
|
2c83a8 |
index 9b5b1b5..1e6ce64 100644
|
|
|
2c83a8 |
--- a/src/lib/dump_dir.c
|
|
|
2c83a8 |
+++ b/src/lib/dump_dir.c
|
|
|
2c83a8 |
@@ -1375,8 +1375,7 @@ void delete_dump_dir(const char *dirname)
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
|
|
|
2c83a8 |
-#if DUMP_DIR_OWNED_BY_USER == 0
|
|
|
2c83a8 |
-static bool uid_in_group(uid_t uid, gid_t gid)
|
|
|
2c83a8 |
+bool uid_in_group(uid_t uid, gid_t gid)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
char **tmp;
|
|
|
2c83a8 |
struct passwd *pwd = getpwuid(uid);
|
|
|
2c83a8 |
@@ -1403,7 +1402,6 @@ static bool uid_in_group(uid_t uid, gid_t gid)
|
|
|
2c83a8 |
log_info("user %s DOESN'T belong to group: %s", pwd->pw_name, grp->gr_name);
|
|
|
2c83a8 |
return FALSE;
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
-#endif
|
|
|
2c83a8 |
|
|
|
2c83a8 |
int fdump_dir_stat_for_uid(int dir_fd, uid_t uid)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
--
|
|
|
2c83a8 |
1.8.3.1
|
|
|
2c83a8 |
|