]> git.ozlabs.org Git - petitboot/blobdiff - discover/yaboot-parser.c
discover: pxe: Avoid dereferencing null pointer
[petitboot] / discover / yaboot-parser.c
index eaefbf0041572cfbcd7dd3fdf3a376d7bd657718..42db95bcfbbb1ae758b4704303baa3b3992dc5d8 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <i18n/i18n.h>
 
 #include "log/log.h"
 #include "talloc/talloc.h"
@@ -16,7 +17,6 @@
 
 struct yaboot_state {
        int globals_done;
-       const char *const *known_names;
 
        /* current option data */
        struct discover_boot_option *opt;
@@ -115,6 +115,13 @@ static void yaboot_finish(struct conf_context *conf)
        /* populate the boot option from state data */
        state->opt->boot_image = create_yaboot_devpath_resource(state,
                                conf, state->boot_image);
+
+       char* args_sigfile_default = talloc_asprintf(opt,
+               "%s.cmdline.sig", state->boot_image);
+       state->opt->args_sig_file = create_yaboot_devpath_resource(state,
+                               conf, args_sigfile_default);
+       talloc_free(args_sigfile_default);
+
        if (state->initrd) {
                state->opt->initrd = create_yaboot_devpath_resource(state,
                                conf, state->initrd);
@@ -194,9 +201,6 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
        if (!state->globals_done && conf_set_global_option(conf, name, value))
                return;
 
-       if (!conf_param_in_list(state->known_names, name))
-               return;
-
        /* image */
        if (streq(name, "image")) {
                /* an image section finishes our global defintions */
@@ -244,7 +248,7 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
 
        /* all other processing requires an image */
        if (!opt) {
-               pb_log("%s: unknown name: %s\n", __func__, name);
+               pb_debug("%s: unknown name: %s\n", __func__, name);
                return;
        }
 
@@ -310,7 +314,7 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
                return;
        }
 
-       pb_log("%s: unknown name: %s\n", __func__, name);
+       pb_debug("%s: unknown name: %s\n", __func__, name);
 }
 
 static struct conf_global_option yaboot_global_options[] = {
@@ -329,35 +333,21 @@ static struct conf_global_option yaboot_global_options[] = {
 static const char *const yaboot_conf_files[] = {
        "/yaboot.conf",
        "/yaboot.cnf",
+       "/etc/lilo.conf",
+       "/etc/silo.conf",
        "/etc/yaboot.conf",
        "/etc/yaboot.cnf",
        "/suseboot/yaboot.cnf",
        "/YABOOT.CONF",
        "/YABOOT.CNF",
+       "/ETC/LILO.CONF",
+       "/ETC/SILO.CONF",
        "/ETC/YABOOT.CONF",
        "/ETC/YABOOT.CNF",
        "/SUSEBOOT/YABOOT.CNF",
        NULL
 };
 
-static const char *yaboot_known_names[] = {
-       "append",
-       "image",
-       "image[64bit]", /* SUSE extension */
-       "image[32bit]", /* SUSE extension */
-       "initrd",
-       "initrd-size",
-       "label",
-       "literal",
-       "ramdisk",
-       "read-only",
-       "read-write",
-       "root",
-       "device",
-       "partition",
-       NULL
-};
-
 static int yaboot_parse(struct discover_context *dc)
 {
        const char * const *filename;
@@ -383,8 +373,6 @@ static int yaboot_parse(struct discover_context *dc)
        conf->finish = yaboot_finish;
        conf->parser_info = state = talloc_zero(conf, struct yaboot_state);
 
-       state->known_names = yaboot_known_names;
-
        state->opt = NULL;
 
        for (filename = yaboot_conf_files; *filename; filename++) {
@@ -393,6 +381,9 @@ static int yaboot_parse(struct discover_context *dc)
                        continue;
 
                conf_parse_buf(conf, buf, len);
+               device_handler_status_dev_info(dc->handler, dc->device,
+                               _("Parsed yaboot configuration from %s"),
+                               *filename);
                talloc_free(buf);
        }