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

Diff for /src/usr.bin/ssh/dns.c between version 1.12 and 1.12.2.1

version 1.12, 2005/06/17 02:44:32 version 1.12.2.1, 2006/02/03 03:01:56
Line 25 
Line 25 
  * 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"  #include "includes.h"
   RCSID("$OpenBSD$");
   
 #include <openssl/bn.h>  
 #ifdef LWRES  
 #include <lwres/netdb.h>  
 #include <dns/result.h>  
 #else /* LWRES */  
 #include <netdb.h>  #include <netdb.h>
 #endif /* LWRES */  
   
 #include "xmalloc.h"  #include "xmalloc.h"
 #include "key.h"  #include "key.h"
 #include "dns.h"  #include "dns.h"
 #include "log.h"  #include "log.h"
 #include "uuencode.h"  
   
 extern char *__progname;  
 RCSID("$OpenBSD$");  
   
 #ifndef LWRES  
 static const char *errset_text[] = {  static const char *errset_text[] = {
         "success",              /* 0 ERRSET_SUCCESS */          "success",              /* 0 ERRSET_SUCCESS */
         "out of memory",        /* 1 ERRSET_NOMEMORY */          "out of memory",        /* 1 ERRSET_NOMEMORY */
Line 75 
Line 64 
                 return "unknown error";                  return "unknown error";
         }          }
 }  }
 #endif /* LWRES */  
   
   
 /*  /*
  * Read SSHFP parameters from key buffer.   * Read SSHFP parameters from key buffer.
  */   */
Line 95 
Line 82 
                 *algorithm = SSHFP_KEY_DSA;                  *algorithm = SSHFP_KEY_DSA;
                 break;                  break;
         default:          default:
                 *algorithm = SSHFP_KEY_RESERVED;                  *algorithm = SSHFP_KEY_RESERVED; /* 0 */
         }          }
   
         if (*algorithm) {          if (*algorithm) {
                 *digest_type = SSHFP_HASH_SHA1;                  *digest_type = SSHFP_HASH_SHA1;
                 *digest = key_fingerprint_raw(key, SSH_FP_SHA1, digest_len);                  *digest = key_fingerprint_raw(key, SSH_FP_SHA1, digest_len);
                   if (*digest == NULL)
                           fatal("dns_read_key: null from key_fingerprint_raw()");
                 success = 1;                  success = 1;
         } else {          } else {
                 *digest_type = SSHFP_HASH_RESERVED;                  *digest_type = SSHFP_HASH_RESERVED;
Line 133 
Line 122 
                         *digest = (u_char *) xmalloc(*digest_len);                          *digest = (u_char *) xmalloc(*digest_len);
                         memcpy(*digest, rdata + 2, *digest_len);                          memcpy(*digest, rdata + 2, *digest_len);
                 } else {                  } else {
                         *digest = NULL;                          *digest = xstrdup("");
                 }                  }
   
                 success = 1;                  success = 1;
Line 187 
Line 176 
   
         *flags = 0;          *flags = 0;
   
         debug3("verify_hostkey_dns");          debug3("verify_host_key_dns");
         if (hostkey == NULL)          if (hostkey == NULL)
                 fatal("No key to look up!");                  fatal("No key to look up!");
   
Line 223 
Line 212 
         if (fingerprints->rri_nrdatas)          if (fingerprints->rri_nrdatas)
                 *flags |= DNS_VERIFY_FOUND;                  *flags |= DNS_VERIFY_FOUND;
   
         for (counter = 0 ; counter < fingerprints->rri_nrdatas ; counter++)  {          for (counter = 0; counter < fingerprints->rri_nrdatas; counter++)  {
                 /*                  /*
                  * Extract the key from the answer. Ignore any badly                   * Extract the key from the answer. Ignore any badly
                  * formatted fingerprints.                   * formatted fingerprints.
Line 247 
Line 236 
                                 *flags |= DNS_VERIFY_MATCH;                                  *flags |= DNS_VERIFY_MATCH;
                         }                          }
                 }                  }
                   xfree(dnskey_digest);
         }          }
   
           xfree(hostkey_digest); /* from key_fingerprint_raw() */
         freerrset(fingerprints);          freerrset(fingerprints);
   
         if (*flags & DNS_VERIFY_FOUND)          if (*flags & DNS_VERIFY_FOUND)
Line 262 
Line 253 
         return 0;          return 0;
 }  }
   
   
 /*  /*
  * Export the fingerprint of a key as a DNS resource record   * Export the fingerprint of a key as a DNS resource record
  */   */
Line 278 
Line 268 
         int success = 0;          int success = 0;
   
         if (dns_read_key(&rdata_pubkey_algorithm, &rdata_digest_type,          if (dns_read_key(&rdata_pubkey_algorithm, &rdata_digest_type,
                          &rdata_digest, &rdata_digest_len, key)) {              &rdata_digest, &rdata_digest_len, key)) {
   
                 if (generic)                  if (generic)
                         fprintf(f, "%s IN TYPE%d \\# %d %02x %02x ", hostname,                          fprintf(f, "%s IN TYPE%d \\# %d %02x %02x ", hostname,
Line 291 
Line 281 
                 for (i = 0; i < rdata_digest_len; i++)                  for (i = 0; i < rdata_digest_len; i++)
                         fprintf(f, "%02x", rdata_digest[i]);                          fprintf(f, "%02x", rdata_digest[i]);
                 fprintf(f, "\n");                  fprintf(f, "\n");
                   xfree(rdata_digest); /* from key_fingerprint_raw() */
                 success = 1;                  success = 1;
         } else {          } else {
                 error("dns_export_rr: unsupported algorithm");                  error("export_dns_rr: unsupported algorithm");
         }          }
   
         return success;          return success;

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.12.2.1