aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeradius3/freeradius3-3.0.3-rlm_linelog-2.patch
blob: 0c735a4c8392fa24721a4d8539035194ae948b46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
commit c85e234fdc804e0202e94cdb56a878d5478bfdab
Author: Alan T. DeKok <aland@freeradius.org>
Date:   Tue Sep 2 12:04:12 2014 -0400

    Use new fr_getgid() function.  Addresses #776

diff --git a/src/modules/rlm_linelog/rlm_linelog.c b/src/modules/rlm_linelog/rlm_linelog.c
index 5572b97..6d476eb 100644
--- a/src/modules/rlm_linelog/rlm_linelog.c
+++ b/src/modules/rlm_linelog/rlm_linelog.c
 -204,7 +204,6 @@ static rlm_rcode_t CC_HINT(nonnull) mod_do_linelog(void *instance, REQUEST *requ
 
 #ifdef HAVE_GRP_H
 	gid_t gid;
-	struct group *grp;
 	char *endptr;
 #endif
 
 -282,21 +281,10 @@ static rlm_rcode_t CC_HINT(nonnull) mod_do_linelog(void *instance, REQUEST *requ
 		if (inst->group != NULL) {
 			gid = strtol(inst->group, &endptr, 10);
 			if (*endptr != '\0') {
-#ifdef HAVE_GETGRNAM_R
-				char group_buffer[1024];
-				struct group my_group;
-
-				if (getgrnam_r(inst->group, &my_group, group_buffer, sizeof(group_buffer), &grp) != 0) {
-					grp = NULL;
-				}
-#else
-				grp = getgrnam(inst->group);
-#endif
-				if (!grp) {
+				if (!fr_getgid(inst->group, &gid)) {
 					RDEBUG2("Unable to find system group \"%s\"", inst->group);
 					goto skip_group;
 				}
-				gid = grp->gr_gid;
 			}
 
 			if (chown(buffer, -1, gid) == -1) {