Allow --without-privsep build.

David Woodhouse dwmw2 at infradead.org
Sun Jan 8 12:05:07 EST 2006


On Sun, 2006-01-08 at 01:01 +0000, David Woodhouse wrote:
> I've been trying to cut down the size of openssh so I can run it on my
> Nokia 770. One thing which helps a fair amount (and will help even more
> when I get '-ffunction-sections -fdata-sections --gc-sections' working)
> is to have the option of compiling out privilege separation...

When running without privsep I found that sshd was always closing stdin
when starting a login shell. The first channel's ->ctl_fd and ->sock
were both set to zero, rather than -1. I'm not sure if this is something
I introduced myself with the previous patch, or something about the
Nokia 770 environment... any ideas?

The other thing I did to reduce the code size, btw, was to turn libssh
into a shared library -- I assume there's no interest in merging any
change along those lines?

--- openssh-4.2p1/channels.c~	2006-01-06 01:45:55.000000000 +0000
+++ openssh-4.2p1/channels.c	2006-01-06 04:05:47.000000000 +0000
@@ -183,6 +183,8 @@ channel_register_fds(Channel *c, int rfd
 	c->rfd = rfd;
 	c->wfd = wfd;
 	c->efd = efd;
+	c->ctl_fd = -1; /* XXX: set elsewhere */
+	c->sock = -1;
 	channel_fds_changed = 1;
 
 	if (rfd == -1 && wfd == -1 && efd == -1)
@@ -196,7 +198,6 @@ channel_register_fds(Channel *c, int rfd
 	/* XXX set close-on-exec -markus */
 
 	c->sock = (rfd == wfd) ? rfd : -1;
-	c->ctl_fd = -1; /* XXX: set elsewhere */
 	c->extended_usage = extusage;
 
 	/* XXX ugly hack: nonblock is only set by the server */
@@ -332,8 +333,8 @@ channel_close_fd(int *fdp)
 static void
 channel_close_fds(Channel *c)
 {
-	debug3("channel %d: close_fds r %d w %d e %d c %d",
-	    c->self, c->rfd, c->wfd, c->efd, c->ctl_fd);
+	debug3("channel %d: close_fds s %d r %d w %d e %d c %d",
+	      c->self, c->sock, c->rfd, c->wfd, c->efd, c->ctl_fd);
 
 	channel_close_fd(&c->sock);
 	channel_close_fd(&c->ctl_fd);

-- 
dwmw2




More information about the openssh-unix-dev mailing list