[openssh-commits] [openssh] 01/04: upstream: Make the standard output messages of both methods of
git+noreply at mindrot.org
git+noreply at mindrot.org
Sat Jun 8 00:26:00 AEST 2019
This is an automated email from the git hooks/post-receive script.
dtucker pushed a commit to branch master
in repository openssh.
commit 410b231aa41ff830b2f5b09b5aaf5e5cdc1ab86b
Author: lum at openbsd.org <lum at openbsd.org>
Date: Wed May 29 08:30:26 2019 +0000
upstream: Make the standard output messages of both methods of
changing a key pair's comments (using -c and -C) more applicable to both
methods. ok and suggestions djm@ dtucker@
OpenBSD-Commit-ID: b379338118109eb36e14a65bc0a12735205b3de6
---
ssh-keygen.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 3898b281..db371090 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.329 2019/03/25 16:19:44 dtucker Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.330 2019/05/29 08:30:26 lum Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1488,14 +1488,14 @@ do_change_comment(struct passwd *pw, const char *identity_comment)
exit(1);
}
if (comment)
- printf("Key now has comment '%s'\n", comment);
+ printf("Old comment: %s\n", comment);
else
- printf("Key now has no comment\n");
+ printf("No existing comment\n");
if (identity_comment) {
strlcpy(new_comment, identity_comment, sizeof(new_comment));
} else {
- printf("Enter new comment: ");
+ printf("New comment: ");
fflush(stdout);
if (!fgets(new_comment, sizeof(new_comment), stdin)) {
explicit_bzero(passphrase, strlen(passphrase));
@@ -1504,6 +1504,13 @@ do_change_comment(struct passwd *pw, const char *identity_comment)
}
new_comment[strcspn(new_comment, "\n")] = '\0';
}
+ if (comment != NULL && strcmp(comment, new_comment) == 0) {
+ printf("No change to comment\n");
+ free(passphrase);
+ sshkey_free(private);
+ free(comment);
+ exit(0);
+ }
/* Save the file using the new passphrase. */
if ((r = sshkey_save_private(private, identity_file, passphrase,
@@ -1537,7 +1544,11 @@ do_change_comment(struct passwd *pw, const char *identity_comment)
free(comment);
- printf("The comment in your key file has been changed.\n");
+ if (strlen(new_comment) > 0)
+ printf("Comment '%s' applied\n", new_comment);
+ else
+ printf("Comment removed\n");
+
exit(0);
}
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list