vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/auth-pam.c.coverity openssh-6.2p1/auth-pam.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/auth-pam.c.coverity	2009-07-12 14:07:21.000000000 +0200
Petr Lautrbach 8a29de
+++ openssh-6.2p1/auth-pam.c	2013-03-22 09:49:37.341595458 +0100
Jan F. Chadima c870e6
@@ -216,7 +216,12 @@ pthread_join(sp_pthread_t thread, void *
Jan F. Chadima 3b545b
 	if (sshpam_thread_status != -1)
Jan F. Chadima 3b545b
 		return (sshpam_thread_status);
Jan F. Chadima 3b545b
 	signal(SIGCHLD, sshpam_oldsig);
Jan F. Chadima 3b545b
-	waitpid(thread, &status, 0);
Jan F. Chadima c870e6
+	while (waitpid(thread, &status, 0) < 0) {                     
Jan F. Chadima c870e6
+		if (errno == EINTR)                                
Jan F. Chadima c870e6
+			continue;
Jan F. Chadima c870e6
+		fatal("%s: waitpid: %s", __func__,         
Jan F. Chadima c870e6
+				strerror(errno));                      
Jan F. Chadima c870e6
+	}
Jan F. Chadima 3b545b
 	return (status);
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 #endif
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/channels.c.coverity openssh-6.2p1/channels.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/channels.c.coverity	2012-12-02 23:50:55.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/channels.c	2013-03-22 09:49:37.344595444 +0100
Petr Lautrbach 9fe1af
@@ -232,11 +232,11 @@ channel_register_fds(Channel *c, int rfd
Jan F. Chadima 3b545b
 	channel_max_fd = MAX(channel_max_fd, wfd);
Jan F. Chadima 3b545b
 	channel_max_fd = MAX(channel_max_fd, efd);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
-	if (rfd != -1)
Jan F. Chadima 3b545b
+	if (rfd >= 0)
Jan F. Chadima 3b545b
 		fcntl(rfd, F_SETFD, FD_CLOEXEC);
Jan F. Chadima 3b545b
-	if (wfd != -1 && wfd != rfd)
Jan F. Chadima 3b545b
+	if (wfd >= 0 && wfd != rfd)
Jan F. Chadima 3b545b
 		fcntl(wfd, F_SETFD, FD_CLOEXEC);
Jan F. Chadima 3b545b
-	if (efd != -1 && efd != rfd && efd != wfd)
Jan F. Chadima 3b545b
+	if (efd >= 0 && efd != rfd && efd != wfd)
Jan F. Chadima 3b545b
 		fcntl(efd, F_SETFD, FD_CLOEXEC);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	c->rfd = rfd;
Petr Lautrbach 9fe1af
@@ -251,11 +251,11 @@ channel_register_fds(Channel *c, int rfd
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	/* enable nonblocking mode */
Jan F. Chadima 3b545b
 	if (nonblock) {
Jan F. Chadima 3b545b
-		if (rfd != -1)
Jan F. Chadima 3b545b
+		if (rfd >= 0)
Jan F. Chadima 3b545b
 			set_nonblock(rfd);
Jan F. Chadima 3b545b
-		if (wfd != -1)
Jan F. Chadima 3b545b
+		if (wfd >= 0)
Jan F. Chadima 3b545b
 			set_nonblock(wfd);
Jan F. Chadima 3b545b
-		if (efd != -1)
Jan F. Chadima 3b545b
+		if (efd >= 0)
Jan F. Chadima 3b545b
 			set_nonblock(efd);
Jan F. Chadima 3b545b
 	}
Jan F. Chadima 3b545b
 }
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/clientloop.c.coverity openssh-6.2p1/clientloop.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/clientloop.c.coverity	2013-01-09 05:55:51.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/clientloop.c	2013-03-22 09:49:37.342595453 +0100
Petr Lautrbach 8a29de
@@ -2061,14 +2061,15 @@ client_input_global_request(int type, u_
Petr Lautrbach 8a29de
 	char *rtype;
Petr Lautrbach 8a29de
 	int want_reply;
Petr Lautrbach 8a29de
 	int success = 0;
Petr Lautrbach 8a29de
+/* success is still 0 the packet is allways SSH2_MSG_REQUEST_FAILURE, isn't it? */
Petr Lautrbach 8a29de
 
Petr Lautrbach 8a29de
 	rtype = packet_get_string(NULL);
Petr Lautrbach 8a29de
 	want_reply = packet_get_char();
Petr Lautrbach 8a29de
 	debug("client_input_global_request: rtype %s want_reply %d",
Petr Lautrbach 8a29de
 	    rtype, want_reply);
Petr Lautrbach 8a29de
 	if (want_reply) {
Petr Lautrbach 8a29de
-		packet_start(success ?
Petr Lautrbach 8a29de
-		    SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE);
Petr Lautrbach 8a29de
+		packet_start(/*success ?
Petr Lautrbach 8a29de
+		    SSH2_MSG_REQUEST_SUCCESS :*/ SSH2_MSG_REQUEST_FAILURE);
Petr Lautrbach 8a29de
 		packet_send();
Petr Lautrbach 8a29de
 		packet_write_wait();
Petr Lautrbach 8a29de
 	}
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/key.c.coverity openssh-6.2p1/key.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/key.c.coverity	2013-01-18 01:44:05.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/key.c	2013-03-22 09:49:37.345595440 +0100
Petr Lautrbach 9fe1af
@@ -808,8 +808,10 @@ key_read(Key *ret, char **cpp)
Jan F. Chadima 3b545b
 		success = 1;
Jan F. Chadima 3b545b
 /*XXXX*/
Jan F. Chadima 3b545b
 		key_free(k);
Jan F. Chadima 3b545b
+/*XXXX
Jan F. Chadima 3b545b
 		if (success != 1)
Jan F. Chadima 3b545b
 			break;
Jan F. Chadima 3b545b
+XXXX*/
Jan F. Chadima 3b545b
 		/* advance cp: skip whitespace and data */
Jan F. Chadima 3b545b
 		while (*cp == ' ' || *cp == '\t')
Jan F. Chadima 3b545b
 			cp++;
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/monitor.c.coverity openssh-6.2p1/monitor.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/monitor.c.coverity	2012-12-12 00:44:39.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/monitor.c	2013-03-22 12:19:55.189921353 +0100
Petr Lautrbach 8a29de
@@ -449,7 +449,7 @@ monitor_child_preauth(Authctxt *_authctx
Petr Lautrbach 8a29de
 	mm_get_keystate(pmonitor);
Jan F. Chadima cff1d0
 
Jan F. Chadima cff1d0
 	/* Drain any buffered messages from the child */
Jan F. Chadima cff1d0
-	while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
Jan F. Chadima cff1d0
+	while (pmonitor->m_log_recvfd >= 0 && monitor_read_log(pmonitor) == 0)
Jan F. Chadima cff1d0
 		;
Jan F. Chadima cff1d0
 
Petr Lautrbach 8a29de
 	close(pmonitor->m_sendfd);
Petr Lautrbach 8a29de
@@ -1194,6 +1194,10 @@ mm_answer_keyallowed(int sock, Buffer *m
Jan F. Chadima ea97ff
 			break;
Jan F. Chadima ea97ff
 		}
Jan F. Chadima ea97ff
 	}
Jan F. Chadima ea97ff
+
Jan F. Chadima ea97ff
+	debug3("%s: key %p is %s",
Jan F. Chadima ea97ff
+	    __func__, key, allowed ? "allowed" : "not allowed");
Jan F. Chadima ea97ff
+
Jan F. Chadima ea97ff
 	if (key != NULL)
Jan F. Chadima ea97ff
 		key_free(key);
Jan F. Chadima ea97ff
 
Petr Lautrbach 8a29de
@@ -1216,9 +1220,6 @@ mm_answer_keyallowed(int sock, Buffer *m
Jan F. Chadima ea97ff
 		xfree(chost);
Jan F. Chadima ea97ff
 	}
Jan F. Chadima ea97ff
 
Jan F. Chadima ea97ff
-	debug3("%s: key %p is %s",
Jan F. Chadima ea97ff
-	    __func__, key, allowed ? "allowed" : "not allowed");
Jan F. Chadima ea97ff
-
Jan F. Chadima ea97ff
 	buffer_clear(m);
Jan F. Chadima ea97ff
 	buffer_put_int(m, allowed);
Jan F. Chadima ea97ff
 	buffer_put_int(m, forced_command != NULL);
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/monitor_wrap.c.coverity openssh-6.2p1/monitor_wrap.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/monitor_wrap.c.coverity	2013-01-09 06:12:19.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/monitor_wrap.c	2013-03-22 09:49:37.347595431 +0100
Petr Lautrbach 8a29de
@@ -708,10 +708,10 @@ mm_pty_allocate(int *ptyfd, int *ttyfd,
Jan F. Chadima cff1d0
 	if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 ||
Jan F. Chadima cff1d0
 	    (tmp2 = dup(pmonitor->m_recvfd)) == -1) {
Jan F. Chadima cff1d0
 		error("%s: cannot allocate fds for pty", __func__);
Jan F. Chadima cff1d0
-		if (tmp1 > 0)
Jan F. Chadima cff1d0
+		if (tmp1 >= 0)
Jan F. Chadima cff1d0
 			close(tmp1);
Jan F. Chadima cff1d0
-		if (tmp2 > 0)
Jan F. Chadima cff1d0
-			close(tmp2);
Jan F. Chadima cff1d0
+		/*DEAD CODE if (tmp2 >= 0)
Jan F. Chadima cff1d0
+			close(tmp2);*/
Jan F. Chadima cff1d0
 		return 0;
Jan F. Chadima cff1d0
 	}
Jan F. Chadima cff1d0
 	close(tmp1);
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/openbsd-compat/bindresvport.c.coverity openssh-6.2p1/openbsd-compat/bindresvport.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/openbsd-compat/bindresvport.c.coverity	2010-12-03 00:50:26.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/openbsd-compat/bindresvport.c	2013-03-22 09:49:37.347595431 +0100
Jan F. Chadima ea97ff
@@ -58,7 +58,7 @@ bindresvport_sa(int sd, struct sockaddr
Jan F. Chadima ea97ff
 	struct sockaddr_in6 *in6;
Jan F. Chadima ea97ff
 	u_int16_t *portp;
Jan F. Chadima ea97ff
 	u_int16_t port;
Jan F. Chadima ea97ff
-	socklen_t salen;
Jan F. Chadima ea97ff
+	socklen_t salen = sizeof(struct sockaddr_storage);
Jan F. Chadima ea97ff
 	int i;
Jan F. Chadima ea97ff
 
Jan F. Chadima ea97ff
 	if (sa == NULL) {
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/packet.c.coverity openssh-6.2p1/packet.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/packet.c.coverity	2013-02-12 01:03:59.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/packet.c	2013-03-22 09:49:37.348595426 +0100
Petr Lautrbach 8a29de
@@ -1192,6 +1192,7 @@ packet_read_poll1(void)
Jan F. Chadima 3b545b
 		case DEATTACK_DETECTED:
Jan F. Chadima 3b545b
 			packet_disconnect("crc32 compensation attack: "
Jan F. Chadima 3b545b
 			    "network attack detected");
Jan F. Chadima 3b545b
+			break;
Jan F. Chadima 3b545b
 		case DEATTACK_DOS_DETECTED:
Jan F. Chadima 3b545b
 			packet_disconnect("deattack denial of "
Jan F. Chadima 3b545b
 			    "service detected");
Petr Lautrbach 8a29de
@@ -1728,7 +1729,7 @@ void
Jan F. Chadima 3b545b
 packet_write_wait(void)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	fd_set *setp;
Jan F. Chadima 3b545b
-	int ret, ms_remain;
Jan F. Chadima 3b545b
+	int ret, ms_remain = 0;
Jan F. Chadima 3b545b
 	struct timeval start, timeout, *timeoutp = NULL;
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	setp = (fd_set *)xcalloc(howmany(active_state->connection_out + 1,
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/progressmeter.c.coverity openssh-6.2p1/progressmeter.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/progressmeter.c.coverity	2006-08-05 04:39:40.000000000 +0200
Petr Lautrbach 8a29de
+++ openssh-6.2p1/progressmeter.c	2013-03-22 09:49:37.349595422 +0100
Jan F. Chadima 3b545b
@@ -65,7 +65,7 @@ static void update_progress_meter(int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 static time_t start;		/* start progress */
Jan F. Chadima 3b545b
 static time_t last_update;	/* last progress update */
Jan F. Chadima 3b545b
-static char *file;		/* name of the file being transferred */
Jan F. Chadima 3b545b
+static const char *file;	/* name of the file being transferred */
Jan F. Chadima 3b545b
 static off_t end_pos;		/* ending position of transfer */
Jan F. Chadima 3b545b
 static off_t cur_pos;		/* transfer position as of last refresh */
Jan F. Chadima 3b545b
 static volatile off_t *counter;	/* progress counter */
Jan F. Chadima 3b545b
@@ -247,7 +247,7 @@ update_progress_meter(int ignore)
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 void
Jan F. Chadima 3b545b
-start_progress_meter(char *f, off_t filesize, off_t *ctr)
Jan F. Chadima 3b545b
+start_progress_meter(const char *f, off_t filesize, off_t *ctr)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	start = last_update = time(NULL);
Jan F. Chadima 3b545b
 	file = f;
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/progressmeter.h.coverity openssh-6.2p1/progressmeter.h
Petr Lautrbach 8a29de
--- openssh-6.2p1/progressmeter.h.coverity	2006-03-26 05:30:02.000000000 +0200
Petr Lautrbach 8a29de
+++ openssh-6.2p1/progressmeter.h	2013-03-22 09:49:37.349595422 +0100
Jan F. Chadima 3b545b
@@ -23,5 +23,5 @@
Jan F. Chadima 3b545b
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Jan F. Chadima 3b545b
  */
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
-void	start_progress_meter(char *, off_t, off_t *);
Jan F. Chadima 3b545b
+void	start_progress_meter(const char *, off_t, off_t *);
Jan F. Chadima 3b545b
 void	stop_progress_meter(void);
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/scp.c.coverity openssh-6.2p1/scp.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/scp.c.coverity	2013-03-20 02:55:15.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/scp.c	2013-03-22 09:49:37.349595422 +0100
Jan F. Chadima 3b545b
@@ -155,7 +155,7 @@ killchild(int signo)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	if (do_cmd_pid > 1) {
Jan F. Chadima 3b545b
 		kill(do_cmd_pid, signo ? signo : SIGTERM);
Jan F. Chadima 3b545b
-		waitpid(do_cmd_pid, NULL, 0);
Jan F. Chadima 3b545b
+		(void) waitpid(do_cmd_pid, NULL, 0);
Jan F. Chadima 3b545b
 	}
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	if (signo)
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/servconf.c.coverity openssh-6.2p1/servconf.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/servconf.c.coverity	2013-02-12 01:02:08.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/servconf.c	2013-03-22 09:49:37.350595418 +0100
Petr Lautrbach 8a29de
@@ -1268,7 +1268,7 @@ process_server_config_line(ServerOptions
Jan F. Chadima ea97ff
 			fatal("%s line %d: Missing subsystem name.",
Jan F. Chadima ea97ff
 			    filename, linenum);
Jan F. Chadima ea97ff
 		if (!*activep) {
Jan F. Chadima ea97ff
-			arg = strdelim(&cp;;
Jan F. Chadima ea97ff
+			/*arg =*/ (void) strdelim(&cp;;
Jan F. Chadima ea97ff
 			break;
Jan F. Chadima ea97ff
 		}
Jan F. Chadima ea97ff
 		for (i = 0; i < options->num_subsystems; i++)
Petr Lautrbach 8a29de
@@ -1359,8 +1359,9 @@ process_server_config_line(ServerOptions
Jan F. Chadima cff1d0
 		if (*activep && *charptr == NULL) {
Jan F. Chadima cff1d0
 			*charptr = tilde_expand_filename(arg, getuid());
Jan F. Chadima cff1d0
 			/* increase optional counter */
Jan F. Chadima cff1d0
-			if (intptr != NULL)
Jan F. Chadima cff1d0
-				*intptr = *intptr + 1;
Jan F. Chadima cff1d0
+			/* DEAD CODE intptr is still NULL ;)
Jan F. Chadima cff1d0
+  			 if (intptr != NULL)
Jan F. Chadima cff1d0
+				*intptr = *intptr + 1; */
Jan F. Chadima cff1d0
 		}
Jan F. Chadima cff1d0
 		break;
Jan F. Chadima cff1d0
 
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/serverloop.c.coverity openssh-6.2p1/serverloop.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/serverloop.c.coverity	2012-12-07 03:07:47.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/serverloop.c	2013-03-22 09:49:37.351595413 +0100
Jan F. Chadima 3b545b
@@ -147,13 +147,13 @@ notify_setup(void)
Jan F. Chadima 3b545b
 static void
Jan F. Chadima 3b545b
 notify_parent(void)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
-	if (notify_pipe[1] != -1)
Jan F. Chadima 3b545b
+	if (notify_pipe[1] >= 0)
Jan F. Chadima 3b545b
 		write(notify_pipe[1], "", 1);
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 static void
Jan F. Chadima 3b545b
 notify_prepare(fd_set *readset)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
-	if (notify_pipe[0] != -1)
Jan F. Chadima 3b545b
+	if (notify_pipe[0] >= 0)
Jan F. Chadima 3b545b
 		FD_SET(notify_pipe[0], readset);
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 static void
Jan F. Chadima 3b545b
@@ -161,8 +161,8 @@ notify_done(fd_set *readset)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	char c;
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
-	if (notify_pipe[0] != -1 && FD_ISSET(notify_pipe[0], readset))
Jan F. Chadima 3b545b
-		while (read(notify_pipe[0], &c, 1) != -1)
Jan F. Chadima 3b545b
+	if (notify_pipe[0] >= 0 && FD_ISSET(notify_pipe[0], readset))
Jan F. Chadima 3b545b
+		while (read(notify_pipe[0], &c, 1) >= 0)
Jan F. Chadima 3b545b
 			debug2("notify_done: reading");
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -336,7 +336,7 @@ wait_until_can_do_something(fd_set **rea
Jan F. Chadima 3b545b
 		 * If we have buffered data, try to write some of that data
Jan F. Chadima 3b545b
 		 * to the program.
Jan F. Chadima 3b545b
 		 */
Jan F. Chadima 3b545b
-		if (fdin != -1 && buffer_len(&stdin_buffer) > 0)
Jan F. Chadima 3b545b
+		if (fdin >= 0 && buffer_len(&stdin_buffer) > 0)
Jan F. Chadima 3b545b
 			FD_SET(fdin, *writesetp);
Jan F. Chadima 3b545b
 	}
Jan F. Chadima 3b545b
 	notify_prepare(*readsetp);
Petr Lautrbach 9fe1af
@@ -476,7 +476,7 @@ process_output(fd_set *writeset)
Jan F. Chadima 3b545b
 	int len;
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	/* Write buffered data to program stdin. */
Jan F. Chadima 3b545b
-	if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
Jan F. Chadima 3b545b
+	if (!compat20 && fdin >= 0 && FD_ISSET(fdin, writeset)) {
Jan F. Chadima 3b545b
 		data = buffer_ptr(&stdin_buffer);
Jan F. Chadima 3b545b
 		dlen = buffer_len(&stdin_buffer);
Jan F. Chadima 3b545b
 		len = write(fdin, data, dlen);
Petr Lautrbach 9fe1af
@@ -589,7 +589,7 @@ server_loop(pid_t pid, int fdin_arg, int
Jan F. Chadima 3b545b
 	set_nonblock(fdin);
Jan F. Chadima 3b545b
 	set_nonblock(fdout);
Jan F. Chadima 3b545b
 	/* we don't have stderr for interactive terminal sessions, see below */
Jan F. Chadima 3b545b
-	if (fderr != -1)
Jan F. Chadima 3b545b
+	if (fderr >= 0)
Jan F. Chadima 3b545b
 		set_nonblock(fderr);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	if (!(datafellows & SSH_BUG_IGNOREMSG) && isatty(fdin))
Petr Lautrbach 9fe1af
@@ -613,7 +613,7 @@ server_loop(pid_t pid, int fdin_arg, int
Jan F. Chadima 3b545b
 	max_fd = MAX(connection_in, connection_out);
Jan F. Chadima 3b545b
 	max_fd = MAX(max_fd, fdin);
Jan F. Chadima 3b545b
 	max_fd = MAX(max_fd, fdout);
Jan F. Chadima 3b545b
-	if (fderr != -1)
Jan F. Chadima 3b545b
+	if (fderr >= 0)
Jan F. Chadima 3b545b
 		max_fd = MAX(max_fd, fderr);
Jan F. Chadima 3b545b
 #endif
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -643,7 +643,7 @@ server_loop(pid_t pid, int fdin_arg, int
Jan F. Chadima 3b545b
 		 * If we have received eof, and there is no more pending
Jan F. Chadima 3b545b
 		 * input data, cause a real eof by closing fdin.
Jan F. Chadima 3b545b
 		 */
Jan F. Chadima 3b545b
-		if (stdin_eof && fdin != -1 && buffer_len(&stdin_buffer) == 0) {
Jan F. Chadima 3b545b
+		if (stdin_eof && fdin >= 0 && buffer_len(&stdin_buffer) == 0) {
Jan F. Chadima 3b545b
 			if (fdin != fdout)
Jan F. Chadima 3b545b
 				close(fdin);
Jan F. Chadima 3b545b
 			else
Petr Lautrbach 9fe1af
@@ -741,15 +741,15 @@ server_loop(pid_t pid, int fdin_arg, int
Jan F. Chadima 3b545b
 	buffer_free(&stderr_buffer);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	/* Close the file descriptors. */
Jan F. Chadima 3b545b
-	if (fdout != -1)
Jan F. Chadima 3b545b
+	if (fdout >= 0)
Jan F. Chadima 3b545b
 		close(fdout);
Jan F. Chadima 3b545b
 	fdout = -1;
Jan F. Chadima 3b545b
 	fdout_eof = 1;
Jan F. Chadima 3b545b
-	if (fderr != -1)
Jan F. Chadima 3b545b
+	if (fderr >= 0)
Jan F. Chadima 3b545b
 		close(fderr);
Jan F. Chadima 3b545b
 	fderr = -1;
Jan F. Chadima 3b545b
 	fderr_eof = 1;
Jan F. Chadima 3b545b
-	if (fdin != -1)
Jan F. Chadima 3b545b
+	if (fdin >= 0)
Jan F. Chadima 3b545b
 		close(fdin);
Jan F. Chadima 3b545b
 	fdin = -1;
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -943,7 +943,7 @@ server_input_window_size(int type, u_int
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	debug("Window change received.");
Jan F. Chadima 3b545b
 	packet_check_eom();
Jan F. Chadima 3b545b
-	if (fdin != -1)
Jan F. Chadima 3b545b
+	if (fdin >= 0)
Jan F. Chadima 3b545b
 		pty_change_window_size(fdin, row, col, xpixel, ypixel);
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Petr Lautrbach 8a29de
@@ -1003,7 +1003,7 @@ server_request_tun(void)
Jan F. Chadima 3b545b
 	}
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	tun = packet_get_int();
Jan F. Chadima 3b545b
-	if (forced_tun_device != -1) {
Jan F. Chadima 3b545b
+	if (forced_tun_device >= 0) {
Jan F. Chadima 3b545b
 		if (tun != SSH_TUNID_ANY && forced_tun_device != tun)
Jan F. Chadima 3b545b
 			goto done;
Jan F. Chadima 3b545b
 		tun = forced_tun_device;
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/sftp.c.coverity openssh-6.2p1/sftp.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/sftp.c.coverity	2013-02-22 23:12:24.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/sftp.c	2013-03-22 09:49:37.352595409 +0100
Petr Lautrbach 8a29de
@@ -202,7 +202,7 @@ killchild(int signo)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	if (sshpid > 1) {
Petr Lautrbach 9fe1af
 		kill(sshpid, SIGTERM);
Petr Lautrbach 9fe1af
-		waitpid(sshpid, NULL, 0);
Petr Lautrbach 9fe1af
+		(void) waitpid(sshpid, NULL, 0);
Petr Lautrbach 9fe1af
 	}
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 	_exit(1);
Petr Lautrbach 8a29de
@@ -312,7 +312,7 @@ local_do_ls(const char *args)
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 /* Strip one path (usually the pwd) from the start of another */
Petr Lautrbach 9fe1af
 static char *
Petr Lautrbach 9fe1af
-path_strip(char *path, char *strip)
Petr Lautrbach 9fe1af
+path_strip(const char *path, const char *strip)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	size_t len;
Petr Lautrbach 9fe1af
 
Petr Lautrbach 8a29de
@@ -330,7 +330,7 @@ path_strip(char *path, char *strip)
Petr Lautrbach 9fe1af
 }
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 static char *
Petr Lautrbach 9fe1af
-make_absolute(char *p, char *pwd)
Petr Lautrbach 9fe1af
+make_absolute(char *p, const char *pwd)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	char *abs_str;
Petr Lautrbach 9fe1af
 
Petr Lautrbach 8a29de
@@ -478,7 +478,7 @@ parse_df_flags(const char *cmd, char **a
Petr Lautrbach 9fe1af
 }
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-is_dir(char *path)
Petr Lautrbach 9fe1af
+is_dir(const char *path)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	struct stat sb;
Petr Lautrbach 9fe1af
 
Petr Lautrbach 8a29de
@@ -490,7 +490,7 @@ is_dir(char *path)
Petr Lautrbach 9fe1af
 }
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-remote_is_dir(struct sftp_conn *conn, char *path)
Petr Lautrbach 9fe1af
+remote_is_dir(struct sftp_conn *conn, const char *path)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	Attrib *a;
Petr Lautrbach 9fe1af
 
Petr Lautrbach 8a29de
@@ -504,7 +504,7 @@ remote_is_dir(struct sftp_conn *conn, ch
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 /* Check whether path returned from glob(..., GLOB_MARK, ...) is a directory */
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-pathname_is_dir(char *pathname)
Petr Lautrbach 9fe1af
+pathname_is_dir(const char *pathname)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	size_t l = strlen(pathname);
Petr Lautrbach 9fe1af
 
Petr Lautrbach 8a29de
@@ -512,7 +512,7 @@ pathname_is_dir(char *pathname)
Petr Lautrbach 9fe1af
 }
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd,
Petr Lautrbach 9fe1af
+process_get(struct sftp_conn *conn, const char *src, const char *dst, const char *pwd,
Petr Lautrbach 9fe1af
     int pflag, int rflag)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	char *abs_src = NULL;
Petr Lautrbach 8a29de
@@ -586,7 +586,7 @@ out:
Petr Lautrbach 9fe1af
 }
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd,
Petr Lautrbach 9fe1af
+process_put(struct sftp_conn *conn, const char *src, const char *dst, const char *pwd,
Petr Lautrbach 9fe1af
     int pflag, int rflag)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	char *tmp_dst = NULL;
Petr Lautrbach 8a29de
@@ -691,7 +691,7 @@ sdirent_comp(const void *aa, const void
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 /* sftp ls.1 replacement for directories */
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
Petr Lautrbach 9fe1af
+do_ls_dir(struct sftp_conn *conn, const char *path, const char *strip_path, int lflag)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	int n;
Petr Lautrbach 9fe1af
 	u_int c = 1, colspace = 0, columns = 1;
Petr Lautrbach 8a29de
@@ -776,7 +776,7 @@ do_ls_dir(struct sftp_conn *conn, char *
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 /* sftp ls.1 replacement which handles path globs */
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
Petr Lautrbach 9fe1af
+do_globbed_ls(struct sftp_conn *conn, const char *path, const char *strip_path,
Petr Lautrbach 9fe1af
     int lflag)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	char *fname, *lname;
Petr Lautrbach 8a29de
@@ -857,7 +857,7 @@ do_globbed_ls(struct sftp_conn *conn, ch
Petr Lautrbach 9fe1af
 }
Petr Lautrbach 9fe1af
 
Petr Lautrbach 9fe1af
 static int
Petr Lautrbach 9fe1af
-do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
Petr Lautrbach 9fe1af
+do_df(struct sftp_conn *conn, const char *path, int hflag, int iflag)
Petr Lautrbach 9fe1af
 {
Petr Lautrbach 9fe1af
 	struct sftp_statvfs st;
Petr Lautrbach 9fe1af
 	char s_used[FMT_SCALED_STRSIZE];
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/sftp-client.c.coverity openssh-6.2p1/sftp-client.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/sftp-client.c.coverity	2012-07-02 14:15:39.000000000 +0200
Petr Lautrbach 8a29de
+++ openssh-6.2p1/sftp-client.c	2013-03-22 09:49:37.353595404 +0100
Jan F. Chadima 3b545b
@@ -149,7 +149,7 @@ get_msg(struct sftp_conn *conn, Buffer *
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 static void
Jan F. Chadima 3b545b
-send_string_request(struct sftp_conn *conn, u_int id, u_int code, char *s,
Jan F. Chadima 3b545b
+send_string_request(struct sftp_conn *conn, u_int id, u_int code, const char *s,
Jan F. Chadima 3b545b
     u_int len)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Buffer msg;
Jan F. Chadima 3b545b
@@ -165,7 +165,7 @@ send_string_request(struct sftp_conn *co
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 static void
Jan F. Chadima 3b545b
 send_string_attrs_request(struct sftp_conn *conn, u_int id, u_int code,
Jan F. Chadima 3b545b
-    char *s, u_int len, Attrib *a)
Jan F. Chadima 3b545b
+    const char *s, u_int len, Attrib *a)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Buffer msg;
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
@@ -422,7 +422,7 @@ sftp_proto_version(struct sftp_conn *con
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_close(struct sftp_conn *conn, char *handle, u_int handle_len)
Jan F. Chadima 3b545b
+do_close(struct sftp_conn *conn, const char *handle, u_int handle_len)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int id, status;
Jan F. Chadima 3b545b
 	Buffer msg;
Jan F. Chadima 3b545b
@@ -447,7 +447,7 @@ do_close(struct sftp_conn *conn, char *h
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 static int
Jan F. Chadima 3b545b
-do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
Jan F. Chadima 3b545b
+do_lsreaddir(struct sftp_conn *conn, const char *path, int printflag,
Jan F. Chadima 3b545b
     SFTP_DIRENT ***dir)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Buffer msg;
Petr Lautrbach 9fe1af
@@ -572,7 +572,7 @@ do_lsreaddir(struct sftp_conn *conn, cha
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_readdir(struct sftp_conn *conn, char *path, SFTP_DIRENT ***dir)
Jan F. Chadima 3b545b
+do_readdir(struct sftp_conn *conn, const char *path, SFTP_DIRENT ***dir)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	return(do_lsreaddir(conn, path, 0, dir));
Jan F. Chadima 3b545b
 }
Petr Lautrbach 9fe1af
@@ -590,7 +590,7 @@ void free_sftp_dirents(SFTP_DIRENT **s)
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_rm(struct sftp_conn *conn, char *path)
Jan F. Chadima 3b545b
+do_rm(struct sftp_conn *conn, const char *path)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int status, id;
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -605,7 +605,7 @@ do_rm(struct sftp_conn *conn, char *path
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_mkdir(struct sftp_conn *conn, char *path, Attrib *a, int printflag)
Jan F. Chadima 3b545b
+do_mkdir(struct sftp_conn *conn, const char *path, Attrib *a, int printflag)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int status, id;
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -621,7 +621,7 @@ do_mkdir(struct sftp_conn *conn, char *p
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_rmdir(struct sftp_conn *conn, char *path)
Jan F. Chadima 3b545b
+do_rmdir(struct sftp_conn *conn, const char *path)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int status, id;
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -637,7 +637,7 @@ do_rmdir(struct sftp_conn *conn, char *p
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 Attrib *
Jan F. Chadima 3b545b
-do_stat(struct sftp_conn *conn, char *path, int quiet)
Jan F. Chadima 3b545b
+do_stat(struct sftp_conn *conn, const char *path, int quiet)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int id;
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -651,7 +651,7 @@ do_stat(struct sftp_conn *conn, char *pa
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 Attrib *
Jan F. Chadima 3b545b
-do_lstat(struct sftp_conn *conn, char *path, int quiet)
Jan F. Chadima 3b545b
+do_lstat(struct sftp_conn *conn, const char *path, int quiet)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int id;
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -685,7 +685,7 @@ do_fstat(struct sftp_conn *conn, char *h
Jan F. Chadima 3b545b
 #endif
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_setstat(struct sftp_conn *conn, char *path, Attrib *a)
Jan F. Chadima 3b545b
+do_setstat(struct sftp_conn *conn, const char *path, Attrib *a)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int status, id;
Jan F. Chadima 3b545b
 
Petr Lautrbach 9fe1af
@@ -702,7 +702,7 @@ do_setstat(struct sftp_conn *conn, char
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_fsetstat(struct sftp_conn *conn, char *handle, u_int handle_len,
Jan F. Chadima 3b545b
+do_fsetstat(struct sftp_conn *conn, const char *handle, u_int handle_len,
Jan F. Chadima 3b545b
     Attrib *a)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	u_int status, id;
Petr Lautrbach 9fe1af
@@ -719,7 +719,7 @@ do_fsetstat(struct sftp_conn *conn, char
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 char *
Jan F. Chadima 3b545b
-do_realpath(struct sftp_conn *conn, char *path)
Jan F. Chadima 3b545b
+do_realpath(struct sftp_conn *conn, const char *path)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Buffer msg;
Jan F. Chadima 3b545b
 	u_int type, expected_id, count, id;
Petr Lautrbach 9fe1af
@@ -768,7 +768,7 @@ do_realpath(struct sftp_conn *conn, char
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_rename(struct sftp_conn *conn, char *oldpath, char *newpath)
Jan F. Chadima 3b545b
+do_rename(struct sftp_conn *conn, const char *oldpath, const char *newpath)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Buffer msg;
Jan F. Chadima 3b545b
 	u_int status, id;
Petr Lautrbach 9fe1af
@@ -802,7 +802,7 @@ do_rename(struct sftp_conn *conn, char *
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_hardlink(struct sftp_conn *conn, char *oldpath, char *newpath)
Jan F. Chadima 3b545b
+do_hardlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Buffer msg;
Jan F. Chadima 3b545b
 	u_int status, id;
Petr Lautrbach 9fe1af
@@ -835,7 +835,7 @@ do_hardlink(struct sftp_conn *conn, char
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_symlink(struct sftp_conn *conn, char *oldpath, char *newpath)
Jan F. Chadima 3b545b
+do_symlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Buffer msg;
Jan F. Chadima 3b545b
 	u_int status, id;
Petr Lautrbach 9fe1af
@@ -987,7 +987,7 @@ send_read_request(struct sftp_conn *conn
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
Jan F. Chadima 3b545b
+do_download(struct sftp_conn *conn, const char *remote_path, const char *local_path,
Jan F. Chadima 3b545b
     Attrib *a, int pflag)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	Attrib junk;
Petr Lautrbach 9fe1af
@@ -1226,7 +1226,7 @@ do_download(struct sftp_conn *conn, char
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 static int
Jan F. Chadima 3b545b
-download_dir_internal(struct sftp_conn *conn, char *src, char *dst,
Jan F. Chadima 3b545b
+download_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
Jan F. Chadima 3b545b
     Attrib *dirattrib, int pflag, int printflag, int depth)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	int i, ret = 0;
Petr Lautrbach 9fe1af
@@ -1316,7 +1316,7 @@ download_dir_internal(struct sftp_conn *
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-download_dir(struct sftp_conn *conn, char *src, char *dst,
Jan F. Chadima 3b545b
+download_dir(struct sftp_conn *conn, const char *src, const char *dst,
Jan F. Chadima 3b545b
     Attrib *dirattrib, int pflag, int printflag)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	char *src_canon;
Petr Lautrbach 9fe1af
@@ -1334,7 +1334,7 @@ download_dir(struct sftp_conn *conn, cha
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
Jan F. Chadima 3b545b
+do_upload(struct sftp_conn *conn, const char *local_path, const char *remote_path,
Jan F. Chadima 3b545b
     int pflag)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	int local_fd;
Petr Lautrbach 9fe1af
@@ -1517,7 +1517,7 @@ do_upload(struct sftp_conn *conn, char *
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 static int
Jan F. Chadima 3b545b
-upload_dir_internal(struct sftp_conn *conn, char *src, char *dst,
Jan F. Chadima 3b545b
+upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
Jan F. Chadima 3b545b
     int pflag, int printflag, int depth)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	int ret = 0, status;
Petr Lautrbach 9fe1af
@@ -1608,7 +1608,7 @@ upload_dir_internal(struct sftp_conn *co
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 int
Jan F. Chadima 3b545b
-upload_dir(struct sftp_conn *conn, char *src, char *dst, int printflag,
Jan F. Chadima 3b545b
+upload_dir(struct sftp_conn *conn, const char *src, const char *dst, int printflag,
Jan F. Chadima 3b545b
     int pflag)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	char *dst_canon;
Petr Lautrbach 9fe1af
@@ -1625,7 +1625,7 @@ upload_dir(struct sftp_conn *conn, char
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 char *
Jan F. Chadima 3b545b
-path_append(char *p1, char *p2)
Jan F. Chadima 3b545b
+path_append(const char *p1, const char *p2)
Jan F. Chadima 3b545b
 {
Jan F. Chadima 3b545b
 	char *ret;
Jan F. Chadima 3b545b
 	size_t len = strlen(p1) + strlen(p2) + 2;
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/sftp-client.h.coverity openssh-6.2p1/sftp-client.h
Petr Lautrbach 8a29de
--- openssh-6.2p1/sftp-client.h.coverity	2010-12-04 23:02:48.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/sftp-client.h	2013-03-22 09:49:37.353595404 +0100
Jan F. Chadima 3b545b
@@ -56,49 +56,49 @@ struct sftp_conn *do_init(int, int, u_in
Jan F. Chadima 3b545b
 u_int sftp_proto_version(struct sftp_conn *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Close file referred to by 'handle' */
Jan F. Chadima 3b545b
-int do_close(struct sftp_conn *, char *, u_int);
Jan F. Chadima 3b545b
+int do_close(struct sftp_conn *, const char *, u_int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Read contents of 'path' to NULL-terminated array 'dir' */
Jan F. Chadima 3b545b
-int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
Jan F. Chadima 3b545b
+int do_readdir(struct sftp_conn *, const char *, SFTP_DIRENT ***);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
Jan F. Chadima 3b545b
 void free_sftp_dirents(SFTP_DIRENT **);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Delete file 'path' */
Jan F. Chadima 3b545b
-int do_rm(struct sftp_conn *, char *);
Jan F. Chadima 3b545b
+int do_rm(struct sftp_conn *, const char *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Create directory 'path' */
Jan F. Chadima 3b545b
-int do_mkdir(struct sftp_conn *, char *, Attrib *, int);
Jan F. Chadima 3b545b
+int do_mkdir(struct sftp_conn *, const char *, Attrib *, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Remove directory 'path' */
Jan F. Chadima 3b545b
-int do_rmdir(struct sftp_conn *, char *);
Jan F. Chadima 3b545b
+int do_rmdir(struct sftp_conn *, const char *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Get file attributes of 'path' (follows symlinks) */
Jan F. Chadima 3b545b
-Attrib *do_stat(struct sftp_conn *, char *, int);
Jan F. Chadima 3b545b
+Attrib *do_stat(struct sftp_conn *, const char *, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Get file attributes of 'path' (does not follow symlinks) */
Jan F. Chadima 3b545b
-Attrib *do_lstat(struct sftp_conn *, char *, int);
Jan F. Chadima 3b545b
+Attrib *do_lstat(struct sftp_conn *, const char *, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Set file attributes of 'path' */
Jan F. Chadima 3b545b
-int do_setstat(struct sftp_conn *, char *, Attrib *);
Jan F. Chadima 3b545b
+int do_setstat(struct sftp_conn *, const char *, Attrib *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Set file attributes of open file 'handle' */
Jan F. Chadima 3b545b
-int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
Jan F. Chadima 3b545b
+int do_fsetstat(struct sftp_conn *, const char *, u_int, Attrib *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Canonicalise 'path' - caller must free result */
Jan F. Chadima 3b545b
-char *do_realpath(struct sftp_conn *, char *);
Jan F. Chadima 3b545b
+char *do_realpath(struct sftp_conn *, const char *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Get statistics for filesystem hosting file at "path" */
Jan F. Chadima 3b545b
 int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Rename 'oldpath' to 'newpath' */
Jan F. Chadima 3b545b
-int do_rename(struct sftp_conn *, char *, char *);
Jan F. Chadima 3b545b
+int do_rename(struct sftp_conn *, const char *, const char *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Link 'oldpath' to 'newpath' */
Jan F. Chadima 3b545b
-int do_hardlink(struct sftp_conn *, char *, char *);
Jan F. Chadima 3b545b
+int do_hardlink(struct sftp_conn *, const char *, const char *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
-/* Rename 'oldpath' to 'newpath' */
Jan F. Chadima 3b545b
-int do_symlink(struct sftp_conn *, char *, char *);
Jan F. Chadima 3b545b
+/* Symlink 'oldpath' to 'newpath' */
Jan F. Chadima 3b545b
+int do_symlink(struct sftp_conn *, const char *, const char *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* XXX: add callbacks to do_download/do_upload so we can do progress meter */
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
@@ -106,27 +106,27 @@ int do_symlink(struct sftp_conn *, char
Jan F. Chadima 3b545b
  * Download 'remote_path' to 'local_path'. Preserve permissions and times
Jan F. Chadima 3b545b
  * if 'pflag' is set
Jan F. Chadima 3b545b
  */
Jan F. Chadima 3b545b
-int do_download(struct sftp_conn *, char *, char *, Attrib *, int);
Jan F. Chadima 3b545b
+int do_download(struct sftp_conn *, const char *, const char *, Attrib *, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /*
Jan F. Chadima 3b545b
  * Recursively download 'remote_directory' to 'local_directory'. Preserve 
Jan F. Chadima 3b545b
  * times if 'pflag' is set
Jan F. Chadima 3b545b
  */
Jan F. Chadima 3b545b
-int download_dir(struct sftp_conn *, char *, char *, Attrib *, int, int);
Jan F. Chadima 3b545b
+int download_dir(struct sftp_conn *, const char *, const char *, Attrib *, int, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /*
Jan F. Chadima 3b545b
  * Upload 'local_path' to 'remote_path'. Preserve permissions and times
Jan F. Chadima 3b545b
  * if 'pflag' is set
Jan F. Chadima 3b545b
  */
Jan F. Chadima 3b545b
-int do_upload(struct sftp_conn *, char *, char *, int);
Jan F. Chadima 3b545b
+int do_upload(struct sftp_conn *, const char *, const char *, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /*
Jan F. Chadima 3b545b
  * Recursively upload 'local_directory' to 'remote_directory'. Preserve 
Jan F. Chadima 3b545b
  * times if 'pflag' is set
Jan F. Chadima 3b545b
  */
Jan F. Chadima 3b545b
-int upload_dir(struct sftp_conn *, char *, char *, int, int);
Jan F. Chadima 3b545b
+int upload_dir(struct sftp_conn *, const char *, const char *, int, int);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 /* Concatenate paths, taking care of slashes. Caller must free result. */
Jan F. Chadima 3b545b
-char *path_append(char *, char *);
Jan F. Chadima 3b545b
+char *path_append(const char *, const char *);
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 #endif
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/ssh-agent.c.coverity openssh-6.2p1/ssh-agent.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/ssh-agent.c.coverity	2011-06-03 06:14:16.000000000 +0200
Petr Lautrbach 8a29de
+++ openssh-6.2p1/ssh-agent.c	2013-03-22 09:49:37.354595400 +0100
Jan F. Chadima ea97ff
@@ -1147,8 +1147,8 @@ main(int ac, char **av)
Jan F. Chadima ea97ff
 	sanitise_stdfd();
Jan F. Chadima ea97ff
 
Jan F. Chadima ea97ff
 	/* drop */
Jan F. Chadima ea97ff
-	setegid(getgid());
Jan F. Chadima ea97ff
-	setgid(getgid());
Jan F. Chadima ea97ff
+	(void) setegid(getgid());
Jan F. Chadima ea97ff
+	(void) setgid(getgid());
Jan F. Chadima ea97ff
 
Jan F. Chadima ea97ff
 #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
Jan F. Chadima ea97ff
 	/* Disable ptrace on Linux without sgid bit */
Petr Lautrbach 8a29de
diff -up openssh-6.2p1/sshd.c.coverity openssh-6.2p1/sshd.c
Petr Lautrbach 8a29de
--- openssh-6.2p1/sshd.c.coverity	2013-02-12 01:04:48.000000000 +0100
Petr Lautrbach 8a29de
+++ openssh-6.2p1/sshd.c	2013-03-22 09:49:37.355595396 +0100
Petr Lautrbach 8a29de
@@ -691,8 +691,10 @@ privsep_preauth(Authctxt *authctxt)
Jan F. Chadima cff1d0
 		if (getuid() == 0 || geteuid() == 0)
Jan F. Chadima cff1d0
 			privsep_preauth_child();
Jan F. Chadima cff1d0
 		setproctitle("%s", "[net]");
Jan F. Chadima cff1d0
-		if (box != NULL)
Jan F. Chadima cff1d0
+		if (box != NULL) {
Jan F. Chadima cff1d0
 			ssh_sandbox_child(box);
Jan F. Chadima cff1d0
+			xfree(box);
Jan F. Chadima cff1d0
+		}
Jan F. Chadima cff1d0
 
Jan F. Chadima cff1d0
 		return 0;
Jan F. Chadima cff1d0
 	}
Petr Lautrbach 8a29de
@@ -1320,6 +1322,9 @@ server_accept_loop(int *sock_in, int *so
Jan F. Chadima 3b545b
 		if (num_listen_socks < 0)
Jan F. Chadima 3b545b
 			break;
Jan F. Chadima 3b545b
 	}
Jan F. Chadima 3b545b
+
Jan F. Chadima 3b545b
+	if (fdset != NULL)
Jan F. Chadima 3b545b
+		xfree(fdset);
Jan F. Chadima 3b545b
 }
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 
Petr Lautrbach 8a29de
@@ -1806,7 +1811,7 @@ main(int ac, char **av)
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	/* Chdir to the root directory so that the current disk can be
Jan F. Chadima 3b545b
 	   unmounted if desired. */
Jan F. Chadima 3b545b
-	chdir("/");
Jan F. Chadima 3b545b
+	(void) chdir("/");
Jan F. Chadima 3b545b
 
Jan F. Chadima 3b545b
 	/* ignore SIGPIPE */
Jan F. Chadima 3b545b
 	signal(SIGPIPE, SIG_IGN);