#include "usign.h"
+#define USIGN_EXEC "/usr/bin/usign"
+
/*
* check for revoker deadlink in pubkeydir
* return true if a revoker exists, false otherwise
const char *usign_argv[16] = {0};
unsigned int usign_argc = 0;
- usign_argv[usign_argc++] = "/usr/bin/usign";
+ usign_argv[usign_argc++] = USIGN_EXEC;
usign_argv[usign_argc++] = "-S";
usign_argv[usign_argc++] = "-m";
usign_argv[usign_argc++] = msgfile;
if (pipe(fds))
return -1;
- usign_argv[usign_argc++] = "/usr/bin/usign";
+ usign_argv[usign_argc++] = USIGN_EXEC;
usign_argv[usign_argc++] = "-F";
if (pubkeyfile) {
default:
waitpid(pid, &status, 0);
+ status = WEXITSTATUS(status);
if (fingerprint && !WEXITSTATUS(status)) {
- memset(fingerprint, 0, 16);
- read(fds[0], fingerprint, 16);
+ memset(fingerprint, 0, 17);
+ read(fds[0], fingerprint, 17);
+ if (fingerprint[16] != '\n')
+ status = -1;
+
fingerprint[16] = '\0';
+
}
close(fds[0]);
close(fds[1]);
- return WEXITSTATUS(status);
+ return status;
}
return -1;
fprintf(stdout, "key %s has been revoked!\n", fingerprint);
return 1;
}
- usign_argv[usign_argc++] = "/usr/bin/usign";
+ usign_argv[usign_argc++] = USIGN_EXEC;
usign_argv[usign_argc++] = "-V";
usign_argv[usign_argc++] = "-m";
usign_argv[usign_argc++] = msgfile;