From 7bdaea952097f1267469e5d81abf59006745309b Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Wed, 19 Apr 1995 12:55:15 +0000 Subject: [PATCH 1/1] Added auth. --- zlayer/zaccess-yaz.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/zlayer/zaccess-yaz.c b/zlayer/zaccess-yaz.c index 62d3ef2..98e82b8 100644 --- a/zlayer/zaccess-yaz.c +++ b/zlayer/zaccess-yaz.c @@ -4,7 +4,10 @@ * Z39.50 API for the Email gateway - YAZ version * * $Log: zaccess-yaz.c,v $ - * Revision 1.2 1995/04/19 09:24:02 quinn + * Revision 1.3 1995/04/19 12:55:15 quinn + * Added auth. + * + * Revision 1.2 1995/04/19 09:24:02 quinn * Fixed bug in zass_open - variable initialized after use * * Revision 1.1 1995/04/17 11:26:53 quinn @@ -87,12 +90,13 @@ static int send_apdu(struct zass *z, Z_APDU *a) return 0; } -static int send_initreq(struct zass *p) +static int send_initreq(struct zass *p, char *auth) { Z_APDU a; Z_InitRequest init; Odr_bitmask options, protocolVersion; char name[512]; + Z_IdAuthentication idauth; a.which = Z_APDU_initRequest; a.u.initRequest = &init; @@ -108,7 +112,14 @@ static int send_initreq(struct zass *p) ODR_MASK_SET(&protocolVersion, Z_ProtocolVersion_2); init.preferredMessageSize = &p->preferredmessagesize; init.maximumRecordSize = &p->maxrecordsize; - init.idAuthentication = 0; + if (!auth) + init.idAuthentication = 0; + else + { + init.idAuthentication = &idauth; + idauth.which = Z_IdAuthentication_open; + idauth.u.open = auth; + } init.implementationId = ZASS_ID; sprintf(name, "%s (YAZ protocol layer)", ZASS_NAME); init.implementationName = name; @@ -152,7 +163,7 @@ static int receive_initres(struct zass *p) return 0; } -ZASS zass_open(char *host, int port) +ZASS zass_open(char *host, int port, char *auth) { struct zass *p; char addstr[512]; @@ -198,7 +209,7 @@ ZASS zass_open(char *host, int port) gw_log(ZASS_DEBUG, ZASS_TYPE, "connected ok"); p->inbuf = 0; p->inbuflen = 0; - if (send_initreq(p) < 0 || receive_initres(p) < 0) + if (send_initreq(p, auth) < 0 || receive_initres(p) < 0) { gw_log(GW_LOG_FATAL, ZASS_TYPE, "Failed to initialize"); return 0; -- 1.7.10.4