[RP-PPPoE] 3.11 bug report
David F. Skoll
dfs at roaringpenguin.com
Fri Jul 18 08:20:53 EDT 2014
On Fri, 18 Jul 2014 10:41:04 +0000
David Binderman <dcb314 at hotmail.com> wrote:
> ______ if (saved_uid < 0) saved_uid = geteuid();
> ______ if (saved_gid < 0) saved_gid = getegid();
> Suggest code rework.
D'oh. Please try this patch.
Regards,
David.
diff --git a/src/common.c b/src/common.c
index f115f4f..6a2988e 100644
--- a/src/common.c
+++ b/src/common.c
@@ -45,8 +45,8 @@ static char const RCSID[] =
/* Are we running SUID or SGID? */
int IsSetID = 0;
-static uid_t saved_uid = -2;
-static uid_t saved_gid = -2;
+static uid_t saved_uid = (uid_t) -2;
+static uid_t saved_gid = (uid_t) -2;
/**********************************************************************
*%FUNCTION: parsePacket
@@ -173,8 +173,8 @@ findTag(PPPoEPacket *packet, UINT16_t type, PPPoETag *tag)
void
switchToRealID (void) {
if (IsSetID) {
- if (saved_uid < 0) saved_uid = geteuid();
- if (saved_gid < 0) saved_gid = getegid();
+ if (saved_uid == (uid_t) -2) saved_uid = geteuid();
+ if (saved_gid == (uid_t) -2) saved_gid = getegid();
if (setegid(getgid()) < 0) {
printErr("setgid failed");
exit(EXIT_FAILURE);
More information about the RP-PPPoE
mailing list