summaryrefslogtreecommitdiffstats
path: root/src/userdb
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-08-06 17:35:34 +0200
committerLennart Poettering <lennart@poettering.net>2020-08-07 08:39:18 +0200
commit0bb4308014d587354d4dbd1cc3a122f0751974b2 (patch)
treea29c30ffbb90920b720fcbc1168fedf868284336 /src/userdb
parentupdate TODO (diff)
downloadsystemd-0bb4308014d587354d4dbd1cc3a122f0751974b2.tar.xz
systemd-0bb4308014d587354d4dbd1cc3a122f0751974b2.zip
userdb: add "description" field to group records
User records have the realname/gecos fields, groups never had that, but it would really be useful to have it, hence let's add it with similar semantics. We enforce the same syntax as for GECOS, since it's better to start with strict rules and losen them later instead of the opposite.
Diffstat (limited to 'src/userdb')
-rw-r--r--src/userdb/userdbctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c
index c973ee9c01..12c6943ebd 100644
--- a/src/userdb/userdbctl.c
+++ b/src/userdb/userdbctl.c
@@ -232,6 +232,7 @@ static int show_group(GroupRecord *gr, Table *table) {
TABLE_STRING, gr->group_name,
TABLE_STRING, user_disposition_to_string(group_record_disposition(gr)),
TABLE_GID, gr->gid,
+ TABLE_STRING, gr->description,
TABLE_INT, (int) group_record_disposition(gr));
if (r < 0)
return table_log_add_error(r);
@@ -255,13 +256,14 @@ static int display_group(int argc, char *argv[], void *userdata) {
arg_output = argc > 1 ? OUTPUT_FRIENDLY : OUTPUT_TABLE;
if (arg_output == OUTPUT_TABLE) {
- table = table_new("name", "disposition", "gid", "disposition-numeric");
+ table = table_new("name", "disposition", "gid", "description", "disposition-numeric");
if (!table)
return log_oom();
(void) table_set_align_percent(table, table_get_cell(table, 0, 2), 100);
+ (void) table_set_empty_string(table, "-");
(void) table_set_sort(table, (size_t) 3, (size_t) 2, (size_t) -1);
- (void) table_set_display(table, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) -1);
+ (void) table_set_display(table, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) -1);
}
if (argc > 1) {