Bladt Norbert
2000-May-12 15:14 UTC
Patch: OpenSSH 2.1.0 under Solaris 8, Solaris 7 and other sys tems, too
> -----Urspr?ngliche Nachricht----- > Von: Andre Lucas [SMTP:andre.lucas at dial.pipex.com] > Gesendet am: Freitag, 12. Mai 2000 16:37 > An: Bladt Norbert > Cc: 'Karsten Thygesen'; 'openssh-unix-dev at mindrot.org'; > 'carl at bl.echidna.id.au' > Betreff: Re: Patch: OpenSSH 2.1.0 under Solaris 8, Solaris 7 and > other systems, too > > Well spotted. Doh.No problem. I had to use the debug mode to find out why the X11 forwarding didn't work. Finally, the problem was in the client, though.> I think an even better way to fix this would be to save the string as > parsed from ssh_prng_cmds in the command's entropy_source_t, and print > that in debug messages. It's a tiny amount of memory for what is, as you > say, useful debugging info.Sure. I did look at the sources for the first time and do not know a lot of OpenSSH, yet. So, just go ahead and apply your suggested fix for the next release and we are all happy.> So useful, in fact, that the bug occurred when I added the second > parameter to Damien's prng code, likely as a temporary measure, and left > it in...It was easy to spot and temporarily fixed, anyway. Norbert.
Badura, Christoph
2000-May-15 17:41 UTC
Patch: OpenSSH 2.1.0 under Solaris 8, Solaris 7 and other sys tems, too
Because Norbert's patch didn't fix all the core dumps here's a
minimal
minimal patch that implements Andre's suggestion:
*** entropy.c.orig Tue May 2 01:56:41 2000
--- entropy.c Mon May 15 16:18:22 2000
***************
*** 129,134 ****
--- 129,136 ----
unsigned int badness;
/* Increases by factor of two each timeout */
unsigned int sticky_badness;
+ /* Unparsed copy of cmd field in control file */
+ char *cmd;
/* Path to executable */
char *path;
/* argv to pass to executable */
***************
*** 211,218 ****
/* FIXME: turn this off later */
#if 1
! debug("Got %0.2f bytes of entropy from %s",
entropy_estimate,
! entropy_sources[c].path);
#endif
total_entropy_estimate += entropy_estimate;
--- 213,220 ----
/* FIXME: turn this off later */
#if 1
! debug("Got %0.2f bytes of entropy from
'%s'", entropy_estimate,
! entropy_sources[c].cmd);
#endif
total_entropy_estimate += entropy_estimate;
***************
*** 225,233 ****
} else {
/* FIXME: turn this off later */
#if 1
! debug("Command '%s %s %s' disabled (badness
%d)",
! entropy_sources[c].path,
entropy_sources[c].args[1],
! entropy_sources[c].args[2],
entropy_sources[c].badness);
#endif
if (entropy_sources[c].badness > 0)
--- 227,235 ----
} else {
/* FIXME: turn this off later */
#if 1
! debug("Command '%s' disabled (badness %d)",
! entropy_sources[c].cmd,
! entropy_sources[c].badness);
#endif
if (entropy_sources[c].badness > 0)
***************
*** 324,331 ****
close(devnull);
execv(src->path, (char**)(src->args));
! debug("(child) Couldn't exec '%s %s %s': %s",
src->path,
! src->args[1], src->args[2],
strerror(errno));
src->badness = src->sticky_badness = 128;
_exit(-1);
default: /* Parent */
--- 326,333 ----
close(devnull);
execv(src->path, (char**)(src->args));
! debug("(child) Couldn't exec '%s': %s", src->cmd,
! strerror(errno));
src->badness = src->sticky_badness = 128;
_exit(-1);
default: /* Parent */
***************
*** 372,378 ****
case -1:
default:
! error("Command '%s %s': select() failed: %s",
src->path, src->args[1],
strerror(errno));
error_abort = 1;
break;
--- 374,380 ----
case -1:
default:
! error("Command '%s': select() failed: %s", src->cmd,
strerror(errno));
error_abort = 1;
break;
***************
*** 386,393 ****
close(p[0]);
if (waitpid(pid, &status, 0) == -1) {
! error("Couldn't wait for child '%s %s' completion:
%s",
src->path,
! src->args[1], strerror(errno));
/* return(-1); */ /* FIXME: (ATL) this doesn't feel right */
return(0.0);
}
--- 388,395 ----
close(p[0]);
if (waitpid(pid, &status, 0) == -1) {
! error("Couldn't wait for child '%s' completion: %s",
src->cmd,
! strerror(errno));
/* return(-1); */ /* FIXME: (ATL) this doesn't feel right */
return(0.0);
}
***************
*** 398,404 ****
/* closing p[0] on timeout causes the entropy command to
* SIGPIPE. Take whatever output we got, and mark this
command
* as slow */
! debug("Command %s %s timed out", src->path, src->args[1]);
src->sticky_badness *= 2;
src->badness = src->sticky_badness;
return(total_bytes_read);
--- 400,406 ----
/* closing p[0] on timeout causes the entropy command to
* SIGPIPE. Take whatever output we got, and mark this
command
* as slow */
! debug("Command '%s' timed out", src->cmd);
src->sticky_badness *= 2;
src->badness = src->sticky_badness;
return(total_bytes_read);
***************
*** 408,419 ****
if (WEXITSTATUS(status)==0) {
return(total_bytes_read);
} else {
! debug("Exit status was %d", WEXITSTATUS(status));
src->badness = src->sticky_badness = 128;
return (0.0);
}
} else if (WIFSIGNALED(status)) {
! debug("Returned on uncaught signal %d !", status);
src->badness = src->sticky_badness = 128;
return(0.0);
} else
--- 410,422 ----
if (WEXITSTATUS(status)==0) {
return(total_bytes_read);
} else {
! debug("Exit status of '%s' was %d", src->cmd,
! WEXITSTATUS(status));
src->badness = src->sticky_badness = 128;
return (0.0);
}
} else if (WIFSIGNALED(status)) {
! debug("Returned on uncaught signal %d for '%s'!", status,
src->cmd);
src->badness = src->sticky_badness = 128;
return(0.0);
} else
***************
*** 614,619 ****
--- 617,627 ----
linenum, cmdfilename);
continue;
}
+
+ /* save copy of command args for use in debug() */
+ cp = (char*)xmalloc(strlen(cmd)+1);
+ strcpy(cp, cmd);
+ entcmd[cur_cmd].cmd = cp;
/* split the command args */
cp = strtok(cmd, WHITESPACE);
Apparently Analagous Threads
- Patch: OpenSSH 2.1.0 under Solaris 8, Solaris 7 and other systems , too
- problem in entropy.c if no getrusage
- AW: Patch: OpenSSH 2.1.0 under Solaris 8, Solaris 7 and other sys tems, too
- icecast2 sends metadata to clients but not actual stream
- Mountpoint "disappearing" ?