TARGET_LINK_LIBRARIES(${TARGET_LIB_CREDS_DBUS}
${LIB_CREDS_DBUS_DEP_LIBRARIES}
+ ${TARGET_LIB_CREDS_COMMONS}
)
INSTALL(TARGETS ${TARGET_LIB_CREDS_DBUS} DESTINATION ${LIB_INSTALL_DIR})
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (connection == nullptr || uniqueName == nullptr || client == nullptr)
return CYNARA_API_INVALID_PARAM;
+ if (method == cynara_client_creds::CLIENT_METHOD_DEFAULT) {
+ int ret = cynara_creds_get_default_client_method(&method);
+ if (ret != CYNARA_API_SUCCESS)
+ return ret;
+ }
+
switch (method) {
case cynara_client_creds::CLIENT_METHOD_SMACK:
return getClientSmackLabel(connection, uniqueName, client);
if (connection == nullptr || uniqueName == nullptr || user == nullptr)
return CYNARA_API_INVALID_PARAM;
+ if (method == cynara_user_creds::USER_METHOD_DEFAULT) {
+ int ret = cynara_creds_get_default_user_method(&method);
+ if (ret != CYNARA_API_SUCCESS)
+ return ret;
+ }
+
switch (method) {
case cynara_user_creds::USER_METHOD_UID:
return getUserId(connection, uniqueName, user);
TARGET_LINK_LIBRARIES(${TARGET_LIB_CREDS_GDBUS}
${LIB_CREDS_GDBUS_DEP_LIBRARIES}
+ ${TARGET_LIB_CREDS_COMMONS}
)
INSTALL(TARGETS ${TARGET_LIB_CREDS_GDBUS} DESTINATION ${LIB_INSTALL_DIR})
if (connection == nullptr || uniqueName == nullptr || client == nullptr)
return CYNARA_API_INVALID_PARAM;
+ if (method == cynara_client_creds::CLIENT_METHOD_DEFAULT) {
+ int ret = cynara_creds_get_default_client_method(&method);
+ if (ret != CYNARA_API_SUCCESS)
+ return ret;
+ }
+
switch (method) {
case cynara_client_creds::CLIENT_METHOD_SMACK:
ret = call_dbus_daemon_method_str(connection, "GetConnectionSmackContext", uniqueName,
if (connection == nullptr || uniqueName == nullptr || user == nullptr)
return CYNARA_API_INVALID_PARAM;
+ if (method == cynara_user_creds::USER_METHOD_DEFAULT) {
+ int ret = cynara_creds_get_default_user_method(&method);
+ if (ret != CYNARA_API_SUCCESS)
+ return ret;
+ }
+
if (method != cynara_user_creds::USER_METHOD_UID)
return CYNARA_API_METHOD_NOT_SUPPORTED;
VERSION ${LIB_CREDS_SOCKET_VERSION}
)
+TARGET_LINK_LIBRARIES(${TARGET_LIB_CREDS_SOCKET}
+ ${TARGET_LIB_CREDS_COMMONS}
+ )
+
INSTALL(TARGETS ${TARGET_LIB_CREDS_SOCKET} DESTINATION ${LIB_INSTALL_DIR})
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (client == nullptr)
return CYNARA_API_INVALID_PARAM;
+ if (method == cynara_client_creds::CLIENT_METHOD_DEFAULT) {
+ int ret = cynara_creds_get_default_client_method(&method);
+ if (ret != CYNARA_API_SUCCESS)
+ return ret;
+ }
+
switch (method) {
case cynara_client_creds::CLIENT_METHOD_SMACK:
return getClientSmackLabel(socket_fd, client);
if (user == nullptr)
return CYNARA_API_INVALID_PARAM;
+ if (method == cynara_user_creds::USER_METHOD_DEFAULT) {
+ int ret = cynara_creds_get_default_user_method(&method);
+ if (ret != CYNARA_API_SUCCESS)
+ return ret;
+ }
+
switch (method) {
case cynara_user_creds::USER_METHOD_UID:
return getUserId(socket_fd, user);
enum cynara_client_creds {
CLIENT_METHOD_SMACK,
- CLIENT_METHOD_PID
+ CLIENT_METHOD_PID,
+
+ CLIENT_METHOD_DEFAULT = 0xFFFF,
};
enum cynara_user_creds {
USER_METHOD_UID,
- USER_METHOD_GID
+ USER_METHOD_GID,
+
+ USER_METHOD_DEFAULT = 0xFFFF,
};
#ifdef __cplusplus
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* \par Important notes:
* Memory for returned client string is obtained with malloc(), and should be freed with free().
* Allocated string is returned only, when function succeeds.
+ * If method is CLIENT_METHOD_DEFAULT then it will be chosen based on Cynara configuration file.
*
* \param[in] connection DBus connection to a bus. It manages incomming and outgoing messages
* \param[in] uniqueName DBus identifier of the client
* CYNARA_API_INVALID_PARAM when client is NULL or uniqueName or client has wrong
* value (i.e NULL or non-existing)
* CYNARA_API_METHOD_NOT_SUPPORTED when requested method is not supported
+ * CYNARA_API_CONFIGURATION_ERROR if the configuration file can not be opened or
+ * there are errors in configuration file.
* CYNARA_API_OUT_OF_MEMORY when there was error allocating memory
*/
int cynara_creds_dbus_get_client(DBusConnection *connection, const char *uniqueName,
* \par Important notes:
* Memory for returned user string is obtained with malloc(), and should be freed with free().
* Allocated string is returned only, when function succeeds.
+ * If method is USER_METHOD_DEFAULT then it will be chosen based on Cynara configuration file.
*
* \param[in] connection DBus connection to a bus. It manages incomming and outgoing messages
* \param[in] uniqueName DBus identifier of the client invoked by the user
* CYNARA_API_INVALID_PARAM when user is NULL or connection is not valid DBus connection or
* uniqueName does not represent a process conected to the DBus
* CYNARA_API_METHOD_NOT_SUPPORTED when requested method is not supported
+ * CYNARA_API_CONFIGURATION_ERROR if the configuration file can not be opened or
+ * there are errors in configuration file.
* CYNARA_API_OUT_OF_MEMORY when there was error allocating memory
*/
int cynara_creds_dbus_get_user(DBusConnection *connection, const char *uniqueName,
* \par Important notes:
* Memory for returned user string should be freed with g_free().
* Allocated string is returned only, when function succeeds.
+ * If method is CLIENT_METHOD_DEFAULT then it will be chosen based on Cynara configuration file.
*
* \param[in] connection DBus connection to a bus. It manages incomming and outgoing messages
* \param[in] uniqueName DBus identifier of the client
* \return CYNARA_API_SUCCESS on success
* CYNARA_API_INVALID_PARAM when client is NULL or uniqueName or client has wrong
* value (i.e NULL or non-existing)
+ * CYNARA_API_CONFIGURATION_ERROR if the configuration file can not be opened or
+ * there are errors in configuration file.
* CYNARA_API_METHOD_NOT_SUPPORTED when requested method is not supported
*/
int cynara_creds_gdbus_get_client(GDBusConnection *connection, const gchar *uniqueName,
* \par Important notes:
* Memory for returned user string should be freed with g_free().
* Allocated string is returned only, when function succeeds.
+ * If method is USER_METHOD_DEFAULT then it will be chosen based on Cynara configuration file.
*
* \param[in] connection DBus connection to a bus. It manages incomming and outgoing messages
* \param[in] uniqueName DBus identifier of the client invoked by the user
* \return CYNARA_API_SUCCESS on success
* CYNARA_API_INVALID_PARAM when user is NULL or connection is not valid DBus connection or
* uniqueName does not represent a process conected to the DBus
+ * CYNARA_API_CONFIGURATION_ERROR if the configuration file can not be opened or
+ * there are errors in configuration file.
* CYNARA_API_METHOD_NOT_SUPPORTED when requested method is not supported
*/
int cynara_creds_gdbus_get_user(GDBusConnection *connection, const gchar *uniqueName,
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* \par Important notes:
* Memory for returned client string is obtained with malloc(), and should be freed with free().
* Allocated string is returned only, when function succeeds.
+ * If method is CLIENT_METHOD_DEFAULT then it will be chosen based on Cynara configuration file.
*
* \param[in] socket_fd Descriptor of open connected UNIX socket
* \param[in] method Method of client identifier creation
* CYNARA_API_INVALID_PARAM when client is NULL or socket_fd is not valid connected socket
* descriptor
* CYNARA_API_METHOD_NOT_SUPPORTED when requested method is not supported
+ * CYNARA_API_CONFIGURATION_ERROR if the configuration file can not be opened or
+ * there are errors in configuration file.
* CYNARA_API_OUT_OF_MEMORY when there was error allocating memory
*/
int cynara_creds_socket_get_client(int socket_fd, enum cynara_client_creds method, char **client);
* \par Important notes:
* Memory for returned user string is obtained with malloc(), and should be freed with free().
* Allocated string is returned only, when function succeeds.
+ * If method is USER_METHOD_DEFAULT then it will be chosen based on Cynara configuration file.
*
* \param[in] socket_fd Descriptor of open connected UNIX socket
* \param[in] method Method of user identifier creation
* CYNARA_API_INVALID_PARAM when user is NULL or socket_fd is not valid connected socket
* descriptor
* CYNARA_API_METHOD_NOT_SUPPORTED when requested method is not supported
+ * CYNARA_API_CONFIGURATION_ERROR if the configuration file can not be opened or
+ * there are errors in configuration file.
* CYNARA_API_OUT_OF_MEMORY when there was error allocating memory
*/
int cynara_creds_socket_get_user(int socket_fd, enum cynara_user_creds method, char **user);