summaryrefslogtreecommitdiff
path: root/src/userdb
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-03-24 17:17:31 +0100
committerFrantisek Sumsal <frantisek@sumsal.cz>2023-03-24 17:17:31 +0100
commit5b09499cacd3c1c95ab240d041e28cc954a5975d (patch)
tree27a3c0a4fb6c09f5b70ba59e4ef8592a4fbfeb48 /src/userdb
parent13bf3216101af82d36e24e5a95f450f166f5030b (diff)
downloadsystemd-5b09499cacd3c1c95ab240d041e28cc954a5975d.tar.gz
userdbctl: flush stdout before running the chain command
Otherwise it's quite difficult to capture the entire output: $ userdbctl ssh-authorized-keys dropinuser --chain /bin/echo hello ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA//dxI2xLg4MgxIKKZv1nqwTEIlE/fdakii2Fb75pG+ foo@bar.tld ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMlaqG2rTMje5CQnfjXJKmoSpEVJ2gWtx4jBvsQbmee2XbU/Qdq5+SRisssR9zVuxgg5NA5fv08MgjwJQMm+csc= hello@world.tld hello $ userdbctl ssh-authorized-keys dropinuser --chain /bin/echo hello | tee hello
Diffstat (limited to 'src/userdb')
-rw-r--r--src/userdb/userdbctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c
index 86b8d383df..eab0c3af15 100644
--- a/src/userdb/userdbctl.c
+++ b/src/userdb/userdbctl.c
@@ -1038,6 +1038,7 @@ static int ssh_authorized_keys(int argc, char *argv[], void *userdata) {
log_debug("Chain invoking: %s", s);
}
+ fflush(stdout);
execv(chain_invocation[0], chain_invocation);
if (errno == ENOENT) /* Let's handle ENOENT gracefully */
log_warning_errno(errno, "Chain executable '%s' does not exist, ignoring chain invocation.", chain_invocation[0]);