1 /* This file is part of pam-modules.
2    Copyright (C) 2005-2006, 2010-2012, 2014-2015, 2018 Sergey Poznyakoff
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17    MA 02110-1301 USA */
18 
19 #define debug_level gpam_sql_debug_level
20 #include <graypam.h>
21 #if defined(HAVE_CRYPT_H)
22 # include <crypt.h>
23 #else
24 extern char *crypt(const char *, const char *);
25 #endif
26 #if HAVE_SECURITY_PAM_MISC_H
27 # include <security/pam_misc.h>
28 #endif
29 #include <md5.h>
30 #include <sha1.h>
31 
32 #define CHKVAR(v) \
33  	if (!(v)) {							\
34 	        _pam_log(LOG_ERR, "%s: %s not defined",			\
35 			 gpam_sql_config_file, #v);			\
36 		return PAM_SERVICE_ERR;					\
37 	}								\
38        	DEBUG(100,("Config: %s=%s", #v, v));
39 
40 
41 extern long gpam_sql_debug_level;
42 extern char *gpam_sql_module_name;
43 extern char *gpam_sql_config_file;
44 
45 int gpam_sql_verify_user_pass(pam_handle_t *pamh, const char *passwd,
46 			      const char *query);
47 int gpam_sql_acct(pam_handle_t *pamh, const char *query);
48 
49 char *gpam_sql_find_config(const char *name);
50 const char *gpam_sql_get_query(pam_handle_t *pamh, const char *name,
51 			       gray_slist_t *pslist, int required);
52 int gpam_sql_check_boolean_config(const char *name, int defval);
53 
54