]> git.proxmox.com Git - grub2.git/blame - include/grub/auth.h
2009-12-20 Carles Pina i Estany <carles@pina.cat>
[grub2.git] / include / grub / auth.h
CommitLineData
e7e1f93f 1/*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
4 *
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef GRUB_AURH_HEADER
19#define GRUB_AUTH_HEADER 1
20
21#include <grub/err.h>
7f39d92f 22#include <grub/i18n.h>
e7e1f93f 23
24/* Macros for indistinguishibility. */
25#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
7f39d92f 26#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
e7e1f93f 27 string, len, \
28 '*', 0, 0)
29
30/* Like strcmp but untimeable. Accepts NULL as second argument. */
31int grub_auth_strcmp (const char *user_input, const char *template);
32/* Like strcmp but untimeable and ignores commas in needle. */
33int grub_auth_strword (const char *haystack, const char *needle);
34
35typedef grub_err_t (*grub_auth_callback_t) (const char*, void *);
36
37grub_err_t grub_auth_register_authentication (const char *user,
38 grub_auth_callback_t callback,
39 void *arg);
40grub_err_t grub_auth_unregister_authentication (const char *user);
41
42grub_err_t grub_auth_authenticate (const char *user);
43grub_err_t grub_auth_deauthenticate (const char *user);
44grub_err_t grub_auth_check_authentication (const char *userlist);
45
46#endif /* ! GRUB_AUTH_HEADER */