Patch to allow DSA as well as RSA identities to be specified on the command line

Nigel Williams nigelw at wizardis.com.au
Thu Dec 21 11:17:09 EST 2000


This patch allows DSA identities to be specified on the command
line. Previously, only RSA identities were allowed.

------------------------------------------------------------------------
diff -U2 openssh-2.2.0p1/ssh.0 openssh-2.2.0p1.nigelw/ssh.0
--- openssh-2.2.0p1/ssh.0	Sat Sep  2 10:08:46 2000
+++ openssh-2.2.0p1.nigelw/ssh.0	Thu Dec 21 10:53:07 2000
@@ -224,5 +224,5 @@
      -g      Allows remote hosts to connect to local forwarded ports.
 
-     -i identity_file
+     -i rsa_identity_file
              Selects the file from which the identity (private key) for RSA
              authentication is read.  Default is $HOME/.ssh/identity in the
@@ -230,4 +230,12 @@
              per-host basis in the configuration file.  It is possible to have
              multiple -i options (and multiple identities specified in config-
+             uration files).
+
+     -I dsa_identity_file
+             Selects the file from which the identity (private key) for DSA
+             authentication is read.  Default is $HOME/.ssh/id_dsa in the
+             user's home directory.  Identity files may also be specified on a
+             per-host basis in the configuration file.  It is possible to have
+             multiple -I options (and multiple identities specified in config-
              uration files).
 
diff -U2 openssh-2.2.0p1/ssh.1 openssh-2.2.0p1.nigelw/ssh.1
--- openssh-2.2.0p1/ssh.1	Tue Aug 29 11:33:51 2000
+++ openssh-2.2.0p1.nigelw/ssh.1	Thu Dec 21 10:56:23 2000
@@ -28,5 +28,6 @@
 .Op Fl c Ar cipher_spec
 .Op Fl e Ar escape_char
-.Op Fl i Ar identity_file
+.Op Fl i Ar rsa_identity_file
+.Op Fl I Ar dsa_identity_file
 .Op Fl l Ar login_name
 .Op Fl o Ar option
@@ -381,9 +382,21 @@
 .It Fl g
 Allows remote hosts to connect to local forwarded ports.
-.It Fl i Ar identity_file
+.It Fl i Ar rsa_identity_file
 Selects the file from which the identity (private key) for
 RSA authentication is read.
 Default is
 .Pa $HOME/.ssh/identity
+in the user's home directory.
+Identity files may also be specified on
+a per-host basis in the configuration file.
+It is possible to have multiple
+.Fl i
+options (and multiple identities specified in
+configuration files).
+.It Fl I Ar dsa_identity_file
+Selects the file from which the identity (private key) for
+DSA authentication is read.
+Default is
+.Pa $HOME/.ssh/id_dsa
 in the user's home directory.
 Identity files may also be specified on
diff -U2 openssh-2.2.0p1/ssh.c openssh-2.2.0p1.nigelw/ssh.c
--- openssh-2.2.0p1/ssh.c	Tue Aug 29 11:33:51 2000
+++ openssh-2.2.0p1.nigelw/ssh.c	Thu Dec 21 11:01:39 2000
@@ -125,4 +125,5 @@
 	fprintf(stderr, "  -x          Disable X11 connection forwarding.\n");
 	fprintf(stderr, "  -i file     Identity for RSA authentication (default: ~/.ssh/identity).\n");
+	fprintf(stderr, "  -I file     Identity for DSA authentication (default: ~/.ssh/id_dsa).\n");
 	fprintf(stderr, "  -t          Tty; allocate a tty even if command is given.\n");
 	fprintf(stderr, "  -T          Do not allocate a tty.\n");
@@ -275,5 +276,5 @@
 		if (!opt)
 			usage();
-		if (strchr("eilcpLRo", opt)) {	/* options with arguments */
+		if (strchr("eiIlcpLRo", opt)) {	/* options with arguments */
 			optarg = av[optind] + 2;
 			if (strcmp(optarg, "") == 0) {
@@ -330,12 +331,24 @@
 		case 'i':
 			if (stat(optarg, &st) < 0) {
-				fprintf(stderr, "Warning: Identity file %s does not exist.\n",
+				fprintf(stderr, "Warning: RSA identity file %s does not exist.\n",
 					optarg);
 				break;
 			}
 			if (options.num_identity_files >= SSH_MAX_IDENTITY_FILES)
-				fatal("Too many identity files specified (max %d)",
+				fatal("Too many RSA identity files specified (max %d)",
 				      SSH_MAX_IDENTITY_FILES);
 			options.identity_files[options.num_identity_files++] =
+				xstrdup(optarg);
+			break;
+		case 'I':
+			if (stat(optarg, &st) < 0) {
+				fprintf(stderr, "Warning: DSA identity file %s does not exist.\n",
+					optarg);
+				break;
+			}
+			if (options.num_identity_files2 >= SSH_MAX_IDENTITY_FILES)
+				fatal("Too many DSA identity files specified (max %d)",
+				      SSH_MAX_IDENTITY_FILES);
+			options.identity_files2[options.num_identity_files2++] =
 				xstrdup(optarg);
 			break;
------------------------------------------------------------------------

Nigel
-- 
Heavily armed, easily bored, and off my medication.





More information about the openssh-unix-dev mailing list