App - Script

Wednesday 19 June 2019, 19:17  #1
App - Script - setreuid confusion
theredguy
  • 1 posts

setreuid(geteuid(), geteuid()); <- What does this line do? What would change if we removed it and recompile ch11.c? I already solved the challenge, but I still don’t get what this setreuid changes. Since I’m calling it, it will set the user id to my user id, but by default it’s already my user id, no? At first I thought we somehow have to modify so that it’s called like this: setreuid(1408,1408) because owner of .passwd file has user id 1408, so this way we will be able to read .passwd. The solution was much simpler but still, can anyone explain it to me?