dfuzzer
Data Structures | Macros | Functions
dfuzzer.h File Reference

Go to the source code of this file.

Data Structures

struct  fuzzing_target
 

Macros

#define DF_VERSION
 
#define MINLEN   512
 
#define MAXLEN   256
 

Functions

int df_list_bus_names (const GDBusConnection *dcon)
 
int df_is_object_on_bus (const GDBusConnection *dcon, const char *root_node)
 
int df_traverse_node (const GDBusConnection *dcon, const char *root_node)
 
int df_fuzz (const GDBusConnection *dcon, const char *name, const char *obj, const char *intf)
 
int df_is_valid_dbus (const char *name, const char *obj, const char *intf)
 
int df_open_proc_status_file (const int pid)
 
int df_get_pid (const GDBusConnection *dcon)
 
void df_print_process_info (int pid)
 
void df_parse_parameters (int argc, char **argv)
 
int df_load_suppressions (void)
 
void df_print_help (const char *name)
 
void df_error (const char *message, GError *error)
 
void df_debug (const char *format,...)
 
void df_verbose (const char *format,...)
 
void df_fail (const char *format,...)
 

Macro Definition Documentation

◆ DF_VERSION

#define DF_VERSION
Value:
"dfuzzer 1.4\n" \
"Copyright(C) 2013,2014,2015, Red Hat, Inc.\n" \
"Author: Matus Marhefka <mmarhefk@redhat.com>\n" \
"Additional changes: Miroslav Vadkerti <mvadkert@redhat.com>\n" \
"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"

Version of dfuzzer

◆ MAXLEN

#define MAXLEN   256

Maximum length of strings containing D-Bus name, interface and object path

◆ MINLEN

#define MINLEN   512

Minimal buffer size for generated strings

Function Documentation

◆ df_debug()

void df_debug ( const char *  format,
  ... 
)

Prints debug message.

Parameters
formatFormat string

◆ df_error()

void df_error ( const char *  message,
GError *  error 
)

Displays an error message.

Parameters
messageError message which will be printed
errorPointer on GError structure containing error specification

◆ df_fail()

void df_fail ( const char *  format,
  ... 
)

Prints error message.

Parameters
formatFormat string

◆ df_fuzz()

int df_fuzz ( const GDBusConnection *  dcon,
const char *  name,
const char *  obj,
const char *  intf 
)

Controls fuzz testing of all methods of specified interface (intf) and reports results.

Parameters
dconD-Bus connection structure
nameD-Bus name
objD-Bus object path
intfD-Bus interface
Returns
0 on success, 1 on error, 2 when testing detected any failures or warnings, 3 on warnings

Controls fuzz testing of all methods of specified interface (intf) and reports results.

Parameters
dconD-Bus connection structure
nameD-Bus name
objD-Bus object path
intfD-Bus interface
Returns
0 on success, 1 on error, 2 when testing detected any failures, 3 on warnings

◆ df_get_pid()

int df_get_pid ( const GDBusConnection *  dcon)

Calls method GetConnectionUnixProcessID on the interface org.freedesktop.DBus to get process pid.

Parameters
dconD-Bus connection structure
Returns
Process PID on success, -1 on error

◆ df_is_object_on_bus()

int df_is_object_on_bus ( const GDBusConnection *  dcon,
const char *  root_node 
)

Traverses through all objects of bus name target_proc.name and is looking for object path target_proc.obj_path

Parameters
dconD-Bus connection structure
root_nodeStarting object path (all nodes from this object path will be traversed)
Returns
1 when obj. path target_proc.obj_path is found on bus, 0 otherwise

Information about nodes in a remote object hierarchy.

◆ df_is_valid_dbus()

int df_is_valid_dbus ( const char *  name,
const char *  obj,
const char *  intf 
)

Checks if name is valid D-Bus name, obj is valid D-Bus object path and intf is valid D-Bus interface.

Parameters
nameD-Bus name
objD-Bus object path
intfD-Bus interface
Returns
1 if name, obj and intf are valid, 0 otherwise

◆ df_list_bus_names()

int df_list_bus_names ( const GDBusConnection *  dcon)

Calls method ListNames to get all available connection names on the bus and prints them on the program output.

Parameters
dconD-Bus connection structure
Returns
0 on success, -1 on error

◆ df_load_suppressions()

int df_load_suppressions ( void  )

Searches target_proc.name in suppression file SF1, SF2 and SF3 (the file which is opened first is parsed). If it is found, df_suppression array is seeded with names of methods and df_supp_description is seeded with descriptions why methods are skipped (df_suppression array is used to skip methods which it contains when testing target_proc.name). Suppression file is in format: [bus_name] method1 description method2 description [bus_name2] method1 description method2 description ...

Returns
0 on success, -1 on error

◆ df_open_proc_status_file()

int df_open_proc_status_file ( const int  pid)

Opens process status file.

Parameters
pidPID - identifier of process
Returns
FD of status file on success, -1 on error

◆ df_parse_parameters()

void df_parse_parameters ( int  argc,
char **  argv 
)

Parses program options and stores them into global variables:

  • df_buf_size - Maximum buffer size for generated strings by rand module (in Bytes)
  • df_mem_limit - Memory limit for tested process in kB
  • df_test_method - Contains method name or NULL. When not NULL, only method with this name will be tested
  • target_proc - Is of type struct fuzzing_target and is used to store bus name, object path and interface
  • df_verbose_flag - Be verbose
  • df_debug_flag - Include debug output
  • df_supflg - If -s option is passed 1, otherwise 0
  • df_execute_cmd - Command/script to execute after each method call If error occures function ends program.
    Parameters
    argcCount of options
    argvPointer on strings containing options of program

◆ df_print_help()

void df_print_help ( const char *  name)

Prints help.

Parameters
nameName of program

◆ df_print_process_info()

void df_print_process_info ( int  pid)

Prints process name and package to which process belongs.

Parameters
pidPID of process Note: Any error in this function is suppressed. On error, process name and package is just not printed.

◆ df_traverse_node()

int df_traverse_node ( const GDBusConnection *  dcon,
const char *  root_node 
)

Traverses through all interfaces and objects of bus name target_proc.name and for each interface it calls df_fuzz() to fuzz test all its methods.

Parameters
dconD-Bus connection structure
root_nodeStarting object path (all nodes from this object path will be traversed)
Returns
0 on success, 1 on error, 2 when testing detected any failures or warnings, 3 on warnings

Information about nodes in a remote object hierarchy.

Information about a D-Bus interface.

Return values

◆ df_verbose()

void df_verbose ( const char *  format,
  ... 
)

Prints verbose message.

Parameters
formatFormat string