Browse Source

Document the tricky code - TODO, make it less tricky

pull/947/head
Hamish Coleman 3 years ago
parent
commit
3713d357c8
  1. 14
      src/supernode.c

14
src/supernode.c

@ -639,10 +639,24 @@ int main (int argc, char * const argv[]) {
scan->socket_fd = sss_node.sock;
#ifndef WIN32
/*
* If no uid/gid is specified on the commandline, use the uid/gid of the
* first found out of user "n2n" or "nobody"
*/
if(((pw = getpwnam ("n2n")) != NULL) || ((pw = getpwnam ("nobody")) != NULL)) {
/*
* If the uid/gid is not set from the CLI, set it from getpwnam
* otherwise reset it to zero
* (TODO: this looks wrong)
*/
sss_node.userid = sss_node.userid == 0 ? pw->pw_uid : 0;
sss_node.groupid = sss_node.groupid == 0 ? pw->pw_gid : 0;
}
/*
* If we have a non-zero requested uid/gid, attempt to switch to use
* those
*/
if((sss_node.userid != 0) || (sss_node.groupid != 0)) {
traceEvent(TRACE_NORMAL, "dropping privileges to uid=%d, gid=%d",
(signed int)sss_node.userid, (signed int)sss_node.groupid);

Loading…
Cancel
Save