setlogin failed: Function not implemented

Darren Tucker dtucker at zip.com.au
Mon Oct 27 10:10:11 EST 2003


Ben Lindstrom wrote:
> 
> On Mon, 27 Oct 2003, Darren Tucker wrote:
> 
> > Eivind Magnus Hvidevold wrote:
> > > When configuring openssh I get this in config.log:
> > > configure:6557: checking for setlogin
> > > configure:6594: gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wno-uninitialized   conftest.c -lutil -lz -lnsl  >&5
> > > /tmp/cc4nGZCj.o: In function `main':
> > > /tmp/build/openssh-3.7.1p2/configure:6585: warning: setlogin is not implemented and will always fail
> >
> > One other thing: maybe configure could test for errno == ENOSYS when
> > checking for setlogin?
> 
> If it detects more stupid groups that don't have enough common sense to
> not implemention an API instead of doing a stub then I say go for it.

Eivind, please try this patch.  You'll need to run "autoreconf" after
applying it, then run "./configure && make".

If this works out I might look at doing the same thing for setresuid and
setresgid since they have the same problem on some Linuxes.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/configure.ac,v
retrieving revision 1.173
diff -u -p -r1.173 configure.ac
--- configure.ac	15 Oct 2003 06:57:57 -0000	1.173
+++ configure.ac	26 Oct 2003 22:58:18 -0000
@@ -740,7 +740,7 @@ AC_CHECK_FUNCS(\
 	inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
 	mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
 	pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
-	setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
+	setdtablesize setegid setenv seteuid setgroups setpcred \
 	setproctitle setregid setresgid setresuid setreuid setrlimit \
 	setsid setvbuf sigaction sigvec snprintf socketpair strerror \
 	strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
@@ -773,6 +773,19 @@ AC_CHECK_DECL(tcsendbreak,
 	[AC_DEFINE(HAVE_TCSENDBREAK)],
 	[AC_CHECK_FUNCS(tcsendbreak)], 
 	[#include <termios.h>]
+)
+
+dnl Some platorms have setlogin that isn't implemented
+AC_CHECK_FUNC(setlogin,
+	[AC_MSG_CHECKING(if setlogin seems to work)
+	AC_TRY_RUN([
+#include <errno.h>
+int main(){setlogin("sshtest"); if (errno==ENOSYS) exit 1; else exit 0;}
+		],
+		[AC_MSG_RESULT(yes)
+		 AC_DEFINE(HAVE_SETLOGIN)],
+		 AC_MSG_RESULT(not implemented)
+	)]
 )
 
 dnl    Checks for time functions


More information about the openssh-unix-dev mailing list