move checksig/resign major modes into rpmlib.
CVS patchset: 3157 CVS date: 1999/07/14 16:47:30
This commit is contained in:
parent
4a0755d14f
commit
40d76f715b
1
CHANGES
1
CHANGES
|
@ -4,6 +4,7 @@
|
|||
- include shared libs in rpm-devel (no versioning yet).
|
||||
- add epoch (as [0-9]*:version-release) to install dependency parse.
|
||||
- move install/erase major modes into rpmlib.
|
||||
- move checksig/resign major modes into rpmlib.
|
||||
|
||||
3.0.1 -> 3.0.2
|
||||
- eliminate armv4 entries from rpmrc (Andrew E. Mileski).
|
||||
|
|
|
@ -40,9 +40,9 @@ pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \
|
|||
config.guess config.sub
|
||||
|
||||
noinst_HEADERS = \
|
||||
acconfig.h build.h checksig.h system.h
|
||||
acconfig.h build.h system.h
|
||||
|
||||
rpm_SOURCES = build.c checksig.c rpm.c
|
||||
rpm_SOURCES = build.c rpm.c
|
||||
rpm_LDADD = $(mylibs) @LIBMISC@
|
||||
|
||||
$(PROGRAMS): $(mylibs) @LIBMISC@
|
||||
|
|
353
checksig.c
353
checksig.c
|
@ -1,353 +0,0 @@
|
|||
/* checksig.c: verify the signature of an RPM */
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#include "build/rpmbuild.h"
|
||||
|
||||
#include "checksig.h"
|
||||
#include "rpmlead.h"
|
||||
#include "signature.h"
|
||||
|
||||
int doReSign(int add, char *passPhrase, const char **argv)
|
||||
{
|
||||
FD_t fd, ofd;
|
||||
int count;
|
||||
struct rpmlead lead;
|
||||
unsigned short sigtype;
|
||||
const char *rpm;
|
||||
const char *sigtarget;
|
||||
char tmprpm[1024];
|
||||
unsigned char buffer[8192];
|
||||
Header sig;
|
||||
|
||||
while (*argv) {
|
||||
rpm = *argv++;
|
||||
fprintf(stdout, "%s:\n", rpm);
|
||||
if (fdFileno(fd = fdOpen(rpm, O_RDONLY, 0644)) < 0) {
|
||||
fprintf(stderr, _("%s: Open failed\n"), rpm);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (readLead(fd, &lead)) {
|
||||
fprintf(stderr, _("%s: readLead failed\n"), rpm);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (lead.major == 1) {
|
||||
fprintf(stderr, _("%s: Can't sign v1.0 RPM\n"), rpm);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (lead.major == 2) {
|
||||
fprintf(stderr, _("%s: Can't re-sign v2.0 RPM\n"), rpm);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (rpmReadSignature(fd, &sig, lead.signature_type)) {
|
||||
fprintf(stderr, _("%s: rpmReadSignature failed\n"), rpm);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (add != ADD_SIGNATURE) {
|
||||
rpmFreeSignature(sig);
|
||||
}
|
||||
|
||||
/* Write the rest to a temp file */
|
||||
if (makeTempFile(NULL, &sigtarget, &ofd))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
while ((count = fdRead(fd, buffer, sizeof(buffer))) > 0) {
|
||||
if (count == -1) {
|
||||
perror(_("Couldn't read the header/archive"));
|
||||
fdClose(ofd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (fdWrite(ofd, buffer, count) < 0) {
|
||||
perror(_("Couldn't write header/archive to temp file"));
|
||||
fdClose(ofd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
fdClose(fd);
|
||||
fdClose(ofd);
|
||||
|
||||
/* Start writing the new RPM */
|
||||
strcpy(tmprpm, rpm);
|
||||
strcat(tmprpm, ".XXXXXX");
|
||||
mktemp(tmprpm);
|
||||
|
||||
ofd = fdOpen(tmprpm, O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
||||
lead.signature_type = RPMSIG_HEADERSIG;
|
||||
if (writeLead(ofd, &lead)) {
|
||||
perror("writeLead()");
|
||||
fdClose(ofd);
|
||||
unlink(sigtarget);
|
||||
unlink(tmprpm);
|
||||
xfree(sigtarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Generate the signature */
|
||||
sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY);
|
||||
rpmMessage(RPMMESS_VERBOSE, _("Generating signature: %d\n"), sigtype);
|
||||
if (add != ADD_SIGNATURE) {
|
||||
sig = rpmNewSignature();
|
||||
rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
|
||||
rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
|
||||
}
|
||||
if (sigtype>0) {
|
||||
rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
|
||||
}
|
||||
if (rpmWriteSignature(ofd, sig)) {
|
||||
fdClose(ofd);
|
||||
unlink(sigtarget);
|
||||
unlink(tmprpm);
|
||||
xfree(sigtarget);
|
||||
rpmFreeSignature(sig);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
rpmFreeSignature(sig);
|
||||
|
||||
/* Append the header and archive */
|
||||
fd = fdOpen(sigtarget, O_RDONLY, 0);
|
||||
while ((count = fdRead(fd, buffer, sizeof(buffer))) > 0) {
|
||||
if (count == -1) {
|
||||
perror(_("Couldn't read sigtarget"));
|
||||
fdClose(ofd);
|
||||
fdClose(fd);
|
||||
unlink(sigtarget);
|
||||
unlink(tmprpm);
|
||||
xfree(sigtarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (fdWrite(ofd, buffer, count) < 0) {
|
||||
perror(_("Couldn't write package"));
|
||||
fdClose(ofd);
|
||||
fdClose(fd);
|
||||
unlink(sigtarget);
|
||||
unlink(tmprpm);
|
||||
xfree(sigtarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
fdClose(fd);
|
||||
fdClose(ofd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
|
||||
/* Move it in to place */
|
||||
unlink(rpm);
|
||||
rename(tmprpm, rpm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int doCheckSig(int flags, const char **argv)
|
||||
{
|
||||
FD_t fd, ofd;
|
||||
int res, res2, res3;
|
||||
struct rpmlead lead;
|
||||
const char *rpm;
|
||||
char result[1024];
|
||||
const char * sigtarget;
|
||||
unsigned char buffer[8192];
|
||||
unsigned char missingKeys[7164];
|
||||
unsigned char untrustedKeys[7164];
|
||||
Header sig;
|
||||
HeaderIterator sigIter;
|
||||
int_32 tag, type, count;
|
||||
void *ptr;
|
||||
|
||||
res = 0;
|
||||
while (*argv) {
|
||||
rpm = *argv++;
|
||||
if (fdFileno(fd = fdOpen(rpm, O_RDONLY, 0644)) < 0) {
|
||||
fprintf(stderr, _("%s: Open failed\n"), rpm);
|
||||
res++;
|
||||
continue;
|
||||
}
|
||||
if (readLead(fd, &lead)) {
|
||||
fprintf(stderr, _("%s: readLead failed\n"), rpm);
|
||||
res++;
|
||||
continue;
|
||||
}
|
||||
if (lead.major == 1) {
|
||||
fprintf(stderr, _("%s: No signature available (v1.0 RPM)\n"), rpm);
|
||||
res++;
|
||||
continue;
|
||||
}
|
||||
if (rpmReadSignature(fd, &sig, lead.signature_type)) {
|
||||
fprintf(stderr, _("%s: rpmReadSignature failed\n"), rpm);
|
||||
res++;
|
||||
continue;
|
||||
}
|
||||
if (sig == NULL) {
|
||||
fprintf(stderr, _("%s: No signature available\n"), rpm);
|
||||
res++;
|
||||
continue;
|
||||
}
|
||||
/* Write the rest to a temp file */
|
||||
if (makeTempFile(NULL, &sigtarget, &ofd))
|
||||
exit(EXIT_FAILURE);
|
||||
while ((count = fdRead(fd, buffer, sizeof(buffer))) > 0) {
|
||||
if (count == -1) {
|
||||
perror(_("Couldn't read the header/archive"));
|
||||
fdClose(ofd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (fdWrite(ofd, buffer, count) < 0) {
|
||||
fprintf(stderr, _("Unable to write %s"), sigtarget);
|
||||
perror("");
|
||||
fdClose(ofd);
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
fdClose(fd);
|
||||
fdClose(ofd);
|
||||
|
||||
res2 = 0;
|
||||
missingKeys[0] = '\0';
|
||||
untrustedKeys[0] = '\0';
|
||||
sprintf(buffer, "%s:%c", rpm, (rpmIsVerbose() ? '\n' : ' ') );
|
||||
|
||||
sigIter = headerInitIterator(sig);
|
||||
while (headerNextIterator(sigIter, &tag, &type, &ptr, &count)) {
|
||||
if ((tag == RPMSIGTAG_PGP || tag == RPMSIGTAG_PGP5)
|
||||
&& !(flags & CHECKSIG_PGP))
|
||||
continue;
|
||||
if ((tag == RPMSIGTAG_GPG) && !(flags & CHECKSIG_GPG))
|
||||
continue;
|
||||
if ((tag == RPMSIGTAG_MD5 ||
|
||||
tag == RPMSIGTAG_LEMD5_2 ||
|
||||
tag == RPMSIGTAG_LEMD5_1)
|
||||
&& !(flags & CHECKSIG_MD5))
|
||||
continue;
|
||||
|
||||
if ((res3 = rpmVerifySignature(sigtarget, tag, ptr, count,
|
||||
result))) {
|
||||
if (rpmIsVerbose()) {
|
||||
strcat(buffer, result);
|
||||
res2 = 1;
|
||||
} else {
|
||||
char *tempKey;
|
||||
switch (tag) {
|
||||
case RPMSIGTAG_SIZE:
|
||||
strcat(buffer, "SIZE ");
|
||||
res2 = 1;
|
||||
break;
|
||||
case RPMSIGTAG_MD5:
|
||||
case RPMSIGTAG_LEMD5_1:
|
||||
case RPMSIGTAG_LEMD5_2:
|
||||
strcat(buffer, "MD5 ");
|
||||
res2 = 1;
|
||||
break;
|
||||
case RPMSIGTAG_PGP:
|
||||
case RPMSIGTAG_PGP5:
|
||||
if (res3 == RPMSIG_NOKEY || res3 == RPMSIG_NOTTRUSTED) {
|
||||
/* Do not consider these a failure */
|
||||
int offset = 7;
|
||||
strcat(buffer, "(PGP) ");
|
||||
tempKey = strstr(result, "Key ID");
|
||||
if (tempKey == NULL) {
|
||||
tempKey = strstr(result, "keyid:");
|
||||
offset = 9;
|
||||
}
|
||||
if (tempKey) {
|
||||
if (res3 == RPMSIG_NOKEY) {
|
||||
strcat(missingKeys, " PGP#");
|
||||
strncat(missingKeys, tempKey + offset, 8);
|
||||
} else {
|
||||
strcat(untrustedKeys, " PGP#");
|
||||
strncat(untrustedKeys, tempKey + offset, 8);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
strcat(buffer, "PGP ");
|
||||
res2 = 1;
|
||||
}
|
||||
break;
|
||||
case RPMSIGTAG_GPG:
|
||||
if (res3 == RPMSIG_NOKEY) {
|
||||
/* Do not consider this a failure */
|
||||
strcat(buffer, "(GPG) ");
|
||||
strcat(missingKeys, " GPG#");
|
||||
tempKey = strstr(result, "key ID");
|
||||
if (tempKey)
|
||||
strncat(missingKeys, tempKey+7, 8);
|
||||
} else {
|
||||
strcat(buffer, "GPG ");
|
||||
res2 = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
strcat(buffer, "?UnknownSignatureType? ");
|
||||
res2 = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rpmIsVerbose()) {
|
||||
strcat(buffer, result);
|
||||
} else {
|
||||
switch (tag) {
|
||||
case RPMSIGTAG_SIZE:
|
||||
strcat(buffer, "size ");
|
||||
break;
|
||||
case RPMSIGTAG_MD5:
|
||||
case RPMSIGTAG_LEMD5_1:
|
||||
case RPMSIGTAG_LEMD5_2:
|
||||
strcat(buffer, "md5 ");
|
||||
break;
|
||||
case RPMSIGTAG_PGP:
|
||||
case RPMSIGTAG_PGP5:
|
||||
strcat(buffer, "pgp ");
|
||||
break;
|
||||
case RPMSIGTAG_GPG:
|
||||
strcat(buffer, "gpg ");
|
||||
break;
|
||||
default:
|
||||
strcat(buffer, "??? ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
headerFreeIterator(sigIter);
|
||||
res += res2;
|
||||
unlink(sigtarget);
|
||||
xfree(sigtarget);
|
||||
|
||||
if (res2) {
|
||||
if (rpmIsVerbose()) {
|
||||
fprintf(stderr, "%s", (char *)buffer);
|
||||
} else {
|
||||
fprintf(stderr, "%s%s%s%s%s%s%s%s\n", (char *)buffer,
|
||||
_("NOT OK"),
|
||||
(missingKeys[0] != '\0') ? _(" (MISSING KEYS:") : "",
|
||||
(char *)missingKeys,
|
||||
(missingKeys[0] != '\0') ? _(") ") : "",
|
||||
(untrustedKeys[0] != '\0') ? _(" (UNTRUSTED KEYS:") : "",
|
||||
(char *)untrustedKeys,
|
||||
(untrustedKeys[0] != '\0') ? _(")") : "");
|
||||
|
||||
}
|
||||
} else {
|
||||
if (rpmIsVerbose()) {
|
||||
fprintf(stdout, "%s", (char *)buffer);
|
||||
} else {
|
||||
fprintf(stdout, "%s%s%s%s%s%s%s%s\n", (char *)buffer,
|
||||
_("OK"),
|
||||
(missingKeys[0] != '\0') ? _(" (MISSING KEYS:") : "",
|
||||
(char *)missingKeys,
|
||||
(missingKeys[0] != '\0') ? _(") ") : "",
|
||||
(untrustedKeys[0] != '\0') ? _(" (UNTRUSTED KEYS:") : "",
|
||||
(char *)untrustedKeys,
|
||||
(untrustedKeys[0] != '\0') ? _(")") : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
14
checksig.h
14
checksig.h
|
@ -1,14 +0,0 @@
|
|||
#ifndef H_CHECKSIG
|
||||
#define H_CHECKSIG
|
||||
|
||||
#define CHECKSIG_PGP (1 << 0)
|
||||
#define CHECKSIG_MD5 (1 << 1)
|
||||
#define CHECKSIG_GPG (1 << 2)
|
||||
|
||||
int doCheckSig(int flags, const char **argv);
|
||||
int doReSign(int add, char *passPhrase, const char **argv);
|
||||
|
||||
#define ADD_SIGNATURE 1
|
||||
#define NEW_SIGNATURE 0
|
||||
|
||||
#endif
|
33
ftp.h
33
ftp.h
|
@ -1,33 +0,0 @@
|
|||
#ifndef H_FTP
|
||||
#define H_FTP
|
||||
|
||||
const char * ftpStrerror(int ftpErrno);
|
||||
|
||||
#define FTPERR_BAD_SERVER_RESPONSE -1
|
||||
#define FTPERR_SERVER_IO_ERROR -2
|
||||
#define FTPERR_SERVER_TIMEOUT -3
|
||||
#define FTPERR_BAD_HOST_ADDR -4
|
||||
#define FTPERR_BAD_HOSTNAME -5
|
||||
#define FTPERR_FAILED_CONNECT -6
|
||||
#define FTPERR_FILE_IO_ERROR -7
|
||||
#define FTPERR_PASSIVE_ERROR -8
|
||||
#define FTPERR_FAILED_DATA_CONNECT -9
|
||||
#define FTPERR_FILE_NOT_FOUND -10
|
||||
#define FTPERR_NIC_ABORT_IN_PROGRESS -11
|
||||
#define FTPERR_UNKNOWN -100
|
||||
|
||||
#ifndef IPPORT_FTP
|
||||
# define IPPORT_FTP 21
|
||||
#endif
|
||||
|
||||
void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount);
|
||||
int httpOpen(urlinfo *u);
|
||||
int ftpOpen(urlinfo *u);
|
||||
|
||||
int httpGetFile(FD_t sfd, FD_t tfd);
|
||||
int ftpGetFile(FD_t sfd, FD_t tfd);
|
||||
int ftpGetFileDesc(FD_t);
|
||||
int ftpAbort(FD_t fd);
|
||||
int ftpClose(FD_t fd);
|
||||
|
||||
#endif
|
87
http.h
87
http.h
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Portions
|
||||
* Copyright (c) 1995-1998 The Apache Group. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef H_HTTP
|
||||
#define H_HTTP
|
||||
|
||||
|
||||
|
||||
|
||||
int httpProxySetup(const char * url, urlinfo ** uret);
|
||||
int httpCheckResponse(int fd, char ** str);
|
||||
int httpSkipHeader(FD_t sfd, char *buf,int * bytesRead, char ** start);
|
||||
|
||||
|
||||
#define HTTPERR_OKAY 0
|
||||
#define HTTPERR_BAD_SERVER_RESPONSE -1
|
||||
#define HTTPERR_SERVER_IO_ERROR -2
|
||||
#define HTTPERR_SERVER_TIMEOUT -3
|
||||
#define HTTPERR_BAD_HOSTNAME -4
|
||||
#define HTTPERR_UNSUPPORTED_PROTOCOL -5
|
||||
#define HTTPERR_INVALID_PORT -6
|
||||
#define HTTPERR_INVALID_SERVER_RESPONSE -7
|
||||
#define HTTPERR_UNKNOWN_ERROR -8
|
||||
#define HTTPERR_FILE_UNAVAILABLE -9
|
||||
|
||||
|
||||
/*
|
||||
#define FTPERR_BAD_HOST_ADDR -4
|
||||
#define FTPERR_FAILED_CONNECT -6
|
||||
#define FTPERR_FILE_IO_ERROR -7
|
||||
#define FTPERR_PASSIVE_ERROR -8
|
||||
#define FTPERR_FAILED_DATA_CONNECT -9
|
||||
#define FTPERR_FILE_NOT_FOUND -10
|
||||
#define FTPERR_NIC_ABORT_IN_PROGRESS -11
|
||||
*/
|
||||
|
||||
#define HTTP_CONTINUE 100
|
||||
#define HTTP_SWITCHING_PROTOCOLS 101
|
||||
#define HTTP_PROCESSING 102
|
||||
#define HTTP_OK 200
|
||||
#define HTTP_CREATED 201
|
||||
#define HTTP_ACCEPTED 202
|
||||
#define HTTP_NON_AUTHORITATIVE 203
|
||||
#define HTTP_NO_CONTENT 204
|
||||
#define HTTP_RESET_CONTENT 205
|
||||
#define HTTP_PARTIAL_CONTENT 206
|
||||
#define HTTP_MULTI_STATUS 207
|
||||
#define HTTP_MULTIPLE_CHOICES 300
|
||||
#define HTTP_MOVED_PERMANENTLY 301
|
||||
#define HTTP_MOVED_TEMPORARILY 302
|
||||
#define HTTP_SEE_OTHER 303
|
||||
#define HTTP_NOT_MODIFIED 304
|
||||
#define HTTP_USE_PROXY 305
|
||||
#define HTTP_TEMPORARY_REDIRECT 307
|
||||
#define HTTP_BAD_REQUEST 400
|
||||
#define HTTP_UNAUTHORIZED 401
|
||||
#define HTTP_PAYMENT_REQUIRED 402
|
||||
#define HTTP_FORBIDDEN 403
|
||||
#define HTTP_NOT_FOUND 404
|
||||
#define HTTP_METHOD_NOT_ALLOWED 405
|
||||
#define HTTP_NOT_ACCEPTABLE 406
|
||||
#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
|
||||
#define HTTP_REQUEST_TIME_OUT 408
|
||||
#define HTTP_CONFLICT 409
|
||||
#define HTTP_GONE 410
|
||||
#define HTTP_LENGTH_REQUIRED 411
|
||||
#define HTTP_PRECONDITION_FAILED 412
|
||||
#define HTTP_REQUEST_ENTITY_TOO_LARGE 413
|
||||
#define HTTP_REQUEST_URI_TOO_LARGE 414
|
||||
#define HTTP_UNSUPPORTED_MEDIA_TYPE 415
|
||||
#define HTTP_RANGE_NOT_SATISFIABLE 416
|
||||
#define HTTP_EXPECTATION_FAILED 417
|
||||
#define HTTP_UNPROCESSABLE_ENTITY 422
|
||||
#define HTTP_LOCKED 423
|
||||
#define HTTP_INTERNAL_SERVER_ERROR 500
|
||||
#define HTTP_NOT_IMPLEMENTED 501
|
||||
#define HTTP_BAD_GATEWAY 502
|
||||
#define HTTP_SERVICE_UNAVAILABLE 503
|
||||
#define HTTP_GATEWAY_TIME_OUT 504
|
||||
#define HTTP_VERSION_NOT_SUPPORTED 505
|
||||
#define HTTP_VARIANT_ALSO_VARIES 506
|
||||
#define HTTP_NOT_EXTENDED 510
|
||||
|
||||
#endif
|
||||
|
|
@ -22,9 +22,9 @@ librpm_la_SOURCES = \
|
|||
formats.c fprint.c fs.c ftp.c hash.c header.c install.c \
|
||||
lookup.c macro.c md5.c md5sum.c \
|
||||
messages.c misc.c oldheader.c package.c problems.c query.c \
|
||||
rebuilddb.c rpmbzio.c rpmdb.c rpmerr.c rpminstall.c rpmio.c rpmlead.c \
|
||||
rpmrc.c signature.c stringbuf.c tagName.c tagtable.c transaction.c \
|
||||
tread.c uninstall.c url.c verify.c
|
||||
rebuilddb.c rpmbzio.c rpmchecksig.c rpmdb.c rpmerr.c rpminstall.c \
|
||||
rpmio.c rpmlead.c rpmrc.c signature.c stringbuf.c tagName.c tagtable.c \
|
||||
transaction.c tread.c uninstall.c url.c verify.c
|
||||
|
||||
tagtable.c: rpmlib.h
|
||||
@echo '#include "system.h"' > tagtable.c
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
#include "system.h"
|
||||
|
||||
#ifdef DYING
|
||||
#include "build/rpmbuild.h"
|
||||
#endif
|
||||
#include <rpmlib.h>
|
||||
|
||||
#include "checksig.h"
|
||||
#include "rpmlead.h"
|
||||
#include "signature.h"
|
||||
|
||||
int doReSign(int add, char *passPhrase, const char **argv)
|
||||
int rpmReSign(int add, char *passPhrase, const char **argv)
|
||||
{
|
||||
FD_t fd, ofd;
|
||||
int count;
|
||||
|
@ -142,7 +144,7 @@ int doReSign(int add, char *passPhrase, const char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int doCheckSig(int flags, const char **argv)
|
||||
int rpmCheckSig(int flags, const char **argv)
|
||||
{
|
||||
FD_t fd, ofd;
|
||||
int res, res2, res3;
|
||||
|
|
13
lib/rpmlib.h
13
lib/rpmlib.h
|
@ -676,6 +676,19 @@ void printDepFlags(FILE * f, const char * version, int flags);
|
|||
void printDepProblems(FILE * f, struct rpmDependencyConflict * conflicts,
|
||||
int numConflicts);
|
||||
|
||||
/* ==================================================================== */
|
||||
/* --- checksig/resign */
|
||||
|
||||
#define CHECKSIG_PGP (1 << 0)
|
||||
#define CHECKSIG_MD5 (1 << 1)
|
||||
#define CHECKSIG_GPG (1 << 2)
|
||||
|
||||
int rpmCheckSig(int flags, const char **argv);
|
||||
int rpmReSign(int add, char *passPhrase, const char **argv);
|
||||
|
||||
#define ADD_SIGNATURE 1
|
||||
#define NEW_SIGNATURE 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# Package source files
|
||||
|
||||
build.c
|
||||
checksig.c
|
||||
convertdb.c
|
||||
oldrpmdb.c
|
||||
rpm.c
|
||||
|
@ -49,6 +48,7 @@ lib/problems.c
|
|||
lib/query.c
|
||||
lib/rebuilddb.c
|
||||
lib/rpmbzio.c
|
||||
lib/rpmchecksig.c
|
||||
lib/rpmdb.c
|
||||
lib/rpmerr.c
|
||||
lib/rpminstall.c
|
||||
|
|
682
po/rpm.pot
682
po/rpm.pot
File diff suppressed because it is too large
Load Diff
5
rpm.c
5
rpm.c
|
@ -3,7 +3,6 @@
|
|||
#include "build/rpmbuild.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "checksig.h"
|
||||
#include "install.h"
|
||||
#include "lib/signature.h"
|
||||
#include "popt/popt.h"
|
||||
|
@ -1161,7 +1160,7 @@ int main(int argc, char ** argv)
|
|||
if (!noPgp) checksigFlags |= CHECKSIG_PGP;
|
||||
if (!noGpg) checksigFlags |= CHECKSIG_GPG;
|
||||
if (!noMd5) checksigFlags |= CHECKSIG_MD5;
|
||||
ec = doCheckSig(checksigFlags, poptGetArgs(optCon));
|
||||
ec = rpmCheckSig(checksigFlags, poptGetArgs(optCon));
|
||||
/* XXX don't overflow single byte exit status */
|
||||
if (ec > 255) ec = 255;
|
||||
exit(ec);
|
||||
|
@ -1170,7 +1169,7 @@ int main(int argc, char ** argv)
|
|||
case MODE_RESIGN:
|
||||
if (!poptPeekArg(optCon))
|
||||
argerror(_("no packages given for signing"));
|
||||
ec = doReSign(addSign, passPhrase, poptGetArgs(optCon));
|
||||
ec = rpmReSign(addSign, passPhrase, poptGetArgs(optCon));
|
||||
/* XXX don't overflow single byte exit status */
|
||||
if (ec > 255) ec = 255;
|
||||
exit(ec);
|
||||
|
|
53
url.h
53
url.h
|
@ -1,53 +0,0 @@
|
|||
#ifndef H_URL
|
||||
#define H_URL
|
||||
|
||||
typedef enum {
|
||||
URL_IS_UNKNOWN = 0,
|
||||
URL_IS_DASH = 1,
|
||||
URL_IS_PATH = 2,
|
||||
URL_IS_FTP = 3,
|
||||
URL_IS_HTTP = 4
|
||||
} urltype;
|
||||
|
||||
typedef struct urlinfo {
|
||||
const char *url; /* copy of original url */
|
||||
const char *service;
|
||||
const char *user;
|
||||
const char *password;
|
||||
const char *host;
|
||||
const char *portstr;
|
||||
const char *path;
|
||||
const char *proxyu; /* FTP: proxy user */
|
||||
const char *proxyh; /* FTP/HTTP: proxy host */
|
||||
int proxyp; /* FTP/HTTP: proxy port */
|
||||
int port;
|
||||
int ftpControl;
|
||||
int ftpGetFileDoneNeeded;
|
||||
int openError; /* Type of open failure */
|
||||
} urlinfo;
|
||||
|
||||
#ifndef IPPORT_HTTP
|
||||
#define IPPORT_HTTP 80
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
urltype urlIsURL(const char * url);
|
||||
int urlSplit(const char *url, urlinfo **u);
|
||||
urlinfo *newUrlinfo(void);
|
||||
void freeUrlinfo(urlinfo *u);
|
||||
|
||||
FD_t ufdOpen(const char * pathname, int flags, mode_t mode);
|
||||
int ufdClose(FD_t fd);
|
||||
const char *urlStrerror(const char *url);
|
||||
|
||||
int urlGetFile(const char * url, const char * dest);
|
||||
void urlInvalidateCache(const char * url);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue