Dear Maintainer,

The CPPFLAGS hardening flags are missing because the build system
ignores them.

The attached patch fixes the issue. If possible it should be sent
upstream.

To check if all flags were correctly enabled you can use
`hardening-check` from the hardening-includes package and check
the build log (hardening-check doesn't catch everything):

    $ hardening-check /usr/bin/rdesktop
    /usr/bin/rdesktop:
     Position Independent Executable: no, normal executable!
     Stack protected: yes
     Fortify Source functions: yes (some protected functions found)
     Read-only relocations: yes
     Immediate binding: no not found!

(Position Independent Executable and Immediate binding is not
enabled by default.)

Use find -type f \( -executable -o -name \*.so\* \) -exec
hardening-check {} + on the build result to check all files.

Regards,
Simon

[1]: https://wiki.debian.org/ReleaseGoals/SecurityHardeningBuildFlags
[2]: https://wiki.debian.org/HardeningWalkthrough
[3]: https://wiki.debian.org/Hardening
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
Description: Use CPPFLAGS flags from environment (dpkg-buildflags).
 Necessary for hardening flags.
Author: Simon Ruderich <si...@ruderich.org>
Last-Update: 2012-03-12

--- rdesktop-1.7.1.orig/Makefile.in
+++ rdesktop-1.7.1/Makefile.in
@@ -17,6 +17,7 @@ KEYMAP_PATH = $(datadir)/rdesktop/keymap
 CC          = @CC@
 INSTALL     = @INSTALL@
 CFLAGS      = @CFLAGS@ @X_CFLAGS@ @DEFS@ -DKEYMAP_PATH=\"$(KEYMAP_PATH)\"
+CPPFLAGS    = @CPPFLAGS@
 LDFLAGS     = @LDFLAGS@ @LIBS@ @X_LIBS@ @X_EXTRA_LIBS@
 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 STRIP       = @STRIP@
@@ -39,22 +40,22 @@ VNCOBJ   = vnc/rdp2vnc.o vnc/vnc.o vnc/x
 all: $(TARGETS)
 
 rdesktop: $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ)
-	$(CC) $(CFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) -lX11
+	$(CC) $(CFLAGS) $(CPPFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) -lX11
 
 rdp2vnc: $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) 
-	$(VNCLINK) $(CFLAGS) -o rdp2vnc $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) $(LDVNC)
+	$(VNCLINK) $(CFLAGS) $(CPPFLAGS) -o rdp2vnc $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) $(LDVNC)
 
 vnc/rdp2vnc.o: rdesktop.c
-	$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/rdp2vnc.o -c rdesktop.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(VNCINC) -DRDP2VNC -o vnc/rdp2vnc.o -c rdesktop.c
 
 vnc/vnc.o: vnc/vnc.c
-	$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/vnc.o -c vnc/vnc.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(VNCINC) -DRDP2VNC -o vnc/vnc.o -c vnc/vnc.c
 
 vnc/xkeymap.o: xkeymap.c
-	$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/xkeymap.o -c xkeymap.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(VNCINC) -DRDP2VNC -o vnc/xkeymap.o -c xkeymap.c
 
 vnc/x11stubs.o: vnc/x11stubs.c
-	$(CC) $(CFLAGS) $(VNCINC) -o vnc/x11stubs.o -c vnc/x11stubs.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(VNCINC) -o vnc/x11stubs.o -c vnc/x11stubs.c
 
 .PHONY: install
 install: installbin installkeymaps installman
@@ -161,7 +162,7 @@ configure: configure.ac
 .SUFFIXES: .c .o
 
 .c.o:
-	$(CC) $(CFLAGS) -o $@ -c $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
 
 .PHONY: doc/AUTHORS
 doc/AUTHORS:

Attachment: pgpG6DaC3YtyS.pgp
Description: PGP signature

Reply via email to