diff -3ur ssh-1.2.27-fresh/sshconnect.c ssh-1.2.27-sc/sshconnect.c
--- ssh-1.2.27-fresh/sshconnect.c	Wed May 12 07:19:29 1999
+++ ssh-1.2.27-sc/sshconnect.c	Thu Jul 20 15:33:02 2000
@@ -15,8 +15,17 @@
 */
 
 /*
- * $Id: sshconnect.c,v 1.32 1999/02/21 19:52:51 ylo Exp $
+ * $Id: sshconnect.c,v 1.2 2000/05/13 19:40:26 itoi Exp $
  * $Log: sshconnect.c,v $
+ * Revision 1.2  2000/05/13 19:40:26  itoi
+ * ssh / speke / udp / ip / 7816 works!
+ *
+ * Revision 1.1  2000/05/11 16:48:32  itoi
+ * Initial revision
+ *
+ * Revision 1.1.1.1  2000/02/21 22:19:46  itoi
+ * SSH / Smartcard
+ *
  * Revision 1.32  1999/02/21 19:52:51  ylo
  * 	Intermediate commit of ssh1.2.27 stuff.
  * 	Main change is sprintf -> snprintf; however, there are also
@@ -225,6 +234,9 @@
 #endif /* KRB5 */
 #endif /* KERBEROS */
 
+/* NI */
+extern int remote_sc_mode;
+
 /* Session id for the current session. */
 unsigned char session_id[16];
 
@@ -710,7 +722,6 @@
   struct MD5Context md;
   int i;
 
-  /* Decrypt the challenge using the private key. */
   rsa_private_decrypt(challenge, challenge, prv);
 
   /* Compute the response. */
@@ -733,6 +744,7 @@
   memset(buf, 0, sizeof(buf));
   memset(response, 0, sizeof(response));
   memset(&md, 0, sizeof(md));
+
 }
 
 /* Checks if the user has authentication file, and if so, tries to authenticate
@@ -787,7 +799,9 @@
 
   /* Load the private key.  Try first with empty passphrase; if it fails, 
      ask for a passphrase. */
+
   done = load_private_key(pw->pw_uid, authfile, "", &private_key, NULL);
+  
 #ifdef SECURE_RPC
   if (!done)
     {
@@ -805,15 +819,17 @@
 #endif
   if (!done)
     {
-      char buf[300];
       /* Request passphrase from the user.  We read from /dev/tty to make
          this work even if stdin has been redirected.  If running in
          batch mode, we just use the empty passphrase, which will fail and
          return. */
-      snprintf(buf, sizeof(buf),
-               "Enter passphrase for RSA key '%.100s': ", comment);
       if (may_ask_passphrase)
-        passphrase = read_passphrase(pw->pw_uid, buf, 0);
+	{
+	  char buf[300];
+	  snprintf(buf, sizeof(buf),
+		   "Enter passphrase for RSA key '%.100s': ", comment);
+	  passphrase = read_passphrase(pw->pw_uid, buf, 0);
+	}
       else
         {
           debug("Will not query passphrase for %.100s in batch mode.", 
@@ -850,6 +866,7 @@
   /* We no longer need the comment. */
   xfree(comment);
 
+
   /* Compute and send a response to the challenge. */
   respond_to_rsa_challenge(&challenge, &private_key);
   
@@ -1293,7 +1310,8 @@
   krb5_principal client;
 #endif
 #endif
-  
+  int rv;
+
   /* Convert the user-supplied hostname into all lowercase. */
   host = xstrdup(orighost);
   for (cp = host; *cp; cp++)
@@ -1717,13 +1735,20 @@
       if (try_agent_authentication())
         return; /* Successful connection. */
 
+#ifdef SC_SSH
+      /* try smartcard authentication */
+      rv = try_rsa_authentication_sc();
+      if (rv) return;
+#endif
+      
+
       /* Try RSA authentication for each identity. */
       for (i = 0; i < options->num_identity_files; i++)
         if (try_rsa_authentication(pw, options->identity_files[i],
                                    !options->batch_mode))
           return; /* Successful connection. */
     }
-  
+
   /* Support for TIS authentication server
      Contributed by Andre April <Andre.April@cediti.be>. */
   /* Try Tis authentication daemon if the server supports it. */
