diff options
author | jbj <devnull@localhost> | 2002-08-23 21:01:59 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-08-23 21:01:59 +0000 |
commit | f5a546f5801067dd922aa83e7d78e8e59c84e738 (patch) | |
tree | 3677837b7db8079de19de4e0d5e051eaf8261851 /python | |
parent | 4e245109ad54513ec5563b4292cce64f90482ed6 (diff) | |
download | librpm-tizen-f5a546f5801067dd922aa83e7d78e8e59c84e738.tar.gz librpm-tizen-f5a546f5801067dd922aa83e7d78e8e59c84e738.tar.bz2 librpm-tizen-f5a546f5801067dd922aa83e7d78e8e59c84e738.zip |
- merge signature returns into rpmRC.
- python: exceptions on NOKEY/NOTTRUSTED.
CVS patchset: 5667
CVS date: 2002/08/23 21:01:59
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmts-py.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 3d78f5d55..3e2a0f6db 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -721,7 +721,7 @@ rpmts_HdrFromFdno(rpmtsObject * s, PyObject * args) /*@globals _Py_NoneStruct, fileSystem @*/ /*@modifies s, _Py_NoneStruct, fileSystem @*/ { - hdrObject * hdr; + PyObject * result = NULL; Header h; FD_t fd; int fdno; @@ -737,25 +737,32 @@ fprintf(stderr, "*** rpmts_HdrFromFdno(%p) ts %p\n", s, s->ts); Fclose(fd); switch (rpmrc) { - case RPMRC_BADSIZE: case RPMRC_OK: - hdr = hdr_Wrap(h); - h = headerFree(h); /* XXX ref held by hdr */ + if (h) + result = Py_BuildValue("N", hdr_Wrap(h)); + h = headerFree(h); /* XXX ref held by result */ break; case RPMRC_NOTFOUND: Py_INCREF(Py_None); - hdr = (hdrObject *) Py_None; + result = Py_None; + break; + + case RPMRC_NOKEY: + PyErr_SetString(pyrpmError, "public key not availaiable"); + break; + + case RPMRC_NOTTRUSTED: + PyErr_SetString(pyrpmError, "public key not trusted"); break; case RPMRC_FAIL: - case RPMRC_SHORTREAD: default: PyErr_SetString(pyrpmError, "error reading package header"); - return NULL; + break; } - return Py_BuildValue("N", hdr); + return result; } /** \ingroup python @@ -794,8 +801,17 @@ fprintf(stderr, "*** rpmts_HdrCheck(%p) ts %p\n", s, s->ts); Py_INCREF(Py_None); result = Py_None; break; - default: + + case RPMRC_NOKEY: + PyErr_SetString(pyrpmError, "public key not availaiable"); + break; + + case RPMRC_NOTTRUSTED: + PyErr_SetString(pyrpmError, "public key not trusted"); + break; + case RPMRC_FAIL: + default: PyErr_SetString(pyrpmError, msg); break; } |