--- brasero-3.12.1/src/main.c.~1~ 2014-03-06 17:59:54.000000000 +0400 +++ brasero-3.12.1/src/main.c 2017-03-27 15:15:10.987070302 +0300 @@ -47,6 +47,10 @@ #include "brasero-app.h" #include "brasero-cli.h" +#ifdef __sun +#include +#endif + static BraseroApp *current_app = NULL; /** @@ -59,11 +63,48 @@ return current_app; } +#ifdef __sun +static int setprivs(){ + priv_set_t *pPrivSet; + + if(geteuid()==0){ + g_warning("Running with euid 0, assuming you know what you are doing"); + return 0; + } + + if ((pPrivSet = priv_allocset()) == NULL) { + return 1; + } + + priv_basicset(pPrivSet); + + if(priv_addset(pPrivSet,PRIV_SYS_DEVICES)) { + return 2; + }; + + if(setppriv(PRIV_SET,PRIV_EFFECTIVE,pPrivSet)) { + return 3; + } + + /* CLI tools should also be able to use USCSICMD ioctls */ + if(setppriv(PRIV_SET,PRIV_INHERITABLE,pPrivSet)) { + return 4; + } + + priv_freeset(pPrivSet); + + return 0; +} +#endif + int main (int argc, char **argv) { GApplication *gapp = NULL; GOptionContext *context; +#ifdef __sun + int pcode=0; +#endif #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); @@ -79,6 +120,12 @@ * specific options are parsed. Otherwise on error that crashes. */ gtk_init (&argc, &argv); +#ifdef __sun + if (pcode=setprivs()){ + g_warning("Couldn't raise privileges, pcode=%d\n",pcode); + } +#endif + memset (&cmd_line_options, 0, sizeof (cmd_line_options)); context = g_option_context_new (_("[URI] [URI] …"));