diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-12-14 09:34:25 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-12-14 09:34:25 +0100 |
commit | 627d936df1945e8476a37dc82f460e245469a335 (patch) | |
tree | deb21608f23d2a751cbe852e929d1a7a56d0de2b /src/dbus.c | |
parent | c3a422ac4842e0c1309f2f2437cae387b9b30c61 (diff) | |
download | connman-627d936df1945e8476a37dc82f460e245469a335.tar.gz connman-627d936df1945e8476a37dc82f460e245469a335.tar.bz2 connman-627d936df1945e8476a37dc82f460e245469a335.zip |
Add public function to validate D-Bus identifiers
Diffstat (limited to 'src/dbus.c')
-rw-r--r-- | src/dbus.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -24,9 +24,30 @@ #endif #include <string.h> +#include <dbus/dbus.h> #include "connman.h" +dbus_bool_t connman_dbus_validate_ident(const char *ident) +{ + unsigned int i; + + if (ident == NULL) + return FALSE; + + for (i = 0; i < strlen(ident); i++) { + if (ident[i] >= '0' && ident[i] <= '9') + continue; + if (ident[i] >= 'a' && ident[i] <= 'z') + continue; + if (ident[i] >= 'A' && ident[i] <= 'Z') + continue; + return FALSE; + } + + return TRUE; +} + char *connman_dbus_encode_string(const char *value) { GString *str; |