3 from waflib
import Build
5 bld
.SAMBA_SUBSYSTEM('fuzzing',
9 bld
.SAMBA_SUBSYSTEM('afl-fuzz-main',
10 source
='afl-fuzz-main.c',
12 enabled
=bld
.env
.enable_afl_fuzzer
15 bld
.SAMBA_BINARY('fuzz_tiniparser',
16 source
='fuzz_tiniparser.c',
17 deps
='fuzzing tiniparser talloc afl-fuzz-main',
20 bld
.SAMBA_BINARY('fuzz_oLschema2ldif',
21 source
='fuzz_oLschema2ldif.c',
22 deps
='fuzzing oLschema2ldif-lib afl-fuzz-main',
25 bld
.SAMBA_BINARY('fuzz_reg_parse',
26 source
='fuzz_reg_parse.c',
27 deps
='fuzzing samba3-util smbconf REGFIO afl-fuzz-main',
30 bld
.SAMBA_BINARY('fuzz_regfio',
31 source
='fuzz_regfio.c',
32 deps
='fuzzing samba3-util smbconf REGFIO afl-fuzz-main',
35 bld
.SAMBA_BINARY('fuzz_lzxpress',
36 source
='fuzz_lzxpress.c',
37 deps
='fuzzing LZXPRESS afl-fuzz-main',
40 bld
.SAMBA_BINARY('fuzz_ldap_decode',
41 source
='fuzz_ldap_decode.c',
42 deps
='fuzzing cli-ldap afl-fuzz-main',
45 bld
.SAMBA_BINARY('fuzz_ldb_parse_control',
46 source
='fuzz_ldb_parse_control.c',
47 deps
='fuzzing ldb afl-fuzz-main',
50 bld
.SAMBA_BINARY('fuzz_ldb_dn_explode',
51 source
='fuzz_ldb_dn_explode.c',
52 deps
='fuzzing ldb afl-fuzz-main',
55 bld
.SAMBA_BINARY('fuzz_ldb_ldif_read',
56 source
='fuzz_ldb_ldif_read.c',
57 deps
='fuzzing ldb afl-fuzz-main',
60 bld
.SAMBA_BINARY('fuzz_ldb_parse_tree',
61 source
='fuzz_ldb_parse_tree.c',
62 deps
='fuzzing ldb afl-fuzz-main',
65 # The fuzz_type and fuzz_function parameters make the built
66 # fuzzer take the same input as ndrdump and so the same that
67 # could be sent to the client or server as the stub data.
69 def SAMBA_NDR_FUZZ(bld
, interface
, auto_deps
=False,
70 fuzz_type
=None, fuzz_function
=None):
71 name
= "fuzz_ndr_%s" % (interface
.lower())
72 fuzz_dir
= os
.path
.join(bld
.env
.srcdir
, 'lib/fuzzing')
73 fuzz_reldir
= os
.path
.relpath(fuzz_dir
, bld
.path
.abspath())
74 fuzz_src
= os
.path
.join(fuzz_reldir
, 'fuzz_ndr_X.c')
76 cflags
= "-D FUZZ_PIPE_TABLE=ndr_table_%s" % interface
78 name
+= "_%s" % (fuzz_type
)
79 cflags
+= " -D FUZZ_TYPE=%s " % (fuzz_type
)
80 if fuzz_type
and fuzz_function
:
81 name
+= "_%d" % (fuzz_function
)
82 cflags
+= " -D FUZZ_FUNCTION=%d" % (fuzz_function
)
84 fuzz_named_src
= os
.path
.join(fuzz_reldir
,
86 # Work around an issue that WAF is invoked from up to 3 different
87 # directories so doesn't create a unique name for the multiple .o
88 # files like it would if called from just one place.
89 bld
.SAMBA_GENERATOR(fuzz_named_src
,
91 target
=fuzz_named_src
,
92 rule
='cp ${SRC} ${TGT}')
95 deps
= "afl-fuzz-main talloc ndr NDR_%s" % interface
.upper()
97 deps
= "afl-fuzz-main ndr-table NDR_DCERPC"
99 bld
.SAMBA_BINARY(name
, source
=fuzz_named_src
,
104 Build
.BuildContext
.SAMBA_NDR_FUZZ
= SAMBA_NDR_FUZZ
106 # fuzz_ndr_X is generated from the list if IDL fed to PIDL
107 # however there are exceptions to the normal pattern
108 bld
.SAMBA_NDR_FUZZ('IOXIDResolver') # oxidresolver.idl
109 bld
.SAMBA_NDR_FUZZ('IRemoteActivation') # remact.idl
110 bld
.SAMBA_NDR_FUZZ('iremotewinspool') # winspool.idl
111 bld
.SAMBA_NDR_FUZZ('FileServerVssAgent') # fsvrp.idl
112 bld
.SAMBA_NDR_FUZZ('lsarpc') # lsa.idl
113 bld
.SAMBA_NDR_FUZZ('netdfs') # dfs.idl
114 bld
.SAMBA_NDR_FUZZ('nfs4acl_interface') # nfs4acl.idl
115 bld
.SAMBA_NDR_FUZZ('rpcecho') # echo.idl
118 bld
.SAMBA_NDR_FUZZ('file_quota')
119 bld
.SAMBA_NDR_FUZZ('smb2_query_quota')
120 bld
.SAMBA_NDR_FUZZ('smb1_nt_transact_query_quota')
123 bld
.SAMBA_NDR_FUZZ('copychunk')
124 bld
.SAMBA_NDR_FUZZ('compression')
125 bld
.SAMBA_NDR_FUZZ('netinterface')
126 bld
.SAMBA_NDR_FUZZ('sparse')
127 bld
.SAMBA_NDR_FUZZ('resiliency')
128 bld
.SAMBA_NDR_FUZZ('trim')
131 bld
.SAMBA_NDR_FUZZ('IWbemClassObject')
132 bld
.SAMBA_NDR_FUZZ('IWbemServices')
133 bld
.SAMBA_NDR_FUZZ('IEnumWbemClassObject')
134 bld
.SAMBA_NDR_FUZZ('IWbemContext')
135 bld
.SAMBA_NDR_FUZZ('IWbemLevel1Login')
136 bld
.SAMBA_NDR_FUZZ('IWbemWCOSmartEnum')
137 bld
.SAMBA_NDR_FUZZ('IWbemFetchSmartEnum')
138 bld
.SAMBA_NDR_FUZZ('IWbemCallResult')
139 bld
.SAMBA_NDR_FUZZ('IWbemObjectSink')
142 bld
.SAMBA_NDR_FUZZ('dcom_Unknown')
143 bld
.SAMBA_NDR_FUZZ('IUnknown')
144 bld
.SAMBA_NDR_FUZZ('IClassFactory')
145 bld
.SAMBA_NDR_FUZZ('IRemUnknown')
146 bld
.SAMBA_NDR_FUZZ('IClassActivator')
147 bld
.SAMBA_NDR_FUZZ('ISCMLocalActivator')
148 bld
.SAMBA_NDR_FUZZ('IMachineLocalActivator')
149 bld
.SAMBA_NDR_FUZZ('ILocalObjectExporter')
150 bld
.SAMBA_NDR_FUZZ('ISystemActivator')
151 bld
.SAMBA_NDR_FUZZ('IRemUnknown2')
152 bld
.SAMBA_NDR_FUZZ('IDispatch')
153 bld
.SAMBA_NDR_FUZZ('IMarshal')
154 bld
.SAMBA_NDR_FUZZ('ICoffeeMachine')
155 bld
.SAMBA_NDR_FUZZ('IStream')
157 # Specific struct or function on the interface
159 bld
.SAMBA_NDR_FUZZ('spoolss',