Update to libfilezilla-0.35.0

Overview on changes: https://lib.filezilla-project.org/

Bump major because of removed symbols.
This commit is contained in:
bket 2021-12-11 06:43:19 +00:00
parent da5aab6216
commit a74fca1109
4 changed files with 26 additions and 108 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.23 2021/10/27 07:24:42 bket Exp $
# $OpenBSD: Makefile,v 1.24 2021/12/11 06:43:19 bket Exp $
COMMENT = support library for FileZilla
DISTNAME = libfilezilla-0.34.2
DISTNAME = libfilezilla-0.35.0
SHARED_LIBS += filezilla 10.0 # 21.1.0
SHARED_LIBS += filezilla 11.0 # 23.0.0
CATEGORIES = net

View File

@ -1,2 +1,2 @@
SHA256 (libfilezilla-0.34.2.tar.bz2) = IKKLd+whs4CtAgLbAWbtHHycItRQSN1oBtXsn+J/7Uo=
SIZE (libfilezilla-0.34.2.tar.bz2) = 595072
SHA256 (libfilezilla-0.35.0.tar.bz2) = 7uJRDc49BpHqc9wdoQ+sfbEhWwup7vphbfMFNosJKug=
SIZE (libfilezilla-0.35.0.tar.bz2) = 597061

View File

@ -1,25 +0,0 @@
$OpenBSD: patch-lib_glue_unix_cpp,v 1.1 2021/10/24 18:54:55 bket Exp $
EBADFD is not specified in POSIX, EBADF is.
Index: lib/glue/unix.cpp
--- lib/glue/unix.cpp.orig
+++ lib/glue/unix.cpp
@@ -87,7 +87,7 @@ int send_fd(int socket, fz::buffer & buf, int fd, int
return -1;
}
if (socket < 0) {
- error = EBADFD;
+ error = EBADF;
return -1;
}
@@ -144,7 +144,7 @@ int read_fd(int socket, fz::buffer & buf, int & fd, in
{
fd = -1;
if (socket < 0) {
- error = EBADFD;
+ error = EBADF;
return -1;
}

View File

@ -1,89 +1,32 @@
$OpenBSD: patch-lib_impersonation_cpp,v 1.1 2021/10/24 18:54:55 bket Exp $
$OpenBSD: patch-lib_impersonation_cpp,v 1.2 2021/12/11 06:43:19 bket Exp $
Index: lib/impersonation.cpp
--- lib/impersonation.cpp.orig
+++ lib/impersonation.cpp
@@ -7,10 +7,8 @@
@@ -7,7 +7,7 @@
#include <optional>
#include <tuple>
-#include <crypt.h>
#include <grp.h>
#include <pwd.h>
-#include <shadow.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
@@ -51,43 +49,7 @@ passwd_holder get_passwd(fz::native_string const& user
-#if FZ_UNIX
+#if FZ_UNIX && !__OpenBSD__
#include <crypt.h>
#include <shadow.h>
#endif
@@ -58,7 +58,7 @@ passwd_holder get_passwd(fz::native_string const& user
return ret;
}
-
-
-struct shadow_holder {
- shadow_holder() = default;
- shadow_holder(shadow_holder const&) = delete;
- shadow_holder(shadow_holder &&) = default;
-
- shadow_holder& operator=(shadow_holder const&) = delete;
- shadow_holder& operator=(shadow_holder &&) = default;
-
- ~shadow_holder() noexcept = default;
-
- struct spwd* shadow_{};
-
- struct spwd shadow_buffer_;
- fz::buffer buf_{};
-};
-
-shadow_holder get_shadow(fz::native_string const& username)
-{
- shadow_holder ret;
-
- size_t s = 1024;
- int res{};
- do {
- s *= 2;
- ret.buf_.get(s);
- res = getspnam_r(username.c_str(), &ret.shadow_buffer_, reinterpret_cast<char*>(ret.buf_.get(s)), s, &ret.shadow_);
- } while (res == ERANGE);
-
- if (res) {
- ret.shadow_ = nullptr;
- }
-
- return ret;
}
-}
class impersonation_token_impl final
-#if FZ_UNIX
+#if FZ_UNIX && !__OpenBSD__
struct shadow_holder {
shadow_holder() = default;
shadow_holder(shadow_holder const&) = delete;
@@ -150,7 +150,7 @@ std::vector<gid_t> get_supplementary(std::string const
bool check_auth(fz::native_string const& username, fz::native_string const& password)
{
@@ -139,20 +101,15 @@ impersonation_token::impersonation_token(fz::native_st
{
auto pwd = get_passwd(username);
if (pwd.pwd_) {
- auto shadow = get_shadow(username);
- if (shadow.shadow_) {
- struct crypt_data data{};
- char* encrypted = crypt_r(passwd.c_str(), shadow.shadow_->sp_pwdp, &data);
- if (encrypted && !strcmp(encrypted, shadow.shadow_->sp_pwdp)) {
- impl_ = std::make_unique<impersonation_token_impl>();
- impl_->name_ = username;
- if (pwd.pwd_->pw_dir) {
- impl_->home_ = pwd.pwd_->pw_dir;
- }
- impl_->uid_ = pwd.pwd_->pw_uid;
- impl_->gid_ = pwd.pwd_->pw_gid;
- impl_->sup_groups_ = get_supplementary(username, pwd.pwd_->pw_gid);
+ if (crypt_checkpass(passwd.c_str(), pwd.pwd_->pw_passwd) == 0) {
+ impl_ = std::make_unique<impersonation_token_impl>();
+ impl_->name_ = username;
+ if (pwd.pwd_->pw_dir) {
+ impl_->home_ = pwd.pwd_->pw_dir;
}
+ impl_->uid_ = pwd.pwd_->pw_uid;
+ impl_->gid_ = pwd.pwd_->pw_gid;
+ impl_->sup_groups_ = get_supplementary(username, pwd.pwd_->pw_gid);
}
}
}
-#if FZ_UNIX
+#if FZ_UNIX && !__OpenBSD__
auto shadow = get_shadow(username);
if (shadow.shadow_) {
struct crypt_data data{};