Patch: OpenSSH 2.1.0 under Solaris 8, Solaris 7 and other sys tems, too

Badura, Christoph Christoph.Badura at Dresdner-Bank.com
Tue May 16 03:41:44 EST 2000


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);






More information about the openssh-unix-dev mailing list