vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Blob Blame History Raw
diff -up openssh-5.9p0/ssh-keygen.0.keygen openssh-5.9p0/ssh-keygen.0
--- openssh-5.9p0/ssh-keygen.0.keygen	2011-08-29 16:30:02.000000000 +0200
+++ openssh-5.9p0/ssh-keygen.0	2011-08-30 13:47:56.208087184 +0200
@@ -4,7 +4,7 @@ NAME
      ssh-keygen - authentication key generation, management and conversion
 
 SYNOPSIS
-     ssh-keygen [-q] [-b bits] -t type [-N new_passphrase] [-C comment]
+     ssh-keygen [-q] [-o] [-b bits] -t type [-N new_passphrase] [-C comment]
                 [-f output_keyfile]
      ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
      ssh-keygen -i [-m key_format] [-f input_keyfile]
@@ -181,6 +181,8 @@ DESCRIPTION
              principals may be specified, separated by commas.  Please see the
              CERTIFICATES section for details.
 
+     -o      Overwrite the key without prompting user.
+
      -O option
              Specify a certificate option when signing a key.  This option may
              be specified multiple times.  Please see the CERTIFICATES section
diff -up openssh-5.9p0/ssh-keygen.1.keygen openssh-5.9p0/ssh-keygen.1
--- openssh-5.9p0/ssh-keygen.1.keygen	2011-08-30 13:32:30.787149917 +0200
+++ openssh-5.9p0/ssh-keygen.1	2011-08-30 13:46:42.638087171 +0200
@@ -45,6 +45,7 @@
 .Bk -words
 .Nm ssh-keygen
 .Op Fl q
+.Op Fl o
 .Op Fl b Ar bits
 .Fl t Ar type
 .Op Fl N Ar new_passphrase
@@ -339,6 +340,8 @@ Multiple principals may be specified, se
 Please see the
 .Sx CERTIFICATES
 section for details.
+.It Fl o
+Overwrite the key without prompting user.
 .It Fl O Ar option
 Specify a certificate option when signing a key.
 This option may be specified multiple times.
diff -up openssh-5.9p0/ssh-keygen.c.keygen openssh-5.9p0/ssh-keygen.c
--- openssh-5.9p0/ssh-keygen.c.keygen	2011-08-30 13:32:20.268149992 +0200
+++ openssh-5.9p0/ssh-keygen.c	2011-08-30 13:39:34.550214102 +0200
@@ -73,6 +73,7 @@ int change_passphrase = 0;
 int change_comment = 0;
 
 int quiet = 0;
+int overwrite = 0;
 
 int log_level = SYSLOG_LEVEL_INFO;
 
@@ -1959,7 +1960,7 @@ main(int argc, char **argv)
 		exit(1);
 	}
 
-	while ((opt = getopt(argc, argv, "AegiqpclBHLhvxXyF:b:f:t:D:I:P:m:N:n:"
+	while ((opt = getopt(argc, argv, "AegiqopclBHLhvxXyF:b:f:t:D:I:P:m:N:n:"
 	    "O:C:r:g:R:T:G:M:S:s:a:V:W:z:")) != -1) {
 		switch (opt) {
 		case 'A':
@@ -2042,6 +2043,9 @@ main(int argc, char **argv)
 		case 'q':
 			quiet = 1;
 			break;
+		case 'o':
+			overwrite = 1;
+			break;
 		case 'e':
 		case 'x':
 			/* export key */
@@ -2278,7 +2282,7 @@ main(int argc, char **argv)
 		}
 	}
 	/* If the file already exists, ask the user to confirm. */
-	if (stat(identity_file, &st) >= 0) {
+	if (!overwrite && stat(identity_file, &st) >= 0) {
 		char yesno[3];
 		printf("%s already exists.\n", identity_file);
 		printf("Overwrite (y/n)? ");