Discussion:
[Trousers-scm] [GIT] Trousers master branch updated. TROUSERS_0_3_13-7-gd74889b
Vicky Lo
2014-10-29 03:26:32 UTC
Permalink
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Trousers".

The branch, master has been updated
via d74889b409a52636cc831e283be7fdc1eda8dff4 (commit)
via 802563fd38d10a9233aa60ac5ac50ae3bd15a7ad (commit)
via b236ece1136ede77435f7af80b60a05e175678c6 (commit)
via 104dc8e665c8b7f1f397b8dfbec4c3060ef12a0c (commit)
from c812ff1632bd8eb55f26770d6c3ad13776c06d12 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=d74889b409a52636cc831e283be7fdc1eda8dff4

commit d74889b409a52636cc831e283be7fdc1eda8dff4
Author: Vadim Penzin <***@users.sf.net>
Date: Tue Oct 28 23:07:49 2014 -0400

Fixed failure to recognise connections from localhost over IPv6

Misplaced closing curly bracket makes check for ::1 a dead code.
The attached patch fixes this issue.

diff --git a/src/tcs/rpc/tcstp/rpc.c b/src/tcs/rpc/tcstp/rpc.c
index 08deb84..cc8a085 100644
--- a/src/tcs/rpc/tcstp/rpc.c
+++ b/src/tcs/rpc/tcstp/rpc.c
@@ -540,6 +540,7 @@ access_control(struct tcsd_thread_data *thread_data)
if (memcmp(&sa_in->sin_addr.s_addr, &nloopaddr,
sizeof(in_addr_t)) == 0)
is_localhost = 1;
+ }
else if (sa->sa_family == AF_INET6) {
struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa;
if (memcmp(&sa_in6->sin6_addr.s6_addr, &in6addr_loopback,
@@ -551,7 +552,7 @@ access_control(struct tcsd_thread_data *thread_data)
* approve it */
if (is_localhost)
return 0;
- } else {
+ else {
while (tcsd_options.remote_ops[i]) {
if ((UINT32)tcsd_options.remote_ops[i] == thread_data->comm.hdr.u.ordinal) {
LogInfo("Accepted %s operation from %s",

http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=802563fd38d10a9233aa60ac5ac50ae3bd15a7ad

commit 802563fd38d10a9233aa60ac5ac50ae3bd15a7ad
Author: Vadim Penzin <***@users.sf.net>
Date: Tue Oct 28 22:53:28 2014 -0400

Fixed the wrong type used while comparing IPv6 addresses

src/tcs/rpc/tcstp/rpc.c:access_control() checks if peer's address
is in6addr_loopback. memcmp(3) is passed sizeof(struct sockaddr_in6)
that is larger than sizeof(struct in6_addr), so the call always fails.

diff --git a/src/tcs/rpc/tcstp/rpc.c b/src/tcs/rpc/tcstp/rpc.c
index 1573a8a..08deb84 100644
--- a/src/tcs/rpc/tcstp/rpc.c
+++ b/src/tcs/rpc/tcstp/rpc.c
@@ -543,7 +543,7 @@ access_control(struct tcsd_thread_data *thread_data)
else if (sa->sa_family == AF_INET6) {
struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa;
if (memcmp(&sa_in6->sin6_addr.s6_addr, &in6addr_loopback,
- sizeof(struct sockaddr_in6)) == 0)
+ sizeof(struct in6_addr)) == 0)
is_localhost = 1;
}


http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=b236ece1136ede77435f7af80b60a05e175678c6

commit b236ece1136ede77435f7af80b60a05e175678c6
Author: Vadim Penzin <***@users.sf.net>
Date: Tue Oct 28 22:25:41 2014 -0400

Fixed the wrong type used while comparing IPv4 addresses

src/tcs/rpc/tcstp/rpc.c:access_control() checks if peer's address is
INADDR_LOOPBACK. There are two issues with the current code:

1. For correctness, in_addr_t should be used instead of uint32_t.
2. memcmp(3) is passed sizeof(struct sockaddr_in) that is larger than
sizeof(in_add_r) (or sizeof(uin32_t) for that matter), so the call
always fails.

diff --git a/src/tcs/rpc/tcstp/rpc.c b/src/tcs/rpc/tcstp/rpc.c
index a235a84..1573a8a 100644
--- a/src/tcs/rpc/tcstp/rpc.c
+++ b/src/tcs/rpc/tcstp/rpc.c
@@ -536,9 +536,9 @@ access_control(struct tcsd_thread_data *thread_data)
// Check if it's localhost for both inet protocols
if (sa->sa_family == AF_INET) {
struct sockaddr_in *sa_in = (struct sockaddr_in *)sa;
- uint32_t nloopaddr = htonl(INADDR_LOOPBACK);
+ in_addr_t nloopaddr = htonl(INADDR_LOOPBACK);
if (memcmp(&sa_in->sin_addr.s_addr, &nloopaddr,
- sizeof(struct sockaddr_in)) == 0)
+ sizeof(in_addr_t)) == 0)
is_localhost = 1;
else if (sa->sa_family == AF_INET6) {
struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa;

http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=104dc8e665c8b7f1f397b8dfbec4c3060ef12a0c

commit 104dc8e665c8b7f1f397b8dfbec4c3060ef12a0c
Author: Vadim Penzin <***@users.sf.net>
Date: Tue Oct 28 18:09:26 2014 -0400

Fixed incorrect check of the result of getpeername(2)

diff --git a/src/tcs/rpc/tcstp/rpc.c b/src/tcs/rpc/tcstp/rpc.c
index 0fc7e83..a235a84 100644
--- a/src/tcs/rpc/tcstp/rpc.c
+++ b/src/tcs/rpc/tcstp/rpc.c
@@ -524,7 +524,8 @@ access_control(struct tcsd_thread_data *thread_data)
struct sockaddr *sa;
socklen_t sas_len = sizeof(sas);

- if (!getpeername(thread_data->sock, (struct sockaddr *)&sas, &sas_len)) {
+ if (getpeername(thread_data->sock, (struct sockaddr *)&sas,
+ &sas_len) == -1) {
LogError("Error retrieving local socket address: %s", strerror(errno));
return 1;
}

-----------------------------------------------------------------------

Summary of changes:
src/tcs/rpc/tcstp/rpc.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)


hooks/post-receive
--
Trousers

------------------------------------------------------------------------------
Loading...