diff options
-rw-r--r-- | conf/afm-system-daemon.service.in | 3 | ||||
-rw-r--r-- | conf/afm-user-daemon.service.in | 2 | ||||
-rw-r--r-- | src/afm-binding.c | 18 | ||||
-rw-r--r-- | src/afm-urun.c | 12 |
4 files changed, 17 insertions, 18 deletions
diff --git a/conf/afm-system-daemon.service.in b/conf/afm-system-daemon.service.in index 75a45f9..0c0d71c 100644 --- a/conf/afm-system-daemon.service.in +++ b/conf/afm-system-daemon.service.in @@ -4,7 +4,8 @@ Description=Application Framework Master, system side [Service] User=afm Group=afm -ExecStart=/usr/bin/afb-daemon --name=afm-system-daemon -no-httpd --no-ldpaths --binding=@CMAKE_INSTALL_LIBEXECDIR@/afm/afm-binding.so --ws-server=sd:afm-main +SyslogIdentifier=afm-system-daemon +ExecStart=/usr/bin/afb-daemon --name=afm-system-daemon --no-httpd --no-ldpaths --binding=@CMAKE_INSTALL_FULL_LIBEXECDIR@/afm/afm-binding.so --ws-server=sd:afm-main Restart=on-failure RestartSec=5 CapabilityBoundingSet=CAP_DAC_OVERRIDE CAP_MAC_OVERRIDE diff --git a/conf/afm-user-daemon.service.in b/conf/afm-user-daemon.service.in index f536c82..11e479c 100644 --- a/conf/afm-user-daemon.service.in +++ b/conf/afm-user-daemon.service.in @@ -4,7 +4,7 @@ Description=Application Framework Master, User side [Service] Type=dbus BusName=org.AGL.afm.user -ExecStart=/usr/bin/afm-user-daemon --user-dbus=unix:path=%t/bus +ExecStart=/usr/bin/afm-user-daemon --user-dbus=unix:path=%t/bus unix:/run/afm/apis/ws/afm-main Environment=AFM_APP_INSTALL_DIR=%%r EnvironmentFile=-@afm_confdir@/unit.env.d/* Restart=on-failure diff --git a/src/afm-binding.c b/src/afm-binding.c index 19abc4e..3923462 100644 --- a/src/afm-binding.c +++ b/src/afm-binding.c @@ -104,7 +104,7 @@ static int onrunid(struct afb_req req, const char *method, int *runid) json = afb_req_json(req); if (wrap_json_unpack(json, "s", runid) - || wrap_json_unpack(json, "{ss}", "runid", runid)) { + && wrap_json_unpack(json, "{ss}", "runid", runid)) { INFO("bad request method %s: %s", method, json_object_to_json_string(json)); bad_request(req); @@ -158,7 +158,7 @@ static void detail(struct afb_req req) /* scan the request */ json = afb_req_json(req); if (wrap_json_unpack(json, "s", &appid) - || wrap_json_unpack(json, "{ss}", _id_, &appid)) { + && wrap_json_unpack(json, "{ss}", _id_, &appid)) { bad_request(req); return; } @@ -184,7 +184,7 @@ static void start(struct afb_req req) /* scan the request */ json = afb_req_json(req); if (wrap_json_unpack(json, "s", &appid) - || wrap_json_unpack(json, "{ss}", _id_, &appid)) { + && wrap_json_unpack(json, "{ss}", _id_, &appid)) { bad_request(req); return; } @@ -222,7 +222,7 @@ static void once(struct afb_req req) /* scan the request */ json = afb_req_json(req); if (wrap_json_unpack(json, "s", &appid) - || wrap_json_unpack(json, "{ss}", _id_, &appid)) { + && wrap_json_unpack(json, "{ss}", _id_, &appid)) { bad_request(req); return; } @@ -325,7 +325,7 @@ static void install(struct afb_req req) /* scan the request */ json = afb_req_json(req); if (wrap_json_unpack(json, "s", &wgtfile) - || wrap_json_unpack(json, "{ss s?s s?b s?b}", + && wrap_json_unpack(json, "{ss s?s s?b s?b}", "wgt", &wgtfile, "root", &root, "force", &force, @@ -338,6 +338,7 @@ static void install(struct afb_req req) if (ifo == NULL) afb_req_fail_f(req, "failed", "installation failed: %m"); else { + afm_udb_update(afudb); /* reload if needed */ if (reload) do_reloads(); @@ -365,7 +366,7 @@ static void uninstall(struct afb_req req) /* scan the request */ json = afb_req_json(req); if (wrap_json_unpack(json, "s", &idaver) - || wrap_json_unpack(json, "{ss s?s}", + && wrap_json_unpack(json, "{ss s?s}", _id_, &idaver, "root", &root)) { return bad_request(req); @@ -376,6 +377,7 @@ static void uninstall(struct afb_req req) if (rc) afb_req_fail_f(req, "failed", "uninstallation failed: %m"); else { + afm_udb_update(afudb); afb_req_success(req, NULL, NULL); application_list_changed(_uninstall_, idaver); } @@ -390,10 +392,6 @@ static int init() return -1; } - /* set the systemd's buses */ - systemd_set_bus(0, afb_daemon_get_system_bus()); - systemd_set_bus(1, afb_daemon_get_user_bus()); - /* create TRUE */ json_true = json_object_new_boolean(1); diff --git a/src/afm-urun.c b/src/afm-urun.c index b6418ac..d242df8 100644 --- a/src/afm-urun.c +++ b/src/afm-urun.c @@ -110,9 +110,9 @@ static int get_basis(struct json_object *appli, int *isuser, const char **dpath, /* get dpath of userid */ nun = alloca((size_t)(arodot - uname) + strlen(userid) + strlen(arodot) + 1); stpcpy(stpcpy(stpncpy(nun, uname, (size_t)(arodot - uname)), userid), arodot); - dp = systemd_unit_dpath_by_name(*isuser, uname, 1); + dp = systemd_unit_dpath_by_name(*isuser, nun, 1); if (dp == NULL) { - ERROR("Can't load unit of name %s for %s: %m", uname, uscope); + ERROR("Can't load unit of name %s for %s: %m", nun, uscope); goto error; } /* record the dpath */ @@ -255,7 +255,7 @@ int afm_urun_once(struct json_object *appli, int uid) if (rc < 0) { j_read_string_at(appli, "unit-scope", &uscope); j_read_string_at(appli, "unit-name", &uname); - ERROR("can't start %s unit %s", uscope, uname); + ERROR("can't start %s unit %s for uid %d", uscope, uname, uid); goto error; } @@ -263,13 +263,13 @@ int afm_urun_once(struct json_object *appli, int uid) if (state == NULL) { j_read_string_at(appli, "unit-scope", &uscope); j_read_string_at(appli, "unit-name", &uname); - ERROR("can't wait %s unit %s: %m", uscope, uname); + ERROR("can't wait %s unit %s for uid %d: %m", uscope, uname, uid); goto error; } if (state != SysD_State_Active) { j_read_string_at(appli, "unit-scope", &uscope); j_read_string_at(appli, "unit-name", &uname); - ERROR("start error %s unit %s: %s", uscope, uname, state); + ERROR("start error %s unit %s for uid %d: %s", uscope, uname, uid, state); goto error; } @@ -277,7 +277,7 @@ int afm_urun_once(struct json_object *appli, int uid) if (rc < 0) { j_read_string_at(appli, "unit-scope", &uscope); j_read_string_at(appli, "unit-name", &uname); - ERROR("can't getpid of %s unit %s: %m", uscope, uname); + ERROR("can't getpid of %s unit %s for uid %d: %m", uscope, uname, uid); goto error; } |