Check autofill service app id is validity 53/195553/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 14 Dec 2018 08:01:00 +0000 (17:01 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 14 Dec 2018 08:01:00 +0000 (17:01 +0900)
Change-Id: If6c0f1d0808d5a8a46555ab00c0da3601e74b426
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/autofill-daemon.c

index 3a4c9b3..0f267ab 100644 (file)
@@ -604,10 +604,7 @@ static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_
         int ret = rpc_port_proxy_AutofillSvcPort_destroy(svc_rpc_h);
         LOGD("ret : %d", ret);
     }
-    else {
-        LOGW("Not initialized");
-        return false;
-    }
+
     svc_rpc_h = NULL;
 
     connect_service();
@@ -690,6 +687,7 @@ static bool __manager_get_autofill_service_list_cb(rpc_port_stub_AutofillManager
 static int connect_service()
 {
     int ret;
+    size_t service_id_len;
 
     rpc_port_proxy_AutofillSvcPort_callback_s rpc_callback = {
         .connected = __on_connected,
@@ -704,7 +702,7 @@ static int connect_service()
 
     char *active_autofill_service_id = NULL;
     autofill_config_get_autofill_service_app_id(&active_autofill_service_id);
-    LOGD("autofill service : %s", active_autofill_service_id);
+    LOGD("autofill service : '%s'", active_autofill_service_id);
 
     if (!active_autofill_service_id) {
         active_autofill_service_id = strdup(AUTOFILL_SERVICE_APP_ID);
@@ -712,8 +710,18 @@ static int connect_service()
 
     if (active_autofill_service_id) {
         autofill_config_set_autofill_service_app_id(active_autofill_service_id);
-        ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &svc_rpc_h);
+        service_id_len = strlen(active_autofill_service_id);
+
+        if (service_id_len > 0) {
+            ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &svc_rpc_h);
+        }
         free(active_autofill_service_id);
+
+        if (service_id_len == 0) {
+            LOGD("No Autofill service to connect");
+            return false;
+        }
+
         if (ret != RPC_PORT_ERROR_NONE) {
             LOGW("Failed to create rpc port. err = %d", ret);
             return false;