From: Amos Jeffries Date: Sat, 9 Feb 2013 06:31:57 +0000 (-0700) Subject: Bug 3749: IDENT lookup using wrong ports to identify the user X-Git-Tag: SQUID_3_2_8~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a12af574dbeeb0c502b35f5b24fb803292eda33;p=thirdparty%2Fsquid.git Bug 3749: IDENT lookup using wrong ports to identify the user --- diff --git a/src/ident/Ident.cc b/src/ident/Ident.cc index d9d7b89c51..f2116b869a 100644 --- a/src/ident/Ident.cc +++ b/src/ident/Ident.cc @@ -61,6 +61,7 @@ typedef struct _IdentClient { typedef struct _IdentStateData { hash_link hash; /* must be first */ Comm::ConnectionPointer conn; + MemBuf queryMsg; ///< the lookup message sent to IDENT server IdentClient *clients; char buf[IDENT_BUFSIZE]; } IdentStateData; @@ -149,14 +150,9 @@ Ident::ConnectDone(const Comm::ConnectionPointer &conn, comm_err_t status, int x comm_add_close_handler(conn->fd, Ident::Close, state); - MemBuf mb; - mb.init(); - mb.Printf("%d, %d\r\n", - conn->remote.GetPort(), - conn->local.GetPort()); AsyncCall::Pointer writeCall = commCbCall(5,4, "Ident::WriteFeedback", CommIoCbPtrFun(Ident::WriteFeedback, state)); - Comm::Write(conn, &mb, writeCall); + Comm::Write(conn, &state->queryMsg, writeCall); AsyncCall::Pointer readCall = commCbCall(5,4, "Ident::ReadReply", CommIoCbPtrFun(Ident::ReadReply, state)); comm_read(conn, state->buf, IDENT_BUFSIZE, readCall); @@ -266,6 +262,10 @@ Ident::Start(const Comm::ConnectionPointer &conn, IDCB * callback, void *data) state->conn->local.SetPort(0); state->conn->remote.SetPort(IDENT_PORT); + // build our query from the original connection details + state->queryMsg.init(); + state->queryMsg.Printf("%d, %d\r\n", conn->remote.GetPort(), conn->local.GetPort()); + ClientAdd(state, callback, data); hash_join(ident_hash, &state->hash);