int operation = 0;
int ret = 0;
char **args;
- char *inmode = "r", *outmode = "w";
+ const char *inmode = "r", *outmode = "w";
char *infile = NULL, *outfile = NULL;
char *signerfile = NULL, *recipfile = NULL;
char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
else
badarg = 1;
}
- else if (args_verify(&args, &badarg, bio_err, &vpm))
+ else if (args_verify(&args, NULL, &badarg, bio_err, &vpm))
continue;
else
badarg = 1;
}
else if (operation == SMIME_DECRYPT)
{
- if (!recipfile)
+ if (!recipfile && !keyfile)
{
- BIO_printf(bio_err, "No recipient certificate and key specified\n");
+ BIO_printf(bio_err, "No recipient certificate or key specified\n");
badarg = 1;
}
}
}
-static void nodes_print(BIO *out, char *name, STACK_OF(X509_POLICY_NODE) *nodes)
- {
- X509_POLICY_NODE *node;
- int i;
- BIO_printf(out, "%s Policies:", name);
- if (nodes)
- {
- BIO_puts(out, "\n");
- for (i = 0; i < sk_X509_POLICY_NODE_num(nodes); i++)
- {
- node = sk_X509_POLICY_NODE_value(nodes, i);
- X509_POLICY_NODE_print(out, node, 2);
- }
- }
- else
- BIO_puts(out, " <empty>\n");
- }
-
-static void policies_print(BIO *out, X509_STORE_CTX *ctx)
- {
- X509_POLICY_TREE *tree;
- int explicit_policy;
- tree = X509_STORE_CTX_get0_policy_tree(ctx);
- explicit_policy = X509_STORE_CTX_get_explicit_policy(ctx);
-
- BIO_printf(out, "Require explicit Policy: %s\n",
- explicit_policy ? "True" : "False");
-
- nodes_print(out, "Authority", X509_policy_tree_get0_policies(tree));
- nodes_print(out, "User", X509_policy_tree_get0_user_policies(tree));
- }
-
/* Minimal callback just to output policy info (if any) */
static int smime_cb(int ok, X509_STORE_CTX *ctx)
{
- BIO *out;
int error;
error = X509_STORE_CTX_get_error(ctx);
&& ((error != X509_V_OK) || (ok != 2)))
return ok;
- out = BIO_new_fp(stderr, BIO_NOCLOSE);
-
- policies_print(out, ctx);
-
- BIO_free(out);
+ policies_print(NULL, ctx);
return ok;