D-Bus: Utility functions for strings with special syntax

D-Bus 1.16.2

Functions
Utility functions for strings with special syntax
D-Bus low-level public API

Parsing D-Bus type signatures. More...

## Functions
dbus_bool_t | dbus_validate_path (const char *path, DBusError *error)
| Check an object path for validity.
dbus_bool_t | dbus_validate_interface (const char *name, DBusError *error)
| Check an interface name for validity.
dbus_bool_t | dbus_validate_member (const char *name, DBusError *error)
| Check a member (method/signal) name for validity.
dbus_bool_t | dbus_validate_error_name (const char *name, DBusError *error)
| Check an error name for validity.
dbus_bool_t | dbus_validate_bus_name (const char *name, DBusError *error)
| Check a bus name for validity.
dbus_bool_t | dbus_validate_utf8 (const char *alleged_utf8, DBusError *error)
| Check a string for validity.

## Detailed Description

Parsing D-Bus type signatures.

## Function Documentation

## ◆ dbus_validate_bus_name()

dbus_bool_t dbus_validate_bus_name | ( | const char * | name,
|  | DBusError * | error )

Check a bus name for validity.

Remember that NULL can always be passed instead of a DBusError *, if you don't care about having an error name and message.

This function is suitable for validating C strings, but is not suitable for validating untrusted data from a network unless the string's length is also checked, since it assumes that the string ends at the first zero byte according to normal C conventions.

Parameters

  name | a potentially invalid bus name, which must not be NULL
  error | error return

Returns
  TRUE if name is valid

Definition at line 244 of file dbus-syntax.c.

References _dbus_string_init_const(), _dbus_string_validate_utf8(), _dbus_validate_bus_name(), DBUS_ERROR_INVALID_ARGS, dbus_set_error(), FALSE, NULL, and TRUE.

## ◆ dbus_validate_error_name()

dbus_bool_t dbus_validate_error_name | ( | const char * | name,
|  | DBusError * | error )

Check an error name for validity.

Remember that NULL can always be passed instead of a DBusError *, if you don't care about having an error name and message.

This function is suitable for validating C strings, but is not suitable for validating untrusted data from a network unless the string's length is also checked, since it assumes that the string ends at the first zero byte according to normal C conventions.

Parameters

  name | a potentially invalid error name, which must not be NULL
  error | error return

Returns
  TRUE if name is valid

Definition at line 197 of file dbus-syntax.c.

References _dbus_string_init_const(), _dbus_string_validate_utf8(), _dbus_validate_error_name(), DBUS_ERROR_INVALID_ARGS, dbus_set_error(), FALSE, NULL, and TRUE.

## ◆ dbus_validate_interface()

dbus_bool_t dbus_validate_interface | ( | const char * | name,
|  | DBusError * | error )

Check an interface name for validity.

Remember that NULL can always be passed instead of a DBusError *, if you don't care about having an error name and message.

This function is suitable for validating C strings, but is not suitable for validating untrusted data from a network unless the string's length is also checked, since it assumes that the string ends at the first zero byte according to normal C conventions.

Parameters

  name | a potentially invalid interface name, which must not be NULL
  error | error return

Returns
  TRUE if name is valid

Definition at line 103 of file dbus-syntax.c.

References _dbus_string_init_const(), _dbus_string_validate_utf8(), _dbus_validate_interface(), DBUS_ERROR_INVALID_ARGS, dbus_set_error(), FALSE, NULL, and TRUE.

## ◆ dbus_validate_member()

dbus_bool_t dbus_validate_member | ( | const char * | name,
|  | DBusError * | error )

Check a member (method/signal) name for validity.

Remember that NULL can always be passed instead of a DBusError *, if you don't care about having an error name and message.

This function is suitable for validating C strings, but is not suitable for validating untrusted data from a network unless the string's length is also checked, since it assumes that the string ends at the first zero byte according to normal C conventions.

Parameters

  name | a potentially invalid member name, which must not be NULL
  error | error return

Returns
  TRUE if name is valid

Definition at line 150 of file dbus-syntax.c.

References _dbus_string_init_const(), _dbus_string_validate_utf8(), _dbus_validate_member(), DBUS_ERROR_INVALID_ARGS, dbus_set_error(), FALSE, NULL, and TRUE.

## ◆ dbus_validate_path()

dbus_bool_t dbus_validate_path | ( | const char * | path,
|  | DBusError * | error )

Check an object path for validity.

Remember that NULL can always be passed instead of a DBusError *, if you don't care about having an error name and message.

This function is suitable for validating C strings, but is not suitable for validating untrusted data from a network unless the string's length is also checked, since it assumes that the string ends at the first zero byte according to normal C conventions.

Parameters

  path | a potentially invalid object path, which must not be NULL
  error | error return

Returns
  TRUE if path is valid

Definition at line 56 of file dbus-syntax.c.

References _dbus_string_init_const(), _dbus_string_validate_utf8(), _dbus_validate_path(), DBUS_ERROR_INVALID_ARGS, dbus_set_error(), FALSE, NULL, and TRUE.

## ◆ dbus_validate_utf8()

dbus_bool_t dbus_validate_utf8 | ( | const char * | alleged_utf8,
|  | DBusError * | error )

Check a string for validity.

Strings on D-Bus must be valid UTF-8. Remember that NULL can always be passed instead of a DBusError *, if you don't care about having an error name and message.

This function is suitable for validating C strings, but is not suitable for validating untrusted data from a network unless the string's length is also checked, since it assumes that the string ends at the first zero byte according to normal C conventions.

Parameters

  alleged_utf8 | a string to be checked, which must not be NULL
  error | error return

Returns
  TRUE if alleged_utf8 is valid UTF-8

Definition at line 291 of file dbus-syntax.c.

References _dbus_string_init_const(), _dbus_string_validate_utf8(), DBUS_ERROR_INVALID_ARGS, dbus_set_error(), FALSE, NULL, and TRUE.