Fix client pid check 24/240524/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 7 Aug 2020 05:49:08 +0000 (14:49 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 7 Aug 2020 05:49:08 +0000 (14:49 +0900)
If the loader context is a hydra loader, launchpad doesn't check the
client process ID. The child process of the hydra loader tries to
connect to the launchpad-process-pool. If launchpad rejects the request,
the child process of the hydra loader will be terminated.

Change-Id: If4898ba64acb75f647086e266289a669f83673d5
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad/src/launchpad.c

index 6e9864d..804aa23 100644 (file)
@@ -629,7 +629,7 @@ static int __accept_candidate_process(int server_fd, int *out_client_fd,
                goto error;
        }
 
-       if (cred.pid != cpc_pid) {
+       if (cpc_pid != -1 && cred.pid != cpc_pid) {
                _E("Invalid accept. pid(%d)", cred.pid);
                goto error;
        }
@@ -1449,7 +1449,7 @@ static bool __handle_loader_event(int fd, io_condition_e cond, void *data)
 
        if (!cpc->prepared) {
                ret = __accept_candidate_process(fd, &client_fd, &client_pid,
-                                       cpc->pid);
+                                       cpc->is_hydra ? -1 : cpc->pid);
                if (ret >= 0) {
                        /* for hydra need to set pid to pid of non-hydra candidate, */
                        /* which is connecting now */