1 /* 2 * Copyright (C) 2013 Nikos Mavrogiannopoulos 3 * 4 * Author: Nikos Mavrogiannopoulos 5 * 6 * This file is part of ocserv. 7 * 8 * ocserv is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public License 10 * as published by the Free Software Foundation; either version 2.1 of 11 * the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/> 20 */ 21 #ifndef AUTH_H 22 # define AUTH_H 23 24 #include <main.h> 25 #include <sec-mod.h> 26 27 #define MAX_AUTH_REQS 8 28 29 typedef struct passwd_msg_st { 30 char *msg_str; 31 unsigned counter; 32 } passwd_msg_st; 33 34 typedef struct auth_mod_st { 35 unsigned int type; 36 unsigned int allows_retries; /* whether the module allows retries of the same password */ 37 void (*vhost_init)(void **vctx, void *pool, void* additional); 38 void (*vhost_deinit)(void *vctx); 39 int (*auth_init)(void **ctx, void *pool, void *vctx, const common_auth_init_st *); 40 int (*auth_msg)(void* ctx, void *pool, passwd_msg_st *); 41 int (*auth_pass)(void* ctx, const char* pass, unsigned pass_len); 42 int (*auth_group)(void* ctx, const char *suggested, char *groupname, int groupname_size); 43 int (*auth_user)(void* ctx, char *groupname, int groupname_size); 44 45 void (*auth_deinit)(void* ctx); 46 void (*group_list)(void *pool, void *additional, char ***groupname, unsigned *groupname_size); 47 } auth_mod_st; 48 49 void main_auth_init(main_server_st *s); 50 void proc_auth_deinit(main_server_st* s, struct proc_st* proc); 51 52 /* The authentication with the worker thread is shown in ipc.proto. 53 */ 54 #endif 55