Fix stray comment and using pwentry for group info.
diff --git a/lib/privs.c b/lib/privs.c
index 0ee8d60..1902310 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -138,6 +138,7 @@
int
zprivs_change_uid (zebra_privs_ops_t op)
{
+
if (op == ZPRIVS_RAISE)
return seteuid (zprivs_state.zsuid);
else if (op == ZPRIVS_LOWER)
@@ -194,13 +195,13 @@
if (zprivs->group)
{
if ( (grentry = getgrnam (zprivs->user)) )
- zprivs_state.zgid = pwentry->pw_uid;
+ zprivs_state.zgid = grentry->gr_gid;
else
{
zlog_err ("privs_init: could not lookup supplied user");
exit (1);
}
-
+
/* change group now, forever. uid we do later */
if ( setregid (zprivs_state.zgid, zprivs_state.zgid) )
{
@@ -268,7 +269,7 @@
exit (1);
}
- /* we have caps, we have no need to ever change back the original user
+ /* we have caps, we have no need to ever change back the original user */
if (zprivs_state.zuid)
{
if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) )
@@ -276,8 +277,7 @@
zlog_err ("privs_init (cap): could not setreuid, %s", strerror (errno) );
exit (1);
}
- }
- */
+ }
/* No more need for cap_setuid_value */
cap_set_flag(zprivs_state.caps, CAP_PERMITTED,