Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ EXEEXT=@EXEEXT@

STATIC=@STATIC@

MV=@MV@

# whether we're building client, server, or both for the common objects.
# evilness so we detect 'dropbear' by itself as a word
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
Expand Down Expand Up @@ -177,7 +179,7 @@ default_options_guard.h: $(srcdir)/default_options.h
@echo Creating $@
@printf "/*\n > > > Do not edit this file (default_options_guard.h) < < <\nGenerated from "$^"\nLocal customisation goes in localoptions.h\n*/\n\n" > [email protected]
@$(srcdir)/ifndef_wrapper.sh < $^ >> [email protected]
mv -v [email protected] $@
$(MV) -v [email protected] $@
pwd
ls -l $@

Expand Down
15 changes: 13 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ build_os
build_vendor
build_cpu
build
MV
STATIC
DROPBEAR_LTM_CFLAGS
LTM_CFLAGS
Expand Down Expand Up @@ -4598,6 +4599,15 @@ rm -rf conftest*
fi


# Default mv
# We can edit mv's path, it's usefull on systems where the gnu
# coreutils are not the default implementation. For example on Illumos and
# Solaris, the default mv does not have the -v option (verbose). But on Solaris
# and most Illumos distros, the gnu coreutils are shipped under /usr/gnu, where
# we can find mv under the bin/ directory.
MV="mv"


# Host specific options
# this isn't a definitive list of hosts, they are just added as required

Expand Down Expand Up @@ -4685,8 +4695,7 @@ case "$host" in

*-*-solaris*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
conf_lastlog_location="/var/adm/lastlog"
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -lssp"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for obsolete utmp and wtmp in solaris2.x" >&5
printf %s "checking for obsolete utmp and wtmp in solaris2.x... " >&6; }
sol2ver=`echo "$host"| sed -e 's/.*[0-9]\.//'`
Expand Down Expand Up @@ -4783,6 +4792,8 @@ then :
LIBS="$LIBS -lnsl"
fi

MV="/usr/gnu/bin/mv"

;;

*-*-aix*)
Expand Down
12 changes: 10 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ AC_ARG_ENABLE(werror,
# large file support is useful for scp
AC_SYS_LARGEFILE

# Default mv
# We can edit mv's path, it's usefull on systems where the gnu
# coreutils are not the default implementation. For example on Illumos and
# Solaris, the default mv does not have the -v option (verbose). But on Solaris
# and most Illumos distros, the gnu coreutils are shipped under /usr/gnu, where
# we can find mv under the bin/ directory.
AC_SUBST(MV,["mv"])

# Host specific options
# this isn't a definitive list of hosts, they are just added as required
AC_CANONICAL_HOST
Expand All @@ -160,8 +168,7 @@ case "$host" in

*-*-solaris*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
conf_lastlog_location="/var/adm/lastlog"
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -lssp"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to do

AC_CHECK_LIB(ssp, some_function_in_libssp, LIBS="$LIBS -lssp")

since I suspect there are old versions of solaris without libssp that would break. (Not sure what function you would use there).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just check for __stack_chk_fail,it's the function used:

AC_CHECK_LIB(ssp, __stack_chk_fail, LIBS="$LIBS -lssp")

When running ./configure:

checking for __stack_chk_fail in -lssp... yes

In Makefile:

LIBS+=-lz  -lssp -lsocket -lnsl

However when building:

gcc -mindirect-branch=thunk -mfunction-return=thunk -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE -Wundef -fno-strict-overflow -Wno-pointer-sign -Os -W -Wall -I/usr/local/include  -I./src/../libtomcrypt/src/headers/ -I. -I./src -DDROPBEAR_SERVER -DDROPBEAR_CLIENT src/scpmisc.c -o obj/scpmisc.o -c
gcc -Wl,-pie  -L/usr/local/lib -R/usr/local/lib -o scp ./obj/scp.o ./obj/progressmeter.o ./obj/atomicio.o ./obj/scpmisc.o ./obj/compat.o
Undefined                       first referenced
 symbol                             in file
__stack_chk_fail                    ./obj/scp.o
__stack_chk_guard                   ./obj/scp.o
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:237: scp] Error 1

Same error as before. I'm testing on Solaris, I know that their linker is a bit strict on libraries order so I tried editing the makefile, putting -lssp in first position, doesn't change anything. I also tried to use an other linker, but weirdly enough, same thing. I'll try on OmniOS.

Copy link
Author

@jhessane jhessane Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way works on OmniOS. From what I read in their gcc patches; they added __stack_chk_fail() and __stack_chk_guard in the illumos libc, so they added solaris2 to the ssp compatibles OSes in gcc. I don't really know what to do from here, should we keep it the way it was (having -lssp defined in LDFLAGS) or hope that the great Oracle will patch his gcc?
Using gcc14 on both Solaris and OmniOS, there is gcc15 on Solaris but it seems like it's going to be the same problem.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess if it's fiddly linker order leave it as-is.

AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
if test "$sol2ver" -ge 8; then
Expand All @@ -173,6 +180,7 @@ case "$host" in
fi
AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
AC_CHECK_LIB(nsl, yp_match, LIBS="$LIBS -lnsl")
AC_SUBST(MV,["/usr/gnu/bin/mv"])
;;

*-*-aix*)
Expand Down
2 changes: 2 additions & 0 deletions src/dbhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#define ATTRIB_SENTINEL
#endif

#define __STDC_WANT_LIB_EXT1__ 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be enabled unconditionally, no need to check for Solaris. AFAIK the only reason it's hidden behind a #define is in case of clashes with program symbols, but that won't be the case here.

Copy link
Author

@jhessane jhessane Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know how the support of older OSes is, so I did it this way in case a compiler is not C11 compliant (I think it's not even on some recent C11 compilers because it's optional).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure it'll be fine without the #if defined(SOLARIS)


void m_burn(void* data, unsigned int len);

#endif /* DROPBEAR_DBHELPERS_H_ */