Mercurial > dropbear
changeset 964:67ff2be856ff coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 08 Aug 2014 21:26:07 +0800 |
parents | 46a0b2ebc22c (current diff) dccaecc68c77 (diff) |
children | 763979a9c1f1 |
files | |
diffstat | 4 files changed, 18 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/cli-runopts.c Mon Jul 28 23:38:54 2014 +0800 +++ b/cli-runopts.c Fri Aug 08 21:26:07 2014 +0800 @@ -683,11 +683,13 @@ uid = getuid(); pw = getpwuid(uid); - if (pw == NULL || pw->pw_name == NULL) { - dropbear_exit("Unknown own user"); + if (pw && pw->pw_name != NULL) { + cli_opts.own_user = m_strdup(pw->pw_name); + } else { + dropbear_log(LOG_INFO, "Warning: failed to identify current user. Trying anyway."); + cli_opts.own_user = m_strdup("unknown"); } - cli_opts.own_user = m_strdup(pw->pw_name); } #ifdef ENABLE_CLI_ANYTCPFWD
--- a/dbutil.c Mon Jul 28 23:38:54 2014 +0800 +++ b/dbutil.c Fri Aug 08 21:26:07 2014 +0800 @@ -202,6 +202,9 @@ int iptos_val = 0, so_prio_val = 0, rc; + /* Don't log ENOTSOCK errors so that this can harmlessly be called + * on a client '-J' proxy pipe */ + /* set the TOS bit for either ipv4 or ipv6 */ #ifdef IPTOS_LOWDELAY if (prio == DROPBEAR_PRIO_LOWDELAY) { @@ -211,12 +214,12 @@ } #if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS) rc = setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&iptos_val, sizeof(iptos_val)); - if (rc < 0) { + if (rc < 0 && errno != ENOTSOCK) { TRACE(("Couldn't set IPV6_TCLASS (%s)", strerror(errno))); } #endif rc = setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&iptos_val, sizeof(iptos_val)); - if (rc < 0) { + if (rc < 0 && errno != ENOTSOCK) { TRACE(("Couldn't set IP_TOS (%s)", strerror(errno))); } #endif @@ -229,7 +232,7 @@ } /* linux specific, sets QoS class. see tc-prio(8) */ rc = setsockopt(sock, SOL_SOCKET, SO_PRIORITY, (void*) &so_prio_val, sizeof(so_prio_val)); - if (rc < 0) + if (rc < 0 && errno != ENOTSOCK) dropbear_log(LOG_WARNING, "Couldn't set SO_PRIORITY (%s)", strerror(errno)); #endif
--- a/options.h Mon Jul 28 23:38:54 2014 +0800 +++ b/options.h Fri Aug 08 21:26:07 2014 +0800 @@ -264,7 +264,7 @@ /* The command to invoke for xauth when using X11 forwarding. * "-q" for quiet */ #ifndef XAUTH_COMMAND -#define XAUTH_COMMAND "/usr/bin/X11/xauth -q" +#define XAUTH_COMMAND "/usr/bin/xauth -q" #endif /* if you want to enable running an sftp server (such as the one included with
--- a/packet.c Mon Jul 28 23:38:54 2014 +0800 +++ b/packet.c Fri Aug 08 21:26:07 2014 +0800 @@ -93,9 +93,12 @@ iov[i].iov_base = buf_getptr(writebuf, len); iov[i].iov_len = len; } + /* This may return EAGAIN. The main loop sometimes + calls write_packet() without bothering to test with select() since + it's likely to be necessary */ written = writev(ses.sock_out, iov, iov_max_count); if (written < 0) { - if (errno == EINTR) { + if (errno == EINTR || errno == EAGAIN) { m_free(iov); TRACE2(("leave write_packet: EINTR")) return; @@ -136,7 +139,7 @@ written = write(ses.sock_out, buf_getptr(writebuf, len), len); if (written < 0) { - if (errno == EINTR) { + if (errno == EINTR || errno == EAGAIN) { TRACE2(("leave writepacket: EINTR")) return; } else { @@ -255,7 +258,7 @@ ses.remoteclosed(); } if (slen < 0) { - if (errno == EINTR) { + if (errno == EINTR || errno == EAGAIN) { TRACE2(("leave read_packet_init: EINTR")) return DROPBEAR_FAILURE; }