/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to initramfs-tools-hook

  • Committer: Teddy Hogeborn
  • Date: 2014-06-14 23:29:00 UTC
  • Revision ID: teddy@recompile.se-20140614232900-vhcywskev4u8rz2d
mandos-client: Fix some bugs on error conditions.

* plugins.d/mandos-client.c (run_network_hooks): Init "dirent" to NULL
                                                 and, later, always
                                                 free() it unless
                                                 scandirat() or
                                                 scandir() failed.
  (main): Fix free() of uninitalized memory in case scandirat() or
          scandir() of "/sys/class/net" failed.  Also, when cleaning
          up, even if GPGME temp directory is empty, do
          free(direntries) and remove the directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
done
151
151
 
152
152
# GPGME needs GnuPG
153
 
gpg=/usr/bin/gpg
154
153
libgpgme11_version="`dpkg-query --showformat='${Version}' --show libgpgme11`"
155
 
if dpkg --compare-versions "$libgpgme11_version" ge 1.5.0-0.1; then
156
 
    if [ -e /usr/bin/gpgconf ]; then
157
 
        if [ ! -e "${DESTDIR}/usr/bin/gpgconf" ]; then
158
 
            copy_exec /usr/bin/gpgconf
159
 
        fi
160
 
        gpg="`/usr/bin/gpgconf|sed --quiet --expression='s/^gpg:[^:]*://p'`"
161
 
    fi
162
 
elif dpkg --compare-versions "$libgpgme11_version" ge 1.4.1-0.1; then
 
154
if dpkg --compare-versions "$libgpgme11_version" ge 1.4.1-0.1; then
163
155
    gpg=/usr/bin/gpg2
 
156
else
 
157
    gpg=/usr/bin/gpg
164
158
fi
165
159
if [ ! -e "${DESTDIR}$gpg" ]; then
166
160
    copy_exec "$gpg"