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