From 25d2e96f6076cb5be5db27960c254d9720082eb8 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 6 Sep 2006 05:28:04 +0000 Subject: [PATCH] added sanity checking to prevent id retrievals using objects git-svn-id: svn://svn.open-ils.org/ILS/trunk@5979 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm index def59ab0ae..2d391a0134 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm @@ -380,6 +380,17 @@ sub __arg_to_string { sub runmethod { my( $self, $action, $type, $arg, $options ) = @_; + if( $action eq 'retrieve' ) { + if(! defined($arg) ) { + $self->log(W,"$action $type called with no ID..."); + $self->event(_mk_not_found($type, $arg)); + return undef; + } elsif( ref($arg) =~ /Fieldmapper/ ) { + $self->log(E,"$action $type called with an object.. attempting ID retrieval.."); + $arg = $arg->id; + } + } + my @arg = ( ref($arg) eq 'ARRAY' ) ? @$arg : ($arg); my $method = "open-ils.cstore.direct.$type.$action"; -- 2.11.0