* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.57 1998-04-03 14:45:18 adam
+ * Revision 1.61 1998-06-24 12:16:15 adam
+ * Support for relations on text operands. Open range support in
+ * DFA module (i.e. [-j], [g-]).
+ *
+ * Revision 1.60 1998/06/22 11:36:49 adam
+ * Added authentication check facility to zebra.
+ *
+ * Revision 1.59 1998/06/12 12:22:13 adam
+ * Work on Zebra API.
+ *
+ * Revision 1.58 1998/05/27 16:57:46 adam
+ * Zebra returns surrogate diagnostic for single records when
+ * appropriate.
+ *
+ * Revision 1.57 1998/04/03 14:45:18 adam
* Fixed setting of last_in_set in bend_fetch.
*
* Revision 1.56 1998/03/05 08:45:13 adam
bend_initresult *r = odr_malloc (q->stream, sizeof(*r));
ZebraHandle zh;
struct statserv_options_block *sob;
+ char *user = NULL;
+ char *passwd = NULL;
r->errcode = 0;
r->errstring = 0;
logf (LOG_DEBUG, "bend_init");
sob = statserv_getcontrol ();
- if (!(zh = zebra_open (NULL, sob->configname)))
+ if (!(zh = zebra_open (sob->configname)))
{
logf (LOG_FATAL, "Failed to open Zebra `%s'", sob->configname);
r->errcode = 1;
return r;
}
+ if (q->auth)
+ {
+ if (q->auth->which == Z_IdAuthentication_open)
+ {
+ char *openpass = xstrdup (q->auth->u.open);
+ char *cp = strchr (openpass, '/');
+ if (cp)
+ {
+ *cp = '\0';
+ user = nmem_strdup (odr_getmem (q->stream), openpass);
+ passwd = nmem_strdup (odr_getmem (q->stream), cp+1);
+ }
+ xfree (openpass);
+ }
+ }
+ if (zebra_auth (zh, user, passwd))
+ {
+ r->errcode = 222;
+ r->errstring = user;
+ zebra_close (zh);
+ return r;
+ }
r->handle = zh;
return r;
}
r->last_in_set = 0;
zebra_records_retrieve (zh, q->stream, q->setname, q->comp,
q->format, 1, &retrievalRecord);
-
- if (zh->errCode)
+ if (zh->errCode) /* non Surrogate Diagnostic */
{
r->errcode = zh->errCode;
r->errstring = zh->errString;
}
- else
+ else if (retrievalRecord.errCode) /* Surrogate Diagnostic */
+ {
+ q->surrogate_flag = 1;
+ r->errcode = retrievalRecord.errCode;
+ r->errstring = retrievalRecord.errString;
+ r->basename = retrievalRecord.base;
+ }
+ else /* Database Record */
{
r->errcode = 0;
r->basename = retrievalRecord.base;
{
ZebraHandle zh = handle;
- zebra_sort (zh, rr->stream, rr->num_input_setnames, rr->input_setnames,
+ zebra_sort (zh, rr->stream,
+ rr->num_input_setnames, (const char **) rr->input_setnames,
rr->output_setname, rr->sort_sequence, &rr->sort_status);
rr->errcode = zh->errCode;
rr->errstring = zh->errString;