[BACK]Return to authfile.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/authfile.c between version 1.61 and 1.61.2.1

version 1.61, 2005/06/17 02:44:32 version 1.61.2.1, 2006/10/06 03:19:32
Line 1 
Line 1 
   /* $OpenBSD$ */
 /*  /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>   * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland   * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
Line 35 
Line 36 
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */   */
   
 #include "includes.h"  
 RCSID("$OpenBSD$");  
   
   #include <sys/types.h>
   #include <sys/stat.h>
   #include <sys/param.h>
   #include <sys/uio.h>
   
 #include <openssl/err.h>  #include <openssl/err.h>
 #include <openssl/evp.h>  #include <openssl/evp.h>
 #include <openssl/pem.h>  #include <openssl/pem.h>
   
 #include "cipher.h"  #include <errno.h>
   #include <fcntl.h>
   #include <stdio.h>
   #include <stdlib.h>
   #include <string.h>
   #include <unistd.h>
   
 #include "xmalloc.h"  #include "xmalloc.h"
   #include "cipher.h"
 #include "buffer.h"  #include "buffer.h"
 #include "bufaux.h"  
 #include "key.h"  #include "key.h"
 #include "ssh.h"  #include "ssh.h"
 #include "log.h"  #include "log.h"
Line 184 
Line 194 
                 return 0;                  return 0;
         }          }
         fp = fdopen(fd, "w");          fp = fdopen(fd, "w");
         if (fp == NULL ) {          if (fp == NULL) {
                 error("fdopen %s failed: %s.", filename, strerror(errno));                  error("fdopen %s failed: %s.", filename, strerror(errno));
                 close(fd);                  close(fd);
                 return 0;                  return 0;
Line 211 
Line 221 
         case KEY_RSA1:          case KEY_RSA1:
                 return key_save_private_rsa1(key, filename, passphrase,                  return key_save_private_rsa1(key, filename, passphrase,
                     comment);                      comment);
                 break;  
         case KEY_DSA:          case KEY_DSA:
         case KEY_RSA:          case KEY_RSA:
                 return key_save_private_pem(key, filename, passphrase,                  return key_save_private_pem(key, filename, passphrase,
                     comment);                      comment);
                 break;  
         default:          default:
                 break;                  break;
         }          }
Line 507 
Line 515 
         return prv;          return prv;
 }  }
   
 static int  int
 key_perm_ok(int fd, const char *filename)  key_perm_ok(int fd, const char *filename)
 {  {
         struct stat st;          struct stat st;
Line 534 
Line 542 
   
 Key *  Key *
 key_load_private_type(int type, const char *filename, const char *passphrase,  key_load_private_type(int type, const char *filename, const char *passphrase,
     char **commentp)      char **commentp, int *perm_ok)
 {  {
         int fd;          int fd;
   
Line 542 
Line 550 
         if (fd < 0)          if (fd < 0)
                 return NULL;                  return NULL;
         if (!key_perm_ok(fd, filename)) {          if (!key_perm_ok(fd, filename)) {
                   if (perm_ok != NULL)
                           *perm_ok = 0;
                 error("bad permissions: ignore key: %s", filename);                  error("bad permissions: ignore key: %s", filename);
                 close(fd);                  close(fd);
                 return NULL;                  return NULL;
         }          }
           if (perm_ok != NULL)
                   *perm_ok = 1;
         switch (type) {          switch (type) {
         case KEY_RSA1:          case KEY_RSA1:
                 return key_load_private_rsa1(fd, filename, passphrase,                  return key_load_private_rsa1(fd, filename, passphrase,
                     commentp);                      commentp);
                 /* closes fd */                  /* closes fd */
                 break;  
         case KEY_DSA:          case KEY_DSA:
         case KEY_RSA:          case KEY_RSA:
         case KEY_UNSPEC:          case KEY_UNSPEC:
                 return key_load_private_pem(fd, type, passphrase, commentp);                  return key_load_private_pem(fd, type, passphrase, commentp);
                 /* closes fd */                  /* closes fd */
                 break;  
         default:          default:
                 close(fd);                  close(fd);
                 break;                  break;

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.61.2.1