From 05c2cf51484b104fe8cb8211b27b4d257b7865b8 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 23 Jan 2002 20:25:42 +0000 Subject: [PATCH] Function p_query_rpn returns 0 for unknown attribute set. --- CHANGELOG | 2 ++ zutil/pquery.c | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ab789fa..d3f8e8a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,8 @@ Possible compatibility problems with earlier versions marked with '*'. --- 1.8.5 2002/XX/XX +Prefix query parser reports "fail" when bad attribute set is given. + Fix in MARC decoder. Proximity logging. Fix for attribute set in scan handler for server. Patches by Shigeru Ishida. diff --git a/zutil/pquery.c b/zutil/pquery.c index 0df4c1b..adb54c7 100644 --- a/zutil/pquery.c +++ b/zutil/pquery.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 1995-2001, Index Data. + * Copyright (c) 1995-2002, Index Data. * See the file LICENSE for details. * - * $Id: pquery.c,v 1.11 2001-11-13 23:00:43 adam Exp $ + * $Id: pquery.c,v 1.12 2002-01-23 20:25:42 adam Exp $ */ #include @@ -253,6 +253,7 @@ static Z_AttributesPlusTerm *rpn_term (struct lex_info *li, ODR o, elements[k]->attributeType = &attr_tmp[2*i]; elements[k]->attributeSet = yaz_oidval_to_z3950oid(o, CLASS_ATTSET, attr_set[i]); + if (attr_clist[i]) { elements[k]->which = Z_AttributeValue_complex; @@ -310,13 +311,13 @@ static Z_Operand *rpn_simple (struct lex_info *li, ODR o, oid_proto proto, if (!(zo->u.attributesPlusTerm = rpn_term (li, o, proto, num_attr, attr_list, attr_clist, attr_set))) - return NULL; + return 0; lex (li); break; case 's': lex (li); if (!li->query_look) - return NULL; + return 0; zo->which = Z_Operand_resultSetId; zo->u.resultSetId = (char *)odr_malloc (o, li->lex_len+1); memcpy (zo->u.resultSetId, li->lex_buf, li->lex_len); @@ -324,7 +325,7 @@ static Z_Operand *rpn_simple (struct lex_info *li, ODR o, oid_proto proto, lex (li); break; default: - return NULL; + return 0; } return zo; } @@ -462,7 +463,9 @@ static Z_RPNStructure *rpn_structure (struct lex_info *li, ODR o, return NULL; if (num_attr >= max_attr) return NULL; - p_query_parse_attr(li, o, num_attr, attr_list, attr_clist, attr_set); + if (!p_query_parse_attr(li, o, num_attr, attr_list, + attr_clist, attr_set)) + return 0; num_attr++; lex (li); return @@ -575,10 +578,12 @@ Z_AttributesPlusTerm *p_query_scan_mk (struct lex_info *li, { lex (li); if (!li->query_look) - return NULL; + return 0; if (num_attr >= max_attr) - return NULL; - p_query_parse_attr(li, o, num_attr, attr_list, attr_clist, attr_set); + return 0; + if (!p_query_parse_attr(li, o, num_attr, attr_list, + attr_clist, attr_set)) + return 0; num_attr++; lex (li); } -- 1.7.10.4