release super user mode?
Posted: Fri Jul 16, 2010 6:15 am
I'm trying to write a "control panel" app for Ubuntu, kinda like the one that WinXP has, but of course better. The idea is to have it accept "plugins" as .so files, to add more options. So all the settings can be found in one place and more functionality can be added later ... but anyways, I've come up with this code to make sure the program is running in su mode.
While testing and playing around with the code, I've noticed that when I open a terminal (or use nautilus) and run the compiled binary, I only have to type my password once. Then I can run it again and again without it prompting me for the password. "It" does it for me. I also made a couple different binaries with different file names and what I found was: I only have to enter my password once for one binary only, then any time the gksu bit is supposed to prompt me for the password, it does it for me, without me knowing I was even being asked for the password. Scary huh? Is there something I have to do to release "su" mode or something so it can be more secure?
Code: Select all
a.s = ProgramParameter(0)
;display ProgramParameter(0) so I can see what instance this is.
MessageRequester("?", ProgramParameter(0))
If FindString(a.s, "suMode", 0) = 0
MessageRequester("?", "Should be prompting for a password:")
;run myself in su mode
RunProgram("gksu", ProgramFilename() + " suMode", "")
End
EndIf
;try something I can't do normally:
su = ExamineDirectory(#PB_Any, "/lost+found", "*.*")
If Not su
MessageRequester("!", "NO")
;RunProgram("gksu", ProgramFilename(), "")
End
EndIf
;If we are beyond this point, we are in super user mode.
MessageRequester("!", "YES")