aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am5
-rw-r--r--src/af-usrd.c156
-rw-r--r--src/appfwk-run.c207
-rw-r--r--src/appfwk.c127
-rw-r--r--src/appfwk.h36
-rw-r--r--src/secmgr-wrap.c1
-rw-r--r--src/utils-jbus.c16
-rw-r--r--src/utils-jbus.h24
-rw-r--r--src/verbose.h4
-rw-r--r--src/wgt-config.c1
-rw-r--r--src/wgt-info.c2
-rw-r--r--src/wgtpkg-base64.c1
-rw-r--r--src/wgtpkg-certs.c1
-rw-r--r--src/wgtpkg-digsig.c1
-rw-r--r--src/wgtpkg-files.c3
-rw-r--r--src/wgtpkg-info.c3
-rw-r--r--src/wgtpkg-install.c1
-rw-r--r--src/wgtpkg-installer.c3
-rw-r--r--src/wgtpkg-pack.c3
-rw-r--r--src/wgtpkg-permissions.c3
-rw-r--r--src/wgtpkg-sign.c3
-rw-r--r--src/wgtpkg-workdir.c3
-rw-r--r--src/wgtpkg-xmlsec.c1
-rw-r--r--src/wgtpkg-zip.c1
24 files changed, 557 insertions, 49 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3465049..cb4d334 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,10 +3,11 @@ bin_PROGRAMS = \
wgtpkg-pack \
wgtpkg-sign \
wgtpkg-info \
- appfwk
+ af-usrd
OTHERSRCS = \
utils-dir.c \
+ utils-jbus.c \
verbose.c
WGTPKGSRCS = \
@@ -80,6 +81,6 @@ wgtpkg_installer_SOURCES = wgtpkg-installer.c ${WGTPKGSRCS} ${WGTSRCS} ${SECWRP}
wgtpkg_info_SOURCES = wgtpkg-info.c ${WGTPKGSRCS} ${WGTSRCS} ${OTHERSRCS}
-appfwk_SOURCES = ${APPFWK} ${WGTSRCS} ${OTHERSRCS}
+af_usrd_SOURCES = af-usrd.c ${APPFWK} ${WGTSRCS} ${OTHERSRCS}
diff --git a/src/af-usrd.c b/src/af-usrd.c
new file mode 100644
index 0000000..f7e039f
--- /dev/null
+++ b/src/af-usrd.c
@@ -0,0 +1,156 @@
+/*
+ Copyright 2015 IoT.bzh
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include <json.h>
+
+#include "verbose.h"
+#include "utils-jbus.h"
+#include "appfwk.h"
+
+static struct jbus *jbus;
+static struct appfwk *appfwk;
+
+const char error_nothing[] = "[]";
+const char error_not_found[] = "{\"status\":\"error: not found\"}";
+
+static const char *getappid(struct json_object *obj)
+{
+ return json_object_get_string(obj);
+}
+
+static const char *getrunid(struct json_object *obj)
+{
+ return json_object_get_string(obj);
+}
+
+static void reply(struct jreq *jreq, struct json_object *resp, const char *errstr)
+{
+ if (obj)
+ jbus_reply(jreq, resp);
+ else
+ jbus_replyj(jreq, errstr);
+}
+
+static void on_runnables(struct jreq *jreq, struct json_object *obj)
+{
+ struct json_object *resp = appfwk_application_list(appfwk);
+ jbus_reply(jreq, resp);
+ json_object_put(obj);
+}
+
+static void on_detail(struct jreq *jreq, struct json_object *obj)
+{
+ const char *appid = getappid(obj);
+ struct json_object *resp = appfwk_get_application_public(appfwk, appid);
+ reply(jreq, resp, error_not_found);
+ json_object_put(obj);
+}
+
+static void on_start(struct jreq *jreq, struct json_object *obj)
+{
+ const char *appid = getappid(obj);
+ const char *runid = appfwk_start(appfwk, appid);
+ jbus_replyj(jreq, runid ? runid : error_not_found);
+ json_object_put(obj);
+}
+
+static void on_stop(struct jreq *jreq, struct json_object *obj)
+{
+ const char *runid = getrunid(obj);
+ int status = appfwk_stop(appfwk, runid);
+ jbus_replyj(jreq, status ? error_not_found : "true");
+ json_object_put(obj);
+}
+
+static void on_suspend(struct jreq *jreq, struct json_object *obj)
+{
+ const char *runid = getrunid(obj);
+ int status = appfwk_suspend(appfwk, runid);
+ jbus_replyj(jreq, status ? error_not_found : "true");
+ json_object_put(obj);
+}
+
+static void on_resume(struct jreq *jreq, struct json_object *obj)
+{
+ const char *runid = getrunid(obj);
+ int status = appfwk_resume(appfwk, runid);
+ jbus_replyj(jreq, status ? error_not_found : "true");
+ json_object_put(obj);
+}
+
+static void on_runners(struct jreq *jreq, struct json_object *obj)
+{
+ struct json_object *resp = appfwk_running_list(appfwk);
+ jbus_reply(jreq, resp);
+ json_object_put(obj);
+}
+
+static void on_state(struct jreq *jreq, struct json_object *obj)
+{
+ const char *runid = getrunid(obj);
+ int status = appfwk_state(appfwk, runid);
+ jbus_replyj(jreq, status ? error_not_found : "true");
+ json_object_put(obj);
+}
+
+int main(int ac, char **av)
+{
+ LOGAUTH("af-usrd");
+
+ /* init framework */
+ appfwk = appfwk_create();
+ if (!appfwk) {
+ ERROR("appfwk_create failed");
+ return 1;
+ }
+ if (appfwk_add_root(appfwk, FWK_APP_DIR)) {
+ ERROR("can't add root %s", FWK_APP_DIR);
+ return 1;
+ }
+ if (appfwk_update_applications(appfwk)) {
+ ERROR("appfwk_update_applications failed");
+ return 1;
+ }
+
+ /* init service */
+ jbus = create_jbus(1, "/org/automotive/linux/framework");
+ if (!jbus) {
+ ERROR("create_jbus failed");
+ return 1;
+ }
+ if(jbus_add_service(jbus, "runnables", on_runnables)
+ || jbus_add_service(jbus, "detail", on_detail)
+ || jbus_add_service(jbus, "start", on_run)
+ || jbus_add_service(jbus, "stop", on_stop)
+ || jbus_add_service(jbus, "suspend", on_suspend)
+ || jbus_add_service(jbus, "resume", on_resume)
+ || jbus_add_service(jbus, "runners", on_runners)
+ || jbus_add_service(jbus, "state", on_state)) {
+ ERROR("adding services failed");
+ return 1;
+ }
+
+ /* start and run */
+ if (jbus_start_serving(jbus)) {
+ ERROR("cant start server");
+ return 1;
+ }
+ while (!jbus_read_write_dispatch(jbus, -1));
+ return 0;
+}
+
+
+
diff --git a/src/appfwk-run.c b/src/appfwk-run.c
new file mode 100644
index 0000000..1c7fcaa
--- /dev/null
+++ b/src/appfwk-run.c
@@ -0,0 +1,207 @@
+/*
+ Copyright 2015 IoT.bzh
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include <unistd.h>
+
+
+
+
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <json.h>
+
+#include <wgt-info.h>
+
+
+enum appstate {
+ as_in_progress,
+ as_running,
+ as_paused,
+ as_stopping
+};
+
+struct apprun {
+ struct apprun *next;
+ int runid;
+ enum appstate state;
+ pid_t backend;
+ pid_t frontend;
+};
+
+#define ROOT_RUNNERS_COUNT 32
+#define MAX_RUNNER_COUNT 32767
+
+static struct apprun *runners[ROOT_RUNNERS_COUNT];
+static int runnercount = 0;
+static int runnerid = 0;
+
+static struct apprun *getrunner(int id)
+{
+ struct apprun *result = runners[id & (ROOT_RUNNERS_COUNT - 1)];
+ while (result && result->id != id)
+ result = result->next;
+ return result;
+}
+
+static void freerunner(struct apprun *runner)
+{
+ struct apprun **prev = &[runner->id & (ROOT_RUNNERS_COUNT - 1)];
+ assert(*prev);
+ while(*prev != runner) {
+ prev = &(*prev)->next;
+ assert(*prev);
+ }
+ *prev = runner->next;
+ free(runner);
+ runnercount--;
+}
+
+static struct apprun *createrunner()
+{
+ struct apprun *result;
+
+ if (runnercount >= MAX_RUNNER_COUNT)
+ return NULL;
+ do {
+ runnerid++;
+ if (runnerid > MAX_RUNNER_COUNT)
+ runnerid = 1;
+ } while(getrunner(runnerid));
+ result = malloc(sizeof * result);
+ if (result) {
+ result->id = runnerid;
+ result->state = as_in_progress;
+ result->backend = 0;
+ result->frontend = 0;
+ result->next = runners[runnerid & (ROOT_RUNNERS_COUNT - 1)];
+ runners[runnerid & (ROOT_RUNNERS_COUNT - 1)] = result;
+ runnercount++;
+ }
+ return result;
+}
+
+int appfwk_run_start(struct json_object *appli)
+{
+}
+
+int appfwk_run_stop()
+{
+}
+
+
+static struct json_object *mkrunner(const char *appid, const char *runid)
+{
+ struct json_object *result = json_object_new_object();
+ if (result) {
+ if(json_add_str(result, "id", appid)
+ || json_add_str(result, "runid", runid)
+ || json_add_str(result, "state", NULL)) {
+ json_object_put(result);
+ result = NULL;
+ }
+ }
+ return result;
+}
+
+const char *appfwk_start(struct appfwk *af, const char *appid)
+{
+ struct json_object *appli;
+ struct json_object *runner;
+ char buffer[250];
+
+ /* get the application description */
+ appli = appfwk_get_application(af, appid);
+ if (appli == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ /* prepare the execution */
+ snprintf(buffer, sizeof buffer, "{\"id\":\"%s\",\"runid\":\"%s\"
+}
+
+int appfwk_stop(struct appfwk *af, const char *runid)
+{
+ struct json_object *runner;
+ runner = appfwk_state(af, runid);
+ if (runner == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+ json_object_get(runner);
+ json_object_object_del(af->runners, runid);
+
+
+
+
+
+
+..........
+
+
+
+
+
+
+ json_object_put(runner);
+}
+
+int appfwk_suspend(struct appfwk *af, const char *runid)
+{
+}
+
+int appfwk_resume(struct appfwk *af, const char *runid)
+{
+}
+
+struct json_object *appfwk_running_list(struct appfwk *af)
+{
+ return af->runners;
+}
+
+struct json_object *appfwk_state(struct appfwk *af, const char *runid)
+{
+ struct json_object *result;
+ int status = json_object_object_get_ex(af->runners, runid, &result);
+ return status ? result : NULL;
+}
+
+
+
+
+
+
+
+#if defined(TESTAPPFWK)
+#include <stdio.h>
+int main()
+{
+struct appfwk *af = appfwk_create();
+appfwk_add_root(af,FWK_APP_DIR);
+appfwk_update_applications(af);
+printf("array = %s\n", json_object_to_json_string_ext(af->applications.pubarr, 3));
+printf("direct = %s\n", json_object_to_json_string_ext(af->applications.direct, 3));
+printf("byapp = %s\n", json_object_to_json_string_ext(af->applications.byapp, 3));
+return 0;
+}
+#endif
+
diff --git a/src/appfwk.c b/src/appfwk.c
index 0ede96a..6a625ca 100644
--- a/src/appfwk.c
+++ b/src/appfwk.c
@@ -38,20 +38,28 @@ struct appfwk {
int nrroots;
char **roots;
struct afapps applications;
+ struct json_object *runners;
};
struct appfwk *appfwk_create()
{
struct appfwk *appfwk = malloc(sizeof * appfwk);
- if (!appfwk)
+ if (appfwk == NULL)
errno = ENOMEM;
else {
- appfwk->refcount = 1;
- appfwk->nrroots = 0;
- appfwk->roots = NULL;
- appfwk->applications.pubarr = NULL;
- appfwk->applications.direct = NULL;
- appfwk->applications.byapp = NULL;
+ appfwk->runners = json_object_new_object();
+ if (appfwk->runners == NULL) {
+ free(appfwk);
+ appfwk = NULL;
+ errno = ENOMEM;
+ } else {
+ appfwk->refcount = 1;
+ appfwk->nrroots = 0;
+ appfwk->roots = NULL;
+ appfwk->applications.pubarr = NULL;
+ appfwk->applications.direct = NULL;
+ appfwk->applications.byapp = NULL;
+ }
}
return appfwk;
}
@@ -66,6 +74,10 @@ void appfwk_unref(struct appfwk *appfwk)
{
assert(appfwk);
if (!--appfwk->refcount) {
+ json_object_put(appfwk->applications.pubarr);
+ json_object_put(appfwk->applications.direct);
+ json_object_put(appfwk->applications.byapp);
+ json_object_put(appfwk->runners);
while (appfwk->nrroots)
free(appfwk->roots[--appfwk->nrroots]);
free(appfwk->roots);
@@ -325,12 +337,110 @@ int appfwk_ensure_applications(struct appfwk *af)
return af->applications.pubarr ? 0 : appfwk_update_applications(af);
}
-/* regenerate the list of applications */
struct json_object *appfwk_application_list(struct appfwk *af)
{
return appfwk_ensure_applications(af) ? NULL : af->applications.pubarr;
}
+struct json_object *appfwk_get_application(struct appfwk *af, const char *id)
+{
+ struct json_object *result;
+ if (!appfwk_ensure_applications(af) && json_object_object_get_ex(obj, id, &result))
+ return result;
+ }
+ return NULL;
+}
+
+struct json_object *appfwk_get_application_public(struct appfwk *af, const char *id)
+{
+ struct json_object *result = appfwk_get_application(af, id);
+ return result && json_object_object_get_ex(result, "public", &result) ? result : NULL;
+}
+
+static struct json_object *mkrunner(const char *appid, const char *runid)
+{
+ struct json_object *result = json_object_new_object();
+ if (result) {
+ if(json_add_str(result, "id", appid)
+ || json_add_str(result, "runid", runid)
+ || json_add_str(result, "state", NULL)) {
+ json_object_put(result);
+ result = NULL;
+ }
+ }
+ return result;
+}
+
+const char *appfwk_start(struct appfwk *af, const char *appid)
+{
+ struct json_object *appli;
+ struct json_object *runner;
+ char buffer[250];
+
+ /* get the application description */
+ appli = appfwk_get_application(af, appid);
+ if (appli == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ /* prepare the execution */
+ snprintf(buffer, sizeof buffer, "{\"id\":\"%s\",\"runid\":\"%s\"
+}
+
+int appfwk_stop(struct appfwk *af, const char *runid)
+{
+ struct json_object *runner;
+ runner = appfwk_state(af, runid);
+ if (runner == NULL) {
+ errno = ENOENT;
+ return -1;
+ }
+ json_object_get(runner);
+ json_object_object_del(af->runners, runid);
+
+
+
+
+
+
+..........
+
+
+
+
+
+
+ json_object_put(runner);
+}
+
+int appfwk_suspend(struct appfwk *af, const char *runid)
+{
+}
+
+int appfwk_resume(struct appfwk *af, const char *runid)
+{
+}
+
+struct json_object *appfwk_running_list(struct appfwk *af)
+{
+ return af->runners;
+}
+
+struct json_object *appfwk_state(struct appfwk *af, const char *runid)
+{
+ struct json_object *result;
+ int status = json_object_object_get_ex(af->runners, runid, &result);
+ return status ? result : NULL;
+}
+
+
+
+
+
+
+
+#if defined(TESTAPPFWK)
#include <stdio.h>
int main()
{
@@ -342,4 +452,5 @@ printf("direct = %s\n", json_object_to_json_string_ext(af->applications.direct,
printf("byapp = %s\n", json_object_to_json_string_ext(af->applications.byapp, 3));
return 0;
}
+#endif
diff --git a/src/appfwk.h b/src/appfwk.h
new file mode 100644
index 0000000..3e0d1b7
--- /dev/null
+++ b/src/appfwk.h
@@ -0,0 +1,36 @@
+/*
+ Copyright 2015 IoT.bzh
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+struct appfwk;
+
+extern struct appfwk *appfwk_create();
+extern void appfwk_addref(struct appfwk *appfwk);
+extern void appfwk_unref(struct appfwk *appfwk);
+
+extern int appfwk_add_root(struct appfwk *appfwk, const char *path);
+extern int appfwk_update_applications(struct appfwk *af);
+extern int appfwk_ensure_applications(struct appfwk *af);
+
+extern struct json_object *appfwk_application_list(struct appfwk *af);
+extern struct json_object *appfwk_get_application(struct appfwk *af, const char *id);
+extern struct json_object *appfwk_get_application_public(struct appfwk *af, const char *id);
+
+extern const char *appfwk_start(struct appfwk *af, const char *appid);
+extern int appfwk_stop(struct appfwk *af, const char *runid);
+extern int appfwk_suspend(struct appfwk *af, const char *runid);
+extern int appfwk_resume(struct appfwk *af, const char *runid);
+extern struct json_object *appfwk_running_list(struct appfwk *af);
+extern struct json_object *appfwk_state(struct appfwk *af, const char *runid);
diff --git a/src/secmgr-wrap.c b/src/secmgr-wrap.c
index 40c06b0..87aa5a5 100644
--- a/src/secmgr-wrap.c
+++ b/src/secmgr-wrap.c
@@ -17,7 +17,6 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
-#include <syslog.h>
#include <security-manager.h>
diff --git a/src/utils-jbus.c b/src/utils-jbus.c
index 988f9cf..8c144ad 100644
--- a/src/utils-jbus.c
+++ b/src/utils-jbus.c
@@ -291,14 +291,22 @@ int jbus_start_serving(struct jbus *jbus)
return 0;
case DBUS_REQUEST_NAME_REPLY_EXISTS:
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
+ default:
errno = EADDRINUSE;
return -1;
}
}
+int jbus_read_write_dispatch(struct jbus *jbus, int toms)
+{
+ if (dbus_connection_read_write_dispatch(jbus->connection, toms));
+ return 0;
+ errno = EPIPE;
+ return -1;
+}
+
int jbus_callj(struct jbus *jbus, const char *method, const char *query, void (*onresp)(int status, struct json_object *response, void *data), void *data)
{
- int rc;
DBusMessage *msg;
struct jrespw *resp;
@@ -374,7 +382,7 @@ int main()
int s2 = jbus_add_service(jbus, "incr", incr);
int s3 = jbus_start_serving(jbus);
printf("started %d %d %d\n", s1, s2, s3);
- while (dbus_connection_read_write_dispatch (jbus->connection, -1))
+ while (!jbus_read_write_dispatch (jbus, -1))
;
}
#endif
@@ -393,9 +401,9 @@ int main()
while(i--) {
jbus_callj(jbus, "ping", "{\"toto\":[1,2,3,4,true,\"toto\"]}", onresp, "ping");
jbus_callj(jbus, "incr", "{\"doit\":\"for-me\"}", onresp, "incr");
- dbus_connection_read_write_dispatch (jbus->connection, 1);
+ jbus_read_write_dispatch (jbus, 1);
}
- while (dbus_connection_read_write_dispatch (jbus->connection, -1))
+ while (!jbus_read_write_dispatch (jbus, -1))
;
}
#endif
diff --git a/src/utils-jbus.h b/src/utils-jbus.h
index e751086..1e4a033 100644
--- a/src/utils-jbus.h
+++ b/src/utils-jbus.h
@@ -18,16 +18,16 @@
struct jreq;
struct jbus;
-
-struct jbus *create_jbus(int session, const char *path);
-void jbus_addref(struct jbus *jbus);
-void jbus_unref(struct jbus *jbus);
-
-int jbus_replyj(struct jreq *jreq, const char *reply);
-int jbus_reply(struct jreq *jreq, struct json_object *reply);
-int jbus_add_service(struct jbus *jbus, const char *method, void (*oncall)(struct jreq *, struct json_object *));
-int jbus_start_serving(struct jbus *jbus);
-
-int jbus_callj(struct jbus *jbus, const char *method, const char *query, void (*onresp)(int, struct json_object *, void *), void *data);
-int jbus_call(struct jbus *jbus, const char *method, struct json_object *query, void (*onresp)(int, struct json_object *response, void *), void *data);
+extern struct jbus *create_jbus(int session, const char *path);
+extern void jbus_addref(struct jbus *jbus);
+extern void jbus_unref(struct jbus *jbus);
+
+extern int jbus_replyj(struct jreq *jreq, const char *reply);
+extern int jbus_reply(struct jreq *jreq, struct json_object *reply);
+extern int jbus_add_service(struct jbus *jbus, const char *method, void (*oncall)(struct jreq *, struct json_object *));
+extern int jbus_start_serving(struct jbus *jbus);
+extern int jbus_read_write_dispatch(struct jbus *jbus, int toms);
+
+extern int jbus_callj(struct jbus *jbus, const char *method, const char *query, void (*onresp)(int, struct json_object *, void *), void *data);
+extern int jbus_call(struct jbus *jbus, const char *method, struct json_object *query, void (*onresp)(int, struct json_object *response, void *), void *data);
diff --git a/src/verbose.h b/src/verbose.h
index 8103539..082a9b1 100644
--- a/src/verbose.h
+++ b/src/verbose.h
@@ -17,6 +17,8 @@
#if !defined(NDEBUG)
#include <syslog.h>
extern int verbosity;
+#define LOGUSER(app) openlog(app,LOG_PERROR,LOG_USER)
+#define LOGAUTH(app) openlog(app,LOG_PERROR,LOG_AUTH)
#define ERROR(...) syslog(LOG_ERR,__VA_ARGS__)
#define WARNING(...) do{if(verbosity)syslog(LOG_WARNING,__VA_ARGS__);}while(0)
#define NOTICE(...) do{if(verbosity)syslog(LOG_NOTICE,__VA_ARGS__);}while(0)
@@ -24,6 +26,8 @@ extern int verbosity;
#define DEBUG(...) do{if(verbosity>1)syslog(LOG_DEBUG,__VA_ARGS__);}while(0)
#else
#include <syslog.h>
+#define LOGUSER(app) openlog(app,LOG_PERROR,LOG_USER)
+#define LOGAUTH(app) openlog(app,LOG_PERROR,LOG_AUTH)
extern void verbose_error(const char *file, int line);
#define ERROR(...) verbose_error(__FILE__,__LINE__)
#define WARNING(...) do{/*nothing*/}while(0)
diff --git a/src/wgt-config.c b/src/wgt-config.c
index 2e32628..cdf501c 100644
--- a/src/wgt-config.c
+++ b/src/wgt-config.c
@@ -16,7 +16,6 @@
#include <unistd.h>
#include <string.h>
-#include <syslog.h>
#include <assert.h>
#include <errno.h>
diff --git a/src/wgt-info.c b/src/wgt-info.c
index 019f8ce..816ec12 100644
--- a/src/wgt-info.c
+++ b/src/wgt-info.c
@@ -18,7 +18,7 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
-#include <syslog.h>
+
#include <libxml/tree.h>
#include "verbose.h"
diff --git a/src/wgtpkg-base64.c b/src/wgtpkg-base64.c
index 4e6d84e..a1099f0 100644
--- a/src/wgtpkg-base64.c
+++ b/src/wgtpkg-base64.c
@@ -17,7 +17,6 @@
#include <stdlib.h>
#include <string.h>
-#include <syslog.h>
#include "verbose.h"
#include "wgtpkg.h"
diff --git a/src/wgtpkg-certs.c b/src/wgtpkg-certs.c
index 98118f9..da5029c 100644
--- a/src/wgtpkg-certs.c
+++ b/src/wgtpkg-certs.c
@@ -15,7 +15,6 @@
*/
-#include <syslog.h>
#include <openssl/x509.h>
#include "verbose.h"
diff --git a/src/wgtpkg-digsig.c b/src/wgtpkg-digsig.c
index ed78354..a146741 100644
--- a/src/wgtpkg-digsig.c
+++ b/src/wgtpkg-digsig.c
@@ -16,7 +16,6 @@
#include <string.h>
-#include <syslog.h>
#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/wgtpkg-files.c b/src/wgtpkg-files.c
index ed63726..bb758e0 100644
--- a/src/wgtpkg-files.c
+++ b/src/wgtpkg-files.c
@@ -18,7 +18,6 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
-#include <syslog.h>
#include <dirent.h>
#include <stdio.h>
#include <fcntl.h>
@@ -55,7 +54,7 @@ static unsigned int what_signature(const char *name)
while ('0' <= name[len] && name[len] <= '9') {
nid = 10 * id + (unsigned int)(name[len++] - '0');
if (nid < id || nid == UINT_MAX) {
- syslog(LOG_WARNING, "number too big for %s", name);
+ WARNING("number too big for %s", name);
return 0;
}
id = nid;
diff --git a/src/wgtpkg-info.c b/src/wgtpkg-info.c
index f8778e0..1ed4de6 100644
--- a/src/wgtpkg-info.c
+++ b/src/wgtpkg-info.c
@@ -22,7 +22,6 @@
#include <unistd.h>
#include <limits.h>
#include <errno.h>
-#include <syslog.h>
#include <getopt.h>
#include "verbose.h"
@@ -59,7 +58,7 @@ int main(int ac, char **av)
int i;
char *wpath;
- openlog(appname, LOG_PERROR, LOG_USER);
+ LOGUSER(appname);
xmlsec_init();
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 096903b..4825d1c 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -17,7 +17,6 @@
#define _GNU_SOURCE
#include <errno.h>
-#include <syslog.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
diff --git a/src/wgtpkg-installer.c b/src/wgtpkg-installer.c
index 3d9c237..def311c 100644
--- a/src/wgtpkg-installer.c
+++ b/src/wgtpkg-installer.c
@@ -23,7 +23,6 @@
#include <unistd.h>
#include <limits.h>
#include <errno.h>
-#include <syslog.h>
#include <getopt.h>
#include "verbose.h"
@@ -62,7 +61,7 @@ int main(int ac, char **av)
{
int i;
- openlog(appname, LOG_PERROR, LOG_AUTH);
+ LOGAUTH(appname);
xmlsec_init();
diff --git a/src/wgtpkg-pack.c b/src/wgtpkg-pack.c
index b8e49e2..483ec89 100644
--- a/src/wgtpkg-pack.c
+++ b/src/wgtpkg-pack.c
@@ -21,7 +21,6 @@
#include <unistd.h>
#include <limits.h>
#include <errno.h>
-#include <syslog.h>
#include <getopt.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -71,7 +70,7 @@ int main(int ac, char **av)
char *wgtfile, *directory, *x;
struct stat s;
- openlog(appname, LOG_PERROR, LOG_USER);
+ LOGUSER(appname);
force = 0;
wgtfile = directory = NULL;
diff --git a/src/wgtpkg-permissions.c b/src/wgtpkg-permissions.c
index ee38988..a6efd2a 100644
--- a/src/wgtpkg-permissions.c
+++ b/src/wgtpkg-permissions.c
@@ -17,7 +17,6 @@
#define _GNU_SOURCE
#include <errno.h>
-#include <syslog.h>
#include <string.h>
#include "verbose.h"
@@ -30,7 +29,7 @@ struct permission {
unsigned level: 3;
};
-static const char prefix_of_permissions[] = PREFIXPERMISSION;
+static const char prefix_of_permissions[] = FWK_PREFIX_PERMISSION;
static int nrpermissions = 0;
static struct permission *permissions = NULL;
diff --git a/src/wgtpkg-sign.c b/src/wgtpkg-sign.c
index be618a7..9df50ec 100644
--- a/src/wgtpkg-sign.c
+++ b/src/wgtpkg-sign.c
@@ -21,7 +21,6 @@
#include <unistd.h>
#include <limits.h>
#include <errno.h>
-#include <syslog.h>
#include <getopt.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -91,7 +90,7 @@ int main(int ac, char **av)
char *keyfile, *certfiles[MAXCERT+1], *directory, **x;
struct stat s;
- openlog(appname, LOG_PERROR, LOG_USER);
+ LOGUSER(appname);
force = ncert = author = 0;
number = UINT_MAX;
diff --git a/src/wgtpkg-workdir.c b/src/wgtpkg-workdir.c
index 1b8684c..81ae0c9 100644
--- a/src/wgtpkg-workdir.c
+++ b/src/wgtpkg-workdir.c
@@ -19,7 +19,6 @@
#include <unistd.h>
#include <string.h>
#include <dirent.h>
-#include <syslog.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
@@ -175,7 +174,7 @@ int make_workdir(int reuse)
static int move_real_workdir(const char *dest, int parents, int force)
{
- int rc, len, l;
+ int rc, len;
struct stat s;
char *copy;
const char *iter;
diff --git a/src/wgtpkg-xmlsec.c b/src/wgtpkg-xmlsec.c
index 6b6302e..31223ca 100644
--- a/src/wgtpkg-xmlsec.c
+++ b/src/wgtpkg-xmlsec.c
@@ -15,7 +15,6 @@
*/
-#include <syslog.h>
#include <unistd.h>
#include <stdio.h>
#include <dirent.h>
diff --git a/src/wgtpkg-zip.c b/src/wgtpkg-zip.c
index 8234bae..4984998 100644
--- a/src/wgtpkg-zip.c
+++ b/src/wgtpkg-zip.c
@@ -25,7 +25,6 @@
#include <assert.h>
#include <dirent.h>
#include <string.h>
-#include <syslog.h>
#include <unistd.h>
#include "verbose.h"