[squid-dev] [PATCH] Fix ext_session_acl to handle - when no argument is passed

Amos Jeffries squid3 at treenet.co.nz
Wed Mar 22 05:43:08 UTC 2017


On 21/03/2017 3:36 a.m., Trever L. Adams wrote:
> On 03/20/2017 05:47 AM, Trever L. Adams wrote:
>> This is pull #1 on github if that is the correct place to do this.
>>
>> Thank you.
>>
>> Trever
>>
> I am sorry, I sent the wrong patch. Pull request has been corrected as well.
> 


Hi Trever,
 Can you explain the problem and intended behaviour change? the title of
the PR does not tell much.


FYI: the current contents of github are experiments which will be remove
or replaced shortly. AFAIK the plan is that the 'squid' repository name
will be the one used in future, however the current contents are going
to be replaced shortly. Please do not rely on them until an announcement
comes out about the migration. Apologies for the inconvenience.

Amos

PS. for squid-dev the patch submission was:

ext_session_acl_no_argument.patch

diff --git a/src/acl/external/session/ext_session_acl.cc
b/src/acl/external/session/ext_session_acl.cc
index 09ff163..e252165 100644
--- a/src/acl/external/session/ext_session_acl.cc
+++ b/src/acl/external/session/ext_session_acl.cc
@@ -202,15 +202,13 @@ int main(int argc, char **argv)
         char *lastdetail = strrchr(detail, ' ');
         size_t detail_len = strlen(detail);
         if (lastdetail) {
+            detail_len = (size_t)(lastdetail-detail);
             if (strcmp(lastdetail, " LOGIN") == 0) {
                 action = 1;
-                detail_len = (size_t)(lastdetail-detail);
-                *lastdetail = '\0';
             } else if (strcmp(lastdetail, " LOGOUT") == 0) {
                 action = -1;
-                detail_len = (size_t)(lastdetail-detail);
-                *lastdetail = '\0';
             }
+            *lastdetail = '\0';
         }
         if (action == -1) {
             session_logout(detail, detail_len);



More information about the squid-dev mailing list