Re: DIFF: helpers/external_acl/eDirectory_userip (2010-09-22)

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 24 Sep 2010 05:11:14 +1200

On 23/09/10 05:22, Chad Naugle wrote:
> I fixed all the mentioned errors below, I believe, and I have it building with test-builds.sh if I enable it using "config.test". I didn't let it go past the "btlayer-00-default".
>
> - Removed all compile-time warnings.
> - Disabled "local_debug()" in favor of Squid's "debug()".
> - Swapped out all "strcpy()" and "strncpy()" calls for Squid's "xstrncpy()"
> - Added meaningful error messages to ERR responses, as opposed to only "debug()" calls.
> - Added ERR message, loop continue, to a BindLDAP() failure, like as if it can't connect to the LDAP Servce. I used "continue" as opposed to "exit" so Squid doesn't complain if the helper exits, unless you want it to work that way.

continue is better if the recovery is possible. exit is fine if its not
recoverable.

> - Fully changed default LDAP Search Scope& Attributes, last diff was missing '-u' option code, default settings, etc.
> - Made a few slight modifications to the man page, to mention importance of proper Partition Replication, and using the '-G' option, along with proper squid.conf syntax for Groups.
>
> * inet_pton / inet_ntop() use as a replacement for my ConvertIP() has it's limitations. They will work fine for IPv4-only or checking to make sure IPv6 format is correct, but they will not convert an IPv6 address into LONG format. ConvertIP() will do this, ie: a0a::1 will turn into 0A0A0000000000000000000000000001, instead of back to a0a::1. This is because SearchFilterLDAP() needs to add '\' in front of each HEX in order to search for it under LDAP, ie. \0A\0A\00\00\00\00\00\00\00\00\00\00\00\00\00\01. If there is a function that will do this for IPv6, please let me know, and I'll make the adjustments...
>

see src/ip/Address.cc implementation of GetReverseString6().

It produces a PTR record from the full-length raw hex bytes as produced
by inet_pton() text => in6_addr conversion.
You can do a similar to produce full-length hex with any byte markups.

> * Squid-level suggestions
> - Make SEND_ERR / SEND_OK more useful, to, let's say, use fprintf(stdout) / fflush(stdout), and I'll incorporate it to replace my "local_printfx()" for the helper replies.
> - Add a Squid-Level equivalent of "printf()", such as "xprintf()", so Squid can trap them properly (forked), versus running the program manually.
> - Add more Utility Functions, like "xstrncpy()" to Squid's library, mostly for portability reasons.

Thanks for the suggestions.

On that last; anything added gets old fast so we add as needed to patch
problems in compiler libraries. If there is relatively standard a
construct you want to use or a bug you find on one of the basic ones
feel free to bring it up.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.8
   Beta testers wanted for 3.2.0.2
Received on Thu Sep 23 2010 - 17:11:19 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 23 2010 - 12:00:11 MDT