#include <list/list.h>
#include <log/log.h>
#include <process/process.h>
+#include <crypt/crypt.h>
#include "hostboot.h"
#include "platform.h"
struct platform_powerpc {
struct param_list *params;
struct ipmi *ipmi;
- bool ipmi_bootdev_persistent;
int (*get_ipmi_bootdev)(
struct platform_powerpc *platform,
uint8_t *bootdev, bool *persistent);
{
uint16_t resp_len;
uint8_t resp[8];
+ char *debug_buf;
int rc;
uint8_t req[] = {
0x05, /* parameter selector: boot flags */
return -1;
}
- pb_debug("IPMI get_bootdev response:\n");
- for (int i = 0; i < resp_len; i++)
- pb_debug("%x ", resp[i]);
- pb_debug("\n");
+ debug_buf = format_buffer(platform, resp, resp_len);
+ pb_debug_fn("IPMI get_bootdev response:\n%s\n", debug_buf);
+ talloc_free(debug_buf);
if (resp[0] != 0) {
pb_log("platform: non-zero completion code %d from IPMI req\n",
uint16_t min_len = 12, resp_len = 53, version;
const uint32_t magic_value = 0x21706221;
uint8_t resp[resp_len];
+ char *debug_buf;
uint32_t cookie;
bool persistent;
int i, rc;
resp, &resp_len,
ipmi_timeout);
- pb_debug("IPMI net override resp [%d][%d]:\n", rc, resp_len);
- if (resp_len > 0) {
- for (i = 0; i < resp_len; i++) {
- pb_debug(" %02x", resp[i]);
- if (i && (i + 1) % 16 == 0 && i != resp_len - 1)
- pb_debug("\n");
- else if (i && (i + 1) % 8 == 0)
- pb_debug(" ");
- }
- pb_debug("\n");
- }
+ debug_buf = format_buffer(platform, resp, resp_len);
+ pb_debug_fn("IPMI net override response:\n%s\n", debug_buf);
+ talloc_free(debug_buf);
if (rc) {
pb_debug("IPMI network config option unavailable\n");
static int load_config(struct platform *p, struct config *config)
{
struct platform_powerpc *platform = to_platform_powerpc(p);
+ const char *hash;
int rc;
rc = parse_nvram(platform);
config_get_active_consoles(config);
+
+ hash = param_list_get_value(platform->params, "petitboot,password");
+ if (hash) {
+ rc = crypt_set_password_hash(platform, hash);
+ if (rc)
+ pb_log("Failed to set password hash\n");
+ }
+
return 0;
}
return 0;
}
+static bool restrict_clients(struct platform *p)
+{
+ struct platform_powerpc *platform = to_platform_powerpc(p);
+
+ return param_list_get_value(platform->params, "petitboot,password") != NULL;
+}
+
+static int set_password(struct platform *p, const char *hash)
+{
+ struct platform_powerpc *platform = to_platform_powerpc(p);
+
+ param_list_set(platform->params, "petitboot,password", hash, true);
+ write_nvram(platform);
+
+ return 0;
+}
+
static bool probe(struct platform *p, void *ctx)
{
struct platform_powerpc *platform;
.save_config = save_config,
.pre_boot = pre_boot,
.get_sysinfo = get_sysinfo,
+ .restrict_clients = restrict_clients,
+ .set_password = set_password,
};
register_platform(platform_powerpc);