switch (sig_type) {
case RPMSIG_PGP262_1024:
+ if (! getVar(RPMVAR_PGP_NAME)) {
+ error(RPMERR_SIGGEN, "You must set \"pgp_name:\" in /etc/rpmrc\n");
+ return RPMERR_SIGGEN;
+ }
if ((res = makePGPSignature(file, ofd, passPhrase)) == -1) {
/* This is the 151 byte sig hack */
return makePGPSignature(file, ofd, passPhrase);
{
char *pass;
+ if (! getVar(RPMVAR_PGP_NAME)) {
+ error(RPMERR_SIGGEN,
+ "You must set \"pgp_name:\" in your rpmrc file");
+ return NULL;
+ }
+
if (prompt) {
pass = getpass(prompt);
} else {
static int checkPassPhrase(char *passPhrase)
{
- char secring[1024];
- char pubring[1024];
char name[1024];
int passPhrasePipe[2];
FILE *fpipe;
int fd;
sprintf(name, "+myname=\"%s\"", getVar(RPMVAR_PGP_NAME));
- sprintf(secring, "+secring=\"%s\"", getVar(RPMVAR_PGP_SECRING));
- sprintf(pubring, "+pubring=\"%s\"", getVar(RPMVAR_PGP_PUBRING));
pipe(passPhrasePipe);
if (!(pid = fork())) {
close(0);
close(1);
- close(2);
+ if (! isVerbose()) {
+ close(2);
+ }
if ((fd = open("/dev/null", O_RDONLY)) != 0) {
dup2(fd, 0);
}
}
dup2(passPhrasePipe[0], 3);
setenv("PGPPASSFD", "3", 1);
- setenv("PGPPATH", getVar(RPMVAR_PGP_PATH), 1);
+ if (getVar(RPMVAR_PGP_PATH)) {
+ setenv("PGPPATH", getVar(RPMVAR_PGP_PATH), 1);
+ }
execlp("pgp", "pgp",
"+batchmode=on", "+verbose=0",
- name, secring, pubring,
- "-sf",
+ name, "-sf",
NULL);
error(RPMERR_EXEC, "Couldn't exec pgp");
exit(RPMERR_EXEC);
static int makePGPSignature(char *file, int ofd, char *passPhrase)
{
- char secring[1024];
- char pubring[1024];
char name[1024];
char sigfile[1024];
int pid, status;
struct stat statbuf;
sprintf(name, "+myname=\"%s\"", getVar(RPMVAR_PGP_NAME));
- sprintf(secring, "+secring=\"%s\"", getVar(RPMVAR_PGP_SECRING));
- sprintf(pubring, "+pubring=\"%s\"", getVar(RPMVAR_PGP_PUBRING));
sprintf(sigfile, "%s.sig", file);
dup2(inpipe[0], 3);
close(inpipe[1]);
setenv("PGPPASSFD", "3", 1);
- setenv("PGPPATH", getVar(RPMVAR_PGP_PATH), 1);
+ if (getVar(RPMVAR_PGP_PATH)) {
+ setenv("PGPPATH", getVar(RPMVAR_PGP_PATH), 1);
+ }
/* setenv("PGPPASS", passPhrase, 1); */
execlp("pgp", "pgp",
"+batchmode=on", "+verbose=0", "+armor=off",
- name, secring, pubring,
- "-sb", file, sigfile,
+ name, "-sb", file, sigfile,
NULL);
error(RPMERR_EXEC, "Couldn't exec pgp");
exit(RPMERR_EXEC);
char *datafile;
int count, sfd, pid, status, outpipe[2];
unsigned char buf[8192];
- char secring[1024];
- char pubring[1024];
FILE *file;
/* Write out the signature */
close(sfd);
/* Now run PGP */
- sprintf(secring, "+secring=\"%s\"", getVar(RPMVAR_PGP_SECRING));
- sprintf(pubring, "+pubring=\"%s\"", getVar(RPMVAR_PGP_PUBRING));
pipe(outpipe);
if (!(pid = fork())) {
close(1);
close(outpipe[0]);
dup2(outpipe[1], 1);
- setenv("PGPPATH", getVar(RPMVAR_PGP_PATH), 1);
+ if (getVar(RPMVAR_PGP_PATH)) {
+ setenv("PGPPATH", getVar(RPMVAR_PGP_PATH), 1);
+ }
execlp("pgp", "pgp",
"+batchmode=on", "+verbose=0",
- secring, pubring,
sigfile, datafile,
NULL);
printf("exec failed!\n");