X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=9ff2d7c63a632d1d1047831a729aa379994f551d;hb=0193e3e218a53df6c3011e2f16f73b1af9a7e19e;hp=5f4a9dbc076a47581211cad23b392b280a6f46ea;hpb=6cb032fd2ece4742e3516e0941507143f677e5cd;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 5f4a9db..9ff2d7c 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.168 2005-05-11 12:39:37 adam Exp $ +/* $Id: zebraapi.c,v 1.172 2005-05-31 17:10:06 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -169,11 +169,13 @@ ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) log_level_initialized = 1; } - yaz_log(log_level, "zebra_start %s",configName); + yaz_log(YLOG_LOG, "zebra_start %s %s",configName, ZEBRAVER); assert(configName); if ((res = res_open (configName, def_res, over_res))) { + const char *passwd_plain = 0; + const char *passwd_encrypt = 0; ZebraService zh = xmalloc(sizeof(*zh)); yaz_log (YLOG_DEBUG, "Read resources `%s'", configName); @@ -185,16 +187,23 @@ ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) zebra_chdir (zh); zebra_mutex_cond_init (&zh->session_lock); - if (!res_get (zh->global_res, "passwd")) + passwd_plain = res_get (zh->global_res, "passwd"); + passwd_encrypt = res_get (zh->global_res, "passwd.c"); + + if (!passwd_plain && !passwd_encrypt) zh->passwd_db = NULL; else { - zh->passwd_db = passwd_db_open (); + zh->passwd_db = passwd_db_open(); if (!zh->passwd_db) yaz_log (YLOG_WARN|YLOG_ERRNO, "passwd_db_open failed"); else - passwd_db_file (zh->passwd_db, - res_get (zh->global_res, "passwd")); + { + if (passwd_plain) + passwd_db_file_plain(zh->passwd_db, passwd_plain); + if (passwd_encrypt) + passwd_db_file_crypt(zh->passwd_db, passwd_encrypt); + } } zh->path_root = res_get (zh->global_res, "root"); zh->nmem = nmem_create(); @@ -268,15 +277,27 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, reg->dh = data1_createx (DATA1_FLAG_XML); if (!reg->dh) + { + xfree(reg); return 0; + } reg->bfs = bfs_create (res_get (res, "register"), reg_path); if (!reg->bfs) { data1_destroy(reg->dh); + xfree(reg); return 0; } if (useshadow) - bf_cache (reg->bfs, res_get (res, "shadow")); + { + if (bf_cache (reg->bfs, res_get (res, "shadow")) == ZEBRA_FAIL) + { + bfs_destroy(reg->bfs); + data1_destroy(reg->dh); + xfree(reg); + return 0; + } + } getcwd(cwd, sizeof(cwd)-1); profilePath = res_get_def(res, "profilePath", DEFAULT_PROFILE_PATH); @@ -923,6 +944,9 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream, { char *buf; int len; + + zebra_get_hit_vector(zh, setname, poset[i].sysno); + recs[i].errCode = zebra_record_fetch(zh, poset[i].sysno, poset[i].score, stream, input_format, comp,