s3:libsmb: let cli_tree_connect_creds() only call cli_credentials_get_password()...
[samba.git] / nsswitch / wscript_build
1 #!/usr/bin/env python
2 from waflib import Utils
3 import sys
4 host_os = sys.platform
5
6 bld.SAMBA_BINARY('nsstest',
7                  source='nsstest.c',
8                  deps='replace dl',
9                  for_selftest=True
10                  )
11
12 if bld.CONFIG_SET('HAVE_PTHREAD'):
13     bld.SAMBA_BINARY('stress-nss-libwbclient',
14                      source='stress-nss-libwbclient.c',
15                      deps='wbclient pthread',
16                      for_selftest=True
17                      )
18     bld.SAMBA_BINARY('b15464-testcase',
19                      source='b15464-testcase.c',
20                      deps='replace pthread dl',
21                      for_selftest=True
22                      )
23
24 # The nss_wrapper code relies strictly on the linux implementation and
25 # name, so compile but do not install a copy under this name.
26 bld.SAMBA_PLUGIN('nss_wrapper_winbind',
27                   cflags='-D_PUBLIC_ON_LINUX_=_PUBLIC_',
28                   source='winbind_nss_linux.c',
29                   deps='wbclient',
30                   realname='libnss_wrapper_winbind.so.2',
31                   install=False,
32                   vnum='2')
33
34 # FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
35 # the search for .rfind('gnu') covers gnu* and *-gnu is that too broad?
36
37 if (Utils.unversioned_sys_platform() == 'linux' or (host_os.rfind('gnu') > -1)):
38     bld.SAMBA_PLUGIN('nss_winbind',
39               cflags='-D_PUBLIC_ON_LINUX_=_PUBLIC_',
40               source='winbind_nss_linux.c',
41               deps='wbclient',
42               realname='libnss_winbind.so.2',
43               soname='libnss_winbind.so.2',
44               vnum='2')
45
46     bld.SAMBA3_PLUGIN('nss_wins',
47                       cflags='-D_PUBLIC_ON_LINUX_=_PUBLIC_',
48                       source='wins.c',
49                       deps='wbclient replace',
50                       realname='libnss_wins.so.2',
51                       soname='libnss_wins.so.2',
52                       vnum='2')
53 elif (host_os.rfind('freebsd') > -1):
54         # FreeBSD winbind client is implemented as a wrapper around
55         # the Linux version.
56         bld.SAMBA_PLUGIN('nss_winbind',
57                           source='winbind_nss_linux.c winbind_nss_freebsd.c',
58                           deps='wbclient',
59                           realname='nss_winbind.so.1',
60                           vnum='1')
61
62         bld.SAMBA3_PLUGIN('nss_wins',
63                           source='wins.c wins_freebsd.c',
64                           deps='''wbclient''',
65                           realname='nss_wins.so.1',
66                           vnum='1')
67
68 elif (host_os.rfind('netbsd') > -1):
69         # NetBSD winbind client is implemented as a wrapper
70         # around the Linux version. It needs getpwent_r() to
71         # indicate libc's use of the correct nsdispatch API.
72
73         if bld.CONFIG_SET("HAVE_GETPWENT_R"):
74                 bld.SAMBA_PLUGIN('nss_winbind',
75                                   source='winbind_nss_linux.c winbind_nss_netbsd.c',
76                                   deps='wbclient',
77                                   realname='libnss_winbind.so')
78 elif Utils.unversioned_sys_platform() == 'sunos':
79         bld.SAMBA_PLUGIN('nss_winbind',
80                           source='winbind_nss_solaris.c winbind_nss_linux.c',
81                           deps='wbclient',
82                           realname='nss_winbind.so.1',
83                           vnum='1')
84 elif (host_os.rfind('hpux') > -1):
85         bld.SAMBA_PLUGIN('nss_winbind',
86                           source='winbind_nss_linux.c',
87                           deps='wbclient',
88                           realname='libnss_winbind.so')
89 elif (host_os.rfind('aix') > -1):
90         bld.SAMBA_PLUGIN('nss_winbind',
91                           source='winbind_nss_aix.c',
92                           deps='wbclient',
93                           realname='WINBIND')
94
95 if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'):
96         bld.SAMBA_PLUGIN('pamwinbind',
97                 source='pam_winbind.c',
98                 deps='talloc wbclient tiniparser pam samba_intl',
99                 cflags='-DLOCALEDIR=\"%s/locale\"' % bld.env.DATADIR,
100                 realname='pam_winbind.so',
101                 install_path='${PAMMODULESDIR}'
102                 )
103
104 if bld.CONFIG_GET("USING_SYSTEM_KRB5"):
105     # If we build locator plugins for a
106     # system library we should use builtin
107     # linking of our own subsystems,
108     # while we may link to the system
109     # krb5 libraries.
110     winbind_krb5_require_builtin_deps = True
111 else:
112     # If we build locator plugins for our own heimdal
113     # version we don't want to do builtin linking.
114     # As we're already using private libraries
115     # it's not a problem...
116     winbind_krb5_require_builtin_deps = False
117
118 if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
119     bld.SAMBA_PLUGIN('winbind_krb5_locator',
120                      source='krb5_plugin/winbind_krb5_locator.c',
121                      deps='wbclient krb5 com_err',
122                      require_builtin_deps=winbind_krb5_require_builtin_deps,
123                      realname='winbind_krb5_locator.so',
124                      install_path='${MODULESDIR}/krb5')
125
126 if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
127     # libkrb5.so scans it's plugin directories for files
128     # and calls dlopen()/dlsym() on them. The actual path
129     # depends on MIT vs. Heimdal.
130     #
131     # The async_dns_krb5_locator don't use winbind,
132     # instead it uses almost all of samba directly,
133     # which means everything will be injected
134     # into all processes using the libkrb5.so.
135     #
136     # See https://bugzilla.samba.org/show_bug.cgi?id=14780
137     # why this is a bad idea.
138     #
139     # We install this plugin (and also the other krb5 plugins)
140     # under Samba's MODULESDIR, it's not available to
141     # libkrb5.so by default.
142     #
143     # Packagers should leave it that way and allow admins
144     # to create symlinks for the plugins they actually want
145     # to be used.
146     bld.SAMBA_PLUGIN('async_dns_krb5_locator',
147                      source='krb5_plugin/async_dns_krb5_locator.c',
148                      deps='''
149                      talloc
150                      addns
151                      samba_intl
152                      libsmb
153                      smbconf
154                      KRBCLIENT
155                      smbd_base
156                      krb5
157                      com_err
158                      ''',
159                      require_builtin_deps=False,
160                      realname='async_dns_krb5_locator.so',
161                      install_path='${MODULESDIR}/krb5')
162
163 if bld.CONFIG_SET('HAVE_KRB5_LOCALAUTH_PLUGIN_H'):
164     bld.SAMBA_PLUGIN('winbind_krb5_localauth',
165                      source='krb5_plugin/winbind_krb5_localauth.c',
166                      deps='wbclient krb5 com_err',
167                      require_builtin_deps=winbind_krb5_require_builtin_deps,
168                      realname='winbind_krb5_localauth.so',
169                      install_path='${MODULESDIR}/krb5')
170
171 bld.SAMBA_SUBSYSTEM('WB_REQTRANS',
172         source='wb_reqtrans.c',
173         deps='talloc tevent LIBASYNC_REQ'
174         )
175
176 bld.SAMBA_BINARY('wbinfo',
177         source='wbinfo.c',
178         deps='samba-util LIBCLI_AUTH popt cmdline wbclient LIBAFS_SETTOKEN'
179         )