Problems with OpenSSH2.9p1 on Linux/Sparc

mouring at etoh.eviladmin.org mouring at etoh.eviladmin.org
Sat May 12 09:48:15 EST 2001


The real issue is here in defines.h...

#if !defined(HAVE_ATEXIT) && defined(HAVE_ON_EXIT)
# define atexit(a) on_exit(a)
			^^^^^^^^^^^ On Linux on_exit() takes two arguments

What platform does on_exit() have a single argument?  I believe this
should be:

# define atexit(a) on_exit(a, NULL)

SunOS 4.x requires two arguments also.

- Ben

On Fri, 11 May 2001, Corey Bodzin wrote:

> Let me start this with the disclaimer that I am a Linux lover that only
> pretends to
> have any clue about coding.
>
> I grabbed the latest version of OpenSSH (v2.9p1) and went to install it
> on my Sparc
> (RH 6.2, v2.4.2).  Unlike OpenSSH 2.5.2p2, however, when I tried to
> compile it
> I got the following error:
>
> ... <compiling away> ...
> gcc -g -O2 -Wall -I. -I. -I/usr/local/ssl/include
> -DETCDIR=\"/usr/local/etc\" -
> D_PATH_SSH_PROGRAM=\"/usr/local/bin/ssh\"
> -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/loc
> al/libexec/ssh-askpass\"
> -D_PATH_SFTP_SERVER=\"/usr/local/libexec/sftp-server\"
> -D_PATH_SSH_PIDDIR=\"/var/run\" -DHAVE_CONFIG_H -c channels.c
> channels.c: In function `auth_input_request_forwarding':
> channels.c:2613: warning: implicit declaration of function `mkdtemp'
> channels.c:2613: warning: comparison between pointer and integer
> channels.c:2626: warning: passing arg 1 of `on_exit' from incompatible
> pointer type
> channels.c:2626: too few arguments to function `on_exit'
> make: *** [channels.o] Error 1
>
> This was not good.
>
> After doing a little research I discovered that atexit() apparently
> doesn't work
> on my current system (in glibc > 2.1 it is declared external, which
> breaks things
> on Sparc...I don't claim to fully follow, so read the news groups for
> more info).
> Further reading indicated that on_exit() has a different parameter list
> than atexit(),
> as shown below:
>
>  int atexit(void (*function)(void));
>  int on_exit(void (*function)(int , void *), void *arg);
>
> Since the differing parameter is for arguments I thought it might be
> safe to just
> set it to NULL, as shown below:
>
>         /* if (atexit(cleanup_socket) < 0) { */   /* Original, causes
> gcc to barf */
>         if (on_exit(cleanup_socket, NULL) < 0) {  /* Revised, now
> finger-lickin' good */
>
> This seems to do the trick, allowing me to compile.  Furthermore, I've
> been running
> the daemon for a little while now and I don't *seem* to have any bad
> things happening.
> I put together a patch to fix the required files (channels.c,
> ssh-agent.c) and listed it
> below.
>
> Anyhow, I've posted this for two reasons:
>
> 1) So that all the C-impaired people of the world (such as myself) who
> want to compile
>    OpenSSH2.9p1 on Sparc can do so without the crying, screaming, and
> cursing that I
>    had to endure.  Just remember, I am not a coder (nor do I play one on
> TV), so this
>    is not guaranteed to be good or even recommended; it may not even
> work; it may break
>    things; standard disclaimers apply.
>
> 2) So that all the C/OpenSSH/General-UNIX gurus out there can point out
> if there is a
>    better way to fix this, if this is harmful, etc.
>
> Please drop a line to me at the (obviously spam-protected) address
> DELETEcbodzin at home.com
> and let me know.
>
> Patch follows - put the text into a file and then type "cat <patchfile>
> | patch -p1" from
> your openssh2.9p1 directory to install.
>
> ----------------------------------------------------------
>
> *** channels.c Fri May 11 16:06:04 2001
> --- channels.c.new Fri May 11 16:07:29 2001
> ***************
> *** 2623,2629 ****
>    snprintf(channel_forwarded_auth_socket_name, MAX_SOCKET_NAME,
> "%s/agent.%d",
>      channel_forwarded_auth_socket_dir, (int) getpid());
>
> !  if (atexit(cleanup_socket) < 0) {
>     int saved = errno;
>     cleanup_socket();
>     packet_disconnect("socket: %.100s", strerror(saved));
> --- 2623,2633 ----
>    snprintf(channel_forwarded_auth_socket_name, MAX_SOCKET_NAME,
> "%s/agent.%d",
>      channel_forwarded_auth_socket_dir, (int) getpid());
>
> !  /* This is bad...on_exit requires 2 parameters, whereas
> !     at_exit only takes one.  Field 2 is arguments, so let's
> !     see if we can fool it by passing null - Corey 5/11/01   */
> !  /* if (atexit(cleanup_socket) < 0) { */
> !  if (on_exit(cleanup_socket, NULL) < 0) {
>     int saved = errno;
>     cleanup_socket();
>     packet_disconnect("socket: %.100s", strerror(saved));
> *** ssh-agent.c Fri May 11 16:05:57 2001
> --- ssh-agent.c.new Fri May 11 16:07:20 2001
> ***************
> *** 860,866 ****
>     perror("setsid");
>     cleanup_exit(1);
>    }
> !  if (atexit(cleanup_socket) < 0) {
>     perror("atexit");
>     cleanup_exit(1);
>    }
> --- 860,870 ----
>     perror("setsid");
>     cleanup_exit(1);
>    }
> !         /* This is bad...on_exit requires 2 parameters, whereas
> !            at_exit only takes one.  Field 2 is arguments, so let's
> !            see if we can fool it by passing null - Corey 5/11/01   */
> !  /* if (atexit(cleanup_socket) < 0) { */
> !         if (on_exit(cleanup_socket, NULL) < 0) {
>     perror("atexit");
>     cleanup_exit(1);
>    }
>
>




More information about the openssh-unix-dev mailing list