7 def find_library(library_names
, lookup_paths
):
8 for directory
in lookup_paths
:
9 for filename
in library_names
:
10 libpam_path
= os
.path
.join(directory
, filename
)
11 if os
.path
.exists(libpam_path
):
16 if conf
.CHECK_PAM_WRAPPER():
17 conf
.DEFINE('USING_SYSTEM_PAM_WRAPPER', 1)
18 libpam_wrapper_so_path
= 'libpam_wrapper.so'
21 if conf
.CONFIG_SET("HAVE___THREAD"):
22 conf
.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)
24 # check HAVE_FUNCTION_ATTRIBUTE_FORMAT
26 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
32 'HAVE_FUNCTION_ATTRIBUTE_FORMAT',
35 msg
='Checking for printf format validation support')
37 conf
.CHECK_HEADERS('security/pam_appl.h')
38 conf
.CHECK_HEADERS('security/pam_modules.h')
39 conf
.CHECK_HEADERS('security/pam_ext.h')
41 conf
.CHECK_FUNCS_IN('pam_vsyslog',
44 headers
='security/pam_ext.h')
46 conf
.CHECK_FUNCS_IN('pam_syslog',
49 headers
='security/pam_ext.h')
51 conf
.CHECK_C_PROTOTYPE('pam_vprompt',
52 'int pam_vprompt(const pam_handle_t *_pamh, int _style, char **_resp, const char *_fmt, va_list _ap)',
53 define
='HAVE_PAM_VPROMPT_CONST', headers
='stdio.h sys/types.h security/pam_appl.h security/pam_modules.h')
55 conf
.CHECK_C_PROTOTYPE('pam_prompt',
56 'int pam_prompt(const pam_handle_t *_pamh, int _style, char **_resp, const char *_fmt, ...)',
57 define
='HAVE_PAM_PROMPT_CONST', headers
='stdio.h sys/types.h security/pam_appl.h security/pam_modules.h')
59 conf
.CHECK_C_PROTOTYPE(
61 'const char *pam_strerror(const pam_handle_t *pamh, int errnum)',
62 define
='HAVE_PAM_STRERROR_CONST',
63 headers
='''stdio.h sys/types.h security/pam_appl.h
64 security/pam_modules.h''')
66 # Find the absolute path to libpam.so.0
67 libpam_path
= find_library(['libpam.so.0', 'libpam.so'], conf
.env
.STANDARD_LIBPATH
)
68 conf
.DEFINE('PAM_LIBRARY', ('"%s"' % libpam_path
))
70 # Create full path to pam_wrapper
71 blddir
= os
.path
.realpath(conf
.bldnode
.abspath())
72 libpam_wrapper_so_path
= blddir
+ '/default/third_party/pam_wrapper/libpam-wrapper.so'
74 conf
.DEFINE('LIBPAM_WRAPPER_SO_PATH', libpam_wrapper_so_path
)
75 conf
.DEFINE('PAM_WRAPPER', 1)
78 if not bld
.CONFIG_SET("USING_SYSTEM_PAM_WRAPPER"):
79 # We need to do it this way or the library wont work.
80 # Using private_library=True will add symbol version which
82 bld
.SAMBA_LIBRARY('pam_wrapper',
83 source
='pam_wrapper.c',
86 realname
='libpam-wrapper.so')
88 bld
.SAMBA_SUBSYSTEM('libpamtest',
89 source
='libpamtest.c',
92 # Can be used to write pam tests in python
93 for env
in bld
.gen_python_environments():
94 bld
.SAMBA_PYTHON('pypamtest',
95 source
='python/pypamtest.c',