+ db_args += "user=" + mp::util::uri_encode(authentication);
+ }
+ }
+ else
+ {
+ // A non-CF target
+ if (db_args.length())
+ {
+ // user has specified backend authentication
+ const char *param_user = 0;
+ const char *param_password = 0;
+ char **names;
+ char **values;
+ int i;
+ int no_parms = yaz_uri_to_array(db_args.c_str(),
+ odr, &names, &values);
+ for (i = 0; i < no_parms; i++)
+ {
+ const char *name = names[i];
+ const char *value = values[i];
+ if (!strcmp(name, "user"))
+ param_user = value;
+ else if (!strcmp(name, "password"))
+ param_password = value;
+ else
+ {
+ BackendPtr notfound;
+ char *msg = (char*) odr_malloc(odr, strlen(name) + 30);
+ *error = YAZ_BIB1_TEMPORARY_SYSTEM_ERROR;
+ sprintf(msg, "Bad database argument: %s", name);
+ *addinfo = msg;
+ return notfound;
+ }
+ }
+ if (param_user && param_password)
+ {
+ char *auth = (char*) odr_malloc(
+ odr, strlen(param_user) + strlen(param_password) + 2);
+ strcpy(auth, param_user);
+ strcat(auth, "/");
+ strcat(auth, param_password);
+ b->set_option("user", auth);
+ }
+ db_args.clear(); // no arguments to be passed (non-CF)
+ }
+ else
+ {
+ // use authentication from Torus, if given
+ if (authentication.length())
+ b->set_option("user", authentication.c_str());