--- sound-juicer-3.40.0/src/sj-main.c.orig +++ sound-juicer-3.40.0/src/sj-main.c @@ -56,6 +56,10 @@ #include "sj-window-state.h" #include "sj-tree-view.h" +#ifdef __sun +#include +#endif + gboolean on_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); static void reread_cd (void); @@ -2112,6 +2116,40 @@ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled); } +#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) { GtkApplication *app; @@ -2122,6 +2160,13 @@ { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &uris, N_("URI to the CD device to read"), NULL }, { NULL } }; +#ifdef __sun + int pcode=0; + if (pcode=setprivs()){ + g_warning("Couldn't raise privileges, pcode=%d\n",pcode); + } +#endif + guint status = 0; bindtextdomain (PACKAGE, LOCALEDIR);