7 def find_library(library_names
, lookup_paths
):
8 for directory
in lookup_paths
:
9 for filename
in library_names
:
10 so_path
= os
.path
.join(directory
, filename
)
11 if os
.path
.exists(so_path
):
16 if conf
.CHECK_PAM_WRAPPER():
17 conf
.DEFINE('USING_SYSTEM_PAM_WRAPPER', 1)
18 libpam_wrapper_so_path
= 'libpam_wrapper.so'
20 pam_set_items_so_path
= find_library(['pam_set_items.so'],
21 ['/usr/lib64/pam_wrapper', '/usr/lib/pam_wrapper'])
24 if conf
.CONFIG_SET("HAVE___THREAD"):
25 conf
.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)
27 # check HAVE_FUNCTION_ATTRIBUTE_FORMAT
29 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
35 'HAVE_FUNCTION_ATTRIBUTE_FORMAT',
38 msg
='Checking for printf format validation support')
40 conf
.CHECK_HEADERS('security/pam_appl.h')
41 conf
.CHECK_HEADERS('security/pam_modules.h')
42 conf
.CHECK_HEADERS('security/pam_ext.h')
44 conf
.CHECK_FUNCS_IN('pam_vsyslog',
47 headers
='security/pam_ext.h')
49 conf
.CHECK_FUNCS_IN('pam_syslog',
52 headers
='security/pam_ext.h')
54 conf
.CHECK_C_PROTOTYPE('pam_vprompt',
55 'int pam_vprompt(const pam_handle_t *_pamh, int _style, char **_resp, const char *_fmt, va_list _ap)',
56 define
='HAVE_PAM_VPROMPT_CONST', headers
='stdio.h sys/types.h security/pam_appl.h security/pam_modules.h')
58 conf
.CHECK_C_PROTOTYPE('pam_prompt',
59 'int pam_prompt(const pam_handle_t *_pamh, int _style, char **_resp, const char *_fmt, ...)',
60 define
='HAVE_PAM_PROMPT_CONST', headers
='stdio.h sys/types.h security/pam_appl.h security/pam_modules.h')
62 conf
.CHECK_C_PROTOTYPE(
64 'const char *pam_strerror(const pam_handle_t *pamh, int errnum)',
65 define
='HAVE_PAM_STRERROR_CONST',
66 headers
='''stdio.h sys/types.h security/pam_appl.h
67 security/pam_modules.h''')
69 # Find the absolute path to libpam.so.0
70 libpam_path
= find_library(['libpam.so.0', 'libpam.so'], conf
.env
.STANDARD_LIBPATH
)
71 conf
.DEFINE('PAM_LIBRARY', ('"%s"' % libpam_path
))
73 # Create full path to pam_wrapper
74 blddir
= os
.path
.realpath(conf
.bldnode
.abspath())
75 libpam_wrapper_so_path
= blddir
+ '/default/third_party/pam_wrapper/libpam-wrapper.so'
76 pam_set_items_so_path
= blddir
+ '/default/third_party/pam_wrapper/libpam-set-items.so'
78 conf
.DEFINE('LIBPAM_WRAPPER_SO_PATH', libpam_wrapper_so_path
)
79 conf
.DEFINE('PAM_SET_ITEMS_SO_PATH', pam_set_items_so_path
)
80 conf
.DEFINE('PAM_WRAPPER', 1)
83 if not bld
.CONFIG_SET("USING_SYSTEM_PAM_WRAPPER"):
84 # We need to do it this way or the library wont work.
85 # Using private_library=True will add symbol version which
87 bld
.SAMBA_LIBRARY('pam_wrapper',
88 source
='pam_wrapper.c',
91 realname
='libpam-wrapper.so')
93 bld
.SAMBA_SUBSYSTEM('libpamtest',
94 source
='libpamtest.c',
97 bld
.SAMBA_LIBRARY('pam_set_items',
98 source
='modules/pam_set_items.c',
101 realname
='pam_set_items.so')
103 # Can be used to write pam tests in python
104 for env
in bld
.gen_python_environments():
105 bld
.SAMBA_PYTHON('pypamtest',
106 source
='python/pypamtest.c',