ojsde / dnb

OJS plugin that exports full texts and metadata to the Deutsche Nationalbibliothek (DNB)
GNU General Public License v2.0
3 stars 3 forks source link

No error message despite incorrect settings #21

Open kirchnerf opened 6 months ago

kirchnerf commented 6 months ago

Although the access data (user name, password and subfolder ID) are incorrect, the plugin reports a successful upload of the data. Curl returns the status code 0 and the error array is empty. This case is not covered by the error detection in the depositXML() method in DNBExportPlugin.inc.php.

This behavior has already been described in #11

OJS version: 3.3.0.16 DNB plugin version: 1.5.0 PHP 8.0.30

ronste commented 5 months ago

Hi @kirchnerf ,

thanks for reporting the issue. I tested this on my system again. With my configuration (no proxy) I do get an error message when I put in wrong credentials:

grafik

In fact, the plugin adds the original error message ("Authentication failure") provided by the SFTP server to an internal error massage, provided that curl acutally reported an error. If curl doesn't report an error there is unfortunately nothing the plugin can do.

The only reason I can image why curl is not repoerting an error in case wrong credetials are given is a proxy server inbetween the connection that does not pass on the error reported by the DNB SFTP server.

Do you use a proxy server in your configuration?

kirchnerf commented 5 months ago

We don't use a proxy. But I did some more tests and found out that I get an error on Windows if the credentials are wrong. On openSuse and Suse Linux Enterprise, I don't get an error. On all systems I used PHP 8.0.30. I will now also try it with Ubuntu.

ronste commented 5 months ago

Thanks for digging into this.

We don't use a proxy. But I did some more tests and found out that I get an error on Windows if the credentials are wrong. On openSuse and Suse Linux Enterprise, I don't get an error. On all systems I used PHP 8.0.30. I will now also try it with Ubuntu.

It may be a curl or sftp configuration issue. Or the curl/sftp bineries have been compiled with different options on the different platforms. We use Debian. More information on this issue would very helpful.

kirchnerf commented 5 months ago

On Ubuntu 22.04.4 (PHP 8.1) the behavior is the same as on openSuse and SLES. php-curl does not return an error if the credentials are wrong.

ronste commented 5 months ago

Could you do a curl --version on one of these systems?

On my Debian 10 it gives:

$ curl --version
curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1n zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 
kirchnerf commented 5 months ago

OpenSuse 15.5:

curl 8.0.1 (x86_64-suse-linux-gnu) libcurl/8.0.1 OpenSSL/1.1.1l-fips zlib/1.2.13 brotli/1.0.7 zstd/1.5.0 libidn2/2.2.0 libpsl/0.20.1 (+libidn2/2.2.0) libssh/0.9.8/openssl/zlib nghttp2/1.40.0
Release-Date: 2023-03-20
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

Suse Linux Enterprise 15.5:

curl 8.0.1 (x86_64-suse-linux-gnu) libcurl/8.0.1 OpenSSL/1.1.1l-fips zlib/1.2.13 brotli/1.0.7 zstd/1.5.0 libidn2/2.2.0 libpsl/0.20.1 (+libidn2/2.2.0) libssh/0.9.8/openssl/zlib nghttp2/1.40.0
Release-Date: 2023-03-20
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

Ubuntu 22.04.4:

curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd