X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=4e5d2fdeca61be0c4e614bd123f8e2dbdb8d9842;hb=12cdf00008c22bb5edf92632c7236b2676a273dd;hp=7caf21a3166d9a045fa68ea9e5be42271c30f5c7;hpb=3f45c68ea8b1d3a3e9c5b3a014b3d001e89c46eb;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 7caf21a..4e5d2fd 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -4,7 +4,14 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebraapi.c,v $ - * Revision 1.5 1998-06-13 00:14:08 adam + * Revision 1.7 1998-06-24 12:16:13 adam + * Support for relations on text operands. Open range support in + * DFA module (i.e. [-j], [g-]). + * + * Revision 1.6 1998/06/22 11:36:47 adam + * Added authentication check facility to zebra. + * + * Revision 1.5 1998/06/13 00:14:08 adam * Minor changes. * * Revision 1.4 1998/06/12 12:22:12 adam @@ -155,6 +162,21 @@ ZebraHandle zebra_open (const char *configName) zh->errString = 0; zebraRankInstall (zh, rank1_class); + + if (!res_get (zh->res, "passwd")) + zh->passwd_db = NULL; + else + { + zh->passwd_db = passwd_db_open (); + if (!zh->passwd_db) + logf (LOG_WARN|LOG_ERRNO, "passwd_db_open failed"); + else + passwd_db_file (zh->passwd_db, res_get (zh->res, "passwd")); + } + zh->bfs = bfs_create (res_get (zh->res, "register")); + bf_lockDir (zh->bfs, res_get (zh->res, "lockDir")); + data1_set_tabpath (zh->dh, res_get(zh->res, "profilePath")); + return zh; } @@ -179,6 +201,8 @@ void zebra_close (ZebraHandle zh) data1_destroy (zh->dh); zebra_server_lock_destroy (zh); + if (zh->passwd_db) + passwd_db_close (zh->passwd_db); res_close (zh->res); xfree (zh); } @@ -259,8 +283,8 @@ void zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, } void zebra_sort (ZebraHandle zh, ODR stream, - int num_input_setnames, char **input_setnames, - char *output_setname, Z_SortKeySpecList *sort_sequence, + int num_input_setnames, const char **input_setnames, + const char *output_setname, Z_SortKeySpecList *sort_sequence, int *sort_status) { zh->errCode = 0; @@ -291,6 +315,13 @@ int zebra_hits (ZebraHandle zh) return zh->hits; } +int zebra_auth (ZebraHandle zh, const char *user, const char *pass) +{ + if (!zh->passwd_db || !passwd_db_auth (zh->passwd_db, user, pass)) + return 0; + return 1; +} + void zebra_setDB (ZebraHandle zh, int num_bases, char **basenames) {