mirror of
https://github.com/systemd/systemd
synced 2026-03-31 04:04:54 +02:00
Compare commits
No commits in common. "cef916c743dc5a9d3ea311b6b49cf37feaf40c96" and "22e5118cdaac95644afe8308df542dc2eb603ee2" have entirely different histories.
cef916c743
...
22e5118cda
@ -12,7 +12,7 @@
|
|||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "tmpfile-util.h"
|
#include "tmpfile-util.h"
|
||||||
|
|
||||||
int home_setup_cifs(
|
int home_prepare_cifs(
|
||||||
UserRecord *h,
|
UserRecord *h,
|
||||||
bool already_activated,
|
bool already_activated,
|
||||||
HomeSetup *setup) {
|
HomeSetup *setup) {
|
||||||
@ -102,7 +102,7 @@ int home_activate_cifs(
|
|||||||
PasswordCache *cache,
|
PasswordCache *cache,
|
||||||
UserRecord **ret_home) {
|
UserRecord **ret_home) {
|
||||||
|
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
|
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
|
||||||
const char *hdo, *hd;
|
const char *hdo, *hd;
|
||||||
int r;
|
int r;
|
||||||
@ -117,7 +117,7 @@ int home_activate_cifs(
|
|||||||
assert_se(hdo = user_record_home_directory(h));
|
assert_se(hdo = user_record_home_directory(h));
|
||||||
hd = strdupa_safe(hdo); /* copy the string out, since it might change later in the home record object */
|
hd = strdupa_safe(hdo); /* copy the string out, since it might change later in the home record object */
|
||||||
|
|
||||||
r = home_setup_cifs(h, false, &setup);
|
r = home_prepare_cifs(h, false, &setup);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ int home_activate_cifs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int home_create_cifs(UserRecord *h, UserRecord **ret_home) {
|
int home_create_cifs(UserRecord *h, UserRecord **ret_home) {
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
|
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL;
|
||||||
_cleanup_(closedirp) DIR *d = NULL;
|
_cleanup_(closedirp) DIR *d = NULL;
|
||||||
_cleanup_close_ int copy = -1;
|
_cleanup_close_ int copy = -1;
|
||||||
@ -160,7 +160,7 @@ int home_create_cifs(UserRecord *h, UserRecord **ret_home) {
|
|||||||
return log_error_errno(errno, "Unable to detect whether /sbin/mount.cifs exists: %m");
|
return log_error_errno(errno, "Unable to detect whether /sbin/mount.cifs exists: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
r = home_setup_cifs(h, false, &setup);
|
r = home_prepare_cifs(h, false, &setup);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#include "homework.h"
|
#include "homework.h"
|
||||||
#include "user-record.h"
|
#include "user-record.h"
|
||||||
|
|
||||||
int home_setup_cifs(UserRecord *h, bool already_activated, HomeSetup *setup);
|
int home_prepare_cifs(UserRecord *h, bool already_activated, HomeSetup *setup);
|
||||||
|
|
||||||
int home_activate_cifs(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
|
int home_activate_cifs(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#include "tmpfile-util.h"
|
#include "tmpfile-util.h"
|
||||||
#include "umask-util.h"
|
#include "umask-util.h"
|
||||||
|
|
||||||
int home_setup_directory(UserRecord *h, bool already_activated, HomeSetup *setup) {
|
int home_prepare_directory(UserRecord *h, bool already_activated, HomeSetup *setup) {
|
||||||
assert(h);
|
assert(h);
|
||||||
assert(setup);
|
assert(setup);
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ int home_activate_directory(
|
|||||||
UserRecord **ret_home) {
|
UserRecord **ret_home) {
|
||||||
|
|
||||||
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *header_home = NULL;
|
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *header_home = NULL;
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
const char *hdo, *hd, *ipo, *ip;
|
const char *hdo, *hd, *ipo, *ip;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ int home_activate_directory(
|
|||||||
assert_se(hdo = user_record_home_directory(h));
|
assert_se(hdo = user_record_home_directory(h));
|
||||||
hd = strdupa_safe(hdo);
|
hd = strdupa_safe(hdo);
|
||||||
|
|
||||||
r = home_setup(h, false, cache, &setup, &header_home);
|
r = home_prepare(h, false, cache, &setup, &header_home);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ int home_resize_directory(
|
|||||||
assert(ret_home);
|
assert(ret_home);
|
||||||
assert(IN_SET(user_record_storage(h), USER_DIRECTORY, USER_SUBVOLUME, USER_FSCRYPT));
|
assert(IN_SET(user_record_storage(h), USER_DIRECTORY, USER_SUBVOLUME, USER_FSCRYPT));
|
||||||
|
|
||||||
r = home_setup(h, already_activated, cache, setup, NULL);
|
r = home_prepare(h, already_activated, cache, setup, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ int home_resize_directory(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = home_setup_done(setup);
|
r = home_setup_undo(setup);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#include "homework.h"
|
#include "homework.h"
|
||||||
#include "user-record.h"
|
#include "user-record.h"
|
||||||
|
|
||||||
int home_setup_directory(UserRecord *h, bool already_activated, HomeSetup *setup);
|
int home_prepare_directory(UserRecord *h, bool already_activated, HomeSetup *setup);
|
||||||
int home_activate_directory(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
|
int home_activate_directory(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
|
||||||
int home_create_directory_or_subvolume(UserRecord *h, UserRecord **ret_home);
|
int home_create_directory_or_subvolume(UserRecord *h, UserRecord **ret_home);
|
||||||
int home_resize_directory(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_home);
|
int home_resize_directory(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_home);
|
||||||
|
|||||||
@ -278,7 +278,7 @@ static int fscrypt_setup(
|
|||||||
return log_error_errno(SYNTHETIC_ERRNO(ENOKEY), "Failed to set up home directory with provided passwords.");
|
return log_error_errno(SYNTHETIC_ERRNO(ENOKEY), "Failed to set up home directory with provided passwords.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int home_setup_fscrypt(
|
int home_prepare_fscrypt(
|
||||||
UserRecord *h,
|
UserRecord *h,
|
||||||
bool already_activated,
|
bool already_activated,
|
||||||
PasswordCache *cache,
|
PasswordCache *cache,
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#include "homework.h"
|
#include "homework.h"
|
||||||
#include "user-record.h"
|
#include "user-record.h"
|
||||||
|
|
||||||
int home_setup_fscrypt(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup);
|
int home_prepare_fscrypt(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup);
|
||||||
int home_create_fscrypt(UserRecord *h, char **effective_passwords, UserRecord **ret_home);
|
int home_create_fscrypt(UserRecord *h, char **effective_passwords, UserRecord **ret_home);
|
||||||
|
|
||||||
int home_passwd_fscrypt(UserRecord *h, HomeSetup *setup, PasswordCache *cache, char **effective_passwords);
|
int home_passwd_fscrypt(UserRecord *h, HomeSetup *setup, PasswordCache *cache, char **effective_passwords);
|
||||||
|
|||||||
@ -1098,7 +1098,7 @@ static int lock_image_fd(int image_fd, const char *ip) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int home_setup_luks(
|
int home_prepare_luks(
|
||||||
UserRecord *h,
|
UserRecord *h,
|
||||||
bool already_activated,
|
bool already_activated,
|
||||||
const char *force_image_path,
|
const char *force_image_path,
|
||||||
@ -1362,7 +1362,7 @@ int home_activate_luks(
|
|||||||
UserRecord **ret_home) {
|
UserRecord **ret_home) {
|
||||||
|
|
||||||
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *luks_home_record = NULL;
|
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *luks_home_record = NULL;
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
uint64_t host_size, encrypted_size;
|
uint64_t host_size, encrypted_size;
|
||||||
const char *hdo, *hd;
|
const char *hdo, *hd;
|
||||||
struct statfs sfs;
|
struct statfs sfs;
|
||||||
@ -1385,7 +1385,7 @@ int home_activate_luks(
|
|||||||
if (r > 0)
|
if (r > 0)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EEXIST), "Device mapper device %s already exists, refusing.", setup.dm_node);
|
return log_error_errno(SYNTHETIC_ERRNO(EEXIST), "Device mapper device %s already exists, refusing.", setup.dm_node);
|
||||||
|
|
||||||
r = home_setup_luks(
|
r = home_prepare_luks(
|
||||||
h,
|
h,
|
||||||
false,
|
false,
|
||||||
NULL,
|
NULL,
|
||||||
@ -2797,7 +2797,7 @@ int home_resize_luks(
|
|||||||
new_image_size = new_image_size_rounded;
|
new_image_size = new_image_size_rounded;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = home_setup_luks(h, already_activated, whole_disk, cache, setup, &header_home);
|
r = home_prepare_luks(h, already_activated, whole_disk, cache, setup, &header_home);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -2999,7 +2999,7 @@ int home_resize_luks(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = home_setup_done(setup);
|
r = home_setup_undo(setup);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include "homework.h"
|
#include "homework.h"
|
||||||
#include "user-record.h"
|
#include "user-record.h"
|
||||||
|
|
||||||
int home_setup_luks(UserRecord *h, bool already_activated, const char *force_image_path, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_luks_home);
|
int home_prepare_luks(UserRecord *h, bool already_activated, const char *force_image_path, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_luks_home);
|
||||||
|
|
||||||
int home_activate_luks(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
|
int home_activate_luks(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
|
||||||
int home_deactivate_luks(UserRecord *h);
|
int home_deactivate_luks(UserRecord *h);
|
||||||
|
|||||||
@ -298,7 +298,7 @@ static void drop_caches_now(void) {
|
|||||||
log_debug("Dropped caches.");
|
log_debug("Dropped caches.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int home_setup_done(HomeSetup *setup) {
|
int home_setup_undo(HomeSetup *setup) {
|
||||||
int r = 0, q;
|
int r = 0, q;
|
||||||
|
|
||||||
assert(setup);
|
assert(setup);
|
||||||
@ -368,7 +368,7 @@ int home_setup_done(HomeSetup *setup) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int home_setup(
|
int home_prepare(
|
||||||
UserRecord *h,
|
UserRecord *h,
|
||||||
bool already_activated,
|
bool already_activated,
|
||||||
PasswordCache *cache,
|
PasswordCache *cache,
|
||||||
@ -393,19 +393,19 @@ int home_setup(
|
|||||||
switch (user_record_storage(h)) {
|
switch (user_record_storage(h)) {
|
||||||
|
|
||||||
case USER_LUKS:
|
case USER_LUKS:
|
||||||
return home_setup_luks(h, already_activated, NULL, cache, setup, ret_header_home);
|
return home_prepare_luks(h, already_activated, NULL, cache, setup, ret_header_home);
|
||||||
|
|
||||||
case USER_SUBVOLUME:
|
case USER_SUBVOLUME:
|
||||||
case USER_DIRECTORY:
|
case USER_DIRECTORY:
|
||||||
r = home_setup_directory(h, already_activated, setup);
|
r = home_prepare_directory(h, already_activated, setup);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USER_FSCRYPT:
|
case USER_FSCRYPT:
|
||||||
r = home_setup_fscrypt(h, already_activated, cache, setup);
|
r = home_prepare_fscrypt(h, already_activated, cache, setup);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USER_CIFS:
|
case USER_CIFS:
|
||||||
r = home_setup_cifs(h, already_activated, setup);
|
r = home_prepare_cifs(h, already_activated, setup);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1426,7 +1426,7 @@ static int home_validate_update(UserRecord *h, HomeSetup *setup) {
|
|||||||
|
|
||||||
static int home_update(UserRecord *h, UserRecord **ret) {
|
static int home_update(UserRecord *h, UserRecord **ret) {
|
||||||
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *header_home = NULL, *embedded_home = NULL;
|
_cleanup_(user_record_unrefp) UserRecord *new_home = NULL, *header_home = NULL, *embedded_home = NULL;
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
_cleanup_(password_cache_free) PasswordCache cache = {};
|
_cleanup_(password_cache_free) PasswordCache cache = {};
|
||||||
bool already_activated = false;
|
bool already_activated = false;
|
||||||
int r;
|
int r;
|
||||||
@ -1445,7 +1445,7 @@ static int home_update(UserRecord *h, UserRecord **ret) {
|
|||||||
|
|
||||||
already_activated = r > 0;
|
already_activated = r > 0;
|
||||||
|
|
||||||
r = home_setup(h, already_activated, &cache, &setup, &header_home);
|
r = home_prepare(h, already_activated, &cache, &setup, &header_home);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -1469,7 +1469,7 @@ static int home_update(UserRecord *h, UserRecord **ret) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = home_setup_done(&setup);
|
r = home_setup_undo(&setup);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -1480,7 +1480,7 @@ static int home_update(UserRecord *h, UserRecord **ret) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int home_resize(UserRecord *h, UserRecord **ret) {
|
static int home_resize(UserRecord *h, UserRecord **ret) {
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
_cleanup_(password_cache_free) PasswordCache cache = {};
|
_cleanup_(password_cache_free) PasswordCache cache = {};
|
||||||
bool already_activated = false;
|
bool already_activated = false;
|
||||||
int r;
|
int r;
|
||||||
@ -1520,7 +1520,7 @@ static int home_resize(UserRecord *h, UserRecord **ret) {
|
|||||||
static int home_passwd(UserRecord *h, UserRecord **ret_home) {
|
static int home_passwd(UserRecord *h, UserRecord **ret_home) {
|
||||||
_cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *embedded_home = NULL, *new_home = NULL;
|
_cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *embedded_home = NULL, *new_home = NULL;
|
||||||
_cleanup_(strv_free_erasep) char **effective_passwords = NULL;
|
_cleanup_(strv_free_erasep) char **effective_passwords = NULL;
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
_cleanup_(password_cache_free) PasswordCache cache = {};
|
_cleanup_(password_cache_free) PasswordCache cache = {};
|
||||||
bool already_activated = false;
|
bool already_activated = false;
|
||||||
int r;
|
int r;
|
||||||
@ -1541,7 +1541,7 @@ static int home_passwd(UserRecord *h, UserRecord **ret_home) {
|
|||||||
|
|
||||||
already_activated = r > 0;
|
already_activated = r > 0;
|
||||||
|
|
||||||
r = home_setup(h, already_activated, &cache, &setup, &header_home);
|
r = home_prepare(h, already_activated, &cache, &setup, &header_home);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -1583,7 +1583,7 @@ static int home_passwd(UserRecord *h, UserRecord **ret_home) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = home_setup_done(&setup);
|
r = home_setup_undo(&setup);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -1595,7 +1595,7 @@ static int home_passwd(UserRecord *h, UserRecord **ret_home) {
|
|||||||
|
|
||||||
static int home_inspect(UserRecord *h, UserRecord **ret_home) {
|
static int home_inspect(UserRecord *h, UserRecord **ret_home) {
|
||||||
_cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *new_home = NULL;
|
_cleanup_(user_record_unrefp) UserRecord *header_home = NULL, *new_home = NULL;
|
||||||
_cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT;
|
_cleanup_(home_setup_undo) HomeSetup setup = HOME_SETUP_INIT;
|
||||||
_cleanup_(password_cache_free) PasswordCache cache = {};
|
_cleanup_(password_cache_free) PasswordCache cache = {};
|
||||||
bool already_activated = false;
|
bool already_activated = false;
|
||||||
int r;
|
int r;
|
||||||
@ -1613,7 +1613,7 @@ static int home_inspect(UserRecord *h, UserRecord **ret_home) {
|
|||||||
|
|
||||||
already_activated = r > 0;
|
already_activated = r > 0;
|
||||||
|
|
||||||
r = home_setup(h, already_activated, &cache, &setup, &header_home);
|
r = home_prepare(h, already_activated, &cache, &setup, &header_home);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -1625,7 +1625,7 @@ static int home_inspect(UserRecord *h, UserRecord **ret_home) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = home_setup_done(&setup);
|
r = home_setup_undo(&setup);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|||||||
@ -54,9 +54,9 @@ void password_cache_free(PasswordCache *cache);
|
|||||||
.partition_size = UINT64_MAX, \
|
.partition_size = UINT64_MAX, \
|
||||||
}
|
}
|
||||||
|
|
||||||
int home_setup_done(HomeSetup *setup);
|
int home_setup_undo(HomeSetup *setup);
|
||||||
|
|
||||||
int home_setup(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_header_home);
|
int home_prepare(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_header_home);
|
||||||
|
|
||||||
int home_refresh(UserRecord *h, HomeSetup *setup, UserRecord *header_home, PasswordCache *cache, struct statfs *ret_statfs, UserRecord **ret_new_home);
|
int home_refresh(UserRecord *h, HomeSetup *setup, UserRecord *header_home, PasswordCache *cache, struct statfs *ret_statfs, UserRecord **ret_new_home);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user