summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2021-08-23 18:12:23 +0200
committerDirk Engling <erdgeist@erdgeist.org>2021-08-23 18:12:23 +0200
commit110868ec4ebe60521d5a4ced63feca6a1cf0aa2a (patch)
tree849b0262c87dbea03f5b56e35402900ff468e2c5
parente89905166c6c1f3347994d2a41eb8d3264c1b56b (diff)
Fix return code check inversion introduced in last commit
-rw-r--r--opentracker.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/opentracker.c b/opentracker.c
index 2bb66fa..a5ba7d3 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -559,20 +559,12 @@ int drop_privileges ( const char * const serveruser, const char * const serverdi
559 /* If we can't find server user, revert to nobody's default uid */ 559 /* If we can't find server user, revert to nobody's default uid */
560 if( !pws ) { 560 if( !pws ) {
561 fprintf( stderr, "Warning: Could not get password entry for %s. Reverting to uid -2.\n", serveruser ); 561 fprintf( stderr, "Warning: Could not get password entry for %s. Reverting to uid -2.\n", serveruser );
562 if (!setegid( (gid_t)-2 ) || 562 if (setegid( (gid_t)-2 ) || setgid( (gid_t)-2 ) || setuid( (uid_t)-2 ) || seteuid( (uid_t)-2 ))
563 !setgid( (gid_t)-2 ) ||
564 !setuid( (uid_t)-2 ) ||
565 !seteuid( (uid_t)-2 )) {
566 panic("Could not set uid to value -2"); 563 panic("Could not set uid to value -2");
567 }
568 } 564 }
569 else { 565 else {
570 if (!setegid( pws->pw_gid ) || 566 if (setegid( pws->pw_gid ) || setgid( pws->pw_gid ) || setuid( pws->pw_uid ) || seteuid( pws->pw_uid ))
571 !setgid( pws->pw_gid ) ||
572 !setuid( pws->pw_uid ) ||
573 !seteuid( pws->pw_uid )) {
574 panic("Could not set uid to specified value"); 567 panic("Could not set uid to specified value");
575 }
576 } 568 }
577 569
578 if( geteuid() == 0 || getegid() == 0 ) 570 if( geteuid() == 0 || getegid() == 0 )