Signalling attempt to access a non-existent service
authorRadoslaw Bartosiak <r.bartosiak@samsung.com>
Wed, 2 Apr 2014 16:28:20 +0000 (18:28 +0200)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Tue, 15 Apr 2014 10:11:18 +0000 (03:11 -0700)
[Bug]       Connect function does not notify on nonexisting service
[Cause]     N/A
[Solution]  New return code SECURITY_SERVER_API_ERROR_NO_SUCH_SERVICE is used
[Problem]   N/A

[Verification] build, run security-server tests

Change-Id: I1fcf9bf7ba46d02cb43585e3de6095829685d9e9
Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
src/include/security-server.h
src/server/client/client-common.cpp

index 85570f2..a69a7e1 100644 (file)
@@ -75,6 +75,9 @@
 /*! \brief   indicating the response from Security Server is malformed */
 #define SECURITY_SERVER_API_ERROR_BAD_RESPONSE -3
 
+/*! \brief   indicating the requested service does not exist */
+#define SECURITY_SERVER_API_ERROR_NO_SUCH_SERVICE -4
+
 /*! \brief   indicating requesting object is not exist */
 #define SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT -6
 
index b032974..00f099f 100644 (file)
@@ -107,7 +107,7 @@ public:
 
         if (strlen(interface) >= sizeof(clientAddr.sun_path)) {
             LogError("Error: interface name " << interface << "is too long. Max len is:" << sizeof(clientAddr.sun_path));
-            return SECURITY_SERVER_API_ERROR_SOCKET;
+            return SECURITY_SERVER_API_ERROR_NO_SUCH_SERVICE;
         }
 
         strcpy(clientAddr.sun_path, interface);
@@ -148,6 +148,8 @@ public:
             LogError("Error connecting socket: " << strerror(err));
             if (err == EACCES)
                 return SECURITY_SERVER_API_ERROR_ACCESS_DENIED;
+            if (err == ENOTSOCK)
+                return SECURITY_SERVER_API_ERROR_NO_SUCH_SERVICE;
             return SECURITY_SERVER_API_ERROR_SOCKET;
         }