auth/ntlmssp: add ntlmssp_{client,server}:force_old_spnego option for testing
[Samba.git] / .ycm_extra_conf.py
blobcd7093cd9ed82f27050e95d201a47cca4e97911f
1 # This file is NOT licensed under the GPLv3, which is the license for the rest
2 # of Samba.
4 # Here's the license text for this file:
6 # This is free and unencumbered software released into the public domain.
8 # Anyone is free to copy, modify, publish, use, compile, sell, or
9 # distribute this software, either in source code form or as a compiled
10 # binary, for any purpose, commercial or non-commercial, and by any
11 # means.
13 # In jurisdictions that recognize copyright laws, the author or authors
14 # of this software dedicate any and all copyright interest in the
15 # software to the public domain. We make this dedication for the benefit
16 # of the public at large and to the detriment of our heirs and
17 # successors. We intend this dedication to be an overt act of
18 # relinquishment in perpetuity of all present and future rights to this
19 # software under copyright law.
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 # OTHER DEALINGS IN THE SOFTWARE.
29 # For more information, please refer to <http://unlicense.org/>
31 import os
32 import ycm_core
34 flags = [
35 '-Wall',
36 '-Wextra',
37 '-Werror',
38 '-Wno-unused-parameter',
39 # This is a C project
40 '-x', 'c',
41 # Defines
42 '-DCONFIG_H_IS_FROM_SAMBA=1',
43 '-DHAVE_CONFIG_H=1',
44 '-D_SAMBA_BUILD_=4',
45 '-DAD_DC_BUILD_IS_ENABLED=1',
46 '-D_GNU_SOURCE=1',
47 '-DHAVE_IPV6=1',
48 # Includes
49 '-I.',
50 '-Iauth',
51 '-Iauth/credentials',
52 '-Iauth/gensec',
53 '-Iauth/kerberos',
54 '-Iauth/ntlmssp',
55 '-Idfs_server',
56 '-Idynconfig',
57 '-Iinclude',
58 '-Iinclude/public',
59 '-Ilib',
60 '-Ilib/addns',
61 '-Ilib/async_req',
62 '-Ilib/ccan',
63 '-Ilib/compression',
64 '-Ilib/crypto',
65 '-Ilib/dbwrap',
66 '-Ilib/krb5_wrap',
67 '-Ilib/ldb',
68 '-Ilib/ldb-samba',
69 '-Ilib/ldb/include',
70 '-Ilib/param',
71 '-Ilib/replace',
72 '-Ilib/smbconf',
73 '-Ilib/socket',
74 '-Ilib/talloc',
75 '-Ilib/tdb',
76 '-Ilib/tdb/include',
77 '-Ilib/tdb_compat',
78 '-Ilib/tevent',
79 '-Ilib/tsocket',
80 '-Ilib/util/charset',
81 '-Ilibcli/auth',
82 '-Ilibcli/cldap',
83 '-Ilibcli/dns',
84 '-Ilibcli/drsuapi',
85 '-Ilibcli/ldap',
86 '-Ilibcli/lsarpc',
87 '-Ilibcli/named_pipe_auth',
88 '-Ilibcli/nbt',
89 '-Ilibcli/netlogon',
90 '-Ilibcli/registry',
91 '-Ilibcli/security',
92 '-Ilibcli/smb',
93 '-Ilibcli/util',
94 '-Ilibds/common',
95 '-Ilibrpc',
96 '-Insswitch',
97 '-Insswitch/libwbclient',
98 '-Isource3',
99 '-Isource3/auth',
100 '-Isource3/include',
101 '-Isource3/lib',
102 '-Isource3/lib/asys',
103 '-Isource3/lib/pthreadpool',
104 '-Isource3/librpc',
105 '-Isource3/modules',
106 '-Isource3/passdb',
107 '-Isource3/rpc_server',
108 '-Isource4',
109 '-Isource4/auth',
110 '-Isource4/auth/gensec',
111 '-Isource4/auth/kerberos',
112 '-Isource4/dsdb',
113 '-Isource4/include',
114 '-Isource4/lib',
115 '-Isource4/lib/events',
116 '-Isource4/lib/socket',
117 '-Isource4/lib/stream',
118 '-Isource4/lib/tls',
119 '-Isource4/libcli',
120 '-Isource4/libcli/ldap',
121 '-Isource4/param',
122 '-Isource4/winbind',
123 # Generated headers
124 '-Ibin/default',
125 '-Ibin/default/auth/credentials',
126 '-Ibin/default/auth/gensec',
127 '-Ibin/default/file_server',
128 '-Ibin/default/include',
129 '-Ibin/default/include/public',
130 '-Ibin/default/include/public/core',
131 '-Ibin/default/include/public/gen_ndr',
132 '-Ibin/default/include/public/ndr',
133 '-Ibin/default/include/public/samba',
134 '-Ibin/default/include/public/util',
135 '-Ibin/default/libcli/nbt',
136 '-Ibin/default/lib/crypto',
137 '-Ibin/default/lib/ldb/include',
138 '-Ibin/default/lib/ldb-samba',
139 '-Ibin/default/lib/param',
140 '-Ibin/default/librpc/gen_ndr',
141 '-Ibin/default/lib/util',
142 '-Ibin/default/source3/include',
143 '-Ibin/default/source3/librpc/gen_ndr',
144 '-Ibin/default/source3/param',
145 '-Ibin/default/source4/auth',
146 '-Ibin/default/source4/auth/gensec',
147 '-Ibin/default/source4/auth/kerberos',
148 '-Ibin/default/source4/auth/ntlm',
149 '-Ibin/default/source4/cldap_server',
150 '-Ibin/default/source4/dsdb/common',
151 '-Ibin/default/source4/dsdb/kcc',
152 '-Ibin/default/source4/dsdb/repl',
153 '-Ibin/default/source4/dsdb/samdb',
154 '-Ibin/default/source4/dsdb/samdb/ldb_modules',
155 '-Ibin/default/source4/dsdb/schema',
156 '-Ibin/default/source4/heimdal/kdc',
157 '-Ibin/default/source4/heimdal/lib/asn1',
158 '-Ibin/default/source4/heimdal/lib/gssapi',
159 '-Ibin/default/source4/heimdal/lib/gssapi/krb5',
160 '-Ibin/default/source4/heimdal/lib/gssapi/spnego',
161 '-Ibin/default/source4/heimdal/lib/hdb',
162 '-Ibin/default/source4/heimdal/lib/hx509',
163 '-Ibin/default/source4/heimdal/lib/krb5',
164 '-Ibin/default/source4/heimdal/lib/ntlm',
165 '-Ibin/default/source4/heimdal/lib/wind',
166 '-Ibin/default/source4/ldap_server',
167 '-Ibin/default/source4/libcli',
168 '-Ibin/default/source4/libcli/composite',
169 '-Ibin/default/source4/libcli/ldap',
170 '-Ibin/default/source4/libcli/rap',
171 '-Ibin/default/source4/libcli/raw',
172 '-Ibin/default/source4/libcli/resolve',
173 '-Ibin/default/source4/libcli/smb2',
174 '-Ibin/default/source4/libcli/util',
175 '-Ibin/default/source4/libcli/wrepl',
176 '-Ibin/default/source4/lib/cmdline',
177 '-Ibin/default/source4/libnet',
178 '-Ibin/default/source4/lib/registry',
179 '-Ibin/default/source4/lib/registry/tests',
180 '-Ibin/default/source4/lib/registry/tools',
181 '-Ibin/default/source4/librpc/gen_ndr',
182 '-Ibin/default/source4/librpc/rpc',
183 '-Ibin/default/source4/lib/socket',
184 '-Ibin/default/source4/nbt_server',
185 '-Ibin/default/source4/nbt_server/dgram',
186 '-Ibin/default/source4/nbt_server/wins',
187 '-Ibin/default/source4/ntptr',
188 '-Ibin/default/source4/ntvfs',
189 '-Ibin/default/source4/ntvfs/cifs_posix_cli',
190 '-Ibin/default/source4/ntvfs/common',
191 '-Ibin/default/source4/ntvfs/ipc',
192 '-Ibin/default/source4/ntvfs/posix',
193 '-Ibin/default/source4/ntvfs/simple',
194 '-Ibin/default/source4/rpc_server',
195 '-Ibin/default/source4/rpc_server/backupkey',
196 '-Ibin/default/source4/rpc_server/common',
197 '-Ibin/default/source4/rpc_server/lsa',
198 '-Ibin/default/source4/rpc_server/samr',
199 '-Ibin/default/source4/rpc_server/srvsvc',
200 '-Ibin/default/source4/smbd',
201 '-Ibin/default/source4/smb_server',
202 '-Ibin/default/source4/smb_server/smb',
203 '-Ibin/default/source4/smb_server/smb2',
204 '-Ibin/default/source4/torture/auth',
205 '-Ibin/default/source4/torture/basic',
206 '-Ibin/default/source4/torture/dfs',
207 '-Ibin/default/source4/torture/drs',
208 '-Ibin/default/source4/torture/ldap',
209 '-Ibin/default/source4/torture/libnet',
210 '-Ibin/default/source4/torture/libnetapi',
211 '-Ibin/default/source4/torture/libsmbclient',
212 '-Ibin/default/source4/torture/local',
213 '-Ibin/default/source4/torture/nbench',
214 '-Ibin/default/source4/torture/nbt',
215 '-Ibin/default/source4/torture/ndr',
216 '-Ibin/default/source4/torture/ntp',
217 '-Ibin/default/source4/torture/rap',
218 '-Ibin/default/source4/torture/raw',
219 '-Ibin/default/source4/torture/rpc',
220 '-Ibin/default/source4/torture/smb2',
221 '-Ibin/default/source4/torture/unix',
222 '-Ibin/default/source4/torture/winbind',
223 '-Ibin/default/source4/winbind',
224 '-Ibin/default/source4/wrepl_server',
225 '-Ibin/default/testsuite/headers',
228 # Set this to the absolute path to the folder (NOT the file!) containing the
229 # compile_commands.json file to use that instead of 'flags'. See here for
230 # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
232 # Most projects will NOT need to set this to anything; you can just change the
233 # 'flags' list of compilation flags. Notice that YCM itself uses that approach.
234 compilation_database_folder = ''
236 if os.path.exists( compilation_database_folder ):
237 database = ycm_core.CompilationDatabase( compilation_database_folder )
238 else:
239 database = None
241 SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
243 def DirectoryOfThisScript():
244 return os.path.dirname( os.path.abspath( __file__ ) )
247 def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
248 if not working_directory:
249 return list( flags )
250 new_flags = []
251 make_next_absolute = False
252 path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
253 for flag in flags:
254 new_flag = flag
256 if make_next_absolute:
257 make_next_absolute = False
258 if not flag.startswith( '/' ):
259 new_flag = os.path.join( working_directory, flag )
261 for path_flag in path_flags:
262 if flag == path_flag:
263 make_next_absolute = True
264 break
266 if flag.startswith( path_flag ):
267 path = flag[ len( path_flag ): ]
268 new_flag = path_flag + os.path.join( working_directory, path )
269 break
271 if new_flag:
272 new_flags.append( new_flag )
273 return new_flags
276 def IsHeaderFile( filename ):
277 extension = os.path.splitext( filename )[ 1 ]
278 return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
281 def GetCompilationInfoForFile( filename ):
282 # The compilation_commands.json file generated by CMake does not have entries
283 # for header files. So we do our best by asking the db for flags for a
284 # corresponding source file, if any. If one exists, the flags for that file
285 # should be good enough.
286 if IsHeaderFile( filename ):
287 basename = os.path.splitext( filename )[ 0 ]
288 for extension in SOURCE_EXTENSIONS:
289 replacement_file = basename + extension
290 if os.path.exists( replacement_file ):
291 compilation_info = database.GetCompilationInfoForFile(
292 replacement_file )
293 if compilation_info.compiler_flags_:
294 return compilation_info
295 return None
296 return database.GetCompilationInfoForFile( filename )
299 def FlagsForFile( filename, **kwargs ):
300 if database:
301 # Bear in mind that compilation_info.compiler_flags_ does NOT return a
302 # python list, but a "list-like" StringVec object
303 compilation_info = GetCompilationInfoForFile( filename )
304 if not compilation_info:
305 return None
307 final_flags = MakeRelativePathsInFlagsAbsolute(
308 compilation_info.compiler_flags_,
309 compilation_info.compiler_working_dir_ )
310 else:
311 relative_to = DirectoryOfThisScript()
312 final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
314 return {
315 'flags': final_flags,
316 'do_cache': True