log("switch group " + currentGroup + " -> " + group);
if (currentGroup != null && !currentGroup.equals(group))
{
Pointer p = CLibrary.INSTANCE.getgrnam(group);
CLibrary.group g = new CLibrary.group(p);
int newGid = g.getGid();
String nam = g.getName();
if (newGid == 0)
log("could not get group " + group);
// System.out.println("switching to group name/id "+nam+"/"+newGid);
int res = CLibrary.INSTANCE.setregid(newGid, newGid);
if (res != 0)
log("could not change to group " + group);
}
log("switch user " + currentUser + " -> " + user);
if (currentUser != null && !currentUser.equals(user))
{
Pointer p = CLibrary.INSTANCE.getpwnam(user);
int newUid = new CLibrary.passwd(p).getUid();
if (newUid == 0)
log("could not get user " + user);
int res = CLibrary.INSTANCE.setreuid(newUid, newUid);
if (res != 0)