Gum Validate

Gum Validate — Utility functions for validating strings

Functions

Types and Values

Object Hierarchy


Includes

#include <gum/common/gum-validate.h>

Description

Name/secret validation functions

Functions

gum_validate_name ()

gboolean
gum_validate_name (const gchar *name,
                   GError **error);

Validates the name against the GUM_NAME_PATTERN pattern.

Parameters

name

the name string to be validated.

[transfer none]

error

the GError to be set in case of error.

[transfer none]

Returns

TRUE if validation succeeds, FALSE otherwise.


gum_validate_generate_username ()

gchar *
gum_validate_generate_username (const gchar *str,
                                GError **error);

Generate username based on the string str and then validate the generated user name against GUM_NAME_PATTERN pattern.

Parameters

str

the string to be validated.

[transfer none]

error

the GError to be set in case of error.

[transfer none]

Returns

string if successful, NULL otherwise.

[transfer full]


gum_validate_db_string_entry_regx ()

gboolean
gum_validate_db_string_entry_regx (const gchar *str,
                                   GError **error);

Validates the string str against the GUM_DB_ENTRY_PATTERN pattern using regular expressions.

Parameters

str

the string to be validated.

[transfer none]

error

the GError to be set in case of error.

[transfer none]

Returns

TRUE if validation succeeds, FALSE otherwise.


gum_validate_db_string_entry ()

gboolean
gum_validate_db_string_entry (const gchar *str,
                              GError **error);

Validates the string str to be used in the user/group database. No control chars (0x00-0x1F,0x7F), comma (',' 0x2c) or colon (':' 0x3A) is allowed.

Parameters

str

the string to be validated.

[transfer none]

error

the GError to be set in case of error.

[transfer none]

Returns

TRUE if validation succeeds, FALSE otherwise.


gum_validate_db_secret_entry ()

gboolean
gum_validate_db_secret_entry (const gchar *str,
                              GError **error);

Validates the string str to be used as secret in the user/group database. No control chars (0x00-0x1F,0x7F) or colon (':' 0x3A) is allowed.

Parameters

str

the string to be validated.

[transfer none]

error

the GError to be set in case of error.

[transfer none]

Returns

TRUE if validation succeeds, FALSE otherwise.

Types and Values

GUM_NAME_PATTERN

#define GUM_NAME_PATTERN "^[A-Za-z_][A-Za-z0-9_.-]*[A-Za-z0-9_.$-]\\?$"

A macro that defines the string pattern to be acceptable for names.


GUM_DB_ENTRY_PATTERN

#define GUM_DB_ENTRY_PATTERN "^[^\x2C\x3A[:cntrl:]]*$"

A macro that defines the string pattern to be acceptable for entries in the user/group database.