summaryrefslogtreecommitdiff
path: root/rpmsign.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-10-13 13:19:35 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-10-13 13:24:15 +0300
commitf5e2b115db4db554cb05213535c5be4098f70bea (patch)
tree0f4db882fc3aef8a2b8e0d1edd5f660f45c36609 /rpmsign.c
parente4816d8819343677f810816ca1ef3ff66d8086e9 (diff)
downloadrpm-f5e2b115db4db554cb05213535c5be4098f70bea.tar.gz
Make rpmsign use the new signing interface (minimal conversion for now)
Diffstat (limited to 'rpmsign.c')
-rw-r--r--rpmsign.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/rpmsign.c b/rpmsign.c
index 2469c00bd..543bd8f11 100644
--- a/rpmsign.c
+++ b/rpmsign.c
@@ -92,7 +92,7 @@ static int checkPassPhrase(const char * passPhrase)
}
/* TODO: permit overriding macro setup on the command line */
-static int doSign(ARGV_const_t args)
+static int doSign(poptContext optCon)
{
int rc = EXIT_FAILURE;
char * passPhrase = NULL;
@@ -107,8 +107,11 @@ static int doSign(ARGV_const_t args)
passPhrase = getpass(_("Enter pass phrase: "));
passPhrase = (passPhrase != NULL) ? rstrdup(passPhrase) : NULL;
if (checkPassPhrase(passPhrase) == 0) {
+ const char *arg;
fprintf(stderr, _("Pass phrase is good.\n"));
- rc = rpmcliSign(args, 0, passPhrase);
+ while ((arg = poptGetArg(optCon)) != NULL) {
+ rc += rpmPkgSign(arg, NULL, passPhrase);
+ }
} else {
fprintf(stderr, _("Pass phrase check failed\n"));
}
@@ -122,25 +125,26 @@ int main(int argc, char *argv[])
{
int ec = EXIT_FAILURE;
poptContext optCon = rpmcliInit(argc, argv, optionsTable);
- ARGV_const_t args = NULL;
+ const char *arg;
if (argc <= 1) {
printUsage(optCon, stderr, 0);
goto exit;
}
- args = (ARGV_const_t) poptGetArgs(optCon);
- if (args == NULL) {
+ if (poptPeekArg(optCon) == NULL) {
argerror(_("no arguments given"));
}
switch (mode) {
case MODE_ADDSIGN:
case MODE_RESIGN:
- ec = doSign(args);
+ ec = doSign(optCon);
break;
case MODE_DELSIGN:
- ec = rpmcliSign(args, 1, NULL);
+ while ((arg = poptGetArg(optCon)) != NULL) {
+ ec += rpmPkgDelSign(arg);
+ }
break;
default:
argerror(_("only one major mode may be specified"));