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