mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-15 04:40:05 +01:00
Add verbose log level and move unlocking keyslot messages there.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@238 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
2010-05-27 Milan Broz <mbroz@redhat.com>
|
2010-05-27 Milan Broz <mbroz@redhat.com>
|
||||||
* Fix luksFormat/luksOpen reading passphrase from stdin and "-" keyfile.
|
* Fix luksFormat/luksOpen reading passphrase from stdin and "-" keyfile.
|
||||||
|
* Add verbose log level and move unlocking message there.
|
||||||
|
|
||||||
2010-05-23 Milan Broz <mbroz@redhat.com>
|
2010-05-23 Milan Broz <mbroz@redhat.com>
|
||||||
* Fix luksClose operation for stacked DM devices.
|
* Fix luksClose operation for stacked DM devices.
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ int parse_into_name_and_mode(const char *nameAndMode, char *name, char *mode);
|
|||||||
void logger(struct crypt_device *cd, int class, const char *file, int line, const char *format, ...);
|
void logger(struct crypt_device *cd, int class, const char *file, int line, const char *format, ...);
|
||||||
#define log_dbg(x...) logger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
|
#define log_dbg(x...) logger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
|
||||||
#define log_std(c, x...) logger(c, CRYPT_LOG_NORMAL, __FILE__, __LINE__, x)
|
#define log_std(c, x...) logger(c, CRYPT_LOG_NORMAL, __FILE__, __LINE__, x)
|
||||||
|
#define log_verbose(c, x...) logger(c, CRYPT_LOG_VERBOSE, __FILE__, __LINE__, x)
|
||||||
#define log_err(c, x...) do { \
|
#define log_err(c, x...) do { \
|
||||||
logger(c, CRYPT_LOG_ERROR, __FILE__, __LINE__, x); \
|
logger(c, CRYPT_LOG_ERROR, __FILE__, __LINE__, x); \
|
||||||
set_error(x); } while(0)
|
set_error(x); } while(0)
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ int crypt_init_by_name(struct crypt_device **cd, const char *name);
|
|||||||
*/
|
*/
|
||||||
#define CRYPT_LOG_NORMAL 0
|
#define CRYPT_LOG_NORMAL 0
|
||||||
#define CRYPT_LOG_ERROR 1
|
#define CRYPT_LOG_ERROR 1
|
||||||
|
#define CRYPT_LOG_VERBOSE 2
|
||||||
#define CRYPT_LOG_DEBUG -1 /* always on stdout */
|
#define CRYPT_LOG_DEBUG -1 /* always on stdout */
|
||||||
void crypt_set_log_callback(struct crypt_device *cd,
|
void crypt_set_log_callback(struct crypt_device *cd,
|
||||||
void (*log)(int level, const char *msg, void *usrptr),
|
void (*log)(int level, const char *msg, void *usrptr),
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ static int verify_other_keyslot(struct crypt_device *cd,
|
|||||||
if (openedIndex < 0)
|
if (openedIndex < 0)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
log_std(cd, _("Key slot %d verified.\n"), openedIndex);
|
log_verbose(cd, _("Key slot %d verified.\n"), openedIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ int LUKS_verify_master_key(const struct luks_phdr *hdr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Try to open a particular key slot */
|
/* Try to open a particular key slot */
|
||||||
int LUKS_open_key(const char *device,
|
static int LUKS_open_key(const char *device,
|
||||||
unsigned int keyIndex,
|
unsigned int keyIndex,
|
||||||
const char *password,
|
const char *password,
|
||||||
size_t passwordLen,
|
size_t passwordLen,
|
||||||
@@ -670,7 +670,7 @@ int LUKS_open_key(const char *device,
|
|||||||
|
|
||||||
r = LUKS_verify_master_key(hdr, mk);
|
r = LUKS_verify_master_key(hdr, mk);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
log_std(ctx, _("Key slot %d unlocked.\n"), keyIndex);
|
log_verbose(ctx, _("Key slot %d unlocked.\n"), keyIndex);
|
||||||
out:
|
out:
|
||||||
free(AfKey);
|
free(AfKey);
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -137,15 +137,6 @@ int LUKS_set_key(
|
|||||||
uint64_t *PBKDF2_per_sec,
|
uint64_t *PBKDF2_per_sec,
|
||||||
struct crypt_device *ctx);
|
struct crypt_device *ctx);
|
||||||
|
|
||||||
int LUKS_open_key(
|
|
||||||
const char *device,
|
|
||||||
unsigned int keyIndex,
|
|
||||||
const char *password,
|
|
||||||
size_t passwordLen,
|
|
||||||
struct luks_phdr *hdr,
|
|
||||||
struct luks_masterkey *mk,
|
|
||||||
struct crypt_device *ctx);
|
|
||||||
|
|
||||||
int LUKS_open_key_with_hdr(
|
int LUKS_open_key_with_hdr(
|
||||||
const char *device,
|
const char *device,
|
||||||
int keyIndex,
|
int keyIndex,
|
||||||
|
|||||||
@@ -138,23 +138,27 @@ static int yesDialog(char *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void cmdLineLog(int level, char *msg) {
|
static void cmdLineLog(int level, char *msg) {
|
||||||
switch(level) {
|
switch(level) {
|
||||||
|
|
||||||
case CRYPT_LOG_NORMAL:
|
case CRYPT_LOG_NORMAL:
|
||||||
fputs(msg, stdout);
|
fputs(msg, stdout);
|
||||||
break;
|
break;
|
||||||
case CRYPT_LOG_ERROR:
|
case CRYPT_LOG_VERBOSE:
|
||||||
fputs(msg, stderr);
|
if (opt_verbose)
|
||||||
break;
|
fputs(msg, stdout);
|
||||||
default:
|
break;
|
||||||
fprintf(stderr, "Internal error on logging class for msg: %s", msg);
|
case CRYPT_LOG_ERROR:
|
||||||
break;
|
fputs(msg, stderr);
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Internal error on logging class for msg: %s", msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct interface_callbacks cmd_icb = {
|
static struct interface_callbacks cmd_icb = {
|
||||||
.yesDialog = yesDialog,
|
.yesDialog = yesDialog,
|
||||||
.log = cmdLineLog,
|
.log = cmdLineLog,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void _log(int level, const char *msg, void *usrptr)
|
static void _log(int level, const char *msg, void *usrptr)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#define log_dbg(x...) clogger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
|
#define log_dbg(x...) clogger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
|
||||||
#define log_std(x...) clogger(NULL, CRYPT_LOG_NORMAL, __FILE__, __LINE__, x)
|
#define log_std(x...) clogger(NULL, CRYPT_LOG_NORMAL, __FILE__, __LINE__, x)
|
||||||
|
#define log_verbose(x...) clogger(NULL, CRYPT_LOG_VERBOSE, __FILE__, __LINE__, x)
|
||||||
#define log_err(x...) clogger(NULL, CRYPT_LOG_ERROR, __FILE__, __LINE__, x)
|
#define log_err(x...) clogger(NULL, CRYPT_LOG_ERROR, __FILE__, __LINE__, x)
|
||||||
|
|
||||||
#endif /* CRYPTSETUP_H */
|
#endif /* CRYPTSETUP_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user