/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 Makefile

  • Committer: Teddy Hogeborn
  • Date: 2019-08-01 17:35:45 UTC
  • Revision ID: teddy@recompile.se-20190801173545-swvm0c6e1e00qdwi
password-agent: Fix memory alignment issue

On many architectures (armel, armhf, mips, mips64el, mipsel, hppa,
ia64, sh4, and sparc64) GCC shows a warning when casting a "char *" to
a "struct inotify_event *"; The exact warning message from GCC is
"cast increases required alignment of target type [-Wcast-align]".

* dracut-module/password-agent.c (read_inotify_event): Change
  "ievent_buffer" to an anonymous struct instead of a char array.
  (test_read_inotify_event_IN_CLOSE_WRITE): - '' -
  (test_read_inotify_event_IN_MOVED_TO): - '' -
  (test_read_inotify_event_IN_DELETE): - '' -
  (test_read_inotify_event_IN_CLOSE_WRITE_badname): - '' -
  (test_read_inotify_event_IN_MOVED_TO_badname): - '' -
  (test_read_inotify_event_IN_DELETE_badname): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#COVERAGE=--coverage
42
42
OPTIMIZE:=-Os -fno-strict-aliasing
43
43
LANGUAGE:=-std=gnu11
44
 
FEATURES:=-D_FILE_OFFSET_BITS=64
45
44
htmldir:=man
46
 
version:=1.8.7
 
45
version:=1.8.5
47
46
SED:=sed
48
 
PKG_CONFIG?=pkg-config
49
47
 
50
48
USER:=$(firstword $(subst :, ,$(shell getent passwd _mandos \
51
49
        || getent passwd nobody || echo 65534)))
52
50
GROUP:=$(firstword $(subst :, ,$(shell getent group _mandos \
53
51
        || getent group nogroup || echo 65534)))
54
52
 
55
 
LINUXVERSION:=$(shell uname --kernel-release)
56
 
 
57
53
## Use these settings for a traditional /usr/local install
58
54
# PREFIX:=$(DESTDIR)/usr/local
59
55
# CONFDIR:=$(DESTDIR)/etc/mandos
75
71
STATEDIR:=$(DESTDIR)/var/lib/mandos
76
72
LIBDIR:=$(shell \
77
73
        for d in \
78
 
        "/usr/lib/`dpkg-architecture \
79
 
                        -qDEB_HOST_MULTIARCH 2>/dev/null`" \
 
74
        "/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null`" \
80
75
        "`rpm --eval='%{_libdir}' 2>/dev/null`" /usr/lib; do \
81
76
                if [ -d "$$d" -a "$$d" = "$${d%/}" ]; then \
82
77
                        echo "$(DESTDIR)$$d"; \
85
80
        done)
86
81
##
87
82
 
88
 
SYSTEMD:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
89
 
                        --variable=systemdsystemunitdir)
90
 
TMPFILES:=$(DESTDIR)$(shell $(PKG_CONFIG) systemd \
91
 
                        --variable=tmpfilesdir)
 
83
SYSTEMD:=$(DESTDIR)$(shell pkg-config systemd --variable=systemdsystemunitdir)
 
84
TMPFILES:=$(DESTDIR)$(shell pkg-config systemd --variable=tmpfilesdir)
92
85
 
93
 
GNUTLS_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I gnutls)
94
 
GNUTLS_LIBS:=$(shell $(PKG_CONFIG) --libs gnutls)
95
 
AVAHI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I avahi-core)
96
 
AVAHI_LIBS:=$(shell $(PKG_CONFIG) --libs avahi-core)
 
86
GNUTLS_CFLAGS:=$(shell pkg-config --cflags-only-I gnutls)
 
87
GNUTLS_LIBS:=$(shell pkg-config --libs gnutls)
 
88
AVAHI_CFLAGS:=$(shell pkg-config --cflags-only-I avahi-core)
 
89
AVAHI_LIBS:=$(shell pkg-config --libs avahi-core)
97
90
GPGME_CFLAGS:=$(shell gpgme-config --cflags; getconf LFS_CFLAGS)
98
91
GPGME_LIBS:=$(shell gpgme-config --libs; getconf LFS_LIBS; \
99
92
        getconf LFS_LDFLAGS)
100
 
LIBNL3_CFLAGS:=$(shell $(PKG_CONFIG) --cflags-only-I libnl-route-3.0)
101
 
LIBNL3_LIBS:=$(shell $(PKG_CONFIG) --libs libnl-route-3.0)
102
 
GLIB_CFLAGS:=$(shell $(PKG_CONFIG) --cflags glib-2.0)
103
 
GLIB_LIBS:=$(shell $(PKG_CONFIG) --libs glib-2.0)
 
93
LIBNL3_CFLAGS:=$(shell pkg-config --cflags-only-I libnl-route-3.0)
 
94
LIBNL3_LIBS:=$(shell pkg-config --libs libnl-route-3.0)
 
95
GLIB_CFLAGS:=$(shell pkg-config --cflags glib-2.0)
 
96
GLIB_LIBS:=$(shell pkg-config --libs glib-2.0)
104
97
 
105
98
# Do not change these two
106
 
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
107
 
        $(LANGUAGE) $(FEATURES) -DVERSION='"$(version)"'
 
