363
int numok = (debug_level && digitp (debug_level));
364
int numlvl = numok? atoi (debug_level) : 0;
363
366
if (!debug_level)
365
else if (!strcmp (debug_level, "none"))
368
else if (!strcmp (debug_level, "none") || (numok && numlvl < 1))
367
else if (!strcmp (debug_level, "basic"))
370
else if (!strcmp (debug_level, "basic") || (numok && numlvl <= 2))
368
371
opt.debug = DBG_ASSUAN_VALUE;
369
else if (!strcmp (debug_level, "advanced"))
372
else if (!strcmp (debug_level, "advanced") || (numok && numlvl <= 5))
370
373
opt.debug = DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE;
371
else if (!strcmp (debug_level, "expert"))
374
else if (!strcmp (debug_level, "expert") || (numok && numlvl <= 8))
372
375
opt.debug = (DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE
373
376
|DBG_CACHE_VALUE);
374
else if (!strcmp (debug_level, "guru"))
377
else if (!strcmp (debug_level, "guru") || numok)
380
/* Unless the "guru" string has been used we don't want to allow
381
hashing debugging. The rationale is that people tend to
382
select the highest debug value and would then clutter their
383
disk with debug files which may reveal confidential data. */
385
opt.debug &= ~(DBG_HASHING_VALUE);
378
389
log_error (_("invalid debug-level `%s' given\n"), debug_level);
390
401
if (opt.debug & DBG_CRYPTO_VALUE )
391
402
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
392
403
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
406
log_info ("enabled debug flags:%s%s%s%s%s%s%s%s\n",
407
(opt.debug & DBG_COMMAND_VALUE)? " command":"",
408
(opt.debug & DBG_MPI_VALUE )? " mpi":"",
409
(opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
410
(opt.debug & DBG_MEMORY_VALUE )? " memory":"",
411
(opt.debug & DBG_CACHE_VALUE )? " cache":"",
412
(opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
413
(opt.debug & DBG_HASHING_VALUE)? " hashing":"",
414
(opt.debug & DBG_ASSUAN_VALUE )? " assuan":"");