mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 18:22:50 +01:00
Fix ident for ssl connections.
This commit is contained in:
parent
e4bb4f3645
commit
3540120ad5
3 changed files with 7 additions and 12 deletions
|
@ -298,6 +298,8 @@ struct PreClient
|
||||||
|
|
||||||
rb_dlink_list dnsbl_queries; /* list of struct BlacklistClient * */
|
rb_dlink_list dnsbl_queries; /* list of struct BlacklistClient * */
|
||||||
struct Blacklist *dnsbl_listed; /* first dnsbl where it's listed */
|
struct Blacklist *dnsbl_listed; /* first dnsbl where it's listed */
|
||||||
|
|
||||||
|
struct rb_sockaddr_storage lip; /* address of our side of the connection */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ListClient
|
struct ListClient
|
||||||
|
|
|
@ -435,7 +435,7 @@ close_listeners()
|
||||||
* any client list yet.
|
* any client list yet.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, void *ssl_ctl)
|
add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, struct sockaddr *lai, void *ssl_ctl)
|
||||||
{
|
{
|
||||||
struct Client *new_client;
|
struct Client *new_client;
|
||||||
s_assert(NULL != listener);
|
s_assert(NULL != listener);
|
||||||
|
@ -447,6 +447,7 @@ add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, voi
|
||||||
new_client = make_client(NULL);
|
new_client = make_client(NULL);
|
||||||
|
|
||||||
memcpy(&new_client->localClient->ip, sai, sizeof(struct rb_sockaddr_storage));
|
memcpy(&new_client->localClient->ip, sai, sizeof(struct rb_sockaddr_storage));
|
||||||
|
memcpy(&new_client->preClient->lip, lai, sizeof(struct rb_sockaddr_storage));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copy address to 'sockhost' as a string, copy it to host too
|
* copy address to 'sockhost' as a string, copy it to host too
|
||||||
|
@ -553,7 +554,7 @@ accept_ssld(rb_fde_t *F, struct sockaddr *addr, struct sockaddr *laddr, struct L
|
||||||
rb_fde_t *xF[2];
|
rb_fde_t *xF[2];
|
||||||
rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Incoming ssld Connection");
|
rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Incoming ssld Connection");
|
||||||
ctl = start_ssld_accept(F, xF[1], rb_get_fd(xF[0])); /* this will close F for us */
|
ctl = start_ssld_accept(F, xF[1], rb_get_fd(xF[0])); /* this will close F for us */
|
||||||
add_connection(listener, xF[0], addr, ctl);
|
add_connection(listener, xF[0], addr, laddr, ctl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -575,5 +576,5 @@ accept_callback(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t add
|
||||||
if(listener->ssl)
|
if(listener->ssl)
|
||||||
accept_ssld(F, addr, (struct sockaddr *)&lip, listener);
|
accept_ssld(F, addr, (struct sockaddr *)&lip, listener);
|
||||||
else
|
else
|
||||||
add_connection(listener, F, addr, NULL);
|
add_connection(listener, F, addr, (struct sockaddr *)&lip, NULL);
|
||||||
}
|
}
|
||||||
|
|
10
src/s_auth.c
10
src/s_auth.c
|
@ -297,7 +297,6 @@ static int
|
||||||
start_auth_query(struct AuthRequest *auth)
|
start_auth_query(struct AuthRequest *auth)
|
||||||
{
|
{
|
||||||
struct rb_sockaddr_storage localaddr, destaddr;
|
struct rb_sockaddr_storage localaddr, destaddr;
|
||||||
socklen_t locallen = sizeof(struct rb_sockaddr_storage);
|
|
||||||
rb_fde_t *F;
|
rb_fde_t *F;
|
||||||
int family;
|
int family;
|
||||||
|
|
||||||
|
@ -333,14 +332,7 @@ start_auth_query(struct AuthRequest *auth)
|
||||||
* since the ident request must originate from that same address--
|
* since the ident request must originate from that same address--
|
||||||
* and machines with multiple IP addresses are common now
|
* and machines with multiple IP addresses are common now
|
||||||
*/
|
*/
|
||||||
memset(&localaddr, 0, locallen);
|
localaddr = auth->client->preClient->lip;
|
||||||
if(getsockname(rb_get_fd(auth->client->localClient->F),
|
|
||||||
(struct sockaddr *) &localaddr, &locallen) == -1)
|
|
||||||
{
|
|
||||||
/* can happen if connection was just closed */
|
|
||||||
rb_close(F);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */
|
/* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */
|
||||||
#ifdef RB_IPV6
|
#ifdef RB_IPV6
|
||||||
|
|
Loading…
Reference in a new issue