Compare commits
8 Commits
9a1862bfa6
...
279be556f8
Author | SHA1 | Date |
---|---|---|
Anita Zhang | 279be556f8 | |
Yu Watanabe | 020313b213 | |
Yu Watanabe | 4af8ab2cab | |
Yu Watanabe | b44b735a78 | |
Yu Watanabe | 9610210d32 | |
Yu Watanabe | 02cec15629 | |
Yu Watanabe | 00c7b071ac | |
Yu Watanabe | 852640f8a2 |
|
@ -496,11 +496,9 @@ int getgroups_alloc(gid_t** gids) {
|
||||||
|
|
||||||
free(allocated);
|
free(allocated);
|
||||||
|
|
||||||
allocated = new(gid_t, ngroups);
|
p = allocated = new(gid_t, ngroups);
|
||||||
if (!allocated)
|
if (!allocated)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
p = allocated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*gids = TAKE_PTR(p);
|
*gids = TAKE_PTR(p);
|
||||||
|
|
|
@ -314,7 +314,7 @@ static int manager_add_home_by_record(
|
||||||
const char *fname) {
|
const char *fname) {
|
||||||
|
|
||||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||||
_cleanup_(user_record_unrefp) UserRecord *hr;
|
_cleanup_(user_record_unrefp) UserRecord *hr = NULL;
|
||||||
unsigned line, column;
|
unsigned line, column;
|
||||||
int r, is_signed;
|
int r, is_signed;
|
||||||
Home *h;
|
Home *h;
|
||||||
|
|
|
@ -17,9 +17,6 @@ int home_prepare_cifs(
|
||||||
bool already_activated,
|
bool already_activated,
|
||||||
HomeSetup *setup) {
|
HomeSetup *setup) {
|
||||||
|
|
||||||
char **pw;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(h);
|
assert(h);
|
||||||
assert(setup);
|
assert(setup);
|
||||||
assert(user_record_storage(h) == USER_CIFS);
|
assert(user_record_storage(h) == USER_CIFS);
|
||||||
|
@ -28,6 +25,8 @@ int home_prepare_cifs(
|
||||||
setup->root_fd = open(user_record_home_directory(h), O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
|
setup->root_fd = open(user_record_home_directory(h), O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
|
||||||
else {
|
else {
|
||||||
bool mounted = false;
|
bool mounted = false;
|
||||||
|
char **pw;
|
||||||
|
int r;
|
||||||
|
|
||||||
r = home_unshare_and_mount(NULL, NULL, false);
|
r = home_unshare_and_mount(NULL, NULL, false);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -92,7 +91,7 @@ int home_prepare_cifs(
|
||||||
setup->root_fd = open("/run/systemd/user-home-mount", O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
|
setup->root_fd = open("/run/systemd/user-home-mount", O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
|
||||||
}
|
}
|
||||||
if (setup->root_fd < 0)
|
if (setup->root_fd < 0)
|
||||||
return log_error_errno(r, "Failed to open home directory: %m");
|
return log_error_errno(errno, "Failed to open home directory: %m");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -737,6 +737,8 @@ int user_record_make_hashed_password(UserRecord *h, char **secret, bool extend)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = json_variant_set_field(&priv, "hashedPassword", new_array);
|
r = json_variant_set_field(&priv, "hashedPassword", new_array);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = json_variant_set_field(&h->json, "privileged", priv);
|
r = json_variant_set_field(&h->json, "privileged", priv);
|
||||||
|
|
|
@ -906,7 +906,7 @@ static int mount_inaccessible(const char *dest, CustomMount *m) {
|
||||||
|
|
||||||
r = mount_verbose(m->graceful ? LOG_DEBUG : LOG_ERR, NULL, where, NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, NULL);
|
r = mount_verbose(m->graceful ? LOG_DEBUG : LOG_ERR, NULL, where, NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, NULL);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
umount_verbose(where);
|
(void) umount_verbose(where);
|
||||||
return m->graceful ? 0 : r;
|
return m->graceful ? 0 : r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,15 +310,19 @@ static void test_gid_lists_ops(void) {
|
||||||
int nresult;
|
int nresult;
|
||||||
|
|
||||||
nresult = merge_gid_lists(l2, ELEMENTSOF(l2), l3, ELEMENTSOF(l3), &res1);
|
nresult = merge_gid_lists(l2, ELEMENTSOF(l2), l3, ELEMENTSOF(l3), &res1);
|
||||||
|
assert_se(nresult >= 0);
|
||||||
assert_se(memcmp_nn(res1, nresult, result1, ELEMENTSOF(result1)) == 0);
|
assert_se(memcmp_nn(res1, nresult, result1, ELEMENTSOF(result1)) == 0);
|
||||||
|
|
||||||
nresult = merge_gid_lists(NULL, 0, l2, ELEMENTSOF(l2), &res2);
|
nresult = merge_gid_lists(NULL, 0, l2, ELEMENTSOF(l2), &res2);
|
||||||
|
assert_se(nresult >= 0);
|
||||||
assert_se(memcmp_nn(res2, nresult, l2, ELEMENTSOF(l2)) == 0);
|
assert_se(memcmp_nn(res2, nresult, l2, ELEMENTSOF(l2)) == 0);
|
||||||
|
|
||||||
nresult = merge_gid_lists(l1, ELEMENTSOF(l1), l1, ELEMENTSOF(l1), &res3);
|
nresult = merge_gid_lists(l1, ELEMENTSOF(l1), l1, ELEMENTSOF(l1), &res3);
|
||||||
|
assert_se(nresult >= 0);
|
||||||
assert_se(memcmp_nn(l1, ELEMENTSOF(l1), res3, nresult) == 0);
|
assert_se(memcmp_nn(l1, ELEMENTSOF(l1), res3, nresult) == 0);
|
||||||
|
|
||||||
nresult = merge_gid_lists(l1, ELEMENTSOF(l1), l4, ELEMENTSOF(l4), &res4);
|
nresult = merge_gid_lists(l1, ELEMENTSOF(l1), l4, ELEMENTSOF(l4), &res4);
|
||||||
|
assert_se(nresult >= 0);
|
||||||
assert_se(memcmp_nn(result2, ELEMENTSOF(result2), res4, nresult) == 0);
|
assert_se(memcmp_nn(result2, ELEMENTSOF(result2), res4, nresult) == 0);
|
||||||
|
|
||||||
nresult = getgroups_alloc(&gids);
|
nresult = getgroups_alloc(&gids);
|
||||||
|
|
|
@ -77,7 +77,7 @@ static int on_sigusr2(sd_event_source *s, const struct signalfd_siginfo *si, voi
|
||||||
}
|
}
|
||||||
|
|
||||||
int manager_new(Manager **ret) {
|
int manager_new(Manager **ret) {
|
||||||
Manager *m;
|
_cleanup_(manager_freep) Manager *m = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
m = new(Manager, 1);
|
m = new(Manager, 1);
|
||||||
|
|
Loading…
Reference in New Issue