1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2  *
3  * Copyright (C) 2006 William Jon McCann <mccann@jhu.edu>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
18  * 02110-1335, USA.
19  *
20  */
21 
22 #ifndef __CS_AUTH_H
23 #define __CS_AUTH_H
24 
25 #include <glib.h>
26 
27 G_BEGIN_DECLS
28 
29 typedef enum {
30     CS_AUTH_MESSAGE_PROMPT_ECHO_ON,
31     CS_AUTH_MESSAGE_PROMPT_ECHO_OFF,
32     CS_AUTH_MESSAGE_ERROR_MSG,
33     CS_AUTH_MESSAGE_TEXT_INFO
34 } CsAuthMessageStyle;
35 
36 typedef enum {
37     CS_AUTH_ERROR_GENERAL,
38     CS_AUTH_ERROR_AUTH_ERROR,
39     CS_AUTH_ERROR_USER_UNKNOWN,
40     CS_AUTH_ERROR_AUTH_DENIED
41 } CsAuthError;
42 
43 #define PAM_SERVICE_NAME "cinnamon-screensaver"
44 
45 typedef gboolean  (* CsAuthMessageFunc) (CsAuthMessageStyle style,
46                                          const char        *msg,
47                                          char             **response,
48                                          gpointer           data);
49 
50 #define CS_AUTH_ERROR cs_auth_error_quark ()
51 
52 GQuark   cs_auth_error_quark (void);
53 
54 void     cs_auth_set_verbose (gboolean verbose);
55 gboolean cs_auth_get_verbose (void);
56 
57 gboolean cs_auth_priv_init   (void);
58 gboolean cs_auth_init        (void);
59 gboolean cs_auth_verify_user (const char       *username,
60                               const char       *display,
61                               CsAuthMessageFunc func,
62                               gpointer          data,
63                               GError          **error);
64 
65 G_END_DECLS
66 
67 #endif /* __CS_AUTH_H */
68