Fixed bug #1136: Access rights not enforced.
[metaproxy-moved-to-github.git] / src / filter_record_transform.cpp
index 472ec9a..23c4524 100644 (file)
@@ -1,7 +1,22 @@
-/* $Id: filter_record_transform.cpp,v 1.9 2007-03-20 07:57:54 adam Exp $
+/* $Id: filter_record_transform.cpp,v 1.12 2007-05-09 21:23:09 adam Exp $
    Copyright (c) 2005-2007, Index Data.
 
-   See the LICENSE file for details
+This file is part of Metaproxy.
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Metaproxy; see the file LICENSE.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
  */
 
 #include "config.hpp"
@@ -141,7 +156,7 @@ void yf::RecordTransform::Impl::process(mp::Package &package) const
     }
     
     const char *match_schema = 0;
-    int *match_syntax = 0;
+    Odr_oid *match_syntax = 0;
 
     const char *backend_schema = 0;
     Odr_oid *backend_syntax = 0;
@@ -178,7 +193,7 @@ void yf::RecordTransform::Impl::process(mp::Package &package) const
         else if (ret_code == 2)
         {
             char oidbuf[OID_STR_MAX];
-            oid_to_dotstring(input_syntax, oidbuf);
+            oid_oid_to_dotstring(input_syntax, oidbuf);
             details = odr_strdup(odr_en, oidbuf);
             
             apdu = odr_en.create_presentResponse(
@@ -189,16 +204,12 @@ void yf::RecordTransform::Impl::process(mp::Package &package) const
         return;
     }
 
-
-
     // now re-coding the z3950 backend present request
      
-    // z3950'fy record syntax
-    if (backend_syntax)  // TODO: this seems not to work - why ??
-        pr_req->preferredRecordSyntax = backend_syntax;
+    if (backend_syntax) 
+        pr_req->preferredRecordSyntax = odr_oiddup(odr_en, backend_syntax);
     else
-        pr_req->preferredRecordSyntax
-            = yaz_oidval_to_z3950oid(odr_en, CLASS_RECSYN, VAL_NONE);
+        pr_req->preferredRecordSyntax = 0;
     
 
     // z3950'fy record schema
@@ -284,9 +295,8 @@ void yf::RecordTransform::Impl::process(mp::Package &package) const
                                                    output_record);
                      if (ret_trans == 0)
                      {
-                         struct oident *ident = oid_getentbyoid(match_syntax);
                          npr->u.databaseRecord =
-                             z_ext_record(odr_en, ident->value,
+                             z_ext_record_oid(odr_en, match_syntax,
                                           wrbuf_buf(output_record),
                                           wrbuf_len(output_record));
                      }