From 5381b2f81bb793e364cd5b2a910e026ce84d9d05 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 18 Jul 2003 19:54:30 +0000 Subject: [PATCH] Support for the UserInformation DPU OCLC-UserInformation: - Add VAL_OCLCUI to oid.h - #include in include/yaz/proto.h - #define Z_External_OCLCUserInfo in include/yaz/prt-ext.h - Add Z_OCLC_UserInformation *oclc branch to Z_External.u - Add "OCLC-userInfo" entry to OID database in util/oid.c - New file "oclcui.asn" in z39.50 directory - Mention "oclcui.asn" and "z-oclcui.c" in z39.50/Makefile.am - Add VAL_OCLCUI registration in z39.50/prt-ext.c - Add arm to union-database in Z_External() in z39.50/prt-ext.c - Include UserInfoFormat-oclcUserInformation in z39.50/z.tcl (This is a handy checklist next time I need to add something.) More verbose authentication-setting in command-line client. Temporary debugging code in client (for OCLC diagnostics). --- client/client.c | 24 +++++++++++++++++------- include/yaz/oid.h | 3 ++- include/yaz/proto.h | 3 ++- include/yaz/prt-ext.h | 2 ++ util/oid.c | 6 ++++-- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/client/client.c b/client/client.c index a833835..3eae707 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.202 2003-07-14 12:59:23 adam Exp $ + * $Id: client.c,v 1.203 2003-07-18 19:54:30 mike Exp $ */ #include @@ -332,18 +332,24 @@ static int process_initResponse(Z_InitResponse *res) printf("Version: %s\n", res->implementationVersion); if (res->userInformationField) { + Z_External *uif = res->userInformationField; printf("UserInformationfield:\n"); - if (!z_External(print, (Z_External**)&res-> userInformationField, - 0, 0)) + if (!z_External(print, (Z_External**)&uif, 0, 0)) { odr_perror(print, "Printing userinfo\n"); odr_reset(print); } - if (res->userInformationField->which == Z_External_octet) + if (uif->which == Z_External_octet) { printf("Guessing visiblestring:\n"); - printf("'%s'\n", res->userInformationField->u. octet_aligned->buf); - } + printf("'%s'\n", uif->u. octet_aligned->buf); + } else if (uif->which == Z_External_single +// && oid_is(uif->direct_reference, "1.2.840.10003.10.1000.17.1") + ) { + /* FirstSearch's crappy private init-diagnostic OID */ + Odr_any *sat = uif->u.single_ASN1_type; + printf("### NAUGHTY: External is '%s'\n", sat->buf); + } odr_reset (print); } printf ("Options:"); @@ -580,7 +586,7 @@ int cmd_authentication(const char *arg) r = sscanf (arg, "%39s %39s %39s", user, group, pass); if (r == 0) { - printf("Auth field set to null\n"); + printf("Authentication set to null\n"); auth = 0; } if (r == 1) @@ -588,6 +594,7 @@ int cmd_authentication(const char *arg) auth = &au; au.which = Z_IdAuthentication_open; au.u.open = user; + printf("Authentication set to Open (%s)\n", user); } if (r == 2) { @@ -597,6 +604,7 @@ int cmd_authentication(const char *arg) idPass.groupId = NULL; idPass.userId = user; idPass.password = group; + printf("Authentication set to User (%s), Pass (%s)\n", user, group); } if (r == 3) { @@ -606,6 +614,8 @@ int cmd_authentication(const char *arg) idPass.groupId = group; idPass.userId = user; idPass.password = pass; + printf("Authentication set to User (%s), Group (%s), Pass (%s)\n", + user, group, pass); } return 1; } diff --git a/include/yaz/oid.h b/include/yaz/oid.h index 044fd1d..c0beb28 100644 --- a/include/yaz/oid.h +++ b/include/yaz/oid.h @@ -23,7 +23,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * - * $Id: oid.h,v 1.17 2003-07-10 11:51:46 mike Exp $ + * $Id: oid.h,v 1.18 2003-07-18 19:54:30 mike Exp $ */ #ifndef OID_H @@ -212,6 +212,7 @@ typedef enum oid_value VAL_ZEEREX, VAL_CQL, VAL_DBUPDATE1, + VAL_OCLCUI, /* VAL_DYNAMIC must have highest value */ VAL_DYNAMIC, diff --git a/include/yaz/proto.h b/include/yaz/proto.h index cf01f36..5023c15 100644 --- a/include/yaz/proto.h +++ b/include/yaz/proto.h @@ -3,7 +3,7 @@ * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * - * $Id: proto.h,v 1.10 2003-07-14 12:59:23 adam Exp $ + * $Id: proto.h,v 1.11 2003-07-18 19:54:30 mike Exp $ */ #ifndef Z_PROTO_H #define Z_PROTO_H @@ -43,6 +43,7 @@ #include #include #include +#include YAZ_BEGIN_CDECL diff --git a/include/yaz/prt-ext.h b/include/yaz/prt-ext.h index 48bacb1..731acdb 100644 --- a/include/yaz/prt-ext.h +++ b/include/yaz/prt-ext.h @@ -86,6 +86,7 @@ struct Z_External #define Z_External_acfKrb1 25 #define Z_External_multisrch2 26 #define Z_External_CQL 27 +#define Z_External_OCLCUserInfo 28 union { /* Generic types */ @@ -124,6 +125,7 @@ struct Z_External Z_KRBObject *acfKrb1; Z_MultipleSearchTerms_2 *multipleSearchTerms_2; Z_InternationalString *cql; + Z_OCLC_UserInformation *oclc; } u; }; diff --git a/util/oid.c b/util/oid.c index 4aeddfe..1a0ecbb 100644 --- a/util/oid.c +++ b/util/oid.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: oid.c,v 1.63 2003-07-10 11:52:37 mike Exp $ + * $Id: oid.c,v 1.64 2003-07-18 19:54:30 mike Exp $ */ /* @@ -299,7 +299,7 @@ static oident standard_oids[] = {PROTO_Z3950, CLASS_NEGOT, VAL_CHARNEG3, {15,3,-1}, "CharSetandLanguageNegotiation-3"}, {PROTO_Z3950, CLASS_USERINFO,VAL_CQL, {16, 2, -1}, - "CQL"}, + "OCLC-userInfo"}, {PROTO_GENERAL, CLASS_GENERAL, VAL_UCS2, {1,0,10646,1,0,2,-1}, "UCS-2"}, {PROTO_GENERAL, CLASS_GENERAL, VAL_UCS4, {1,0,10646,1,0,4,-1}, @@ -308,6 +308,8 @@ static oident standard_oids[] = "UTF-16"}, {PROTO_GENERAL, CLASS_GENERAL, VAL_UTF8, {1,0,10646,1,0,8,-1}, "UTF-8"}, + {PROTO_Z3950, CLASS_USERINFO,VAL_OCLCUI, {10, 1000, 17, 1, -1}, + "CQL"}, {PROTO_NOP, CLASS_NOP, VAL_NOP, {-1}, 0 } }; -- 1.7.10.4