# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/gnomesu/features.patch # Copyright (C) 2004 - 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- This feature patch was primarily developed for the Archivista Scan Server Box, however it should be useful for others as well. First we do not want to let the joe user see cryptic commands to be executed when asked for authentication (always done when a command was supplied now) Second for some special cases (like setting passwords) we want to retrieve the current password to injet into e.g. MySQL and co (-p). - Rene Rebe diff -u gnomesu-0.3.1/src/xsu.c gnomesu-0.3.1-fixed/src/xsu.c --- gnomesu-0.3.1/src/xsu.c 2003-04-10 14:03:14.000000000 +0000 +++ gnomesu-0.3.1-fixed/src/xsu.c 2005-09-05 22:58:12.000000000 +0000 @@ -126,7 +126,10 @@ buffer = g_strdup_printf("%s%s;%s", SET_DISPL_ENV, displ_host, command); g_free(displ_host); } - else + else if (show_password) { + buffer = g_strdup_printf("PASSWD=\"%s\" %s", password, command); + } + else { buffer = g_strdup_printf("%s", command); } @@ -371,13 +377,16 @@ if(g_strdup(argv[1])) // there was a first argument { /* As long as the first item is not a switch set the first item as the command */ - if ((strcmp(argv[1], "-u")) && (strcmp(argv[1], "--username")) && (strcmp(argv[1], "-m")) && (strcmp (argv[1], "-c")) && (strcmp (argv[1], "--command")) && (strcmp(argv[1], "--message")) && (strcmp(argv[1], "-t")) && (strcmp(argv[1], "--title"))) + if ((strcmp(argv[1], "-u")) && (strcmp(argv[1], "--username")) && (strcmp(argv[1], "-m")) && (strcmp (argv[1], "-c")) && (strcmp (argv[1], "--command")) && (strcmp(argv[1], "--message")) && (strcmp(argv[1], "-t")) && (strcmp(argv[1], "--title")) && (strcmp(argv[1], "-p"))) { arg_command = g_strdup(argv[1]); command_in=TRUE; } } + if (!strcmp (argv[x], "-p")) + show_password=TRUE; + // -c switch for backwards compatibility with xsu if ((!strcmp (argv[x], "-c")) || (!strcmp (argv[x], "--command"))) { @@ -542,7 +554,9 @@ if (command_in) { gtk_entry_set_text(GTK_ENTRY(gtk_command_textbox),arg_command); - //gtk_entry_set_editable(GTK_ENTRY(gtk_command_textbox), FALSE); + gtk_entry_set_editable(GTK_ENTRY(gtk_command_textbox), FALSE); + gtk_widget_hide (gtk_commandtxt_label); + gtk_widget_hide (gtk_command_textbox); gtk_widget_grab_focus (gtk_password_textbox); } else { gtk_widget_grab_focus (gtk_command_textbox); diff -u gnomesu-0.3.1/src/xsu.h gnomesu-0.3.1-fixed/src/xsu.h --- gnomesu-0.3.1/src/xsu.h 2003-01-07 21:01:09.000000000 +0000 +++ gnomesu-0.3.1-fixed/src/xsu.h 2005-09-05 22:27:38.000000000 +0000 @@ -77,6 +77,7 @@ GtkTooltips *tooltips; gchar *arg_message, *arg_title, *displ_host; +gboolean show_password=FALSE; gboolean message_in=FALSE, title_in=FALSE,