99
CFLAGS+=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) \
 
100
        $(OPTIMIZE) $(LANGUAGE) -DVERSION='"$(version)"'
108
101
LDFLAGS+=-Xlinker --as-needed $(COVERAGE) $(LINK_FORTIFY) $(strip \
109
102
        ) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
110
103
 
319
312
        ./dracut-module/password-agent --test
320
313
 
321
314
# Run the client with a local config and key
322
 
run-client: all keydir/seckey.txt keydir/pubkey.txt \
323
 
                        keydir/tls-privkey.pem keydir/tls-pubkey.pem
324
 
        @echo '######################################################'
325
 
        @echo '# The following error messages are harmless and can  #'
326
 
        @echo '#  be safely ignored:                                #'
327
 
        @echo '## From plugin-runner:                               #'
328
 
        @echo '# setgid: Operation not permitted                    #'
329
 
        @echo '# setuid: Operation not permitted                    #'
330
 
        @echo '## From askpass-fifo:                                #'
331
 
        @echo '# mkfifo: Permission denied                          #'
332
 
        @echo '## From mandos-client:                               #'
333
 
        @echo '# Failed to raise privileges: Operation not permi... #'
334
 
        @echo '# Warning: network hook "*" exited with status *     #'
335
 
        @echo '# ioctl SIOCSIFFLAGS +IFF_UP: Operation not permi... #'
336
 
        @echo '# Failed to bring up interface "*": Operation not... #'
337
 
        @echo '#                                                    #'
338
 
        @echo '# (The messages are caused by not running as root,   #'
339
 
        @echo '# but you should NOT run "make run-client" as root   #'
340
 
        @echo '# unless you also unpacked and compiled Mandos as    #'
341
 
        @echo '# root, which is also NOT recommended.)              #'
342
 
        @echo '######################################################'
 
315
run-client: all keydir/seckey.txt keydir/pubkey.txt keydir/tls-privkey.pem keydir/tls-pubkey.pem
 
316
        @echo "###################################################################"
 
317
        @echo "# The following error messages are harmless and can be safely     #"
 
318
        @echo "# ignored:                                                        #"
 
319
        @echo "# From plugin-runner: setgid: Operation not permitted             #"
 
320
        @echo "#                     setuid: Operation not permitted             #"
 
321
        @echo "# From askpass-fifo:  mkfifo: Permission denied                   #"
 
322
        @echo "# From mandos-client:                                             #"
 
323
        @echo "#             Failed to raise privileges: Operation not permitted #"
 
324
        @echo "#             Warning: network hook \"*\" exited with status *      #"
 
325
        @echo "#                                                                 #"
 
326
        @echo "# (The messages are caused by not running as root, but you should #"
 
327
        @echo "# NOT run \"make run-client\" as root unless you also unpacked and  #"
 
328
        @echo "# compiled Mandos as root, which is also NOT recommended.)        #"
 
329
        @echo "###################################################################"
343
330
# We set GNOME_KEYRING_CONTROL to block pam_gnome_keyring
344
331
        ./plugin-runner --plugin-dir=plugins.d \
345
332
                --plugin-helper-dir=plugin-helpers \
385
372
        elif install --directory --mode=u=rwx $(STATEDIR); then \
386
373
                chown -- $(USER):$(GROUP) $(STATEDIR) || :; \
387
374
        fi
388
 
        if [ "$(TMPFILES)" != "$(DESTDIR)" \
389
 
                        -a -d "$(TMPFILES)" ]; then \
 
375
        if [ "$(TMPFILES)" != "$(DESTDIR)" -a -d "$(TMPFILES)" ]; then \
390
376
                install --mode=u=rw,go=r tmpfiles.d-mandos.conf \
391
377
                        $(TMPFILES)/mandos.conf; \
392
378
        fi
439
425
        install --mode=u=rwx,go=rx \
440
426
                --target-directory=$(LIBDIR)/mandos plugin-runner
441
427
        install --mode=u=rwx,go=rx \
442
 
                --target-directory=$(LIBDIR)/mandos \
443
 
                mandos-to-cryptroot-unlock
 
428
                --target-directory=$(LIBDIR)/mandos mandos-to-cryptroot-unlock
444
429
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
445
430
                mandos-keygen
446
431
        install --mode=u=rwx,go=rx \
509
494
        if command -v update-initramfs >/dev/null; then \
510
495
            update-initramfs -k all -u; \
511
496
        elif command -v dracut >/dev/null; then \
512
 
            for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
 
497
            for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
513
498
                if [ -w "$$initrd" ]; then \
514
499
                    chmod go-r "$$initrd"; \
515
500
                    dracut --force "$$initrd"; \
568
553
        if command -v update-initramfs >/dev/null; then \
569
554
            update-initramfs -k all -u; \
570
555
        elif command -v dracut >/dev/null; then \
571
 
            for initrd in $(DESTDIR)/boot/initr*-$(LINUXVERSION); do \
 
556
            for initrd in $(DESTDIR)/boot/initr*-$(shell uname --kernel-release); do \
572
557
                test -w "$$initrd" && dracut --force "$$initrd"; \
573
558
            done; \
574
559
        fi