summaryrefslogtreecommitdiff
path: root/src/home/homed-home.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-05-31 21:55:44 +0200
committerLennart Poettering <lennart@poettering.net>2021-06-01 13:32:31 +0200
commitbfc0cc1a2506eb2327dca8e1a474be51634e8ab9 (patch)
tree51c0e7a5b722bd442e842894d95a53ae22824f22 /src/home/homed-home.c
parent17e7561a973495992014dd102135f15eb808ae01 (diff)
downloadsystemd-bfc0cc1a2506eb2327dca8e1a474be51634e8ab9.tar.gz
userdb: make most loading of JSON user record data "permissive"
We want user records to be extensible, hence we shouldn't complain about fields we can't parse. In particular we want them to be extensible for our own future extensions. Some code already turned the permissive flag when parsing the JSON data, but most did not. Fix that. A few select cases remain where the bit is not set: where we just gnerated the JSON data ourselves, and thus can be reasonably sure that if we can't parse it it's our immediate programming error and not just us processing a user record from some other tool or a newer version of ourselves.
Diffstat (limited to 'src/home/homed-home.c')
-rw-r--r--src/home/homed-home.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/home/homed-home.c b/src/home/homed-home.c
index 54e36e3b71..39dd501a32 100644
--- a/src/home/homed-home.c
+++ b/src/home/homed-home.c
@@ -145,7 +145,7 @@ int home_new(Manager *m, UserRecord *hr, const char *sysfs, Home **ret) {
return r;
}
- r = user_record_clone(hr, USER_RECORD_LOAD_MASK_SECRET, &home->record);
+ r = user_record_clone(hr, USER_RECORD_LOAD_MASK_SECRET|USER_RECORD_PERMISSIVE, &home->record);
if (r < 0)
return r;
@@ -243,7 +243,7 @@ int home_set_record(Home *h, UserRecord *hr) {
if (!new_hr)
return -ENOMEM;
- r = user_record_load(new_hr, v, USER_RECORD_LOAD_REFUSE_SECRET);
+ r = user_record_load(new_hr, v, USER_RECORD_LOAD_REFUSE_SECRET|USER_RECORD_PERMISSIVE);
if (r < 0)
return r;
@@ -384,7 +384,7 @@ static int home_parse_worker_stdout(int _fd, UserRecord **ret) {
if (!hr)
return log_oom();
- r = user_record_load(hr, v, USER_RECORD_LOAD_REFUSE_SECRET);
+ r = user_record_load(hr, v, USER_RECORD_LOAD_REFUSE_SECRET|USER_RECORD_PERMISSIVE);
if (r < 0)
return log_error_errno(r, "Failed to load home record identity: %m");
@@ -1410,7 +1410,7 @@ static int home_update_internal(
return sd_bus_error_set(error, BUS_ERROR_HOME_RECORD_DOWNGRADE, "Refusing to update to older home record.");
if (!secret && FLAGS_SET(hr->mask, USER_RECORD_SECRET)) {
- r = user_record_clone(hr, USER_RECORD_EXTRACT_SECRET, &saved_secret);
+ r = user_record_clone(hr, USER_RECORD_EXTRACT_SECRET|USER_RECORD_PERMISSIVE, &saved_secret);
if (r < 0)
return r;
@@ -1445,7 +1445,7 @@ static int home_update_internal(
return r;
}
- r = user_record_extend_with_binding(hr, h->record, USER_RECORD_LOAD_MASK_SECRET, &new_hr);
+ r = user_record_extend_with_binding(hr, h->record, USER_RECORD_LOAD_MASK_SECRET|USER_RECORD_PERMISSIVE, &new_hr);
if (r < 0)
return r;
@@ -1539,7 +1539,7 @@ int home_resize(Home *h, uint64_t disk_size, UserRecord *secret, sd_bus_error *e
if (h->signed_locally <= 0) /* Don't allow changing of records not signed only by us */
return sd_bus_error_setf(error, BUS_ERROR_HOME_RECORD_SIGNED, "Home %s is signed and cannot be modified locally.", h->user_name);
- r = user_record_clone(h->record, USER_RECORD_LOAD_REFUSE_SECRET, &c);
+ r = user_record_clone(h->record, USER_RECORD_LOAD_REFUSE_SECRET|USER_RECORD_PERMISSIVE, &c);
if (r < 0)
return r;
@@ -1628,7 +1628,7 @@ int home_passwd(Home *h,
if (r < 0)
return r;
- r = user_record_clone(h->record, USER_RECORD_LOAD_REFUSE_SECRET, &c);
+ r = user_record_clone(h->record, USER_RECORD_LOAD_REFUSE_SECRET|USER_RECORD_PERMISSIVE, &c);
if (r < 0)
return r;