Skip to content

Commit

Permalink
Don't seteuid() if process is already running as that uid.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmark committed Oct 15, 2023
1 parent d575ac2 commit 1e49e50
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions etc/afpd/afp_asp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ static void afp_asp_close(AFPObj *obj)
{
ASP asp = obj->handle;

if (seteuid( obj->uid ) < 0) {
LOG(log_error, logtype_afpd, "can't seteuid back %s", strerror(errno));
if ( obj->uid != geteuid() ) {
if (seteuid(obj->uid) < 0) {
LOG(log_error, logtype_afpd,
"afp_asp_close: can't seteuid back to %i from %i (%s)",
obj->uid, geteuid(), strerror(errno));
exit(EXITERR_SYS);
}
close_all_vol();
Expand Down

0 comments on commit 1e49e50

Please sign in to comment.