]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #16690 from poettering/userdb-group-desc
authorAnita Zhang <the.anitazha@gmail.com>
Tue, 11 Aug 2020 07:27:54 +0000 (00:27 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Aug 2020 07:27:54 +0000 (00:27 -0700)
description field for group records

1  2 
TODO
src/shared/user-record.c

diff --combined TODO
index d6ae200a34df6532fd2abad3e60f647c2795adb9,c038a0d115d77c92fd4902d03291c613853d8e9a..c0fbf8bc6ae9a5ad30678443c2cdddda6f2e09bc
--- 1/TODO
--- 2/TODO
+++ b/TODO
@@@ -120,9 -120,9 +120,9 @@@ Features
    this, it's useful to have one that can dump contents of them, too.
  
  * All tools that support --root= should also learn --image= so that they can
 -  operate on disk images directly. Specifically: bootctl, tmpfiles, sysusers,
 -  systemctl, repart, journalctl, coredumpctl. (Already done: systemd-nspawn,
 -  systemd-firstboot)
 +  operate on disk images directly. Specifically: bootctl, systemctl,
 +  coredumpctl. (Already done: systemd-nspawn, systemd-firstboot,
 +  systemd-repart, systemd-tmpfiles, systemd-sysusers, journalctl)
  
  * seccomp: by default mask x32 ABI system wide on x86-64. it's on its way out
  
    right) become genuine first class citizens, and we gain automatic, sane JSON
    output for them.
  
 -* systemd-firstboot: teach it dissector magic, so that you can point it to some
 -  disk image and it will just set everything in it all behind the scenes.
 -
  * We should probably replace /var/log/README, /etc/rc.d/README with symlinks
    that are linked to these places instead of copied. After all they are
    constant vendor data.
    - in systemd's PAMName= logic: query passwords with ssh-askpassword, so that we can make "loginctl set-linger" mode work
    - fingerprint authentication, pattern authentication, …
    - make sure "classic" user records can also be managed by homed
-   - description field for groups
    - make size of $XDG_RUNTIME_DIR configurable in user record
    - reuse pwquality magic in firstboot
    - query password from kernel keyring first
diff --combined src/shared/user-record.c
index 2c0de383e042316623a97cb6fecd9c58e7e2c45b,801de197748ecfb1d316f741af6f52f1b364ce9c..678f04e53747ceec718d563164d4cf38fd746155
@@@ -203,9 -203,10 +203,9 @@@ int json_dispatch_realm(const char *nam
          return 0;
  }
  
static int json_dispatch_gecos(const char *name, JsonVariant *variant, JsonDispatchFlags flags, void *userdata) {
+ int json_dispatch_gecos(const char *name, JsonVariant *variant, JsonDispatchFlags flags, void *userdata) {
          char **s = userdata;
          const char *n;
 -        int r;
  
          if (json_variant_is_null(variant)) {
                  *s = mfree(*s);
                  return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a string.", strna(name));
  
          n = json_variant_string(variant);
 -        if (!valid_gecos(n))
 -                return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a valid GECOS compatible real name.", strna(name));
 +        if (valid_gecos(n)) {
 +                if (free_and_strdup(s, n) < 0)
 +                        return json_log_oom(variant, flags);
 +        } else {
 +                _cleanup_free_ char *m = NULL;
  
 -        r = free_and_strdup(s, n);
 -        if (r < 0)
 -                return json_log(variant, flags, r, "Failed to allocate string: %m");
 +                json_log(variant, flags|JSON_DEBUG, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a valid GECOS compatible string, mangling.", strna(name));
 +
 +                m = mangle_gecos(n);
 +                if (!m)
 +                        return json_log_oom(variant, flags);
 +
 +                free_and_replace(*s, m);
 +        }
  
          return 0;
  }