http://bugs.winehq.org/show_bug.cgi?id=17337
Martin Gregorie martin@gregorie.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |martin@gregorie.org
--- Comment #3 from Martin Gregorie martin@gregorie.org 2012-06-18 20:19:00 CDT --- I agree with Austin and suggest that, immediately after validating the command line arguments[1], Wine should check the user name before doing anything else except returning replies for --help and --version options. Something like
if(strcmp(getenv("USER"), "root") == 0)
should do the trick nicely. If this check fails, display a warning message about running wine as root (written to stderr and/or displayed as a pop-up if Wine isn't being run from a command line) and exit with the EACCES termination code.
This should nicely trap inadvertent attempts to run as root. If the user really wants to run under root, let him add a command line option to override the username check. I suggest something like an --allow_root option.
[1] Wine does not check for and reject invalid options soon enough. Although "wine --version" doesn't create a .wine prefix if it doesn't exist, "wine -version" DOES create one before saying that it can't find -version.exe. This is annoying: I stick to the one program per prefix rule and would prefer that it doesn't set up default prefixes just because I have finger trouble on occasion. Given that even Windows programs don't have names starting with '-', it would be a good idea to assume that all arguments before the first that is recognizable as a program name, i.e. starts with 0-9a-z and ends with .exe, are Wine options and validate them before starting to create a prefix.