From 549cf017b031985f2f2966637fbfaac16a3e9a83 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 14 Dec 2009 09:34:54 +0100 Subject: [PATCH] Use public function to validate identifiers --- src/profile.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/profile.c b/src/profile.c index 7235870..c9c8981 100644 --- a/src/profile.c +++ b/src/profile.c @@ -496,23 +496,6 @@ static int create_profile(const char *ident, const char *name, return 0; } -static gboolean validate_ident(const char *ident) -{ - unsigned int i; - - 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; -} - int __connman_profile_create(const char *name, const char **path) { struct connman_profile *profile; @@ -520,7 +503,7 @@ int __connman_profile_create(const char *name, const char **path) DBG("name %s", name); - if (validate_ident(name) == FALSE) + if (connman_dbus_validate_ident(name) == FALSE) return -EINVAL; err = create_profile(name, NULL, path); @@ -587,7 +570,7 @@ static int profile_init(void) ident = g_string_free(str, FALSE); - if (validate_ident(ident) == TRUE) + if (connman_dbus_validate_ident(ident) == TRUE) create_profile(ident, NULL, NULL); g_free(ident); -- 2.7.4