|
|
978033 |
diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c
|
|
|
978033 |
index f1bb4e1..aff4f60 100644
|
|
|
978033 |
--- a/src/programs/pkcheck.c
|
|
|
978033 |
+++ b/src/programs/pkcheck.c
|
|
|
978033 |
@@ -363,6 +363,12 @@ main (int argc, char *argv[])
|
|
|
978033 |
local_agent_handle = NULL;
|
|
|
978033 |
ret = 126;
|
|
|
978033 |
|
|
|
978033 |
+ if (argc < 1)
|
|
|
978033 |
+ {
|
|
|
978033 |
+ help();
|
|
|
978033 |
+ exit(1);
|
|
|
978033 |
+ }
|
|
|
978033 |
+
|
|
|
978033 |
/* Disable remote file access from GIO. */
|
|
|
978033 |
setenv ("GIO_USE_VFS", "local", 1);
|
|
|
978033 |
|
|
|
978033 |
diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c
|
|
|
978033 |
index 7698c5c..d84dc57 100644
|
|
|
978033 |
--- a/src/programs/pkexec.c
|
|
|
978033 |
+++ b/src/programs/pkexec.c
|
|
|
978033 |
@@ -488,6 +488,17 @@ main (int argc, char *argv[])
|
|
|
978033 |
pid_t pid_of_caller;
|
|
|
978033 |
gpointer local_agent_handle;
|
|
|
978033 |
|
|
|
978033 |
+
|
|
|
978033 |
+ /*
|
|
|
978033 |
+ * If 'pkexec' is called wrong, just show help and bail out.
|
|
|
978033 |
+ */
|
|
|
978033 |
+ if (argc<1)
|
|
|
978033 |
+ {
|
|
|
978033 |
+ clearenv();
|
|
|
978033 |
+ usage(argc, argv);
|
|
|
978033 |
+ exit(1);
|
|
|
978033 |
+ }
|
|
|
978033 |
+
|
|
|
978033 |
ret = 127;
|
|
|
978033 |
authority = NULL;
|
|
|
978033 |
subject = NULL;
|
|
|
978033 |
@@ -614,10 +625,10 @@ main (int argc, char *argv[])
|
|
|
978033 |
|
|
|
978033 |
path = g_strdup (pwstruct.pw_shell);
|
|
|
978033 |
if (!path)
|
|
|
978033 |
- {
|
|
|
978033 |
+ {
|
|
|
978033 |
g_printerr ("No shell configured or error retrieving pw_shell\n");
|
|
|
978033 |
goto out;
|
|
|
978033 |
- }
|
|
|
978033 |
+ }
|
|
|
978033 |
/* If you change this, be sure to change the if (!command_line)
|
|
|
978033 |
case below too */
|
|
|
978033 |
command_line = g_strdup (path);
|
|
|
978033 |
@@ -636,7 +647,15 @@ main (int argc, char *argv[])
|
|
|
978033 |
goto out;
|
|
|
978033 |
}
|
|
|
978033 |
g_free (path);
|
|
|
978033 |
- argv[n] = path = s;
|
|
|
978033 |
+ path = s;
|
|
|
978033 |
+
|
|
|
978033 |
+ /* argc<2 and pkexec runs just shell, argv is guaranteed to be null-terminated.
|
|
|
978033 |
+ * /-less shell shouldn't happen, but let's be defensive and don't write to null-termination
|
|
|
978033 |
+ */
|
|
|
978033 |
+ if (argv[n] != NULL)
|
|
|
978033 |
+ {
|
|
|
978033 |
+ argv[n] = path;
|
|
|
978033 |
+ }
|
|
|
978033 |
}
|
|
|
978033 |
if (access (path, F_OK) != 0)
|
|
|
978033 |
{
|