Lines Matching +full:- +full:path

3   * See the COPYING file in the top-level directory.
7 #include <glib-unix.h>
12 #include "commands-common-ssh.h"
14 #include "qga-qapi-commands.h"
29 p->pw_dir = (char *)g_get_home_dir(); in test_get_passwd_entry()
30 p->pw_uid = geteuid(); in test_get_passwd_entry()
31 p->pw_gid = getegid(); in test_get_passwd_entry()
33 ret = g_mkdir_with_parents(p->pw_dir, 0700); in test_get_passwd_entry()
52 username, err->message); in get_passwd_entry()
60 mkdir_for_user(const char *path, const struct passwd *p, in mkdir_for_user() argument
63 if (g_mkdir(path, mode) == -1) { in mkdir_for_user()
65 path, g_strerror(errno)); in mkdir_for_user()
69 if (chown(path, p->pw_uid, p->pw_gid) == -1) { in mkdir_for_user()
71 path, g_strerror(errno)); in mkdir_for_user()
75 if (chmod(path, mode) == -1) { in mkdir_for_user()
77 path, g_strerror(errno)); in mkdir_for_user()
85 write_authkeys(const char *path, const GStrv keys, in write_authkeys() argument
92 if (!g_file_set_contents(path, contents, -1, &err)) { in write_authkeys()
93 error_setg(errp, "failed to write to '%s': %s", path, err->message); in write_authkeys()
97 if (chown(path, p->pw_uid, p->pw_gid) == -1) { in write_authkeys()
99 path, g_strerror(errno)); in write_authkeys()
103 if (chmod(path, 0600) == -1) { in write_authkeys()
105 path, g_strerror(errno)); in write_authkeys()
135 ssh_path = g_build_filename(p->pw_dir, ".ssh", NULL); in qmp_guest_ssh_add_authorized_keys()
152 for (k = keys; k != NULL; k = k->next) { in qmp_guest_ssh_add_authorized_keys()
153 if (g_strv_contains((const gchar * const *)authkeys, k->value)) { in qmp_guest_ssh_add_authorized_keys()
156 authkeys[nauthkeys++] = g_strdup(k->value); in qmp_guest_ssh_add_authorized_keys()
182 authkeys_path = g_build_filename(p->pw_dir, ".ssh", in qmp_guest_ssh_remove_authorized_keys()
196 for (k = keys; k != NULL; k = k->next) { in qmp_guest_ssh_remove_authorized_keys()
197 if (g_str_equal(k->value, *a)) { in qmp_guest_ssh_remove_authorized_keys()
225 authkeys_path = g_build_filename(p->pw_dir, ".ssh", in qmp_guest_ssh_get_authorized_keys()
239 QAPI_LIST_PREPEND(ret->keys, g_strdup(authkeys[i])); in qmp_guest_ssh_get_authorized_keys()
265 g_autofree char *path = NULL; in test_authorized_keys_set() local
268 path = g_build_filename(g_get_home_dir(), ".ssh", NULL); in test_authorized_keys_set()
269 ret = g_mkdir_with_parents(path, 0700); in test_authorized_keys_set()
271 g_free(path); in test_authorized_keys_set()
273 path = test_get_authorized_keys_path(); in test_authorized_keys_set()
274 g_file_set_contents(path, contents, -1, &err); in test_authorized_keys_set()
282 g_autofree char *path = NULL; in test_authorized_keys_equal() local
285 path = test_get_authorized_keys_path(); in test_authorized_keys_equal()
286 g_file_get_contents(path, &contents, NULL, &err); in test_authorized_keys_equal()
386 "algo some-key another\n"; in test_remove_keys()
398 "algo some-key another\n"); in test_remove_keys()
408 "algo some-key another\n"; in test_get_keys()
418 for (len = 0, k = ret->keys; k != NULL; k = k->next) { in test_get_keys()
419 g_assert(g_str_has_prefix(k->value, "algo ")); in test_get_keys()