From: Sunmin Lee Date: Thu, 19 Jan 2017 08:21:50 +0000 (+0900) Subject: Deprecate signup validation X-Git-Tag: submit/tizen/20170314.091005~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bedf8ed4864fa1d3aa97a1370e55530ea3ab66f1;p=platform%2Fcore%2Fsystem%2Ftizen-platform-config.git Deprecate signup validation From Tizen 4.0, signup matching to check modification of variables is deprecated. Instead, the library version number will reflect the change of variables. Change-Id: Ie4d4ba6b4adf90b4a909a403cd30272cf46a843f Signed-off-by: Sunmin Lee --- diff --git a/configure.ac b/configure.ac index 4acc6fc..21a90cd 100644 --- a/configure.ac +++ b/configure.ac @@ -11,8 +11,8 @@ AC_PROG_CC AM_PROG_AR LT_INIT([disable-static]) -AC_SUBST([LIBTZPLATFORM_CONFIG_SO_VERSION], [2:0:0]) -AC_SUBST([LIBTZPLATFORM_CONFIG_VERSION], [2.0]) +AC_SUBST([LIBTZPLATFORM_CONFIG_SO_VERSION], [0:0:0]) +AC_SUBST([LIBTZPLATFORM_CONFIG_VERSION], [3.0]) AC_CONFIG_FILES([ Makefile diff --git a/src/Makefile.am b/src/Makefile.am index fbf3de1..f532812 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,16 +2,12 @@ lib_LTLIBRARIES = libtzplatform-config-@LIBTZPLATFORM_CONFIG_VERSION@.la bin_PROGRAMS = tzplatform-get -SRC_FROMWRAPPER_STATIC= \ - static-api.c \ - isadmin.h \ - isadmin.c - -SRC_FROMWRAPPER_SHARED= \ +libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_SOURCES = \ buffer.h \ buffer.c \ foreign.h \ foreign.c \ + global-api.c \ heap.h \ heap.c \ parser.h \ @@ -26,12 +22,13 @@ SRC_FROMWRAPPER_SHARED= \ hashing.h \ init.c \ init.h \ + isadmin.h \ + isadmin.c \ shared-api.c \ shared-api.h \ tzplatform_config.sym \ - tzplatform_config.h - -SRC_FROMWRAPPER=$(SRC_FROMWRAPPER_SHARED) $(SRC_FROMWRAPPER_STATIC) + tzplatform_config.h \ + $(SRC_FROMTOOL) SRC_TOOL = \ buffer.c \ @@ -43,7 +40,6 @@ SRC_TOOL = \ SRC_FROMTOOL= \ tzplatform_variables.h \ - signup.inc \ hash.inc libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_CFLAGS = -fPIC @@ -52,10 +48,6 @@ BUILT_SOURCES=tzplatform-tool $(SRC_FROMTOOL) CLEANFILES=tzplatform-tool $(SRC_FROMTOOL) -libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_SOURCES = \ - $(SRC_FROMWRAPPER) \ - $(SRC_FROMTOOL) - tzplatform-tool: $(SRC_TOOL) $(CC) $^ -o $@ @@ -68,9 +60,6 @@ tzplatform_variables.h: tizen-platform.conf tzplatform-tool hash.inc: tizen-platform.conf tzplatform-tool ./tzplatform-tool c $< >$@ -signup.inc: tizen-platform.conf tzplatform-tool - ./tzplatform-tool signup $< >$@ - libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS = -version-info $(LIBTZPLATFORM_CONFIG_SO_VERSION) libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS += -Wl,--version-script=tzplatform_config.sym libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS += -Wl,-O3 diff --git a/src/global-api.c b/src/global-api.c new file mode 100644 index 0000000..2639097 --- /dev/null +++ b/src/global-api.c @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2013-2014 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * José Bollo + * Stéphane Desneux + * Jean-Benoit Martin + * + */ +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include "tzplatform_variables.h" +#include "tzplatform_config.h" + +#include "shared-api.h" +#include "isadmin.h" + +int tzplatform_getcount() +{ + return _TZPLATFORM_VARIABLES_COUNT_; +} + +const char* tzplatform_getname(enum tzplatform_variable id) +{ + return _getname_tzplatform_(id); +} + +enum tzplatform_variable tzplatform_getid(const char *name) +{ + return _getid_tzplatform_(name); +} + +const char* tzplatform_getenv(enum tzplatform_variable id) +{ + return _getenv_tzplatform_(id); +} + +const char* tzplatform_context_getenv(struct tzplatform_context *context, enum tzplatform_variable id) +{ + return _context_getenv_tzplatform_(id, context); +} + +int tzplatform_getenv_int(enum tzplatform_variable id) +{ + return _getenv_int_tzplatform_(id); +} + +int tzplatform_context_getenv_int(struct tzplatform_context *context, enum tzplatform_variable id) +{ + return _context_getenv_int_tzplatform_(id, context); +} + +const char* tzplatform_mkstr(enum tzplatform_variable id, const char * str) +{ + return _mkstr_tzplatform_(id, str); +} + +const char* tzplatform_context_mkstr(struct tzplatform_context *context, enum tzplatform_variable id, const char *str) +{ + return _context_mkstr_tzplatform_(id, str, context); +} + +const char* tzplatform_mkpath(enum tzplatform_variable id, const char * path) +{ + return _mkpath_tzplatform_(id, path); +} + +const char* tzplatform_context_mkpath(struct tzplatform_context *context, enum tzplatform_variable id, const char *path) +{ + return _context_mkpath_tzplatform_(id, path, context); +} + +const char* tzplatform_mkpath3(enum tzplatform_variable id, const char * path, const char* path2) +{ + return _mkpath3_tzplatform_(id, path, path2); +} + +const char* tzplatform_context_mkpath3(struct tzplatform_context *context, enum tzplatform_variable id, const char *path, const char *path2) +{ + return _context_mkpath3_tzplatform_(id, path, path2, context); +} + +const char* tzplatform_mkpath4(enum tzplatform_variable id, const char * path, const char* path2, const char *path3) +{ + return _mkpath4_tzplatform_(id, path, path2, path3); +} + +const char* tzplatform_context_mkpath4(struct tzplatform_context *context, enum tzplatform_variable id, const char *path, const char *path2, const char *path3) +{ + return _context_mkpath4_tzplatform_(id, path, path2, path3, context); +} + +uid_t tzplatform_getuid(enum tzplatform_variable id) +{ + return _getuid_tzplatform_(id); +} + +uid_t tzplatform_context_getuid(struct tzplatform_context *context, enum tzplatform_variable id) +{ + return _context_getuid_tzplatform_(id, context); +} + +gid_t tzplatform_getgid(enum tzplatform_variable id) +{ + return _getgid_tzplatform_(id); +} + +gid_t tzplatform_context_getgid(struct tzplatform_context *context, enum tzplatform_variable id) +{ + return _context_getgid_tzplatform_(id, context); +} + +int tzplatform_has_system_group(uid_t uid) +{ + return _has_system_group_static_(uid); +} + +#ifdef TEST +#include +#include + +int main() { + int i; + struct tzplatform_context *context; + enum tzplatform_variable id; + const char *name; + const char *value; + int xid; + uid_t uid; + + i = 0; + while(i != tzplatform_getcount()) { + id = (enum tzplatform_variable)i; + name = tzplatform_getname(id); + value = tzplatform_getenv(id); + xid = (int)tzplatform_getid(name); + printf("%d=%d\t%s=%s\n",i,xid,name,value?value:""); + i++; + } + + printf("------------------------\n"); + i = tzplatform_context_create(&context); + if (i) { + printf("error while creating context %d\n",i); + return 1; + } + + uid = (uid_t)0; + i = tzplatform_context_set_user(context, uid); + if (i) { + printf("error %d while switching to user %d\n",i,(int)uid); + return 1; + } + i = 0; + while(i != tzplatform_getcount()) { + id = (enum tzplatform_variable)i; + name = tzplatform_getname(id); + value = tzplatform_context_getenv(context, id); + xid = (int)tzplatform_getid(name); + printf("%d=%d\t%s=%s\n",i,xid,name,value?value:""); + i++; + } + tzplatform_context_destroy(context); + + return 0; +} +#endif + + diff --git a/src/shared-api.c b/src/shared-api.c index 742e69a..801b6b7 100644 --- a/src/shared-api.c +++ b/src/shared-api.c @@ -58,25 +58,10 @@ static struct tzplatform_context global_context = { .user = _USER_NOT_SET_ }; -/* the signup of names */ -#include "signup.inc" - -/* validate the signup */ -static void validate_signup(char signup[33]) -{ - if (memcmp(signup+1, tizen_platform_config_signup+1, 32)) { - syslog(LOG_CRIT, "Bad signup of the client of tizen-platform-config"); - abort(); - } - signup[0] = 1; -} - -/* check the signup */ -static inline void check_signup(char signup[33]) -{ - if (!signup[0]) - validate_signup(signup); -} +/* + * Tizen 4.0: signup validation is deprecated + * version matching will be conducted by numbering of so version + */ /* locks the context */ inline static void lock(struct tzplatform_context *context) @@ -150,7 +135,7 @@ void tzplatform_context_reset(struct tzplatform_context *context) unlock( context); } -uid_t tzplatform_get_user(char signup[33]) +uid_t tzplatform_get_user(void) { return tzplatform_context_get_user( &global_context); } @@ -203,29 +188,26 @@ int tzplatform_context_set_user(struct tzplatform_context *context, uid_t uid) /*************** PUBLIC INTERNAL API begins here **************/ -const char* _getname_tzplatform_(int id, char signup[33]) +const char* _getname_tzplatform_(int id) { - check_signup(signup); return 0 <= id && id < _TZPLATFORM_VARIABLES_COUNT_ ? keyname(id) : NULL; } -int _getid_tzplatform_(const char *name, char signup[33]) +int _getid_tzplatform_(const char *name) { - check_signup(signup); return hashid(name, strlen(name)); } -const char* _getenv_tzplatform_(int id, char signup[33]) +const char* _getenv_tzplatform_(int id) { - return _context_getenv_tzplatform_(id, signup, &global_context); + return _context_getenv_tzplatform_(id, &global_context); } -const char* _context_getenv_tzplatform_(int id, char signup[33], struct tzplatform_context *context) +const char* _context_getenv_tzplatform_(int id, struct tzplatform_context *context) { const char *array[2]; const char *result; - check_signup(signup); result = get_lock(id, context); if (result != NULL) { array[0] = result; @@ -236,34 +218,32 @@ const char* _context_getenv_tzplatform_(int id, char signup[33], struct tzplatfo return result; } -int _getenv_int_tzplatform_(int id, char signup[33]) +int _getenv_int_tzplatform_(int id) { - return _context_getenv_int_tzplatform_(id, signup, &global_context); + return _context_getenv_int_tzplatform_(id, &global_context); } -int _context_getenv_int_tzplatform_(int id, char signup[33], struct tzplatform_context *context) +int _context_getenv_int_tzplatform_(int id, struct tzplatform_context *context) { const char *value; int result; - check_signup(signup); value = get_lock(id, context); result = value==NULL ? -1 : atoi(value); unlock( context); return result; } -const char* _mkstr_tzplatform_(int id, const char * str, char signup[33]) +const char* _mkstr_tzplatform_(int id, const char * str) { - return _context_mkstr_tzplatform_(id, str, signup, &global_context); + return _context_mkstr_tzplatform_(id, str, &global_context); } -const char* _context_mkstr_tzplatform_(int id, const char *str, char signup[33], struct tzplatform_context *context) +const char* _context_mkstr_tzplatform_(int id, const char *str, struct tzplatform_context *context) { const char *array[3]; const char *result; - check_signup(signup); result = get_lock(id, context); if (result != NULL) { array[0] = result; @@ -275,17 +255,16 @@ const char* _context_mkstr_tzplatform_(int id, const char *str, char signup[33], return result; } -const char* _mkpath_tzplatform_(int id, const char * path, char signup[33]) +const char* _mkpath_tzplatform_(int id, const char * path) { - return _context_mkpath_tzplatform_(id, path, signup, &global_context); + return _context_mkpath_tzplatform_(id, path, &global_context); } -const char* _context_mkpath_tzplatform_(int id, const char *path, char signup[33], struct tzplatform_context *context) +const char* _context_mkpath_tzplatform_(int id, const char *path, struct tzplatform_context *context) { const char *array[3]; const char *result; - check_signup(signup); result = get_lock(id, context); if (result != NULL) { array[0] = result; @@ -297,17 +276,16 @@ const char* _context_mkpath_tzplatform_(int id, const char *path, char signup[33 return result; } -const char* _mkpath3_tzplatform_(int id, const char * path, const char* path2, char signup[33]) +const char* _mkpath3_tzplatform_(int id, const char * path, const char* path2) { - return _context_mkpath3_tzplatform_( id, path, path2, signup, &global_context); + return _context_mkpath3_tzplatform_( id, path, path2, &global_context); } -const char* _context_mkpath3_tzplatform_(int id, const char *path, const char *path2, char signup[33], struct tzplatform_context *context) +const char* _context_mkpath3_tzplatform_(int id, const char *path, const char *path2, struct tzplatform_context *context) { const char *array[4]; const char *result; - check_signup(signup); result = get_lock(id, context); if (result != NULL) { array[0] = result; @@ -320,17 +298,16 @@ const char* _context_mkpath3_tzplatform_(int id, const char *path, const char *p return result; } -const char* _mkpath4_tzplatform_(int id, const char * path, const char* path2, const char *path3, char signup[33]) +const char* _mkpath4_tzplatform_(int id, const char * path, const char* path2, const char *path3) { - return _context_mkpath4_tzplatform_( id, path, path2, path3, signup, &global_context); + return _context_mkpath4_tzplatform_( id, path, path2, path3, &global_context); } -const char* _context_mkpath4_tzplatform_(int id, const char *path, const char *path2, const char *path3, char signup[33], struct tzplatform_context *context) +const char* _context_mkpath4_tzplatform_(int id, const char *path, const char *path2, const char *path3, struct tzplatform_context *context) { const char *array[5]; const char *result; - check_signup(signup); result = get_lock(id, context); if (result != NULL) { array[0] = result; @@ -344,17 +321,16 @@ const char* _context_mkpath4_tzplatform_(int id, const char *path, const char *p return result; } -uid_t _getuid_tzplatform_(int id, char signup[33]) +uid_t _getuid_tzplatform_(int id) { - return _context_getuid_tzplatform_( id, signup, &global_context); + return _context_getuid_tzplatform_( id, &global_context); } -uid_t _context_getuid_tzplatform_(int id, char signup[33], struct tzplatform_context *context) +uid_t _context_getuid_tzplatform_(int id, struct tzplatform_context *context) { uid_t result; const char *value; - check_signup(signup); result = (uid_t)-1; value = get_lock(id, context); if (value != NULL) { @@ -364,17 +340,16 @@ uid_t _context_getuid_tzplatform_(int id, char signup[33], struct tzplatform_con return result; } -gid_t _getgid_tzplatform_(int id, char signup[33]) +gid_t _getgid_tzplatform_(int id) { - return _context_getgid_tzplatform_( id, signup, &global_context); + return _context_getgid_tzplatform_( id, &global_context); } -gid_t _context_getgid_tzplatform_(int id, char signup[33], struct tzplatform_context *context) +gid_t _context_getgid_tzplatform_(int id, struct tzplatform_context *context) { gid_t result; const char *value; - check_signup(signup); result = (uid_t)-1; value = get_lock(id, context); if (value != NULL) { diff --git a/src/shared-api.h b/src/shared-api.h index 8735026..a8801e6 100644 --- a/src/shared-api.h +++ b/src/shared-api.h @@ -25,24 +25,24 @@ #ifndef SHARED_API_H #define SHARED_API_H -extern const char* _getname_tzplatform_(int id, char signup[33]); -extern int _getid_tzplatform_(const char *name, char signup[33]); -extern const char* _getenv_tzplatform_(int id, char signup[33]) ; -extern const char* _context_getenv_tzplatform_(int id, char signup[33], struct tzplatform_context *context); -extern int _getenv_int_tzplatform_(int id, char signup[33]); -extern int _context_getenv_int_tzplatform_(int id, char signup[33], struct tzplatform_context *context); -extern const char* _mkstr_tzplatform_(int id, const char * str, char signup[33]); -extern const char* _context_mkstr_tzplatform_(int id, const char *str, char signup[33], struct tzplatform_context *context); -extern const char* _mkpath_tzplatform_(int id, const char * path, char signup[33]); -extern const char* _context_mkpath_tzplatform_(int id, const char *path, char signup[33], struct tzplatform_context *context); -extern const char* _mkpath3_tzplatform_(int id, const char * path, const char* path2, char signup[33]); -extern const char* _context_mkpath3_tzplatform_(int id, const char *path, const char *path2, char signup[33], struct tzplatform_context *context); -extern const char* _mkpath4_tzplatform_(int id, const char * path, const char* path2, const char *path3, char signup[33]); -extern const char* _context_mkpath4_tzplatform_(int id, const char *path, const char *path2, const char *path3, char signup[33], struct tzplatform_context *context); -extern uid_t _getuid_tzplatform_(int id, char signup[33]); -extern uid_t _context_getuid_tzplatform_(int id, char signup[33], struct tzplatform_context *context); -extern gid_t _getgid_tzplatform_(int id, char signup[33]); -extern gid_t _context_getgid_tzplatform_(int id, char signup[33], struct tzplatform_context *context); +extern const char* _getname_tzplatform_(int id); +extern int _getid_tzplatform_(const char *name); +extern const char* _getenv_tzplatform_(int id) ; +extern const char* _context_getenv_tzplatform_(int id, struct tzplatform_context *context); +extern int _getenv_int_tzplatform_(int id); +extern int _context_getenv_int_tzplatform_(int id, struct tzplatform_context *context); +extern const char* _mkstr_tzplatform_(int id, const char * str); +extern const char* _context_mkstr_tzplatform_(int id, const char *str, struct tzplatform_context *context); +extern const char* _mkpath_tzplatform_(int id, const char * path); +extern const char* _context_mkpath_tzplatform_(int id, const char *path, struct tzplatform_context *context); +extern const char* _mkpath3_tzplatform_(int id, const char * path, const char* path2); +extern const char* _context_mkpath3_tzplatform_(int id, const char *path, const char *path2, struct tzplatform_context *context); +extern const char* _mkpath4_tzplatform_(int id, const char * path, const char* path2, const char *path3); +extern const char* _context_mkpath4_tzplatform_(int id, const char *path, const char *path2, const char *path3, struct tzplatform_context *context); +extern uid_t _getuid_tzplatform_(int id); +extern uid_t _context_getuid_tzplatform_(int id, struct tzplatform_context *context); +extern gid_t _getgid_tzplatform_(int id); +extern gid_t _context_getgid_tzplatform_(int id, struct tzplatform_context *context); #endif diff --git a/src/static-api.c b/src/static-api.c deleted file mode 100644 index d6a4e0c..0000000 --- a/src/static-api.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2013-2014 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: - * José Bollo - * Stéphane Desneux - * Jean-Benoit Martin - * - */ -#define _GNU_SOURCE - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include "tzplatform_variables.h" -#include "tzplatform_config.h" - -#include "shared-api.h" -#include "isadmin.h" - -#include "signup.inc" - -int tzplatform_getcount() -{ - return _TZPLATFORM_VARIABLES_COUNT_; -} - -const char* tzplatform_getname(enum tzplatform_variable id) -{ - return _getname_tzplatform_(id, tizen_platform_config_signup); -} - -enum tzplatform_variable tzplatform_getid(const char *name) -{ - return _getid_tzplatform_(name, tizen_platform_config_signup); -} - -const char* tzplatform_getenv(enum tzplatform_variable id) -{ - return _getenv_tzplatform_(id, tizen_platform_config_signup); -} - -const char* tzplatform_context_getenv(struct tzplatform_context *context, enum tzplatform_variable id) -{ - return _context_getenv_tzplatform_(id, tizen_platform_config_signup, context); -} - -int tzplatform_getenv_int(enum tzplatform_variable id) -{ - return _getenv_int_tzplatform_(id, tizen_platform_config_signup); -} - -int tzplatform_context_getenv_int(struct tzplatform_context *context, enum tzplatform_variable id) -{ - return _context_getenv_int_tzplatform_(id, tizen_platform_config_signup, context); -} - -const char* tzplatform_mkstr(enum tzplatform_variable id, const char * str) -{ - return _mkstr_tzplatform_(id, str, tizen_platform_config_signup); -} - -const char* tzplatform_context_mkstr(struct tzplatform_context *context, enum tzplatform_variable id, const char *str) -{ - return _context_mkstr_tzplatform_(id, str, tizen_platform_config_signup, context); -} - -const char* tzplatform_mkpath(enum tzplatform_variable id, const char * path) -{ - return _mkpath_tzplatform_(id, path, tizen_platform_config_signup); -} - -const char* tzplatform_context_mkpath(struct tzplatform_context *context, enum tzplatform_variable id, const char *path) -{ - return _context_mkpath_tzplatform_(id, path, tizen_platform_config_signup, context); -} - -const char* tzplatform_mkpath3(enum tzplatform_variable id, const char * path, const char* path2) -{ - return _mkpath3_tzplatform_(id, path, path2, tizen_platform_config_signup); -} - -const char* tzplatform_context_mkpath3(struct tzplatform_context *context, enum tzplatform_variable id, const char *path, const char *path2) -{ - return _context_mkpath3_tzplatform_(id, path, path2, tizen_platform_config_signup, context); -} - -const char* tzplatform_mkpath4(enum tzplatform_variable id, const char * path, const char* path2, const char *path3) -{ - return _mkpath4_tzplatform_(id, path, path2, path3, tizen_platform_config_signup); -} - -const char* tzplatform_context_mkpath4(struct tzplatform_context *context, enum tzplatform_variable id, const char *path, const char *path2, const char *path3) -{ - return _context_mkpath4_tzplatform_(id, path, path2, path3, tizen_platform_config_signup, context); -} - -uid_t tzplatform_getuid(enum tzplatform_variable id) -{ - return _getuid_tzplatform_(id, tizen_platform_config_signup); -} - -uid_t tzplatform_context_getuid(struct tzplatform_context *context, enum tzplatform_variable id) -{ - return _context_getuid_tzplatform_(id, tizen_platform_config_signup, context); -} - -gid_t tzplatform_getgid(enum tzplatform_variable id) -{ - return _getgid_tzplatform_(id, tizen_platform_config_signup); -} - -gid_t tzplatform_context_getgid(struct tzplatform_context *context, enum tzplatform_variable id) -{ - return _context_getgid_tzplatform_(id, tizen_platform_config_signup, context); -} - -int tzplatform_has_system_group(uid_t uid) -{ - return _has_system_group_static_(uid); -} - -#ifdef TEST -#include -#include - -int main() { - int i; - struct tzplatform_context *context; - enum tzplatform_variable id; - const char *name; - const char *value; - int xid; - uid_t uid; - - i = 0; - while(i != tzplatform_getcount()) { - id = (enum tzplatform_variable)i; - name = tzplatform_getname(id); - value = tzplatform_getenv(id); - xid = (int)tzplatform_getid(name); - printf("%d=%d\t%s=%s\n",i,xid,name,value?value:""); - i++; - } - - printf("------------------------\n"); - i = tzplatform_context_create(&context); - if (i) { - printf("error while creating context %d\n",i); - return 1; - } - - uid = (uid_t)0; - i = tzplatform_context_set_user(context, uid); - if (i) { - printf("error %d while switching to user %d\n",i,(int)uid); - return 1; - } - i = 0; - while(i != tzplatform_getcount()) { - id = (enum tzplatform_variable)i; - name = tzplatform_getname(id); - value = tzplatform_context_getenv(context, id); - xid = (int)tzplatform_getid(name); - printf("%d=%d\t%s=%s\n",i,xid,name,value?value:""); - i++; - } - tzplatform_context_destroy(context); - - return 0; -} -#endif - -