Remove usage of mw-list file in security-server
authorJan Cybulski <j.cybulski@samsung.com>
Thu, 11 Apr 2013 06:08:02 +0000 (08:08 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 11 Apr 2013 10:35:37 +0000 (12:35 +0200)
[Issue#]SSDWSSP-186
[Feature/Bug] N/A
[Problem] N/A
[Cause] N/A
[Solution] Removing hardcoded set of trusted daemon binaries.
Removing function search_middleware_exe_path and file with mw-list entries.
[Verification] Build, tests

Change-Id: I3f7bd1d37bc0b315642884801c80d3e308f78a2a

packaging/security-server.spec
src/CMakeLists.txt
src/communication/security-server-comm.c
src/include/security-server-common.h
src/mw-list [deleted file]

index 9885b4d..df20f30 100644 (file)
@@ -137,7 +137,6 @@ fi
 %defattr(-,root,root,-)
 /usr/lib/systemd/system/multi-user.target.wants/security-server.service
 /usr/lib/systemd/system/security-server.service
-/usr/share/security-server/mw-list
 %attr(755,root,root) /etc/rc.d/init.d/security-serverd
 %attr(755,root,root) /usr/bin/security-server
 
index 28ba4c5..15466cc 100644 (file)
@@ -67,11 +67,6 @@ INSTALL(FILES
     )
 
 INSTALL(FILES
-    ${SECURITY_SERVER_PATH}/mw-list
-    DESTINATION /usr/share/security-server
-    )
-
-INSTALL(FILES
     ${SECURITY_SERVER_PATH}/security-serverd
     DESTINATION /etc/rc.d/init.d
     )
index 3ea4780..4bd37c1 100644 (file)
@@ -2309,59 +2309,12 @@ error:
        return retval;
 }
 
-/* Checking client is pre-defined middleware daemons *
- * Check privilege API is only allowed to middleware daemons *
- * list of middleware daemons' executables are listed in
- * /usr/share/security-server/mw-list */
-int search_middleware_exe_path(char *exe)
-{
-       FILE *fp = NULL;
-       int ret= SECURITY_SERVER_ERROR_AUTHENTICATION_FAILED;
-       size_t len = 0;
-       ssize_t cnt = 0;
-       char *middleware = NULL;
-       int cmp = 0;
-
-       /* Open the list file */
-       fp = fopen(SECURITY_SERVER_MIDDLEWARE_LIST_PATH, "r");
-       if(fp == NULL)
-       {
-               /* error on file */
-               SEC_SVR_DBG("%s", "Error oening mw-list file");
-               return SECURITY_SERVER_ERROR_FILE_OPERATION;
-       }
-
-       /* read file line by line */
-       while ((cnt = getline(&middleware, &len, fp)) != -1) {
-
-           /* trim trailing whitespaces */
-        while (cnt > 0 && isspace(middleware[cnt-1])!=0 )
-            cnt--;
-        middleware[cnt]='\0';
-
-        /* compare middleware list entry with executable */
-        cmp = strcmp(middleware, exe);
-        free(middleware);
-        middleware = NULL;
-        if (cmp == 0)
-        {
-            /* found */
-            SEC_SVR_DBG("%s", "found matching executable");
-            ret = SECURITY_SERVER_SUCCESS;
-            break;
-        }
-    }
-       if(fp != NULL)
-               fclose(fp);
-       return ret;
-}
-
 /* Authenticate the application is middleware daemon
  * The middleware must run as root (or middleware user) and the cmd line must be
  * pre listed for authentication to succeed */
 int authenticate_client_middleware(int sockfd, int *pid)
 {
-       int retval = SECURITY_SERVER_ERROR_AUTHENTICATION_FAILED;
+       int retval = SECURITY_SERVER_SUCCESS;
        struct ucred cr;
        unsigned int cl = sizeof(cr);
        char *exe = NULL;
@@ -2415,8 +2368,6 @@ int authenticate_client_middleware(int sockfd, int *pid)
                goto error;
        }
 
-       /* Search executable of the peer that is really middleware executable */
-       retval = search_middleware_exe_path(exe);
        *pid = cr.pid;
 
 error:
index fa2bded..9350bba 100644 (file)
@@ -60,7 +60,6 @@
 #define SECURITY_SERVER_COOKIE_LEN                     20
 #define MAX_OBJECT_LABEL_LEN                            32
 #define MAX_MODE_STR_LEN                                16
-#define SECURITY_SERVER_MIDDLEWARE_LIST_PATH           "/usr/share/security-server/mw-list"
 #define SECURITY_SERVER_MAX_OBJ_NAME                   30
 #define SECURITY_SERVER_MSG_VERSION                    0x01
 #define SECURITY_SERVER_ACCEPT_TIMEOUT_MILISECOND      10000
diff --git a/src/mw-list b/src/mw-list
deleted file mode 100644 (file)
index 14a8890..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/usr/bin/telephony-server
-/usr/bin/ss-server
-/usr/bin/msg-server
-/usr/bin/alarm-server
-/usr/bin/lbs_server
-/usr/bin/power_manager
-/usr/bin/system_server
-/usr/bin/sec-svr-util
-/usr/bin/mdm-server
-/usr/bin/smartcard-daemon
-/usr/bin/sound_server
-/usr/bin/nfc-manager-daemon