summaryrefslogtreecommitdiffstats
path: root/bin/worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/worker.c')
-rw-r--r--bin/worker.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/worker.c b/bin/worker.c
index 470acb2..1ca9233 100644
--- a/bin/worker.c
+++ b/bin/worker.c
@@ -26,6 +26,8 @@
#include <sys/un.h>
#include <unistd.h>
+#include <systemd/sd-daemon.h>
+
#include <iniparser.h>
#include <keyutils.h>
@@ -350,6 +352,12 @@ int main(int argc, char **argv) {
(void) tmp;
#endif
+ /* check that we are running from systemd */
+ if (sd_notify(0, "READY=0\nSTATUS=Work in progress...") <= 0) {
+ fprintf(stderr, "This is expected to run from a systemd service.\n");
+ goto out10;
+ }
+
/* initialize static memory */
memset(challenge, 0, CHALLENGELEN + 1);
memset(passphrase, 0, PASSPHRASELEN + 2);
@@ -387,6 +395,9 @@ int main(int argc, char **argv) {
if ((rc = walk_askpass(passphrase)) < 0)
goto out30;
+ /* notify systemd about success */
+ sd_notify(0, "READY=1\nSTATUS=All done.");
+
out30:
/* release Yubikey */
if (yk_release() == 0)