rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone
f09e2e
diff -up openssh-6.3p1/auth-pam.c.coverity openssh-6.3p1/auth-pam.c
f09e2e
--- openssh-6.3p1/auth-pam.c.coverity	2013-06-02 00:07:32.000000000 +0200
f09e2e
+++ openssh-6.3p1/auth-pam.c	2013-10-07 13:20:36.288298063 +0200
f09e2e
@@ -216,7 +216,12 @@ pthread_join(sp_pthread_t thread, void *
f09e2e
 	if (sshpam_thread_status != -1)
f09e2e
 		return (sshpam_thread_status);
f09e2e
 	signal(SIGCHLD, sshpam_oldsig);
f09e2e
-	waitpid(thread, &status, 0);
f09e2e
+	while (waitpid(thread, &status, 0) < 0) {                     
f09e2e
+		if (errno == EINTR)                                
f09e2e
+			continue;
f09e2e
+		fatal("%s: waitpid: %s", __func__,         
f09e2e
+				strerror(errno));                      
f09e2e
+	}
f09e2e
 	return (status);
f09e2e
 }
f09e2e
 #endif
f09e2e
diff -up openssh-6.3p1/channels.c.coverity openssh-6.3p1/channels.c
f09e2e
--- openssh-6.3p1/channels.c.coverity	2013-09-13 08:19:31.000000000 +0200
f09e2e
+++ openssh-6.3p1/channels.c	2013-10-07 13:20:36.289298058 +0200
f09e2e
@@ -233,11 +233,11 @@ channel_register_fds(Channel *c, int rfd
f09e2e
 	channel_max_fd = MAX(channel_max_fd, wfd);
f09e2e
 	channel_max_fd = MAX(channel_max_fd, efd);
f09e2e
 
f09e2e
-	if (rfd != -1)
f09e2e
+	if (rfd >= 0)
f09e2e
 		fcntl(rfd, F_SETFD, FD_CLOEXEC);
f09e2e
-	if (wfd != -1 && wfd != rfd)
f09e2e
+	if (wfd >= 0 && wfd != rfd)
f09e2e
 		fcntl(wfd, F_SETFD, FD_CLOEXEC);
f09e2e
-	if (efd != -1 && efd != rfd && efd != wfd)
f09e2e
+	if (efd >= 0 && efd != rfd && efd != wfd)
f09e2e
 		fcntl(efd, F_SETFD, FD_CLOEXEC);
f09e2e
 
f09e2e
 	c->rfd = rfd;
f09e2e
@@ -255,11 +255,11 @@ channel_register_fds(Channel *c, int rfd
f09e2e
 
f09e2e
 	/* enable nonblocking mode */
f09e2e
 	if (nonblock) {
f09e2e
-		if (rfd != -1)
f09e2e
+		if (rfd >= 0)
f09e2e
 			set_nonblock(rfd);
f09e2e
-		if (wfd != -1)
f09e2e
+		if (wfd >= 0)
f09e2e
 			set_nonblock(wfd);
f09e2e
-		if (efd != -1)
f09e2e
+		if (efd >= 0)
f09e2e
 			set_nonblock(efd);
f09e2e
 	}
f09e2e
 }
f09e2e
diff -up openssh-6.3p1/clientloop.c.coverity openssh-6.3p1/clientloop.c
f09e2e
--- openssh-6.3p1/clientloop.c.coverity	2013-06-10 05:07:12.000000000 +0200
f09e2e
+++ openssh-6.3p1/clientloop.c	2013-10-07 13:20:36.289298058 +0200
f09e2e
@@ -2068,14 +2068,15 @@ client_input_global_request(int type, u_
f09e2e
 	char *rtype;
f09e2e
 	int want_reply;
f09e2e
 	int success = 0;
f09e2e
+/* success is still 0 the packet is allways SSH2_MSG_REQUEST_FAILURE, isn't it? */
f09e2e
 
f09e2e
 	rtype = packet_get_string(NULL);
f09e2e
 	want_reply = packet_get_char();
f09e2e
 	debug("client_input_global_request: rtype %s want_reply %d",
f09e2e
 	    rtype, want_reply);
f09e2e
 	if (want_reply) {
f09e2e
-		packet_start(success ?
f09e2e
-		    SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE);
f09e2e
+		packet_start(/*success ?
f09e2e
+		    SSH2_MSG_REQUEST_SUCCESS :*/ SSH2_MSG_REQUEST_FAILURE);
f09e2e
 		packet_send();
f09e2e
 		packet_write_wait();
f09e2e
 	}
f09e2e
diff -up openssh-6.3p1/key.c.coverity openssh-6.3p1/key.c
f09e2e
--- openssh-6.3p1/key.c.coverity	2013-06-01 23:41:51.000000000 +0200
f09e2e
+++ openssh-6.3p1/key.c	2013-10-07 13:20:36.290298054 +0200
f09e2e
@@ -807,8 +807,10 @@ key_read(Key *ret, char **cpp)
f09e2e
 		success = 1;
f09e2e
 /*XXXX*/
f09e2e
 		key_free(k);
f09e2e
+/*XXXX
f09e2e
 		if (success != 1)
f09e2e
 			break;
f09e2e
+XXXX*/
f09e2e
 		/* advance cp: skip whitespace and data */
f09e2e
 		while (*cp == ' ' || *cp == '\t')
f09e2e
 			cp++;
f09e2e
diff -up openssh-6.3p1/monitor.c.coverity openssh-6.3p1/monitor.c
f09e2e
--- openssh-6.3p1/monitor.c.coverity	2013-07-20 05:21:53.000000000 +0200
f09e2e
+++ openssh-6.3p1/monitor.c	2013-10-07 13:54:36.761314042 +0200
f09e2e
@@ -449,7 +449,7 @@ monitor_child_preauth(Authctxt *_authctx
f09e2e
 	mm_get_keystate(pmonitor);
f09e2e
 
f09e2e
 	/* Drain any buffered messages from the child */
f09e2e
-	while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
f09e2e
+	while (pmonitor->m_log_recvfd >= 0 && monitor_read_log(pmonitor) == 0)
f09e2e
 		;
f09e2e
 
f09e2e
 	close(pmonitor->m_sendfd);
f09e2e
@@ -1202,6 +1202,10 @@ mm_answer_keyallowed(int sock, Buffer *m
f09e2e
 			break;
f09e2e
 		}
f09e2e
 	}
f09e2e
+
f09e2e
+	debug3("%s: key %p is %s",
f09e2e
+	    __func__, key, allowed ? "allowed" : "not allowed");
f09e2e
+
f09e2e
 	if (key != NULL)
f09e2e
 		key_free(key);
f09e2e
 
f09e2e
@@ -1223,9 +1227,6 @@ mm_answer_keyallowed(int sock, Buffer *m
f09e2e
 		free(chost);
f09e2e
 	}
f09e2e
 
f09e2e
-	debug3("%s: key %p is %s",
f09e2e
-	    __func__, key, allowed ? "allowed" : "not allowed");
f09e2e
-
f09e2e
 	buffer_clear(m);
f09e2e
 	buffer_put_int(m, allowed);
f09e2e
 	buffer_put_int(m, forced_command != NULL);
f09e2e
diff -up openssh-6.3p1/monitor_wrap.c.coverity openssh-6.3p1/monitor_wrap.c
f09e2e
--- openssh-6.3p1/monitor_wrap.c.coverity	2013-06-02 00:07:32.000000000 +0200
f09e2e
+++ openssh-6.3p1/monitor_wrap.c	2013-10-07 13:20:36.291298049 +0200
f09e2e
@@ -710,10 +710,10 @@ mm_pty_allocate(int *ptyfd, int *ttyfd,
f09e2e
 	if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 ||
f09e2e
 	    (tmp2 = dup(pmonitor->m_recvfd)) == -1) {
f09e2e
 		error("%s: cannot allocate fds for pty", __func__);
f09e2e
-		if (tmp1 > 0)
f09e2e
+		if (tmp1 >= 0)
f09e2e
 			close(tmp1);
f09e2e
-		if (tmp2 > 0)
f09e2e
-			close(tmp2);
f09e2e
+		/*DEAD CODE if (tmp2 >= 0)
f09e2e
+			close(tmp2);*/
f09e2e
 		return 0;
f09e2e
 	}
f09e2e
 	close(tmp1);
f09e2e
diff -up openssh-6.3p1/openbsd-compat/bindresvport.c.coverity openssh-6.3p1/openbsd-compat/bindresvport.c
f09e2e
--- openssh-6.3p1/openbsd-compat/bindresvport.c.coverity	2010-12-03 00:50:26.000000000 +0100
f09e2e
+++ openssh-6.3p1/openbsd-compat/bindresvport.c	2013-10-07 13:20:36.291298049 +0200
f09e2e
@@ -58,7 +58,7 @@ bindresvport_sa(int sd, struct sockaddr
f09e2e
 	struct sockaddr_in6 *in6;
f09e2e
 	u_int16_t *portp;
f09e2e
 	u_int16_t port;
f09e2e
-	socklen_t salen;
f09e2e
+	socklen_t salen = sizeof(struct sockaddr_storage);
f09e2e
 	int i;
f09e2e
 
f09e2e
 	if (sa == NULL) {
f09e2e
diff -up openssh-6.3p1/packet.c.coverity openssh-6.3p1/packet.c
f09e2e
--- openssh-6.3p1/packet.c.coverity	2013-07-18 08:12:45.000000000 +0200
f09e2e
+++ openssh-6.3p1/packet.c	2013-10-07 13:20:36.291298049 +0200
f09e2e
@@ -1199,6 +1199,7 @@ packet_read_poll1(void)
f09e2e
 		case DEATTACK_DETECTED:
f09e2e
 			packet_disconnect("crc32 compensation attack: "
f09e2e
 			    "network attack detected");
f09e2e
+			break;
f09e2e
 		case DEATTACK_DOS_DETECTED:
f09e2e
 			packet_disconnect("deattack denial of "
f09e2e
 			    "service detected");
f09e2e
diff -up openssh-6.3p1/progressmeter.c.coverity openssh-6.3p1/progressmeter.c
f09e2e
--- openssh-6.3p1/progressmeter.c.coverity	2013-06-02 15:46:24.000000000 +0200
f09e2e
+++ openssh-6.3p1/progressmeter.c	2013-10-07 13:42:32.377850691 +0200
f09e2e
@@ -65,7 +65,7 @@ static void update_progress_meter(int);
f09e2e
 
f09e2e
 static time_t start;		/* start progress */
f09e2e
 static time_t last_update;	/* last progress update */
f09e2e
-static char *file;		/* name of the file being transferred */
f09e2e
+static const char *file;	/* name of the file being transferred */
f09e2e
 static off_t end_pos;		/* ending position of transfer */
f09e2e
 static off_t cur_pos;		/* transfer position as of last refresh */
f09e2e
 static volatile off_t *counter;	/* progress counter */
f09e2e
@@ -247,7 +247,7 @@ update_progress_meter(int ignore)
f09e2e
 }
f09e2e
 
f09e2e
 void
f09e2e
-start_progress_meter(char *f, off_t filesize, off_t *ctr)
f09e2e
+start_progress_meter(const char *f, off_t filesize, off_t *ctr)
f09e2e
 {
f09e2e
 	start = last_update = monotime();
f09e2e
 	file = f;
f09e2e
diff -up openssh-6.3p1/progressmeter.h.coverity openssh-6.3p1/progressmeter.h
f09e2e
--- openssh-6.3p1/progressmeter.h.coverity	2006-03-26 05:30:02.000000000 +0200
f09e2e
+++ openssh-6.3p1/progressmeter.h	2013-10-07 13:20:36.292298044 +0200
f09e2e
@@ -23,5 +23,5 @@
f09e2e
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
f09e2e
  */
f09e2e
 
f09e2e
-void	start_progress_meter(char *, off_t, off_t *);
f09e2e
+void	start_progress_meter(const char *, off_t, off_t *);
f09e2e
 void	stop_progress_meter(void);
f09e2e
diff -up openssh-6.3p1/scp.c.coverity openssh-6.3p1/scp.c
f09e2e
--- openssh-6.3p1/scp.c.coverity	2013-07-18 08:11:25.000000000 +0200
f09e2e
+++ openssh-6.3p1/scp.c	2013-10-07 13:20:36.292298044 +0200
f09e2e
@@ -155,7 +155,7 @@ killchild(int signo)
f09e2e
 {
f09e2e
 	if (do_cmd_pid > 1) {
f09e2e
 		kill(do_cmd_pid, signo ? signo : SIGTERM);
f09e2e
-		waitpid(do_cmd_pid, NULL, 0);
f09e2e
+		(void) waitpid(do_cmd_pid, NULL, 0);
f09e2e
 	}
f09e2e
 
f09e2e
 	if (signo)
f09e2e
diff -up openssh-6.3p1/servconf.c.coverity openssh-6.3p1/servconf.c
f09e2e
--- openssh-6.3p1/servconf.c.coverity	2013-07-20 05:21:53.000000000 +0200
f09e2e
+++ openssh-6.3p1/servconf.c	2013-10-07 13:20:36.293298039 +0200
f09e2e
@@ -1323,7 +1323,7 @@ process_server_config_line(ServerOptions
f09e2e
 			fatal("%s line %d: Missing subsystem name.",
f09e2e
 			    filename, linenum);
f09e2e
 		if (!*activep) {
f09e2e
-			arg = strdelim(&cp;;
f09e2e
+			/*arg =*/ (void) strdelim(&cp;;
f09e2e
 			break;
f09e2e
 		}
f09e2e
 		for (i = 0; i < options->num_subsystems; i++)
f09e2e
@@ -1414,8 +1414,9 @@ process_server_config_line(ServerOptions
f09e2e
 		if (*activep && *charptr == NULL) {
f09e2e
 			*charptr = tilde_expand_filename(arg, getuid());
f09e2e
 			/* increase optional counter */
f09e2e
-			if (intptr != NULL)
f09e2e
-				*intptr = *intptr + 1;
f09e2e
+			/* DEAD CODE intptr is still NULL ;)
f09e2e
+  			 if (intptr != NULL)
f09e2e
+				*intptr = *intptr + 1; */
f09e2e
 		}
f09e2e
 		break;
f09e2e
 
f09e2e
diff -up openssh-6.3p1/serverloop.c.coverity openssh-6.3p1/serverloop.c
f09e2e
--- openssh-6.3p1/serverloop.c.coverity	2013-07-18 08:12:45.000000000 +0200
f09e2e
+++ openssh-6.3p1/serverloop.c	2013-10-07 13:43:36.620537138 +0200
f09e2e
@@ -147,13 +147,13 @@ notify_setup(void)
f09e2e
 static void
f09e2e
 notify_parent(void)
f09e2e
 {
f09e2e
-	if (notify_pipe[1] != -1)
f09e2e
+	if (notify_pipe[1] >= 0)
f09e2e
 		(void)write(notify_pipe[1], "", 1);
f09e2e
 }
f09e2e
 static void
f09e2e
 notify_prepare(fd_set *readset)
f09e2e
 {
f09e2e
-	if (notify_pipe[0] != -1)
f09e2e
+	if (notify_pipe[0] >= 0)
f09e2e
 		FD_SET(notify_pipe[0], readset);
f09e2e
 }
f09e2e
 static void
f09e2e
@@ -161,8 +161,8 @@ notify_done(fd_set *readset)
f09e2e
 {
f09e2e
 	char c;
f09e2e
 
f09e2e
-	if (notify_pipe[0] != -1 && FD_ISSET(notify_pipe[0], readset))
f09e2e
-		while (read(notify_pipe[0], &c, 1) != -1)
f09e2e
+	if (notify_pipe[0] >= 0 && FD_ISSET(notify_pipe[0], readset))
f09e2e
+		while (read(notify_pipe[0], &c, 1) >= 0)
f09e2e
 			debug2("notify_done: reading");
f09e2e
 }
f09e2e
 
f09e2e
@@ -336,7 +336,7 @@ wait_until_can_do_something(fd_set **rea
f09e2e
 		 * If we have buffered data, try to write some of that data
f09e2e
 		 * to the program.
f09e2e
 		 */
f09e2e
-		if (fdin != -1 && buffer_len(&stdin_buffer) > 0)
f09e2e
+		if (fdin >= 0 && buffer_len(&stdin_buffer) > 0)
f09e2e
 			FD_SET(fdin, *writesetp);
f09e2e
 	}
f09e2e
 	notify_prepare(*readsetp);
f09e2e
@@ -476,7 +476,7 @@ process_output(fd_set *writeset)
f09e2e
 	int len;
f09e2e
 
f09e2e
 	/* Write buffered data to program stdin. */
f09e2e
-	if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
f09e2e
+	if (!compat20 && fdin >= 0 && FD_ISSET(fdin, writeset)) {
f09e2e
 		data = buffer_ptr(&stdin_buffer);
f09e2e
 		dlen = buffer_len(&stdin_buffer);
f09e2e
 		len = write(fdin, data, dlen);
f09e2e
@@ -589,7 +589,7 @@ server_loop(pid_t pid, int fdin_arg, int
f09e2e
 	set_nonblock(fdin);
f09e2e
 	set_nonblock(fdout);
f09e2e
 	/* we don't have stderr for interactive terminal sessions, see below */
f09e2e
-	if (fderr != -1)
f09e2e
+	if (fderr >= 0)
f09e2e
 		set_nonblock(fderr);
f09e2e
 
f09e2e
 	if (!(datafellows & SSH_BUG_IGNOREMSG) && isatty(fdin))
f09e2e
@@ -613,7 +613,7 @@ server_loop(pid_t pid, int fdin_arg, int
f09e2e
 	max_fd = MAX(connection_in, connection_out);
f09e2e
 	max_fd = MAX(max_fd, fdin);
f09e2e
 	max_fd = MAX(max_fd, fdout);
f09e2e
-	if (fderr != -1)
f09e2e
+	if (fderr >= 0)
f09e2e
 		max_fd = MAX(max_fd, fderr);
f09e2e
 #endif
f09e2e
 
f09e2e
@@ -643,7 +643,7 @@ server_loop(pid_t pid, int fdin_arg, int
f09e2e
 		 * If we have received eof, and there is no more pending
f09e2e
 		 * input data, cause a real eof by closing fdin.
f09e2e
 		 */
f09e2e
-		if (stdin_eof && fdin != -1 && buffer_len(&stdin_buffer) == 0) {
f09e2e
+		if (stdin_eof && fdin >= 0 && buffer_len(&stdin_buffer) == 0) {
f09e2e
 			if (fdin != fdout)
f09e2e
 				close(fdin);
f09e2e
 			else
f09e2e
@@ -739,15 +739,15 @@ server_loop(pid_t pid, int fdin_arg, int
f09e2e
 	buffer_free(&stderr_buffer);
f09e2e
 
f09e2e
 	/* Close the file descriptors. */
f09e2e
-	if (fdout != -1)
f09e2e
+	if (fdout >= 0)
f09e2e
 		close(fdout);
f09e2e
 	fdout = -1;
f09e2e
 	fdout_eof = 1;
f09e2e
-	if (fderr != -1)
f09e2e
+	if (fderr >= 0)
f09e2e
 		close(fderr);
f09e2e
 	fderr = -1;
f09e2e
 	fderr_eof = 1;
f09e2e
-	if (fdin != -1)
f09e2e
+	if (fdin >= 0)
f09e2e
 		close(fdin);
f09e2e
 	fdin = -1;
f09e2e
 
f09e2e
@@ -946,7 +946,7 @@ server_input_window_size(int type, u_int
f09e2e
 
f09e2e
 	debug("Window change received.");
f09e2e
 	packet_check_eom();
f09e2e
-	if (fdin != -1)
f09e2e
+	if (fdin >= 0)
f09e2e
 		pty_change_window_size(fdin, row, col, xpixel, ypixel);
f09e2e
 }
f09e2e
 
f09e2e
@@ -1006,7 +1006,7 @@ server_request_tun(void)
f09e2e
 	}
f09e2e
 
f09e2e
 	tun = packet_get_int();
f09e2e
-	if (forced_tun_device != -1) {
f09e2e
+	if (forced_tun_device >= 0) {
f09e2e
 		if (tun != SSH_TUNID_ANY && forced_tun_device != tun)
f09e2e
 			goto done;
f09e2e
 		tun = forced_tun_device;
f09e2e
diff -up openssh-6.3p1/sftp-client.c.coverity openssh-6.3p1/sftp-client.c
f09e2e
--- openssh-6.3p1/sftp-client.c.coverity	2013-07-26 00:40:00.000000000 +0200
f09e2e
+++ openssh-6.3p1/sftp-client.c	2013-10-07 13:48:45.885027420 +0200
f09e2e
@@ -149,7 +149,7 @@ get_msg(struct sftp_conn *conn, Buffer *
f09e2e
 }
f09e2e
 
f09e2e
 static void
f09e2e
-send_string_request(struct sftp_conn *conn, u_int id, u_int code, char *s,
f09e2e
+send_string_request(struct sftp_conn *conn, u_int id, u_int code, const char *s,
f09e2e
     u_int len)
f09e2e
 {
f09e2e
 	Buffer msg;
f09e2e
@@ -165,7 +165,7 @@ send_string_request(struct sftp_conn *co
f09e2e
 
f09e2e
 static void
f09e2e
 send_string_attrs_request(struct sftp_conn *conn, u_int id, u_int code,
f09e2e
-    char *s, u_int len, Attrib *a)
f09e2e
+    const char *s, u_int len, Attrib *a)
f09e2e
 {
f09e2e
 	Buffer msg;
f09e2e
 
f09e2e
@@ -422,7 +422,7 @@ sftp_proto_version(struct sftp_conn *con
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_close(struct sftp_conn *conn, char *handle, u_int handle_len)
f09e2e
+do_close(struct sftp_conn *conn, const char *handle, u_int handle_len)
f09e2e
 {
f09e2e
 	u_int id, status;
f09e2e
 	Buffer msg;
f09e2e
@@ -447,7 +447,7 @@ do_close(struct sftp_conn *conn, char *h
f09e2e
 
f09e2e
 
f09e2e
 static int
f09e2e
-do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
f09e2e
+do_lsreaddir(struct sftp_conn *conn, const char *path, int printflag,
f09e2e
     SFTP_DIRENT ***dir)
f09e2e
 {
f09e2e
 	Buffer msg;
f09e2e
@@ -572,7 +572,7 @@ do_lsreaddir(struct sftp_conn *conn, cha
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_readdir(struct sftp_conn *conn, char *path, SFTP_DIRENT ***dir)
f09e2e
+do_readdir(struct sftp_conn *conn, const char *path, SFTP_DIRENT ***dir)
f09e2e
 {
f09e2e
 	return(do_lsreaddir(conn, path, 0, dir));
f09e2e
 }
f09e2e
@@ -590,7 +590,7 @@ void free_sftp_dirents(SFTP_DIRENT **s)
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_rm(struct sftp_conn *conn, char *path)
f09e2e
+do_rm(struct sftp_conn *conn, const char *path)
f09e2e
 {
f09e2e
 	u_int status, id;
f09e2e
 
f09e2e
@@ -605,7 +605,7 @@ do_rm(struct sftp_conn *conn, char *path
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_mkdir(struct sftp_conn *conn, char *path, Attrib *a, int printflag)
f09e2e
+do_mkdir(struct sftp_conn *conn, const char *path, Attrib *a, int printflag)
f09e2e
 {
f09e2e
 	u_int status, id;
f09e2e
 
f09e2e
@@ -621,7 +621,7 @@ do_mkdir(struct sftp_conn *conn, char *p
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_rmdir(struct sftp_conn *conn, char *path)
f09e2e
+do_rmdir(struct sftp_conn *conn, const char *path)
f09e2e
 {
f09e2e
 	u_int status, id;
f09e2e
 
f09e2e
@@ -637,7 +637,7 @@ do_rmdir(struct sftp_conn *conn, char *p
f09e2e
 }
f09e2e
 
f09e2e
 Attrib *
f09e2e
-do_stat(struct sftp_conn *conn, char *path, int quiet)
f09e2e
+do_stat(struct sftp_conn *conn, const char *path, int quiet)
f09e2e
 {
f09e2e
 	u_int id;
f09e2e
 
f09e2e
@@ -651,7 +651,7 @@ do_stat(struct sftp_conn *conn, char *pa
f09e2e
 }
f09e2e
 
f09e2e
 Attrib *
f09e2e
-do_lstat(struct sftp_conn *conn, char *path, int quiet)
f09e2e
+do_lstat(struct sftp_conn *conn, const char *path, int quiet)
f09e2e
 {
f09e2e
 	u_int id;
f09e2e
 
f09e2e
@@ -685,7 +685,7 @@ do_fstat(struct sftp_conn *conn, char *h
f09e2e
 #endif
f09e2e
 
f09e2e
 int
f09e2e
-do_setstat(struct sftp_conn *conn, char *path, Attrib *a)
f09e2e
+do_setstat(struct sftp_conn *conn, const char *path, Attrib *a)
f09e2e
 {
f09e2e
 	u_int status, id;
f09e2e
 
f09e2e
@@ -702,7 +702,7 @@ do_setstat(struct sftp_conn *conn, char
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_fsetstat(struct sftp_conn *conn, char *handle, u_int handle_len,
f09e2e
+do_fsetstat(struct sftp_conn *conn, const char *handle, u_int handle_len,
f09e2e
     Attrib *a)
f09e2e
 {
f09e2e
 	u_int status, id;
f09e2e
@@ -719,7 +719,7 @@ do_fsetstat(struct sftp_conn *conn, char
f09e2e
 }
f09e2e
 
f09e2e
 char *
f09e2e
-do_realpath(struct sftp_conn *conn, char *path)
f09e2e
+do_realpath(struct sftp_conn *conn, const char *path)
f09e2e
 {
f09e2e
 	Buffer msg;
f09e2e
 	u_int type, expected_id, count, id;
f09e2e
@@ -768,7 +768,7 @@ do_realpath(struct sftp_conn *conn, char
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_rename(struct sftp_conn *conn, char *oldpath, char *newpath)
f09e2e
+do_rename(struct sftp_conn *conn, const char *oldpath, const char *newpath)
f09e2e
 {
f09e2e
 	Buffer msg;
f09e2e
 	u_int status, id;
f09e2e
@@ -802,7 +802,7 @@ do_rename(struct sftp_conn *conn, char *
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_hardlink(struct sftp_conn *conn, char *oldpath, char *newpath)
f09e2e
+do_hardlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
f09e2e
 {
f09e2e
 	Buffer msg;
f09e2e
 	u_int status, id;
f09e2e
@@ -835,7 +835,7 @@ do_hardlink(struct sftp_conn *conn, char
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_symlink(struct sftp_conn *conn, char *oldpath, char *newpath)
f09e2e
+do_symlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
f09e2e
 {
f09e2e
 	Buffer msg;
f09e2e
 	u_int status, id;
f09e2e
@@ -987,7 +987,7 @@ send_read_request(struct sftp_conn *conn
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
f09e2e
+do_download(struct sftp_conn *conn, const char *remote_path, const char *local_path,
f09e2e
     Attrib *a, int pflag, int resume)
f09e2e
 {
f09e2e
 	Attrib junk;
f09e2e
@@ -1255,7 +1255,7 @@ do_download(struct sftp_conn *conn, char
f09e2e
 }
f09e2e
 
f09e2e
 static int
f09e2e
-download_dir_internal(struct sftp_conn *conn, char *src, char *dst,
f09e2e
+download_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
f09e2e
     Attrib *dirattrib, int pflag, int printflag, int depth, int resume)
f09e2e
 {
f09e2e
 	int i, ret = 0;
f09e2e
@@ -1345,7 +1345,7 @@ download_dir_internal(struct sftp_conn *
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-download_dir(struct sftp_conn *conn, char *src, char *dst,
f09e2e
+download_dir(struct sftp_conn *conn, const char *src, const char *dst,
f09e2e
     Attrib *dirattrib, int pflag, int printflag, int resume)
f09e2e
 {
f09e2e
 	char *src_canon;
f09e2e
@@ -1363,7 +1363,7 @@ download_dir(struct sftp_conn *conn, cha
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
f09e2e
+do_upload(struct sftp_conn *conn, const char *local_path, const char *remote_path,
f09e2e
     int pflag)
f09e2e
 {
f09e2e
 	int local_fd;
f09e2e
@@ -1548,7 +1548,7 @@ do_upload(struct sftp_conn *conn, char *
f09e2e
 }
f09e2e
 
f09e2e
 static int
f09e2e
-upload_dir_internal(struct sftp_conn *conn, char *src, char *dst,
f09e2e
+upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
f09e2e
     int pflag, int printflag, int depth)
f09e2e
 {
f09e2e
 	int ret = 0, status;
f09e2e
@@ -1639,7 +1639,7 @@ upload_dir_internal(struct sftp_conn *co
f09e2e
 }
f09e2e
 
f09e2e
 int
f09e2e
-upload_dir(struct sftp_conn *conn, char *src, char *dst, int printflag,
f09e2e
+upload_dir(struct sftp_conn *conn, const char *src, const char *dst, int printflag,
f09e2e
     int pflag)
f09e2e
 {
f09e2e
 	char *dst_canon;
f09e2e
@@ -1656,7 +1656,7 @@ upload_dir(struct sftp_conn *conn, char
f09e2e
 }
f09e2e
 
f09e2e
 char *
f09e2e
-path_append(char *p1, char *p2)
f09e2e
+path_append(const char *p1, const char *p2)
f09e2e
 {
f09e2e
 	char *ret;
f09e2e
 	size_t len = strlen(p1) + strlen(p2) + 2;
f09e2e
diff -up openssh-6.3p1/sftp-client.h.coverity openssh-6.3p1/sftp-client.h
f09e2e
--- openssh-6.3p1/sftp-client.h.coverity	2013-07-25 03:56:52.000000000 +0200
f09e2e
+++ openssh-6.3p1/sftp-client.h	2013-10-07 13:45:10.108080813 +0200
f09e2e
@@ -56,49 +56,49 @@ struct sftp_conn *do_init(int, int, u_in
f09e2e
 u_int sftp_proto_version(struct sftp_conn *);
f09e2e
 
f09e2e
 /* Close file referred to by 'handle' */
f09e2e
-int do_close(struct sftp_conn *, char *, u_int);
f09e2e
+int do_close(struct sftp_conn *, const char *, u_int);
f09e2e
 
f09e2e
 /* Read contents of 'path' to NULL-terminated array 'dir' */
f09e2e
-int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
f09e2e
+int do_readdir(struct sftp_conn *, const char *, SFTP_DIRENT ***);
f09e2e
 
f09e2e
 /* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
f09e2e
 void free_sftp_dirents(SFTP_DIRENT **);
f09e2e
 
f09e2e
 /* Delete file 'path' */
f09e2e
-int do_rm(struct sftp_conn *, char *);
f09e2e
+int do_rm(struct sftp_conn *, const char *);
f09e2e
 
f09e2e
 /* Create directory 'path' */
f09e2e
-int do_mkdir(struct sftp_conn *, char *, Attrib *, int);
f09e2e
+int do_mkdir(struct sftp_conn *, const char *, Attrib *, int);
f09e2e
 
f09e2e
 /* Remove directory 'path' */
f09e2e
-int do_rmdir(struct sftp_conn *, char *);
f09e2e
+int do_rmdir(struct sftp_conn *, const char *);
f09e2e
 
f09e2e
 /* Get file attributes of 'path' (follows symlinks) */
f09e2e
-Attrib *do_stat(struct sftp_conn *, char *, int);
f09e2e
+Attrib *do_stat(struct sftp_conn *, const char *, int);
f09e2e
 
f09e2e
 /* Get file attributes of 'path' (does not follow symlinks) */
f09e2e
-Attrib *do_lstat(struct sftp_conn *, char *, int);
f09e2e
+Attrib *do_lstat(struct sftp_conn *, const char *, int);
f09e2e
 
f09e2e
 /* Set file attributes of 'path' */
f09e2e
-int do_setstat(struct sftp_conn *, char *, Attrib *);
f09e2e
+int do_setstat(struct sftp_conn *, const char *, Attrib *);
f09e2e
 
f09e2e
 /* Set file attributes of open file 'handle' */
f09e2e
-int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
f09e2e
+int do_fsetstat(struct sftp_conn *, const char *, u_int, Attrib *);
f09e2e
 
f09e2e
 /* Canonicalise 'path' - caller must free result */
f09e2e
-char *do_realpath(struct sftp_conn *, char *);
f09e2e
+char *do_realpath(struct sftp_conn *, const char *);
f09e2e
 
f09e2e
 /* Get statistics for filesystem hosting file at "path" */
f09e2e
 int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
f09e2e
 
f09e2e
 /* Rename 'oldpath' to 'newpath' */
f09e2e
-int do_rename(struct sftp_conn *, char *, char *);
f09e2e
+int do_rename(struct sftp_conn *, const char *, const char *);
f09e2e
 
f09e2e
 /* Link 'oldpath' to 'newpath' */
f09e2e
-int do_hardlink(struct sftp_conn *, char *, char *);
f09e2e
+int do_hardlink(struct sftp_conn *, const char *, const char *);
f09e2e
 
f09e2e
-/* Rename 'oldpath' to 'newpath' */
f09e2e
-int do_symlink(struct sftp_conn *, char *, char *);
f09e2e
+/* Symlink 'oldpath' to 'newpath' */
f09e2e
+int do_symlink(struct sftp_conn *, const char *, const char *);
f09e2e
 
f09e2e
 /* XXX: add callbacks to do_download/do_upload so we can do progress meter */
f09e2e
 
f09e2e
@@ -106,27 +106,27 @@ int do_symlink(struct sftp_conn *, char
f09e2e
  * Download 'remote_path' to 'local_path'. Preserve permissions and times
f09e2e
  * if 'pflag' is set
f09e2e
  */
f09e2e
-int do_download(struct sftp_conn *, char *, char *, Attrib *, int, int);
f09e2e
+int do_download(struct sftp_conn *, const char *, const char *, Attrib *, int, int);
f09e2e
 
f09e2e
 /*
f09e2e
  * Recursively download 'remote_directory' to 'local_directory'. Preserve 
f09e2e
  * times if 'pflag' is set
f09e2e
  */
f09e2e
-int download_dir(struct sftp_conn *, char *, char *, Attrib *, int, int, int);
f09e2e
+int download_dir(struct sftp_conn *, const char *, const char *, Attrib *, int, int, int);
f09e2e
 
f09e2e
 /*
f09e2e
  * Upload 'local_path' to 'remote_path'. Preserve permissions and times
f09e2e
  * if 'pflag' is set
f09e2e
  */
f09e2e
-int do_upload(struct sftp_conn *, char *, char *, int);
f09e2e
+int do_upload(struct sftp_conn *, const char *, const char *, int);
f09e2e
 
f09e2e
 /*
f09e2e
  * Recursively upload 'local_directory' to 'remote_directory'. Preserve 
f09e2e
  * times if 'pflag' is set
f09e2e
  */
f09e2e
-int upload_dir(struct sftp_conn *, char *, char *, int, int);
f09e2e
+int upload_dir(struct sftp_conn *, const char *, const char *, int, int);
f09e2e
 
f09e2e
 /* Concatenate paths, taking care of slashes. Caller must free result. */
f09e2e
-char *path_append(char *, char *);
f09e2e
+char *path_append(const char *, const char *);
f09e2e
 
f09e2e
 #endif
f09e2e
diff -up openssh-6.3p1/sftp.c.coverity openssh-6.3p1/sftp.c
f09e2e
--- openssh-6.3p1/sftp.c.coverity	2013-07-25 03:56:52.000000000 +0200
f09e2e
+++ openssh-6.3p1/sftp.c	2013-10-07 13:49:47.322727449 +0200
f09e2e
@@ -213,7 +213,7 @@ killchild(int signo)
f09e2e
 {
f09e2e
 	if (sshpid > 1) {
f09e2e
 		kill(sshpid, SIGTERM);
f09e2e
-		waitpid(sshpid, NULL, 0);
f09e2e
+		(void) waitpid(sshpid, NULL, 0);
f09e2e
 	}
f09e2e
 
f09e2e
 	_exit(1);
f09e2e
@@ -324,7 +324,7 @@ local_do_ls(const char *args)
f09e2e
 
f09e2e
 /* Strip one path (usually the pwd) from the start of another */
f09e2e
 static char *
f09e2e
-path_strip(char *path, char *strip)
f09e2e
+path_strip(const char *path, const char *strip)
f09e2e
 {
f09e2e
 	size_t len;
f09e2e
 
f09e2e
@@ -342,7 +342,7 @@ path_strip(char *path, char *strip)
f09e2e
 }
f09e2e
 
f09e2e
 static char *
f09e2e
-make_absolute(char *p, char *pwd)
f09e2e
+make_absolute(char *p, const char *pwd)
f09e2e
 {
f09e2e
 	char *abs_str;
f09e2e
 
f09e2e
@@ -493,7 +493,7 @@ parse_df_flags(const char *cmd, char **a
f09e2e
 }
f09e2e
 
f09e2e
 static int
f09e2e
-is_dir(char *path)
f09e2e
+is_dir(const char *path)
f09e2e
 {
f09e2e
 	struct stat sb;
f09e2e
 
f09e2e
@@ -505,7 +505,7 @@ is_dir(char *path)
f09e2e
 }
f09e2e
 
f09e2e
 static int
f09e2e
-remote_is_dir(struct sftp_conn *conn, char *path)
f09e2e
+remote_is_dir(struct sftp_conn *conn, const char *path)
f09e2e
 {
f09e2e
 	Attrib *a;
f09e2e
 
f09e2e
@@ -519,7 +519,7 @@ remote_is_dir(struct sftp_conn *conn, ch
f09e2e
 
f09e2e
 /* Check whether path returned from glob(..., GLOB_MARK, ...) is a directory */
f09e2e
 static int
f09e2e
-pathname_is_dir(char *pathname)
f09e2e
+pathname_is_dir(const char *pathname)
f09e2e
 {
f09e2e
 	size_t l = strlen(pathname);
f09e2e
 
f09e2e
@@ -527,7 +527,7 @@ pathname_is_dir(char *pathname)
f09e2e
 }
f09e2e
 
f09e2e
 static int
f09e2e
-process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd,
f09e2e
+process_get(struct sftp_conn *conn, const char *src, const char *dst, const char *pwd,
f09e2e
     int pflag, int rflag, int resume)
f09e2e
 {
f09e2e
 	char *abs_src = NULL;
f09e2e
@@ -605,7 +605,7 @@ out:
f09e2e
 }
f09e2e
 
f09e2e
 static int
f09e2e
-process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd,
f09e2e
+process_put(struct sftp_conn *conn, const char *src, const char *dst, const char *pwd,
f09e2e
     int pflag, int rflag)
f09e2e
 {
f09e2e
 	char *tmp_dst = NULL;
f09e2e
@@ -709,7 +709,7 @@ sdirent_comp(const void *aa, const void
f09e2e
 
f09e2e
 /* sftp ls.1 replacement for directories */
f09e2e
 static int
f09e2e
-do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
f09e2e
+do_ls_dir(struct sftp_conn *conn, const char *path, const char *strip_path, int lflag)
f09e2e
 {
f09e2e
 	int n;
f09e2e
 	u_int c = 1, colspace = 0, columns = 1;
f09e2e
@@ -794,7 +794,7 @@ do_ls_dir(struct sftp_conn *conn, char *
f09e2e
 
f09e2e
 /* sftp ls.1 replacement which handles path globs */
f09e2e
 static int
f09e2e
-do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
f09e2e
+do_globbed_ls(struct sftp_conn *conn, const char *path, const char *strip_path,
f09e2e
     int lflag)
f09e2e
 {
f09e2e
 	char *fname, *lname;
f09e2e
@@ -875,7 +875,7 @@ do_globbed_ls(struct sftp_conn *conn, ch
f09e2e
 }
f09e2e
 
f09e2e
 static int
f09e2e
-do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
f09e2e
+do_df(struct sftp_conn *conn, const char *path, int hflag, int iflag)
f09e2e
 {
f09e2e
 	struct sftp_statvfs st;
f09e2e
 	char s_used[FMT_SCALED_STRSIZE];
f09e2e
diff -up openssh-6.3p1/ssh-agent.c.coverity openssh-6.3p1/ssh-agent.c
f09e2e
--- openssh-6.3p1/ssh-agent.c.coverity	2013-07-20 05:22:49.000000000 +0200
f09e2e
+++ openssh-6.3p1/ssh-agent.c	2013-10-07 13:20:36.296298024 +0200
f09e2e
@@ -1143,8 +1143,8 @@ main(int ac, char **av)
f09e2e
 	sanitise_stdfd();
f09e2e
 
f09e2e
 	/* drop */
f09e2e
-	setegid(getgid());
f09e2e
-	setgid(getgid());
f09e2e
+	(void) setegid(getgid());
f09e2e
+	(void) setgid(getgid());
f09e2e
 
f09e2e
 #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
f09e2e
 	/* Disable ptrace on Linux without sgid bit */
f09e2e
diff -up openssh-6.3p1/sshd.c.coverity openssh-6.3p1/sshd.c
f09e2e
--- openssh-6.3p1/sshd.c.coverity	2013-07-20 05:21:53.000000000 +0200
f09e2e
+++ openssh-6.3p1/sshd.c	2013-10-07 13:20:36.296298024 +0200
f09e2e
@@ -699,8 +699,10 @@ privsep_preauth(Authctxt *authctxt)
f09e2e
 		if (getuid() == 0 || geteuid() == 0)
f09e2e
 			privsep_preauth_child();
f09e2e
 		setproctitle("%s", "[net]");
f09e2e
-		if (box != NULL)
f09e2e
+		if (box != NULL) {
f09e2e
 			ssh_sandbox_child(box);
f09e2e
+			free(box);
f09e2e
+		}
f09e2e
 
f09e2e
 		return 0;
f09e2e
 	}
f09e2e
@@ -1345,6 +1347,9 @@ server_accept_loop(int *sock_in, int *so
f09e2e
 		if (num_listen_socks < 0)
f09e2e
 			break;
f09e2e
 	}
f09e2e
+
f09e2e
+	if (fdset != NULL)
f09e2e
+		free(fdset);
f09e2e
 }
f09e2e
 
f09e2e