aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2009-05-09 12:17:59 -0300
committerLeandro A. F. Pereira <leandro@hardinfo.org>2009-05-09 12:17:59 -0300
commitd6f07d7b0e2e0bfef721ce51fbf42754c29568b2 (patch)
tree593366b426c0705b8c7510c4b85418d764d2ed77 /hardinfo2
parentdbaeacf7888957ca8d0cad69822b2fe4851b19d4 (diff)
Make temporary ssh-askpass remove itself; chmod 0700 the remote.conf file
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/shell.c4
-rw-r--r--hardinfo2/ssh-conn.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c
index 94cb843f..5e7dfdc8 100644
--- a/hardinfo2/shell.c
+++ b/hardinfo2/shell.c
@@ -590,10 +590,14 @@ void shell_save_hosts_file(void)
gchar *path, *remote_conf;
gsize length;
+ DEBUG("saving hosts file");
+
path = g_build_filename(g_get_home_dir(), ".hardinfo", "remote.conf", NULL);
remote_conf = g_key_file_to_data(shell->hosts, &length, NULL);
g_file_set_contents(path, remote_conf, length, NULL);
+
+ g_chmod(path, 0700);
g_free(remote_conf);
g_free(path);
diff --git a/hardinfo2/ssh-conn.c b/hardinfo2/ssh-conn.c
index eb688275..b5c22eaf 100644
--- a/hardinfo2/ssh-conn.c
+++ b/hardinfo2/ssh-conn.c
@@ -174,7 +174,8 @@ SSHConnResponse ssh_new(SoupURI * uri,
g_chmod(askpass_path, 0700);
tmp = g_strdup_printf("#!/bin/sh\n"
- "echo '%s'\n", uri->password);
+ "echo '%s'\n"
+ "rm -f \"$0\"", uri->password);
write(tmp_askpass, tmp, strlen(tmp));
close(tmp_askpass);
g_free(tmp);