~ubuntu-branches/ubuntu/lucid/wget/lucid-security

« back to all changes in this revision

Viewing changes to src/gnutls.c

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2009-12-12 08:15:59 UTC
  • mfrom: (2.1.5 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091212081559-mvccl4kzdqb138y3
Tags: 1.12-1.1ubuntu1
* Merge from debian testing, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
* Keep build dependencies in main:
  - debian/control: remove info2man build-dep
  - debian/patches/00list: disable wget-infopod_generated_manpage.dpatch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* SSL support via GnuTLS library.
2
 
   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
2
   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
 
3
   Inc.
3
4
 
4
5
This file is part of GNU Wget.
5
6
 
27
28
shall include the source code for the parts of OpenSSL used as well
28
29
as that of the covered work.  */
29
30
 
30
 
#include <config.h>
 
31
#include "wget.h"
31
32
 
32
33
#include <assert.h>
33
34
#include <errno.h>
40
41
#include <gnutls/gnutls.h>
41
42
#include <gnutls/x509.h>
42
43
 
43
 
#include "wget.h"
44
44
#include "utils.h"
45
45
#include "connect.h"
46
46
#include "url.h"
181
181
};
182
182
 
183
183
bool
184
 
ssl_connect (int fd) 
 
184
ssl_connect (int fd)
185
185
{
186
186
  static const int cert_type_priority[] = {
187
187
    GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0
224
224
  if (err < 0)
225
225
    {
226
226
      logprintf (LOG_NOTQUIET, _("%s: No certificate presented by %s.\n"),
227
 
                 severity, escnonprint (host));
 
227
                 severity, quotearg_style (escape_quoting_style, host));
228
228
      success = false;
229
229
      goto out;
230
230
    }
231
231
 
232
232
  if (status & GNUTLS_CERT_INVALID)
233
233
    {
234
 
      logprintf (LOG_NOTQUIET, _("%s: The certificate of `%s' is not trusted.\n"),
235
 
                 severity, escnonprint (host));
 
234
      logprintf (LOG_NOTQUIET, _("%s: The certificate of %s is not trusted.\n"),
 
235
                 severity, quote (host));
236
236
      success = false;
237
237
    }
238
238
  if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)
239
239
    {
240
 
      logprintf (LOG_NOTQUIET, _("%s: The certificate of `%s' hasn't got a known issuer.\n"),
241
 
                 severity, escnonprint (host));
 
240
      logprintf (LOG_NOTQUIET, _("%s: The certificate of %s hasn't got a known issuer.\n"),
 
241
                 severity, quote (host));
242
242
      success = false;
243
243
    }
244
244
  if (status & GNUTLS_CERT_REVOKED)
245
245
    {
246
 
      logprintf (LOG_NOTQUIET, _("%s: The certificate of `%s' has been revoked.\n"),
247
 
                 severity, escnonprint (host));
 
246
      logprintf (LOG_NOTQUIET, _("%s: The certificate of %s has been revoked.\n"),
 
247
                 severity, quote (host));
248
248
      success = false;
249
249
    }
250
250
 
291
291
      if (!gnutls_x509_crt_check_hostname (cert, host))
292
292
        {
293
293
          logprintf (LOG_NOTQUIET,
294
 
                     _("The certificate's owner does not match hostname '%s'\n"),
295
 
                     host);
 
294
                     _("The certificate's owner does not match hostname %s\n"),
 
295
                     quote (host));
296
296
          success = false;
297
297
        }
298
298
      gnutls_x509_crt_deinit (cert);