core: correctly deserialize credentials with empty payload
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Apr 2024 16:31:03 +0000 (18:31 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Apr 2024 17:00:42 +0000 (19:00 +0200)
commit347756ed810e28bac5e5b0c1f12978f91dfa65c8
tree61b3c81b77cc94895e7f815ec057fa43c5c5de94
parentc956bf31f8e58e23740c2b58a779570eca49591e
core: correctly deserialize credentials with empty payload

For example with SetCredential=mycred: the data payload is empty, but it
is still a valid credential.

This reorders the arguments when serializing credentials, so the
possibly empty argument is not at the end of the serialized string. This
way we can still easily use the extract_many_words() machinery, and with
the use of EXTRACT_DONT_COALESCE_SEPARATORS properly deserialize even an
empty credential. This changes LoadCredentials= as well just to keep the
code for (de)serializing both directives in sync.
src/core/execute-serialize.c