mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Document the tricky code - TODO, make it less tricky
This commit is contained in:
parent
954547a9c1
commit
3713d357c8
|
@ -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…
Reference in New Issue
Block a user