summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2011-01-25 01:51:25 +0000
committerColin Watson <cjwatson@debian.org>2011-01-25 01:51:25 +0000
commit5e750371bb19c8cc58b5faea70278d857acdae0a (patch)
treefa223746d886bda4acb9e242675bbcc4ddba4efb
parent26883397c648afa38ed502e68652945a794b0cd3 (diff)
Backport SELinux build fix from CVS.
-rw-r--r--Makefile.in3
-rwxr-xr-xconfigure18
-rw-r--r--configure.ac8
-rw-r--r--debian/changelog1
-rw-r--r--debian/patches/selinux-build-failure.patch236
-rw-r--r--debian/patches/series3
-rw-r--r--openbsd-compat/port-linux.c14
-rw-r--r--openbsd-compat/port-linux.h1
-rw-r--r--ssh.c7
9 files changed, 277 insertions, 14 deletions
diff --git a/Makefile.in b/Makefile.in
index f51b86a27..415577112 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -48,6 +48,7 @@ LD=@LD@
48CFLAGS=@CFLAGS@ 48CFLAGS=@CFLAGS@
49CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ 49CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
50LIBS=@LIBS@ 50LIBS=@LIBS@
51SSHLIBS=@SSHLIBS@
51SSHDLIBS=@SSHDLIBS@ 52SSHDLIBS=@SSHDLIBS@
52LIBEDIT=@LIBEDIT@ 53LIBEDIT=@LIBEDIT@
53AR=@AR@ 54AR=@AR@
@@ -144,7 +145,7 @@ libssh.a: $(LIBSSH_OBJS)
144 $(RANLIB) $@ 145 $(RANLIB) $@
145 146
146ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS) 147ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
147 $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 148 $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS)
148 149
149sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) 150sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS)
150 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) 151 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS)
diff --git a/configure b/configure
index 6e05311aa..7eaffb08e 100755
--- a/configure
+++ b/configure
@@ -696,7 +696,6 @@ STARTUP_SCRIPT_SHELL
696LOGIN_PROGRAM_FALLBACK 696LOGIN_PROGRAM_FALLBACK
697PATH_PASSWD_PROG 697PATH_PASSWD_PROG
698LD 698LD
699SSHDLIBS
700PKGCONFIG 699PKGCONFIG
701LIBEDIT 700LIBEDIT
702TEST_SSH_SHA256 701TEST_SSH_SHA256
@@ -721,6 +720,8 @@ PROG_UPTIME
721PROG_IPCS 720PROG_IPCS
722PROG_TAIL 721PROG_TAIL
723INSTALL_SSH_PRNG_CMDS 722INSTALL_SSH_PRNG_CMDS
723SSHLIBS
724SSHDLIBS
724KRB5CONF 725KRB5CONF
725PRIVSEP_PATH 726PRIVSEP_PATH
726xauth_path 727xauth_path
@@ -9047,7 +9048,6 @@ cat >>confdefs.h <<\_ACEOF
9047_ACEOF 9048_ACEOF
9048 9049
9049 SSHDLIBS="$SSHDLIBS -lcontract" 9050 SSHDLIBS="$SSHDLIBS -lcontract"
9050
9051 SPC_MSG="yes" 9051 SPC_MSG="yes"
9052fi 9052fi
9053 9053
@@ -9126,7 +9126,6 @@ cat >>confdefs.h <<\_ACEOF
9126_ACEOF 9126_ACEOF
9127 9127
9128 SSHDLIBS="$SSHDLIBS -lproject" 9128 SSHDLIBS="$SSHDLIBS -lproject"
9129
9130 SP_MSG="yes" 9129 SP_MSG="yes"
9131fi 9130fi
9132 9131
@@ -27806,6 +27805,7 @@ echo "$as_me: error: SELinux support requires libselinux library" >&2;}
27806 { (exit 1); exit 1; }; } 27805 { (exit 1); exit 1; }; }
27807fi 27806fi
27808 27807
27808 SSHLIBS="$SSHLIBS $LIBSELINUX"
27809 SSHDLIBS="$SSHDLIBS $LIBSELINUX" 27809 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
27810 27810
27811 27811
@@ -27908,6 +27908,8 @@ done
27908fi 27908fi
27909 27909
27910 27910
27911
27912
27911# Check whether user wants Kerberos 5 support 27913# Check whether user wants Kerberos 5 support
27912KRB5_MSG="no" 27914KRB5_MSG="no"
27913 27915
@@ -31416,7 +31418,6 @@ STARTUP_SCRIPT_SHELL!$STARTUP_SCRIPT_SHELL$ac_delim
31416LOGIN_PROGRAM_FALLBACK!$LOGIN_PROGRAM_FALLBACK$ac_delim 31418LOGIN_PROGRAM_FALLBACK!$LOGIN_PROGRAM_FALLBACK$ac_delim
31417PATH_PASSWD_PROG!$PATH_PASSWD_PROG$ac_delim 31419PATH_PASSWD_PROG!$PATH_PASSWD_PROG$ac_delim
31418LD!$LD$ac_delim 31420LD!$LD$ac_delim
31419SSHDLIBS!$SSHDLIBS$ac_delim
31420PKGCONFIG!$PKGCONFIG$ac_delim 31421PKGCONFIG!$PKGCONFIG$ac_delim
31421LIBEDIT!$LIBEDIT$ac_delim 31422LIBEDIT!$LIBEDIT$ac_delim
31422TEST_SSH_SHA256!$TEST_SSH_SHA256$ac_delim 31423TEST_SSH_SHA256!$TEST_SSH_SHA256$ac_delim
@@ -31433,6 +31434,7 @@ PROG_PS!$PROG_PS$ac_delim
31433PROG_SAR!$PROG_SAR$ac_delim 31434PROG_SAR!$PROG_SAR$ac_delim
31434PROG_W!$PROG_W$ac_delim 31435PROG_W!$PROG_W$ac_delim
31435PROG_WHO!$PROG_WHO$ac_delim 31436PROG_WHO!$PROG_WHO$ac_delim
31437PROG_LAST!$PROG_LAST$ac_delim
31436_ACEOF 31438_ACEOF
31437 31439
31438 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then 31440 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -31474,7 +31476,6 @@ _ACEOF
31474ac_delim='%!_!# ' 31476ac_delim='%!_!# '
31475for ac_last_try in false false false false false :; do 31477for ac_last_try in false false false false false :; do
31476 cat >conf$$subs.sed <<_ACEOF 31478 cat >conf$$subs.sed <<_ACEOF
31477PROG_LAST!$PROG_LAST$ac_delim
31478PROG_LASTLOG!$PROG_LASTLOG$ac_delim 31479PROG_LASTLOG!$PROG_LASTLOG$ac_delim
31479PROG_DF!$PROG_DF$ac_delim 31480PROG_DF!$PROG_DF$ac_delim
31480PROG_VMSTAT!$PROG_VMSTAT$ac_delim 31481PROG_VMSTAT!$PROG_VMSTAT$ac_delim
@@ -31482,6 +31483,8 @@ PROG_UPTIME!$PROG_UPTIME$ac_delim
31482PROG_IPCS!$PROG_IPCS$ac_delim 31483PROG_IPCS!$PROG_IPCS$ac_delim
31483PROG_TAIL!$PROG_TAIL$ac_delim 31484PROG_TAIL!$PROG_TAIL$ac_delim
31484INSTALL_SSH_PRNG_CMDS!$INSTALL_SSH_PRNG_CMDS$ac_delim 31485INSTALL_SSH_PRNG_CMDS!$INSTALL_SSH_PRNG_CMDS$ac_delim
31486SSHLIBS!$SSHLIBS$ac_delim
31487SSHDLIBS!$SSHDLIBS$ac_delim
31485KRB5CONF!$KRB5CONF$ac_delim 31488KRB5CONF!$KRB5CONF$ac_delim
31486PRIVSEP_PATH!$PRIVSEP_PATH$ac_delim 31489PRIVSEP_PATH!$PRIVSEP_PATH$ac_delim
31487xauth_path!$xauth_path$ac_delim 31490xauth_path!$xauth_path$ac_delim
@@ -31496,7 +31499,7 @@ LIBOBJS!$LIBOBJS$ac_delim
31496LTLIBOBJS!$LTLIBOBJS$ac_delim 31499LTLIBOBJS!$LTLIBOBJS$ac_delim
31497_ACEOF 31500_ACEOF
31498 31501
31499 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then 31502 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then
31500 break 31503 break
31501 elif $ac_last_try; then 31504 elif $ac_last_try; then
31502 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 31505 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -31993,6 +31996,9 @@ echo " Libraries: ${LIBS}"
31993if test ! -z "${SSHDLIBS}"; then 31996if test ! -z "${SSHDLIBS}"; then
31994echo " +for sshd: ${SSHDLIBS}" 31997echo " +for sshd: ${SSHDLIBS}"
31995fi 31998fi
31999if test ! -z "${SSHLIBS}"; then
32000echo " +for ssh: ${SSHLIBS}"
32001fi
31996 32002
31997echo "" 32003echo ""
31998 32004
diff --git a/configure.ac b/configure.ac
index d7d1a988d..f15518b78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -761,7 +761,6 @@ mips-sony-bsd|mips-sony-newsos4)
761 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1, 761 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
762 [Define if you have Solaris process contracts]) 762 [Define if you have Solaris process contracts])
763 SSHDLIBS="$SSHDLIBS -lcontract" 763 SSHDLIBS="$SSHDLIBS -lcontract"
764 AC_SUBST(SSHDLIBS)
765 SPC_MSG="yes" ], ) 764 SPC_MSG="yes" ], )
766 ], 765 ],
767 ) 766 )
@@ -772,7 +771,6 @@ mips-sony-bsd|mips-sony-newsos4)
772 [ AC_DEFINE(USE_SOLARIS_PROJECTS, 1, 771 [ AC_DEFINE(USE_SOLARIS_PROJECTS, 1,
773 [Define if you have Solaris projects]) 772 [Define if you have Solaris projects])
774 SSHDLIBS="$SSHDLIBS -lproject" 773 SSHDLIBS="$SSHDLIBS -lproject"
775 AC_SUBST(SSHDLIBS)
776 SP_MSG="yes" ], ) 774 SP_MSG="yes" ], )
777 ], 775 ],
778 ) 776 )
@@ -3539,11 +3537,14 @@ AC_ARG_WITH(selinux,
3539 LIBS="$LIBS -lselinux" 3537 LIBS="$LIBS -lselinux"
3540 ], 3538 ],
3541 AC_MSG_ERROR(SELinux support requires libselinux library)) 3539 AC_MSG_ERROR(SELinux support requires libselinux library))
3540 SSHLIBS="$SSHLIBS $LIBSELINUX"
3542 SSHDLIBS="$SSHDLIBS $LIBSELINUX" 3541 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
3543 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level) 3542 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3544 LIBS="$save_LIBS" 3543 LIBS="$save_LIBS"
3545 fi ] 3544 fi ]
3546) 3545)
3546AC_SUBST(SSHLIBS)
3547AC_SUBST(SSHDLIBS)
3547 3548
3548# Check whether user wants Kerberos 5 support 3549# Check whether user wants Kerberos 5 support
3549KRB5_MSG="no" 3550KRB5_MSG="no"
@@ -4365,6 +4366,9 @@ echo " Libraries: ${LIBS}"
4365if test ! -z "${SSHDLIBS}"; then 4366if test ! -z "${SSHDLIBS}"; then
4366echo " +for sshd: ${SSHDLIBS}" 4367echo " +for sshd: ${SSHDLIBS}"
4367fi 4368fi
4369if test ! -z "${SSHLIBS}"; then
4370echo " +for ssh: ${SSHLIBS}"
4371fi
4368 4372
4369echo "" 4373echo ""
4370 4374
diff --git a/debian/changelog b/debian/changelog
index e7f334fe8..b063f0fac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,7 @@ openssh (1:5.7p1-1) UNRELEASED; urgency=low
26 installations or if you manually add 'HostKey 26 installations or if you manually add 'HostKey
27 /etc/ssh/ssh_host_ecdsa_key' to /etc/ssh/sshd_config. 27 /etc/ssh/ssh_host_ecdsa_key' to /etc/ssh/sshd_config.
28 * Build-depend on libssl-dev (>= 0.9.8g) to ensure sufficient ECC support. 28 * Build-depend on libssl-dev (>= 0.9.8g) to ensure sufficient ECC support.
29 * Backport SELinux build fix from CVS.
29 30
30 -- Colin Watson <cjwatson@debian.org> Mon, 24 Jan 2011 12:07:24 +0000 31 -- Colin Watson <cjwatson@debian.org> Mon, 24 Jan 2011 12:07:24 +0000
31 32
diff --git a/debian/patches/selinux-build-failure.patch b/debian/patches/selinux-build-failure.patch
new file mode 100644
index 000000000..47c953009
--- /dev/null
+++ b/debian/patches/selinux-build-failure.patch
@@ -0,0 +1,236 @@
1Description: Fix SELinux build failure
2Origin: backport, http://bazaar.launchpad.net/~vcs-imports/openssh/main/revision/6317
3Author: Damien Miller <djm@mindrot.org>
4Last-Update: 2011-01-25
5
6Index: b/Makefile.in
7===================================================================
8--- a/Makefile.in
9+++ b/Makefile.in
10@@ -48,6 +48,7 @@
11 CFLAGS=@CFLAGS@
12 CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
13 LIBS=@LIBS@
14+SSHLIBS=@SSHLIBS@
15 SSHDLIBS=@SSHDLIBS@
16 LIBEDIT=@LIBEDIT@
17 AR=@AR@
18@@ -144,7 +145,7 @@
19 $(RANLIB) $@
20
21 ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
22- $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
23+ $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS)
24
25 sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS)
26 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS)
27Index: b/configure.ac
28===================================================================
29--- a/configure.ac
30+++ b/configure.ac
31@@ -761,7 +761,6 @@
32 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
33 [Define if you have Solaris process contracts])
34 SSHDLIBS="$SSHDLIBS -lcontract"
35- AC_SUBST(SSHDLIBS)
36 SPC_MSG="yes" ], )
37 ],
38 )
39@@ -772,7 +771,6 @@
40 [ AC_DEFINE(USE_SOLARIS_PROJECTS, 1,
41 [Define if you have Solaris projects])
42 SSHDLIBS="$SSHDLIBS -lproject"
43- AC_SUBST(SSHDLIBS)
44 SP_MSG="yes" ], )
45 ],
46 )
47@@ -3539,11 +3537,14 @@
48 LIBS="$LIBS -lselinux"
49 ],
50 AC_MSG_ERROR(SELinux support requires libselinux library))
51+ SSHLIBS="$SSHLIBS $LIBSELINUX"
52 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
53 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
54 LIBS="$save_LIBS"
55 fi ]
56 )
57+AC_SUBST(SSHLIBS)
58+AC_SUBST(SSHDLIBS)
59
60 # Check whether user wants Kerberos 5 support
61 KRB5_MSG="no"
62@@ -4365,6 +4366,9 @@
63 if test ! -z "${SSHDLIBS}"; then
64 echo " +for sshd: ${SSHDLIBS}"
65 fi
66+if test ! -z "${SSHLIBS}"; then
67+echo " +for ssh: ${SSHLIBS}"
68+fi
69
70 echo ""
71
72Index: b/configure
73===================================================================
74--- a/configure
75+++ b/configure
76@@ -696,7 +696,6 @@
77 LOGIN_PROGRAM_FALLBACK
78 PATH_PASSWD_PROG
79 LD
80-SSHDLIBS
81 PKGCONFIG
82 LIBEDIT
83 TEST_SSH_SHA256
84@@ -721,6 +720,8 @@
85 PROG_IPCS
86 PROG_TAIL
87 INSTALL_SSH_PRNG_CMDS
88+SSHLIBS
89+SSHDLIBS
90 KRB5CONF
91 PRIVSEP_PATH
92 xauth_path
93@@ -9047,7 +9159,6 @@
94 _ACEOF
95
96 SSHDLIBS="$SSHDLIBS -lcontract"
97-
98 SPC_MSG="yes"
99 fi
100
101@@ -9126,7 +9237,6 @@
102 _ACEOF
103
104 SSHDLIBS="$SSHDLIBS -lproject"
105-
106 SP_MSG="yes"
107 fi
108
109@@ -27806,6 +27916,7 @@
110 { (exit 1); exit 1; }; }
111 fi
112
113+ SSHLIBS="$SSHLIBS $LIBSELINUX"
114 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
115
116
117@@ -27908,6 +28019,8 @@
118 fi
119
120
121+
122+
123 # Check whether user wants Kerberos 5 support
124 KRB5_MSG="no"
125
126@@ -31416,7 +31529,6 @@
127 LOGIN_PROGRAM_FALLBACK!$LOGIN_PROGRAM_FALLBACK$ac_delim
128 PATH_PASSWD_PROG!$PATH_PASSWD_PROG$ac_delim
129 LD!$LD$ac_delim
130-SSHDLIBS!$SSHDLIBS$ac_delim
131 PKGCONFIG!$PKGCONFIG$ac_delim
132 LIBEDIT!$LIBEDIT$ac_delim
133 TEST_SSH_SHA256!$TEST_SSH_SHA256$ac_delim
134@@ -31433,6 +31545,7 @@
135 PROG_SAR!$PROG_SAR$ac_delim
136 PROG_W!$PROG_W$ac_delim
137 PROG_WHO!$PROG_WHO$ac_delim
138+PROG_LAST!$PROG_LAST$ac_delim
139 _ACEOF
140
141 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
142@@ -31474,7 +31587,6 @@
143 ac_delim='%!_!# '
144 for ac_last_try in false false false false false :; do
145 cat >conf$$subs.sed <<_ACEOF
146-PROG_LAST!$PROG_LAST$ac_delim
147 PROG_LASTLOG!$PROG_LASTLOG$ac_delim
148 PROG_DF!$PROG_DF$ac_delim
149 PROG_VMSTAT!$PROG_VMSTAT$ac_delim
150@@ -31482,6 +31594,8 @@
151 PROG_IPCS!$PROG_IPCS$ac_delim
152 PROG_TAIL!$PROG_TAIL$ac_delim
153 INSTALL_SSH_PRNG_CMDS!$INSTALL_SSH_PRNG_CMDS$ac_delim
154+SSHLIBS!$SSHLIBS$ac_delim
155+SSHDLIBS!$SSHDLIBS$ac_delim
156 KRB5CONF!$KRB5CONF$ac_delim
157 PRIVSEP_PATH!$PRIVSEP_PATH$ac_delim
158 xauth_path!$xauth_path$ac_delim
159@@ -31496,7 +31610,7 @@
160 LTLIBOBJS!$LTLIBOBJS$ac_delim
161 _ACEOF
162
163- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then
164+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then
165 break
166 elif $ac_last_try; then
167 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
168@@ -31993,6 +32107,9 @@
169 if test ! -z "${SSHDLIBS}"; then
170 echo " +for sshd: ${SSHDLIBS}"
171 fi
172+if test ! -z "${SSHLIBS}"; then
173+echo " +for ssh: ${SSHLIBS}"
174+fi
175
176 echo ""
177
178Index: b/openbsd-compat/port-linux.c
179===================================================================
180--- a/openbsd-compat/port-linux.c
181+++ b/openbsd-compat/port-linux.c
182@@ -222,6 +222,20 @@
183 xfree(oldctx);
184 xfree(newctx);
185 }
186+
187+void
188+ssh_selinux_setfscreatecon(const char *path)
189+{
190+ security_context_t context;
191+
192+ if (path == NULL) {
193+ setfscreatecon(NULL);
194+ return;
195+ }
196+ matchpathcon(path, 0700, &context);
197+ setfscreatecon(context);
198+}
199+
200 #endif /* WITH_SELINUX */
201
202 #ifdef LINUX_OOM_ADJUST
203Index: b/openbsd-compat/port-linux.h
204===================================================================
205--- a/openbsd-compat/port-linux.h
206+++ b/openbsd-compat/port-linux.h
207@@ -24,6 +24,7 @@
208 void ssh_selinux_setup_pty(char *, const char *);
209 void ssh_selinux_setup_exec_context(char *);
210 void ssh_selinux_change_context(const char *);
211+void ssh_selinux_setfscreatecon(const char *);
212 #endif
213
214 #ifdef LINUX_OOM_ADJUST
215Index: b/ssh.c
216===================================================================
217--- a/ssh.c
218+++ b/ssh.c
219@@ -852,15 +852,12 @@
220 strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR);
221 if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) {
222 #ifdef WITH_SELINUX
223- char *scon;
224-
225- matchpathcon(buf, 0700, &scon);
226- setfscreatecon(scon);
227+ ssh_selinux_setfscreatecon(buf);
228 #endif
229 if (mkdir(buf, 0700) < 0)
230 error("Could not create directory '%.200s'.", buf);
231 #ifdef WITH_SELINUX
232- setfscreatecon(NULL);
233+ ssh_selinux_setfscreatecon(NULL);
234 #endif
235 }
236 /* load options.identity_files */
diff --git a/debian/patches/series b/debian/patches/series
index 751a9868c..a3431201e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -36,6 +36,9 @@ openbsd-docs.patch
36ssh-argv0.patch 36ssh-argv0.patch
37doc-hash-tab-completion.patch 37doc-hash-tab-completion.patch
38 38
39# Upstream backports
40selinux-build-failure.patch
41
39# Debian-specific configuration 42# Debian-specific configuration
40gnome-ssh-askpass2-icon.patch 43gnome-ssh-askpass2-icon.patch
41debian-config.patch 44debian-config.patch
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c
index 86a7146a6..744a404c8 100644
--- a/openbsd-compat/port-linux.c
+++ b/openbsd-compat/port-linux.c
@@ -222,6 +222,20 @@ ssh_selinux_change_context(const char *newname)
222 xfree(oldctx); 222 xfree(oldctx);
223 xfree(newctx); 223 xfree(newctx);
224} 224}
225
226void
227ssh_selinux_setfscreatecon(const char *path)
228{
229 security_context_t context;
230
231 if (path == NULL) {
232 setfscreatecon(NULL);
233 return;
234 }
235 matchpathcon(path, 0700, &context);
236 setfscreatecon(context);
237}
238
225#endif /* WITH_SELINUX */ 239#endif /* WITH_SELINUX */
226 240
227#ifdef LINUX_OOM_ADJUST 241#ifdef LINUX_OOM_ADJUST
diff --git a/openbsd-compat/port-linux.h b/openbsd-compat/port-linux.h
index 209d9a7a2..884482bf5 100644
--- a/openbsd-compat/port-linux.h
+++ b/openbsd-compat/port-linux.h
@@ -24,6 +24,7 @@ int ssh_selinux_enabled(void);
24void ssh_selinux_setup_pty(char *, const char *); 24void ssh_selinux_setup_pty(char *, const char *);
25void ssh_selinux_setup_exec_context(char *); 25void ssh_selinux_setup_exec_context(char *);
26void ssh_selinux_change_context(const char *); 26void ssh_selinux_change_context(const char *);
27void ssh_selinux_setfscreatecon(const char *);
27#endif 28#endif
28 29
29#ifdef LINUX_OOM_ADJUST 30#ifdef LINUX_OOM_ADJUST
diff --git a/ssh.c b/ssh.c
index 77dbde058..aa2ad4a2f 100644
--- a/ssh.c
+++ b/ssh.c
@@ -852,15 +852,12 @@ main(int ac, char **av)
852 strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR); 852 strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR);
853 if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) { 853 if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) {
854#ifdef WITH_SELINUX 854#ifdef WITH_SELINUX
855 char *scon; 855 ssh_selinux_setfscreatecon(buf);
856
857 matchpathcon(buf, 0700, &scon);
858 setfscreatecon(scon);
859#endif 856#endif
860 if (mkdir(buf, 0700) < 0) 857 if (mkdir(buf, 0700) < 0)
861 error("Could not create directory '%.200s'.", buf); 858 error("Could not create directory '%.200s'.", buf);
862#ifdef WITH_SELINUX 859#ifdef WITH_SELINUX
863 setfscreatecon(NULL); 860 ssh_selinux_setfscreatecon(NULL);
864#endif 861#endif
865 } 862 }
866 /* load options.identity_files */ 863 /* load options.identity_files */