~ubuntu-branches/ubuntu/natty/gnupg2/natty-updates

« back to all changes in this revision

Viewing changes to scd/scdaemon.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2010-01-22 21:49:55 UTC
  • mfrom: (1.1.14 upstream) (7.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100122214955-r2ab5it9rts5gqjf
Tags: 2.0.14-1ubuntu1
* Merge with Debian testing (lp: #511356). Remaining changes:
  - debian/gnupg2.dev: udev rules to set ACLs on SCM smartcard readers.
  - debian/rules: Call dh_installudev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
288
288
static void
289
289
set_debug (const char *level)
290
290
{
 
291
  int numok = (level && digitp (level));
 
292
  int numlvl = numok? atoi (level) : 0;
 
293
 
291
294
  if (!level)
292
295
    ;
293
 
  else if (!strcmp (level, "none"))
 
296
  else if (!strcmp (level, "none") || (numok && numlvl < 1))
294
297
    opt.debug = 0;
295
 
  else if (!strcmp (level, "basic"))
 
298
  else if (!strcmp (level, "basic") || (numok && numlvl <= 2))
296
299
    opt.debug = DBG_ASSUAN_VALUE;
297
 
  else if (!strcmp (level, "advanced"))
 
300
  else if (!strcmp (level, "advanced") || (numok && numlvl <= 5))
298
301
    opt.debug = DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE;
299
 
  else if (!strcmp (level, "expert"))
 
302
  else if (!strcmp (level, "expert") || (numok && numlvl <= 8))
300
303
    opt.debug = (DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE
301
304
                 |DBG_CACHE_VALUE|DBG_CARD_IO_VALUE);
302
 
  else if (!strcmp (level, "guru"))
303
 
    opt.debug = ~0;
 
305
  else if (!strcmp (level, "guru") || numok)
 
306
    {
 
307
      opt.debug = ~0;
 
308
      /* Unless the "guru" string has been used we don't want to allow
 
309
         hashing debugging.  The rationale is that people tend to
 
310
         select the highest debug value and would then clutter their
 
311
         disk with debug files which may reveal confidential data.  */ 
 
312
      if (numok)
 
313
        opt.debug &= ~(DBG_HASHING_VALUE);
 
314
    }
304
315
  else
305
316
    {
306
317
      log_error (_("invalid debug-level `%s' given\n"), level);
318
329
  if (opt.debug & DBG_CRYPTO_VALUE )
319
330
    gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
320
331
  gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
 
332
 
 
333
  if (opt.debug)
 
334
    log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s\n",
 
335
              (opt.debug & DBG_COMMAND_VALUE)? " command":"",    
 
336
              (opt.debug & DBG_MPI_VALUE    )? " mpi":"",    
 
337
              (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",    
 
338
              (opt.debug & DBG_MEMORY_VALUE )? " memory":"", 
 
339
              (opt.debug & DBG_CACHE_VALUE  )? " cache":"", 
 
340
              (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"", 
 
341
              (opt.debug & DBG_HASHING_VALUE)? " hashing":"", 
 
342
              (opt.debug & DBG_ASSUAN_VALUE )? " assuan":"",
 
343
              (opt.debug & DBG_CARD_IO_VALUE)? " cardio":"");
321
344
}
322
345
 
323
346