|
|
70aaeb7 |
From c13cc0b03dcae9a743cc49aaa62c3923a3e7d8f9 Mon Sep 17 00:00:00 2001
|
|
|
70aaeb7 |
From: Peter Jones <pjones@redhat.com>
|
|
|
70aaeb7 |
Date: Wed, 17 Oct 2012 09:55:02 -0400
|
|
|
70aaeb7 |
Subject: [PATCH 4/4] Make sure we actually look up the certificate when not
|
|
|
70aaeb7 |
in daemon mode.
|
|
|
70aaeb7 |
|
|
|
70aaeb7 |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
70aaeb7 |
---
|
|
|
70aaeb7 |
src/pesign.c | 24 +++++++++++++++---------
|
|
|
70aaeb7 |
1 file changed, 15 insertions(+), 9 deletions(-)
|
|
|
70aaeb7 |
|
|
|
70aaeb7 |
diff --git a/src/pesign.c b/src/pesign.c
|
|
|
70aaeb7 |
index 108994e..4ddf636 100644
|
|
|
70aaeb7 |
--- a/src/pesign.c
|
|
|
70aaeb7 |
+++ b/src/pesign.c
|
|
|
70aaeb7 |
@@ -500,12 +500,6 @@ main(int argc, char *argv[])
|
|
|
70aaeb7 |
POPT_TABLEEND
|
|
|
70aaeb7 |
};
|
|
|
70aaeb7 |
|
|
|
70aaeb7 |
- tokenname = strdup(tokenname);
|
|
|
70aaeb7 |
- if (!tokenname) {
|
|
|
70aaeb7 |
- fprintf(stderr, "could not allocate memory: %m\n");
|
|
|
70aaeb7 |
- exit(1);
|
|
|
70aaeb7 |
- }
|
|
|
70aaeb7 |
-
|
|
|
70aaeb7 |
if (!daemon) {
|
|
|
70aaeb7 |
SECStatus status = NSS_Init("/etc/pki/pesign");
|
|
|
70aaeb7 |
if (status != SECSuccess) {
|
|
|
70aaeb7 |
@@ -521,8 +515,6 @@ main(int argc, char *argv[])
|
|
|
70aaeb7 |
exit(1);
|
|
|
70aaeb7 |
}
|
|
|
70aaeb7 |
|
|
|
70aaeb7 |
- ctx.cms_ctx->certname = certname ? strdup(certname) : NULL;
|
|
|
70aaeb7 |
-
|
|
|
70aaeb7 |
optCon = poptGetContext("pesign", argc, (const char **)argv, options,0);
|
|
|
70aaeb7 |
|
|
|
70aaeb7 |
rc = poptReadDefaultConfig(optCon, 0);
|
|
|
70aaeb7 |
@@ -559,7 +551,21 @@ main(int argc, char *argv[])
|
|
|
70aaeb7 |
exit(!is_help);
|
|
|
70aaeb7 |
}
|
|
|
70aaeb7 |
|
|
|
70aaeb7 |
- ctx.cms_ctx->tokenname = tokenname;
|
|
|
70aaeb7 |
+ ctx.cms_ctx->tokenname = tokenname ?
|
|
|
70aaeb7 |
+ PORT_ArenaStrdup(ctx.cms_ctx->arena, tokenname) : NULL;
|
|
|
70aaeb7 |
+ if (!ctx.cms_ctx->tokenname) {
|
|
|
70aaeb7 |
+ fprintf(stderr, "could not allocate token name: %s\n",
|
|
|
70aaeb7 |
+ PORT_ErrorToString(PORT_GetError()));
|
|
|
70aaeb7 |
+ exit(1);
|
|
|
70aaeb7 |
+ }
|
|
|
70aaeb7 |
+
|
|
|
70aaeb7 |
+ ctx.cms_ctx->certname = certname ?
|
|
|
70aaeb7 |
+ PORT_ArenaStrdup(ctx.cms_ctx->arena, certname) : NULL;
|
|
|
70aaeb7 |
+ if (!ctx.cms_ctx->certname) {
|
|
|
70aaeb7 |
+ fprintf(stderr, "could not allocate certificate name: %s\n",
|
|
|
70aaeb7 |
+ PORT_ErrorToString(PORT_GetError()));
|
|
|
70aaeb7 |
+ exit(1);
|
|
|
70aaeb7 |
+ }
|
|
|
70aaeb7 |
|
|
|
70aaeb7 |
int action = 0;
|
|
|
70aaeb7 |
if (daemon)
|
|
|
70aaeb7 |
--
|
|
|
70aaeb7 |
1.7.12.1
|
|
|
70aaeb7 |
|