" \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and"
" \"multiboot\". The option --no-mem-option tells GRUB not to pass a"
" Linux's mem option automatically."},
- /* FIXME: lock is unsupported. */
+ {"lock", "if ! authenticate legacy; then return; fi", NULL, 0, 0, {}, 0,
+ 0, "Break a command execution unless the user is authenticated."},
{"makeactive", "parttool \"$root\" boot+\n", NULL, 0, 0, {}, 0, 0,
"Set the active partition on the root disk to GRUB's root device."
" This command is limited to _primary_ PC partitions on a hard disk."},
return NULL;
}
- if (grub_strncmp ("lock", cmdname, ptr - cmdname) == 0
- && ptr - cmdname == sizeof ("lock") - 1)
- {
- /* FIXME */
- }
-
for (cmdnum = 0; cmdnum < ARRAY_SIZE (legacy_commands); cmdnum++)
if (grub_strncmp (legacy_commands[cmdnum].name, cmdname, ptr - cmdname) == 0
&& legacy_commands[cmdnum].name[ptr - cmdname] == 0)
return GRUB_ACCESS_DENIED;
}
+
+static grub_err_t
+grub_cmd_authenticate (struct grub_command *cmd __attribute__ ((unused)),
+ int argc, char **args)
+{
+ return grub_auth_check_authentication ((argc >= 1) ? args[0] : "");
+}
+
+static grub_command_t cmd;
+
+void
+grub_normal_auth_init (void)
+{
+ cmd = grub_register_command ("authenticate",
+ grub_cmd_authenticate,
+ N_("[USERLIST]"), N_("Authenticate users"));
+
+}
+
+void
+grub_normal_auth_fini (void)
+{
+ grub_unregister_command (cmd);
+}
grub_err_t
grub_normal_set_password (const char *user, const char *password);
+void grub_normal_auth_init (void);
+void grub_normal_auth_fini (void);
+
#endif /* ! GRUB_NORMAL_HEADER */