From cd6c958ca824ab2f1d07ca3bc6ebebdd749189d9 Mon Sep 17 00:00:00 2001 From: Seiji Munetoh Date: Thu, 5 Jan 2012 17:49:15 +0900 Subject: [PATCH] Hold SSH username and port --- src/conf.c | 8 +++++--- src/openpts.c | 8 ++++++++ src/verifier.c | 6 ++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/conf.c b/src/conf.c index 9a0b9c3..3336344 100644 --- a/src/conf.c +++ b/src/conf.c @@ -721,6 +721,7 @@ int readPtsConfig(OPENPTS_CONFIG *conf, char *filename) { xfree(conf->prop_filename); } conf->prop_filename = getFullpathName(conf->config_dir, value); + DEBUG("conf->prop_filename : %s\n", conf->prop_filename); } if (!strncmp(name, "ir.quote", 8)) { if (!strncmp(value, "WITHOUT_QUOTE", 13)) { @@ -760,8 +761,10 @@ int readPtsConfig(OPENPTS_CONFIG *conf, char *filename) { if (!strncmp(name, "ima.validation.mode", 19)) { if (!strncmp(value, "aide", 4)) { conf->ima_validation_mode = OPENPTS_VALIDATION_MODE_AIDE; + DEBUG("conf->ima_validation_mode : OPENPTS_VALIDATION_MODE_AIDE\n"); } else if (!strncmp(value, "none", 4)) { conf->ima_validation_mode = OPENPTS_VALIDATION_MODE_NONE; + DEBUG("conf->ima_validation_mode : OPENPTS_VALIDATION_MODE_NONE\n"); } else { LOG(LOG_ERR, "unknown ima.validation.mode [%s]\n", value); isFileIncorrect = 1; @@ -923,9 +926,8 @@ int readPtsConfig(OPENPTS_CONFIG *conf, char *filename) { /* SSH */ /* default values */ - conf->ssh_username = NULL; // use default values - conf->ssh_port = NULL; - + // conf->ssh_username = NULL; // use default values + // conf->ssh_port = NULL; if (!strncmp(name, "ssh.username", 12)) { conf->ssh_username = smalloc_assert(value); DEBUG("conf->ssh_username : %s\n", conf->ssh_username); diff --git a/src/openpts.c b/src/openpts.c index 7857c67..95071cc 100644 --- a/src/openpts.c +++ b/src/openpts.c @@ -342,6 +342,14 @@ int main(int argc, char *argv[]) { target_conf_dir = getTargetConfDir(conf); // HOME/.openpts/UUID/ target_conf_filename = smalloc_assert(target_collector->target_conf_filename); target_conf = (OPENPTS_CONFIG*)target_collector->target_conf; + /* lookup SSH setting */ + if ((ssh_username == NULL) && (target_conf->ssh_username != NULL)) { + ssh_username = target_conf->ssh_username; + } + if ((ssh_port == NULL) && (target_conf->ssh_port != NULL)) { + ssh_port = target_conf->ssh_port; + } + } } diff --git a/src/verifier.c b/src/verifier.c index 97dc99e..6042371 100644 --- a/src/verifier.c +++ b/src/verifier.c @@ -1319,6 +1319,12 @@ int enroll( /* save target conf */ + if (ssh_username != NULL) { + target_conf->ssh_username = smalloc(ssh_username); + } + if (ssh_port != NULL) { + target_conf->ssh_port = smalloc(ssh_port); + } writeTargetConf( target_conf, target_conf->uuid->uuid, -- 2.11.0