X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fconnection.c;h=7f9691ac2e3ed493022bdb1395a42c4570311d6b;hb=817e3ec506c4095bc4fcc1923cee36153ef4ee43;hp=710d436e0a84a3eadd48c23f8539831956a4000b;hpb=1034064601914be4fd6de1b8fdad1ce13eab1c1d;p=pazpar2-moved-to-github.git diff --git a/src/connection.c b/src/connection.c index 710d436..7f9691a 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1,5 +1,5 @@ /* This file is part of Pazpar2. - Copyright (C) 2006-2013 Index Data + Copyright (C) Index Data Pazpar2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -375,7 +375,6 @@ void connect_resolver_host(struct host *host, iochan_man_t iochan_man) if (sdb) { yaz_mutex_leave(host->mutex); - connection_connect(con, iochan_man); client_start_search(con->client); } else @@ -391,7 +390,6 @@ void connect_resolver_host(struct host *host, iochan_man_t iochan_man) } else { - yaz_log(YLOG_LOG, "connect_resolver_host: state=%d", con->state); con = con->next; } } @@ -411,6 +409,7 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) const char *charset; const char *sru; const char *sru_version = 0; + const char *value; WRBUF w; struct session_database *sdb = client_get_database(con->client); @@ -441,13 +440,27 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) if (apdulog && *apdulog) ZOOM_options_set(zoptions, "apdulog", apdulog); + + if ((sru = session_setting_oneval(sdb, PZ_SRU)) && *sru) + ZOOM_options_set(zoptions, "sru", sru); + if ((sru_version = session_setting_oneval(sdb, PZ_SRU_VERSION)) + && *sru_version) + ZOOM_options_set(zoptions, "sru_version", sru_version); + if ((auth = session_setting_oneval(sdb, PZ_AUTHENTICATION))) { + /* allow splitting user and reset with a blank always */ const char *cp1 = strchr(auth, ' '); + if (!cp1 && sru && *sru) + cp1 = strchr(auth, '/'); if (!cp1) + { + /* Z39.50 user/password style, or no password for SRU */ ZOOM_options_set(zoptions, "user", auth); + } else { + /* now consider group as well */ const char *cp2 = strchr(cp1 + 1, ' '); ZOOM_options_setl(zoptions, "user", auth, cp1 - auth); @@ -460,11 +473,11 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) } } } - if ((sru = session_setting_oneval(sdb, PZ_SRU)) && *sru) - ZOOM_options_set(zoptions, "sru", sru); - if ((sru_version = session_setting_oneval(sdb, PZ_SRU_VERSION)) - && *sru_version) - ZOOM_options_set(zoptions, "sru_version", sru_version); + + value = session_setting_oneval(sdb, PZ_AUTHENTICATION_MODE); + if (value && *value) + ZOOM_options_set(zoptions, "authenticationMode", value); + if (!(con->link = ZOOM_connection_create(zoptions))) { yaz_log(YLOG_FATAL|YLOG_ERRNO, "Failed to create ZOOM Connection");