mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 14:55:37 +03:00
user-record: optionally, allow parsing empty user record JSON objects
This commit is contained in:
parent
871a3a33bb
commit
1a298a206c
@ -1552,7 +1552,7 @@ int user_group_record_mangle(
|
||||
if (FLAGS_SET(load_flags, USER_RECORD_REQUIRE_REGULAR) && !FLAGS_SET(m, USER_RECORD_REGULAR))
|
||||
return json_log(v, json_flags, SYNTHETIC_ERRNO(EBADMSG), "Record lacks basic identity fields, which are required.");
|
||||
|
||||
if (m == 0)
|
||||
if (!FLAGS_SET(load_flags, USER_RECORD_EMPTY_OK) && m == 0)
|
||||
return json_log(v, json_flags, SYNTHETIC_ERRNO(EBADMSG), "Record is empty.");
|
||||
|
||||
if (w)
|
||||
|
@ -169,6 +169,9 @@ typedef enum UserRecordLoadFlags {
|
||||
|
||||
/* Whether to ignore errors and load what we can */
|
||||
USER_RECORD_PERMISSIVE = 1U << 29,
|
||||
|
||||
/* Whether an empty record is OK */
|
||||
USER_RECORD_EMPTY_OK = 1U << 30,
|
||||
} UserRecordLoadFlags;
|
||||
|
||||
static inline UserRecordLoadFlags USER_RECORD_REQUIRE(UserRecordMask m) {
|
||||
|
Loading…
Reference in New Issue
Block a user