OSDN Git Service

Hold SSH username and port v0.2.6
authorSeiji Munetoh <munetoh@jp.ibm.com>
Thu, 5 Jan 2012 08:49:15 +0000 (17:49 +0900)
committerSeiji Munetoh <munetoh@jp.ibm.com>
Thu, 5 Jan 2012 08:49:15 +0000 (17:49 +0900)
src/conf.c
src/openpts.c
src/verifier.c

index 9a0b9c3..3336344 100644 (file)
@@ -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);
index 7857c67..95071cc 100644 (file)
@@ -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;
+            }
+
         }
     }
 
index 97dc99e..6042371 100644 (file)
@@ -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,