Annotation of embedaddon/sudo/plugins/sudoers/auth/sudo_auth.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (c) 1999-2005, 2007-2010 Todd C. Miller <Todd.Miller@courtesan.com>
3: *
4: * Permission to use, copy, modify, and distribute this software for any
5: * purpose with or without fee is hereby granted, provided that the above
6: * copyright notice and this permission notice appear in all copies.
7: *
8: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15: */
16:
17: #ifndef SUDO_AUTH_H
18: #define SUDO_AUTH_H
19:
20: /* Auth function return values. */
21: #define AUTH_SUCCESS 0
22: #define AUTH_FAILURE 1
23: #define AUTH_INTR 2
24: #define AUTH_FATAL 3
25:
26: typedef struct sudo_auth {
27: int flags; /* various flags, see below */
28: int status; /* status from verify routine */
29: char *name; /* name of the method as a string */
30: void *data; /* method-specific data pointer */
31: int (*init)(struct passwd *pw, struct sudo_auth *auth);
32: int (*setup)(struct passwd *pw, char **prompt, struct sudo_auth *auth);
33: int (*verify)(struct passwd *pw, char *p, struct sudo_auth *auth);
34: int (*cleanup)(struct passwd *pw, struct sudo_auth *auth);
35: int (*begin_session)(struct passwd *pw, struct sudo_auth *auth);
36: int (*end_session)(struct passwd *pw, struct sudo_auth *auth);
37: } sudo_auth;
38:
39: /* Values for sudo_auth.flags. */
40: #define FLAG_USER 0x01 /* functions must run as the user, not root */
41: #define FLAG_DISABLED 0x02 /* method disabled */
42: #define FLAG_STANDALONE 0x04 /* standalone auth method */
43: #define FLAG_ONEANDONLY 0x08 /* one and only auth method */
44:
45: /* Shortcuts for using the flags above. */
46: #define NEEDS_USER(x) ((x)->flags & FLAG_USER)
47: #define IS_DISABLED(x) ((x)->flags & FLAG_DISABLED)
48: #define IS_STANDALONE(x) ((x)->flags & FLAG_STANDALONE)
49: #define IS_ONEANDONLY(x) ((x)->flags & FLAG_ONEANDONLY)
50:
51: /* Like tgetpass() but uses conversation function */
52: char *auth_getpass(const char *prompt, int timeout, int type);
53:
54: /* Pointer to conversation function to use with auth_getpass(). */
55: extern sudo_conv_t sudo_conv;
56:
57: /* Prototypes for standalone methods */
58: int fwtk_init(struct passwd *pw, sudo_auth *auth);
59: int fwtk_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
60: int fwtk_cleanup(struct passwd *pw, sudo_auth *auth);
61: int pam_init(struct passwd *pw, sudo_auth *auth);
62: int pam_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
63: int pam_cleanup(struct passwd *pw, sudo_auth *auth);
64: int pam_begin_session(struct passwd *pw, sudo_auth *auth);
65: int pam_end_session(struct passwd *pw, sudo_auth *auth);
66: int sia_setup(struct passwd *pw, char **prompt, sudo_auth *auth);
67: int sia_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
68: int sia_cleanup(struct passwd *pw, sudo_auth *auth);
69: int aixauth_verify(struct passwd *pw, char *pass, sudo_auth *auth);
70: int aixauth_cleanup(struct passwd *pw, sudo_auth *auth);
71: int bsdauth_init(struct passwd *pw, sudo_auth *auth);
72: int bsdauth_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
73: int bsdauth_cleanup(struct passwd *pw, sudo_auth *auth);
74:
75: /* Prototypes for normal methods */
76: int passwd_init(struct passwd *pw, sudo_auth *auth);
77: int passwd_verify(struct passwd *pw, char *pass, sudo_auth *auth);
78: int passwd_cleanup(struct passwd *pw, sudo_auth *auth);
79: int secureware_init(struct passwd *pw, sudo_auth *auth);
80: int secureware_verify(struct passwd *pw, char *pass, sudo_auth *auth);
81: int secureware_cleanup(struct passwd *pw, sudo_auth *auth);
82: int rfc1938_setup(struct passwd *pw, char **prompt, sudo_auth *auth);
83: int rfc1938_verify(struct passwd *pw, char *pass, sudo_auth *auth);
84: int afs_verify(struct passwd *pw, char *pass, sudo_auth *auth);
85: int dce_verify(struct passwd *pw, char *pass, sudo_auth *auth);
86: int kerb4_init(struct passwd *pw, sudo_auth *auth);
87: int kerb4_verify(struct passwd *pw, char *pass, sudo_auth *auth);
88: int kerb5_init(struct passwd *pw, sudo_auth *auth);
89: int kerb5_setup(struct passwd *pw, char **prompt, sudo_auth *auth);
90: int kerb5_verify(struct passwd *pw, char *pass, sudo_auth *auth);
91: int kerb5_cleanup(struct passwd *pw, sudo_auth *auth);
92: int securid_init(struct passwd *pw, sudo_auth *auth);
93: int securid_setup(struct passwd *pw, char **prompt, sudo_auth *auth);
94: int securid_verify(struct passwd *pw, char *pass, sudo_auth *auth);
95:
96: /* Fields: name, flags, init, setup, verify, cleanup, begin_sess, end_sess */
97: #define AUTH_ENTRY(n, f, i, s, v, c, b, e) \
98: { (f), AUTH_FAILURE, (n), NULL, (i), (s), (v), (c) , (b), (e) },
99:
100: #endif /* SUDO_AUTH_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>