~ubuntu-branches/ubuntu/hardy/gnupg2/hardy

« back to all changes in this revision

Viewing changes to agent/gpg-agent.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2007-05-15 13:54:55 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070515135455-89qfyalmgjy6gcqw
Tags: 2.0.4-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Remove libpcsclite-dev, libopensc2-dev build dependencies (they are in
    universe).
  - Build-depend on libcurl3-gnutls-dev
  - g10/call-agent.c: set DBG_ASSUAN to 0 to suppress a debug message
  - Include /doc files as done with gnupg
  - debian/rules: add doc/com-certs.pem to the docs for gpgsm
  - debian/copyright: update download url
  - debian/README.Debian: remove note the gnupg2 isn't released yet.
  - debian/control: Change Maintainer/XSBC-Original-Maintainer field.

Show diffs side-by-side

added added

removed removed

Lines of Context:
276
276
 
277
277
 
278
278
 
279
 
/* Used by gcry for logging */
280
 
static void
281
 
my_gcry_logger (void *dummy, int level, const char *fmt, va_list arg_ptr)
282
 
{
283
 
  /* translate the log levels */
284
 
  switch (level)
285
 
    {
286
 
    case GCRY_LOG_CONT: level = JNLIB_LOG_CONT; break;
287
 
    case GCRY_LOG_INFO: level = JNLIB_LOG_INFO; break;
288
 
    case GCRY_LOG_WARN: level = JNLIB_LOG_WARN; break;
289
 
    case GCRY_LOG_ERROR:level = JNLIB_LOG_ERROR; break;
290
 
    case GCRY_LOG_FATAL:level = JNLIB_LOG_FATAL; break;
291
 
    case GCRY_LOG_BUG:  level = JNLIB_LOG_BUG; break;
292
 
    case GCRY_LOG_DEBUG:level = JNLIB_LOG_DEBUG; break;
293
 
    default:            level = JNLIB_LOG_ERROR; break;  
294
 
    }
295
 
  log_logv (level, fmt, arg_ptr);
296
 
}
297
 
 
298
 
 
299
 
/* This function is called by libgcrypt if it ran out of core and
300
 
   there is no way to return that error to the caller.  We do our own
301
 
   function here to make use of our logging functions. */
302
 
static int
303
 
my_gcry_outofcore_handler ( void *opaque, size_t req_n, unsigned int flags)
304
 
{
305
 
  static int been_here;  /* Used to protect against recursive calls. */
306
 
 
307
 
  if (!been_here)
308
 
    {
309
 
      been_here = 1;
310
 
      if ( (flags & 1) )
311
 
        log_fatal (_("out of core in secure memory "
312
 
                     "while allocating %lu bytes"), (unsigned long)req_n);
313
 
      else
314
 
        log_fatal (_("out of core while allocating %lu bytes"),
315
 
                   (unsigned long)req_n);
316
 
    }
317
 
  return 0; /* Let libgcrypt call its own fatal error handler. */
318
 
}
319
 
 
320
 
 
321
279
/* Setup the debugging.  With the global variable DEBUG_LEVEL set to NULL
322
280
   only the active debug flags are propagated to the subsystems.  With
323
281
   DEBUG_LEVEL set, a specific set of debug flags is set; thus overriding
518
476
     the option parsing may need services of the library. */
519
477
  if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
520
478
    {
521
 
      log_fatal( _("libgcrypt is too old (need %s, have %s)\n"),
 
479
      log_fatal( _("%s is too old (need %s, have %s)\n"), "libgcrypt",
522
480
                 NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
523
481
    }
524
482
 
527
485
  assuan_set_assuan_log_prefix (log_get_prefix (NULL));
528
486
  assuan_set_assuan_err_source (GPG_ERR_SOURCE_DEFAULT);
529
487
 
530
 
  gcry_set_log_handler (my_gcry_logger, NULL);
531
 
  gcry_set_outofcore_handler (my_gcry_outofcore_handler, NULL);
 
488
  setup_libgcrypt_logging ();
532
489
  gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
533
490
 
534
491
  may_coredump = disable_core_dumps ();