* 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
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;
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;
return 0;
}
-ZASS zass_open(char *host, int port)
+ZASS zass_open(char *host, int port, char *auth)
{
struct zass *p;
char addstr[512];
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;