Re: [squid-users] Re: spaces with helpers

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 09 May 2010 22:26:02 +1200

Luis Daniel Lucio Quiroz wrote:
> Le vendredi 7 mai 2010 16:45:11, Luis Daniel Lucio Quiroz a �crit :
>> /usr/lib64/squid/squid_db_auth --dsn=DBI:mysql:joomla:localhost --user=root
>> -- table=jos15_users --usercol=username --passwdcol=password
>> --cond=block=0 -- plaintext --sql='select jos15_users.password from
>> jos15_users INNER JOIN jos15_acctexp_subscr ON jos15_users.id =
>> jos15_acctexp_subscr.userid WHERE (jos15_acctexp_subscr.status LIKE
>> "Active" OR jos15_acctexp_subscr.status LIKE "Excluded") AND
>> jos15_users.username = ?'
>>
>> this helper in command line works, but when writing it to squid it fails.
>> I know it is bause i add the --sql param but i dont gethow shall i escape
>> that sentense to make it work inside squid
>>
>> any help please?
>>
>> LD
> odd
> this should be documented
>
> spaces should need to be escaped \
> --sql=select\ jos15_users.password\ from\ jos15_users\ INNER\ JOIN\
> jos15_acctexp_subscr\ ON\ jos15_users.id\ =\ jos15_acctexp_subscr.userid\
> WHERE\ \(jos15_acctexp_subscr.status\ LIKE\ \"Active\"\ OR\
> jos15_acctexp_subscr.status\ LIKE\ \"Excluded\"\)\ AND\ jos15_users.username\
> \=\ \?
>
> this is how it works

Shell escaping is only needed if you use incorrect shell quoting.

Note the word shell in all the above.

double quote " for shell parameter quoting around the values passed to
each parameter or they will be broken into multiple parameters.

single quote ' for SQL syntax internal quoting.

What you wrote in your first email was the same as:

squid_db_auth
  --dsn "DBI:mysql:joomla:localhost"
  --user "root"
  --table "jos15_users INNER JOIN jos15_acctexp_subscr ON
jos15_users.id=jos15_acctexp_subscr.userid"
  --usercol jos15_users.username
  --passwdcol jos15_users.password
  --cond "(jos15_acctexp_subscr.status='Active' OR
jos15_acctexp_subscr.status='Excluded') AND block=0"
  --plaintext

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.3
Received on Sun May 09 2010 - 10:26:19 MDT

This archive was generated by hypermail 2.2.0 : Sun May 09 2010 - 12:00:04 MDT