[RADIATOR] Using Storable in a hook
Jared Watkins
JWatkins at acninc.com
Wed Jan 25 06:53:34 CST 2012
The attribute list portion that I want to store is an array. I want to store it for development and debugging reasons since I'll be receiving records from several different kinds of sources and I'm trying to develop logic to clean up and normalize the bits I care about. The alternative.. is to manually rip out 250+ possible attribs for each type of source.. and I'd rather not have to do that when I can get a list of decoded elements per packet for 'free'. I'll just be referencing the stored data.. not using it directly in other code.
J
On Jan 25, 2012, at 7:35 AM, Alexander Hartmaier wrote:
> Serializing Objects, references and regexes is no easy task.
> What are you trying to achieve?
> I suggest you switch to a different format like JSON and only serialize
> a data structure you created from the request attributes by yourself.
> The internal representation of a packet could change with every version
> so you shouldn't rely on it or at least be able to fix your code easily
> if that happens.
>
> Best regards, Alex
>
> Am 2012-01-25 04:44, schrieb Jared Watkins:
>> I figured out that I have to call it directly like Storable::nfreeze(\%x) but the error I was getting for other way was:
>>
>> Bizarre copy of HASH in refgen at
>>
>> Now.. I'm passing the value in as a bound parameter in the hook and according to a length call on the variable.. it's going in with an average length of 1450 bytes. However.. when I fetch it from the database (postgres) I'm only getting back 3 bytes.
>>
>> I'm using just the attributes list out of the $p variable by $p->{'Attributes'}.
>>
>> I've done binary data through DBI before (to mysql) without a problem.. so I'm not sure where it might be getting lost here.
>>
>> Thanks,
>> Jared
>>
>>
>> On Jan 24, 2012, at 5:59 PM, Heikki Vatiainen wrote:
>>
>>> On 01/24/2012 10:44 PM, Jared Watkins wrote:
>>>
>>>> I'm seeing some weird errors and behavior trying to use the freeze method from Storable. Is there a special trick to making it work in hook code?
>>> I have not used Storable myself, but if you could reply with some
>>> examples I can take a a look.
>>>
>>> Note that some of the data structures, such as radius requests ($p
>>> usually) are very large. You could see e.g. with Data::Dumper to see
>>> what they look like.
>>>
>>>> I saw a reference on the cpan page for special handling when used in a 'Safe' compartment.. is that what's happening here? For reference.. for development/debugging I'm attempting to serialize and store (in db field) a hash I'm creating with all the per packet name-value pairs.
>>> Hard to tell. Examples would be useful :)
>>>
>>> Thanks!
>>> Heikki
>>>
>>> --
>>> Heikki Vatiainen<hvn at open.com.au>
>>>
>>> Radiator: the most portable, flexible and configurable RADIUS server
>>> anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
>>> Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
>>> TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
>>> DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS,
>>> NetWare etc.
>> _______________________________________________
>> radiator mailing list
>> radiator at open.com.au
>> http://www.open.com.au/mailman/listinfo/radiator
>
>
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
> Handelsgericht Wien, FN 79340b
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> Notice: This e-mail contains information that is confidential and may be privileged.
> If you are not the intended recipient, please notify the sender and then
> delete this e-mail immediately.
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> _______________________________________________
> radiator mailing list
> radiator at open.com.au
> http://www.open.com.au/mailman/listinfo/radiator
More information about the radiator
mailing list