summaryrefslogtreecommitdiff
path: root/lib/signature.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-06-16 01:49:10 +0000
committerjbj <devnull@localhost>2001-06-16 01:49:10 +0000
commit1ed6bde25a2d8c1878ed3b52298848d09a50bd3c (patch)
treeb5ea9304547d9db833cedb0c3b282a984d4fcf14 /lib/signature.c
parentc0ef3c810f0cb08f0dc65ebe83921d24ce2d13b7 (diff)
downloadlibrpm-tizen-1ed6bde25a2d8c1878ed3b52298848d09a50bd3c.tar.gz
librpm-tizen-1ed6bde25a2d8c1878ed3b52298848d09a50bd3c.tar.bz2
librpm-tizen-1ed6bde25a2d8c1878ed3b52298848d09a50bd3c.zip
linux.req now verified functional on ia64-linux.
CVS patchset: 4870 CVS date: 2001/06/16 01:49:10
Diffstat (limited to 'lib/signature.c')
-rw-r--r--lib/signature.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/signature.c b/lib/signature.c
index a60ffa837..c3c987dde 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -516,8 +516,7 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
/*@modifies *result, fileSystem @*/
{
int pid, status, outpipe[2];
- FD_t sfd;
-/*@observer@*/ const char * sigfile;
+/*@only@*/ /*@null@*/ const char * sigfile = NULL;
byte buf[BUFSIZ];
FILE *file;
int res = RPMSIG_OK;
@@ -540,6 +539,7 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
res = RPMSIG_BAD;
/* Write out the signature */
+#ifdef DYING
{ const char *tmppath = rpmGetPath("%{_tmppath}", NULL);
sigfile = tempnam(tmppath, "rpmsig");
tmppath = _free(tmppath);
@@ -549,6 +549,17 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
(void) Fwrite(sig, sizeof(char), count, sfd);
(void) Fclose(sfd);
}
+#else
+ { FD_t sfd;
+ if (!makeTempFile(NULL, &sigfile, &sfd)) {
+ (void) Fwrite(sig, sizeof(char), count, sfd);
+ (void) Fclose(sfd);
+ sfd = NULL;
+ }
+ }
+#endif
+ if (sigfile == NULL)
+ return RPMSIG_BAD;
/* Now run PGP */
outpipe[0] = outpipe[1] = 0;
@@ -620,6 +631,7 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
(void) waitpid(pid, &status, 0);
if (sigfile) (void) unlink(sigfile);
+ sigfile = _free(sigfile);
if (!res && (!WIFEXITED(status) || WEXITSTATUS(status))) {
res = RPMSIG_BAD;
}
@@ -633,13 +645,13 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
/*@modifies *result, fileSystem @*/
{
int pid, status, outpipe[2];
- FD_t sfd;
- char *sigfile;
+/*@only@*/ /*@null@*/ const char * sigfile = NULL;
byte buf[BUFSIZ];
FILE *file;
int res = RPMSIG_OK;
/* Write out the signature */
+#ifdef DYING
{ const char *tmppath = rpmGetPath("%{_tmppath}", NULL);
sigfile = tempnam(tmppath, "rpmsig");
tmppath = _free(tmppath);
@@ -649,6 +661,17 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
(void) Fwrite(sig, sizeof(char), count, sfd);
(void) Fclose(sfd);
}
+#else
+ { FD_t sfd;
+ if (!makeTempFile(NULL, &sigfile, &sfd)) {
+ (void) Fwrite(sig, sizeof(char), count, sfd);
+ (void) Fclose(sfd);
+ sfd = NULL;
+ }
+ }
+#endif
+ if (sigfile == NULL)
+ return RPMSIG_BAD;
/* Now run GPG */
outpipe[0] = outpipe[1] = 0;
@@ -688,6 +711,7 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
(void) waitpid(pid, &status, 0);
if (sigfile) (void) unlink(sigfile);
+ sigfile = _free(sigfile);
if (!res && (!WIFEXITED(status) || WEXITSTATUS(status))) {
res = RPMSIG_BAD;
}