Main Page Modules Data Structures File List Data Fields Globals Related Pages

# lib/verify.c

Go to the documentation of this file.

    00001
    00006 #include "system.h"
    00007
    00008 #include "psm.h"
    00009 #include <rpmcli.h>
    00010
    00011 #include "ugid.h"
    00012 #include "misc.h"       /* XXX for uidToUname() and gnameToGid() */
    00013 #include "debug.h"
    00014
    00015 /*@access TFI_t*/
    00016 /*@access PSM_t*/
    00017 /*@access FD_t*/        /* XXX compared with NULL */
    00018 /*@access rpmdb*/       /* XXX compared with NULL */
    00019
    00020 #define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
    00021
    00022 int rpmVerifyFile(const char * root, Header h, int filenum,
    00023                 rpmVerifyAttrs * result, rpmVerifyAttrs omitMask)
    00024 {
    00025     HGE_t hge = (HGE_t)headerGetEntryMinMemory;
    00026     HFD_t hfd = headerFreeData;
    00027     int_32 * fileFlags;
    00028     rpmfileAttrs fileAttrs = RPMFILE_NONE;
    00029     int_32 * verifyFlags;
    00030     rpmVerifyAttrs flags = RPMVERIFY_ALL;
    00031     unsigned short * modeList;
    00032     const char * fileStatesList;
    00033     const char * filespec = NULL;
    00034     int count;
    00035     int rc;
    00036     struct stat sb;
    00037
    00038     rc = hge(h, RPMTAG_FILEMODES, NULL, (void **) &modeList, &count);
    00039     if (hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL))
    00040         fileAttrs = fileFlags[filenum];
    00041
    00042     if (hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (void **) &verifyFlags, NULL))
    00043         flags = verifyFlags[filenum];
    00044
    00045     {
    00046         const char ** baseNames;
    00047         const char ** dirNames;
    00048         int_32 * dirIndexes;
    00049         rpmTagType bnt, dnt;
    00050
    00051         if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL)
    00052         &&  hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL)
    00053         &&  hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL))
    00054         {
    00055             int nb = (strlen(dirNames[dirIndexes[filenum]]) +
    00056                       strlen(baseNames[filenum]) + strlen(root) + 5);
    00057             char * t = alloca(nb);
    00058             filespec = t;
    00059             *t = '\0';
    00060             if (root && !(root[0] == '/' && root[1] == '\0')) {
    00061                 t = stpcpy(t, root);
    00062                 while (t > filespec && t[-1] == '/') {
    00063                     --t;
    00064                     *t = '\0';
    00065                 }
    00066             }
    00067             t = stpcpy(t, dirNames[dirIndexes[filenum]]);
    00068             t = stpcpy(t, baseNames[filenum]);
    00069         }
    00070         baseNames = hfd(baseNames, bnt);
    00071         dirNames = hfd(dirNames, dnt);
    00072     }
    00073
    00074     *result = RPMVERIFY_NONE;
    00075
    00076     /*
    00077      * Check to see if the file was installed - if not pretend all is OK.
    00078      */
    00079     if (hge(h, RPMTAG_FILESTATES, NULL, (void **) &fileStatesList, NULL) &&
    00080         fileStatesList != NULL)
    00081     {
    00082         rpmfileState fstate = fileStatesList[filenum];
    00083         switch (fstate) {
    00084         case RPMFILE_STATE_NETSHARED:
    00085         case RPMFILE_STATE_REPLACED:
    00086         case RPMFILE_STATE_NOTINSTALLED:
    00087             return 0;
    00088             /*@notreached@*/ break;
    00089         case RPMFILE_STATE_NORMAL:
    00090             break;
    00091         }
    00092     }
    00093
    00094     if (filespec == NULL) {
    00095         *result |= RPMVERIFY_LSTATFAIL;
    00096         return 1;
    00097     }
    00098
    00099     if (Lstat(filespec, &sb) != 0) {
    00100         *result |= RPMVERIFY_LSTATFAIL;
    00101         return 1;
    00102     }
    00103
    00104     /*
    00105      * Not all attributes of non-regular files can be verified.
    00106      */
    00107     if (S_ISDIR(sb.st_mode))
    00108         flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
    00109                         RPMVERIFY_LINKTO);
    00110     else if (S_ISLNK(sb.st_mode)) {
    00111         flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
    00112                 RPMVERIFY_MODE);
    00113 #if CHOWN_FOLLOWS_SYMLINK
    00114             flags &= ~(RPMVERIFY_USER | RPMVERIFY_GROUP);
    00115 #endif
    00116     }
    00117     else if (S_ISFIFO(sb.st_mode))
    00118         flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
    00119                         RPMVERIFY_LINKTO);
    00120     else if (S_ISCHR(sb.st_mode))
    00121         flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
    00122                         RPMVERIFY_LINKTO);
    00123     else if (S_ISBLK(sb.st_mode))
    00124         flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
    00125                         RPMVERIFY_LINKTO);
    00126     else
    00127         flags &= ~(RPMVERIFY_LINKTO);
    00128
    00129     /*
    00130      * Content checks of %ghost files are meaningless.
    00131      */
    00132     if (fileAttrs & RPMFILE_GHOST)
    00133         flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
    00134                         RPMVERIFY_LINKTO);
    00135
    00136     /*
    00137      * Don't verify any features in omitMask.
    00138      */
    00139     flags &= ~(omitMask | RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL);
    00140
    00141     if (flags & RPMVERIFY_MD5) {
    00142         unsigned char md5sum[40];
    00143         const char ** md5List;
    00144         rpmTagType mdt;
    00145
    00146         if (!hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL))
    00147             *result |= RPMVERIFY_MD5;
    00148         else {
    00149             rc = domd5(filespec, md5sum, 1);
    00150             if (rc)
    00151                 *result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
    00152             else if (strcmp(md5sum, md5List[filenum]))
    00153                 *result |= RPMVERIFY_MD5;
    00154         }
    00155         md5List = hfd(md5List, mdt);
    00156     }
    00157
    00158     if (flags & RPMVERIFY_LINKTO) {
    00159         char linkto[1024];
    00160         int size = 0;
    00161         const char ** linktoList;
    00162         rpmTagType ltt;
    00163
    00164         if (!hge(h, RPMTAG_FILELINKTOS, &ltt, (void **) &linktoList, NULL)
    00165         || (size = Readlink(filespec, linkto, sizeof(linkto)-1)) == -1)
    00166             *result |= (RPMVERIFY_READLINKFAIL|RPMVERIFY_LINKTO);
    00167         else {
    00168             linkto[size] = '\0';
    00169             if (strcmp(linkto, linktoList[filenum]))
    00170                 *result |= RPMVERIFY_LINKTO;
    00171         }
    00172         linktoList = hfd(linktoList, ltt);
    00173     }
    00174
    00175     if (flags & RPMVERIFY_FILESIZE) {
    00176         int_32 * sizeList;
    00177
    00178         if (!hge(h, RPMTAG_FILESIZES, NULL, (void **) &sizeList, NULL)
    00179         || sizeList[filenum] != sb.st_size)
    00180             *result |= RPMVERIFY_FILESIZE;
    00181     }
    00182
    00183     if (flags & RPMVERIFY_MODE) {
    00184         unsigned short metamode = modeList[filenum];
    00185         unsigned short filemode;
    00186
    00187         /*
    00188          * Platforms (like AIX) where sizeof(unsigned short) != sizeof(mode_t)
    00189          * need the (unsigned short) cast here.
    00190          */
    00191         filemode = (unsigned short)sb.st_mode;
    00192
    00193         /*
    00194          * Comparing the type of %ghost files is meaningless, but perms are OK.
    00195          */
    00196         if (fileAttrs & RPMFILE_GHOST) {
    00197             metamode &= ~0xf000;
    00198             filemode &= ~0xf000;
    00199         }
    00200
    00201         if (metamode != filemode)
    00202             *result |= RPMVERIFY_MODE;
    00203     }
    00204
    00205     if (flags & RPMVERIFY_RDEV) {
    00206         if (S_ISCHR(modeList[filenum]) != S_ISCHR(sb.st_mode) ||
    00207             S_ISBLK(modeList[filenum]) != S_ISBLK(sb.st_mode))
    00208         {
    00209             *result |= RPMVERIFY_RDEV;
    00210         } else if (S_ISDEV(modeList[filenum]) && S_ISDEV(sb.st_mode)) {
    00211             unsigned short * rdevList;
    00212             if (!hge(h, RPMTAG_FILERDEVS, NULL, (void **) &rdevList, NULL)
    00213             || rdevList[filenum] != sb.st_rdev)
    00214                 *result |= RPMVERIFY_RDEV;
    00215         }
    00216     }
    00217
    00218     if (flags & RPMVERIFY_MTIME) {
    00219         int_32 * mtimeList;
    00220
    00221         if (!hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtimeList, NULL)
    00222         ||  mtimeList[filenum] != sb.st_mtime)
    00223             *result |= RPMVERIFY_MTIME;
    00224     }
    00225
    00226     if (flags & RPMVERIFY_USER) {
    00227         const char * name;
    00228         const char ** unameList;
    00229         int_32 * uidList;
    00230         rpmTagType unt;
    00231
    00232         if (hge(h, RPMTAG_FILEUSERNAME, &unt, (void **) &unameList, NULL)) {
    00233             name = uidToUname(sb.st_uid);
    00234             if (!name || strcmp(unameList[filenum], name))
    00235                 *result |= RPMVERIFY_USER;
    00236             unameList = hfd(unameList, unt);
    00237         } else if (hge(h, RPMTAG_FILEUIDS, NULL, (void **) &uidList, NULL)) {
    00238             if (uidList[filenum] != sb.st_uid)
    00239                 *result |= RPMVERIFY_GROUP;
    00240         } else {
    00241             rpmError(RPMERR_INTERNAL, _("package lacks both user name and id "
    00242                   "lists (this should never happen)\n"));
    00243             *result |= RPMVERIFY_GROUP;
    00244         }
    00245     }
    00246
    00247     if (flags & RPMVERIFY_GROUP) {
    00248         const char ** gnameList;
    00249         int_32 * gidList;
    00250         rpmTagType gnt;
    00251         gid_t gid;
    00252
    00253         if (hge(h, RPMTAG_FILEGROUPNAME, &gnt, (void **) &gnameList, NULL)) {
    00254             rc = gnameToGid(gnameList[filenum], &gid);
    00255             if (rc || (gid != sb.st_gid))
    00256                 *result |= RPMVERIFY_GROUP;
    00257             gnameList = hfd(gnameList, gnt);
    00258         } else if (hge(h, RPMTAG_FILEGIDS, NULL, (void **) &gidList, NULL)) {
    00259             if (gidList[filenum] != sb.st_gid)
    00260                 *result |= RPMVERIFY_GROUP;
    00261         } else {
    00262             rpmError(RPMERR_INTERNAL, _("package lacks both group name and id "
    00263                      "lists (this should never happen)\n"));
    00264             *result |= RPMVERIFY_GROUP;
    00265         }
    00266     }
    00267
    00268     return 0;
    00269 }
    00270
    00279 int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd)
    00280 {
    00281     rpmdb rpmdb = NULL;
    00282     rpmTransactionSet ts = rpmtransCreateSet(rpmdb, rootDir);
    00283     TFI_t fi = xcalloc(1, sizeof(*fi));
    00284     struct psm_s psmbuf;
    00285     PSM_t psm = &psmbuf;
    00286     int rc;
    00287
    00288     if (scriptFd != NULL)
    00289         ts->scriptFd = fdLink(scriptFd, "rpmVerifyScript");
    00290     fi->magic = TFIMAGIC;
    00291     loadFi(h, fi);
    00292     memset(psm, 0, sizeof(*psm));
    00293     psm->ts = ts;
    00294     psm->fi = fi;
    00295     psm->stepName = "verify";
    00296     psm->scriptTag = RPMTAG_VERIFYSCRIPT;
    00297     psm->progTag = RPMTAG_VERIFYSCRIPTPROG;
    00298     rc = psmStage(psm, PSM_SCRIPT);
    00299     freeFi(fi);
    00300     fi = _free(fi);
    00301     ts = rpmtransFree(ts);
    00302     return rc;
    00303 }
    00304
    00305 int rpmVerifyDigest(Header h)
    00306 {
    00307     HGE_t hge = (HGE_t)headerGetEntry;  /* XXX headerGetEntryMinMemory? */
    00308     HFD_t hfd = headerFreeData;
    00309     void * uh = NULL;
    00310     rpmTagType uht;
    00311     int_32 uhc;
    00312     const char * hdigest;
    00313     rpmTagType hdt;
    00314     int ec = 0;         /* assume no problems */
    00315
    00316     /* Retrieve header digest. */
    00317     if (!hge(h, RPMTAG_SHA1RHN, &hdt, (void **) &hdigest, NULL))
    00318             return 0;
    00319
    00320     /* Regenerate original header. */
    00321     if (!hge(h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc))
    00322         return 0;
    00323
    00324     if (hdigest == NULL || uh == NULL)
    00325         return 0;
    00326
    00327     /* Compute header digest. */
    00328     {   DIGEST_CTX ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE);
    00329         const char * digest;
    00330         size_t digestlen;
    00331
    00332         (void) rpmDigestUpdate(ctx, uh, uhc);
    00333         (void) rpmDigestFinal(ctx, (void **)&digest, &digestlen, 1);
    00334
    00335         /* XXX can't happen: report NULL malloc return as a digest failure. */
    00336         ec = (digest == NULL || strcmp(hdigest, digest)) ? 1 : 0;
    00337         digest = _free(digest);
    00338     }
    00339
    00340     uh = hfd(uh, uht);
    00341     hdigest = hfd(hdigest, hdt);
    00342
    00343     return ec;
    00344 }
    00345
    00351 static int verifyHeader(QVA_t qva, Header h)
    00352         /*@modifies h @*/
    00353 {
    00354     HGE_t hge = (HGE_t)headerGetEntryMinMemory;
    00355     char buf[BUFSIZ];
    00356     char * t, * te;
    00357     const char * prefix = (qva->qva_prefix ? qva->qva_prefix : "");
    00358     const char ** fileNames = NULL;
    00359     int count;
    00360     int_32 * fileFlags = NULL;
    00361     rpmVerifyAttrs verifyResult = 0;
    00362     rpmVerifyAttrs omitMask = ((qva->qva_flags & VERIFY_ATTRS) ^ VERIFY_ATTRS);
    00363     int ec = 0;         /* assume no problems */
    00364     int i;
    00365
    00366     te = t = buf;
    00367     *te = '\0';
    00368
    00369     if (!hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL))
    00370         goto exit;
    00371
    00372     if (!headerIsEntry(h, RPMTAG_BASENAMES))
    00373         goto exit;
    00374
    00375     rpmBuildFileList(h, &fileNames, &count);
    00376
    00377     for (i = 0; i < count; i++) {
    00378         rpmfileAttrs fileAttrs;
    00379         int rc;
    00380
    00381         fileAttrs = fileFlags[i];
    00382
    00383         /* If not verifying %ghost, skip ghost files. */
    00384         if (!(qva->qva_fflags & RPMFILE_GHOST)
    00385         && (fileAttrs & RPMFILE_GHOST))
    00386             continue;
    00387
    00388         rc = rpmVerifyFile(prefix, h, i, &verifyResult, omitMask);
    00389         if (rc) {
    00390             /*@-internalglobs@*/ /* FIX: shrug */
    00391             if (!(fileAttrs & RPMFILE_MISSINGOK) || rpmIsVerbose()) {
    00392                 sprintf(te, _("missing    %s"), fileNames[i]);
    00393                 te += strlen(te);
    00394                 ec = rc;
    00395             }
    00396             /*@=internalglobs@*/
    00397         } else if (verifyResult) {
    00398             const char * size, * md5, * link, * mtime, * mode;
    00399             const char * group, * user, * rdev;
    00400             /*@observer@*/ static const char *const aok = ".";
    00401             /*@observer@*/ static const char *const unknown = "?";
    00402
    00403             ec = 1;
    00404
    00405 #define _verify(_RPMVERIFY_F, _C)       \
    00406         ((verifyResult & _RPMVERIFY_F) ? _C : aok)
    00407 #define _verifylink(_RPMVERIFY_F, _C)   \
    00408         ((verifyResult & RPMVERIFY_READLINKFAIL) ? unknown : \
    00409          (verifyResult & _RPMVERIFY_F) ? _C : aok)
    00410 #define _verifyfile(_RPMVERIFY_F, _C)   \
    00411         ((verifyResult & RPMVERIFY_READFAIL) ? unknown : \
    00412          (verifyResult & _RPMVERIFY_F) ? _C : aok)
    00413
    00414             md5 = _verifyfile(RPMVERIFY_MD5, "5");
    00415             size = _verify(RPMVERIFY_FILESIZE, "S");
    00416             link = _verifylink(RPMVERIFY_LINKTO, "L");
    00417             mtime = _verify(RPMVERIFY_MTIME, "T");
    00418             rdev = _verify(RPMVERIFY_RDEV, "D");
    00419             user = _verify(RPMVERIFY_USER, "U");
    00420             group = _verify(RPMVERIFY_GROUP, "G");
    00421             mode = _verify(RPMVERIFY_MODE, "M");
    00422
    00423 #undef _verify
    00424 #undef _verifylink
    00425 #undef _verifyfile
    00426
    00427             sprintf(te, "%s%s%s%s%s%s%s%s %c %s",
    00428                         size, mode, md5, rdev, link, user, group, mtime,
    00429                         ((fileAttrs & RPMFILE_CONFIG)   ? 'c' :
    00430                          (fileAttrs & RPMFILE_DOC)      ? 'd' :
    00431                          (fileAttrs & RPMFILE_GHOST)    ? 'g' :
    00432                          (fileAttrs & RPMFILE_LICENSE)  ? 'l' :
    00433                          (fileAttrs & RPMFILE_README)   ? 'r' : ' '),
    00434                         fileNames[i]);
    00435             te += strlen(te);
    00436         }
    00437
    00438         if (te > t) {
    00439             *te++ = '\n';
    00440             *te = '\0';
    00441             rpmMessage(RPMMESS_NORMAL, "%s", t);
    00442             te = t = buf;
    00443             *t = '\0';
    00444         }
    00445     }
    00446
    00447 exit:
    00448     fileNames = _free(fileNames);
    00449     return ec;
    00450 }
    00451
    00458 static int verifyDependencies(rpmdb rpmdb, Header h)
    00459         /*@modifies h @*/
    00460 {
    00461     rpmTransactionSet ts;
    00462     rpmDependencyConflict conflicts;
    00463     int numConflicts;
    00464     int rc = 0;         /* assume no problems */
    00465     int i;
    00466
    00467     ts = rpmtransCreateSet(rpmdb, NULL);
    00468     (void) rpmtransAddPackage(ts, h, NULL, NULL, 0, NULL);
    00469
    00470     (void) rpmdepCheck(ts, &conflicts, &numConflicts);
    00471     ts = rpmtransFree(ts);
    00472
    00473     /*@-branchstate@*/
    00474     if (numConflicts) {
    00475         const char *n, *v, *r;
    00476         char * t, * te;
    00477         int nb = 512;
    00478         (void) headerNVR(h, &n, &v, &r);
    00479
    00480         for (i = 0; i < numConflicts; i++) {
    00481             nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
    00482             if (conflicts[i].needsFlags)
    00483                 nb += strlen(conflicts[i].needsVersion) + 5;
    00484         }
    00485         te = t = alloca(nb);
    00486         *te = '\0';
    00487         sprintf(te, _("Unsatisfied dependencies for %s-%s-%s: "), n, v, r);
    00488         te += strlen(te);
    00489         for (i = 0; i < numConflicts; i++) {
    00490             if (i) te = stpcpy(te, ", ");
    00491             te = stpcpy(te, conflicts[i].needsName);
    00492             if (conflicts[i].needsFlags) {
    00493                 int flags = conflicts[i].needsFlags;
    00494                 *te++ = ' ';
    00495                 if (flags & RPMSENSE_LESS)      *te++ = '<';
    00496                 if (flags & RPMSENSE_GREATER)   *te++ = '>';
    00497                 if (flags & RPMSENSE_EQUAL)     *te++ = '=';
    00498                 *te++ = ' ';
    00499                 te = stpcpy(te, conflicts[i].needsVersion);
    00500             }
    00501         }
    00502         conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
    00503         if (te > t) {
    00504             *te++ = '\n';
    00505             *te = '\0';
    00506             rpmMessage(RPMMESS_NORMAL, "%s", t);
    00507             te = t;
    00508             *t = '\0';
    00509         }
    00510         rc = 1;
    00511     }
    00512     /*@=branchstate@*/
    00513     return rc;
    00514 }
    00515
    00516 int showVerifyPackage(QVA_t qva, rpmdb rpmdb, Header h)
    00517 {
    00518     const char * prefix = (qva->qva_prefix ? qva->qva_prefix : "");
    00519     int ec = 0;
    00520     int rc;
    00521
    00522     if (qva->qva_flags & VERIFY_DIGEST) {
    00523         if ((rc = rpmVerifyDigest(h)) != 0) {
    00524             const char *n, *v, *r;
    00525             (void) headerNVR(h, &n, &v, &r);
    00526             rpmMessage(RPMMESS_NORMAL,
    00527                    _("%s-%s-%s: immutable header region digest check failed\n"),
    00528                         n, v, r);
    00529             ec = rc;
    00530         }
    00531     }
    00532     if (qva->qva_flags & VERIFY_DEPS) {
    00533         if ((rc = verifyDependencies(rpmdb, h)) != 0)
    00534             ec = rc;
    00535     }
    00536     if (qva->qva_flags & VERIFY_FILES) {
    00537         if ((rc = verifyHeader(qva, h)) != 0)
    00538             ec = rc;
    00539     }
    00540     if (qva->qva_flags & VERIFY_SCRIPT) {
    00541         FD_t fdo = fdDup(STDOUT_FILENO);
    00542         if ((rc = rpmVerifyScript(prefix, h, fdo)) != 0)
    00543             ec = rc;
    00544         if (fdo)
    00545             rc = Fclose(fdo);
    00546     }
    00547     return ec;
    00548 }
    00549
    00550 int rpmVerify(QVA_t qva, rpmQVSources source, const char * arg)
    00551 {
    00552     rpmdb rpmdb = NULL;
    00553     int rc;
    00554
    00555     switch (source) {
    00556     case RPMQV_RPM:
    00557         if (!(qva->qva_flags & VERIFY_DEPS))
    00558             break;
    00559         /*@fallthrough@*/
    00560     default:
    00561         if ((rc = rpmdbOpen(qva->qva_prefix, &rpmdb, O_RDONLY, 0644)) != 0)
    00562             return 1;
    00563         break;
    00564     }
    00565
    00566     rc = rpmQueryVerify(qva, source, arg, rpmdb, showVerifyPackage);
    00567
    00568     if (rpmdb != NULL)
    00569         (void) rpmdbClose(rpmdb);
    00570
    00571     return rc;
    00572 }