X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/b408e4ad0010b273dac0af7dc87ab61062d89e49..a6f8c07f83e4e5a8155c04feab543dc0c82ed495:/apt-pkg/contrib/gpgv.h?ds=sidebyside diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index 1f877fc2d..2a4cdad72 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -9,36 +9,46 @@ #ifndef CONTRIB_GPGV_H #define CONTRIB_GPGV_H +#include + #include #include +#ifndef APT_10_CLEANER_HEADERS #include - -#if __GNUC__ >= 4 - #define APT_noreturn __attribute__ ((noreturn)) -#else - #define APT_noreturn /* no support */ #endif +class FileFd; + /** \brief generates and run the command to verify a file with gpgv * * If File and FileSig specify the same file it is assumed that we - * deal with a clear-signed message. In that case the file will be - * rewritten to be in a good-known format without uneeded whitespaces - * and additional messages (unsigned or signed). + * deal with a clear-signed message. Note that the method will accept + * and validate files which include additional (unsigned) messages + * without complaining. Do NOT open files accepted by this method + * for reading. Use #OpenMaybeClearSignedFile to access the message + * instead to ensure you are only reading signed data. + * + * The method does not return, but has some notable exit-codes: + * 111 signals an internal error like the inability to execute gpgv, + * 112 indicates a clear-signed file which doesn't include a message, + * which can happen if APT is run while on a network requiring + * authentication before usage (e.g. in hotels) + * All other exit-codes are passed-through from gpgv. * * @param File is the message (unsigned or clear-signed) * @param FileSig is the signature (detached or clear-signed) + * @param statusfd is the fd given to gpgv as --status-fd + * @param fd is used as a pipe for the standard output of gpgv + * @param key is the specific one to be used instead of using all */ void ExecGPGV(std::string const &File, std::string const &FileSig, - int const &statusfd, int fd[2]) APT_noreturn; -inline void ExecGPGV(std::string const &File, std::string const &FileSig, + int const &statusfd, int fd[2], std::string const &Key = "") APT_NORETURN; +inline APT_NORETURN void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { int fd[2]; ExecGPGV(File, FileSig, statusfd, fd); -}; - -#undef APT_noreturn +} /** \brief Split an inline signature into message and signature * @@ -51,9 +61,6 @@ inline void ExecGPGV(std::string const &File, std::string const &FileSig, * If a FileFd pointers is NULL it will not be used and the content * which would have been written to it is silently discarded. * - * The code doesn't support dash-encoded lines as these are not - * expected to be present in files we have to deal with. - * * The content of the split files is undefined if the splitting was * unsuccessful. *