Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Apr 2024 07:22:00 GMT
From:      Kurt Jaeger <pi@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: c392b136785e - main - ftp/libfilezilla: fix build by adding missing patch
Message-ID:  <202404210722.43L7M0al031110@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pi:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c392b136785e44d496fb7dc744ee616a9374197e

commit c392b136785e44d496fb7dc744ee616a9374197e
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2024-04-21 07:21:14 +0000
Commit:     Kurt Jaeger <pi@FreeBSD.org>
CommitDate: 2024-04-21 07:21:47 +0000

    ftp/libfilezilla: fix build by adding missing patch
    
    PR:     278463
---
 ftp/libfilezilla/files/patch-lib_impersonation.cpp | 73 ++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/ftp/libfilezilla/files/patch-lib_impersonation.cpp b/ftp/libfilezilla/files/patch-lib_impersonation.cpp
new file mode 100644
index 000000000000..423e5bf90e44
--- /dev/null
+++ b/ftp/libfilezilla/files/patch-lib_impersonation.cpp
@@ -0,0 +1,73 @@
+FreeBSD defines crypt_r() via <unistd.h>.
+
+--- lib/impersonation.cpp.orig	2023-06-28 13:00:47 UTC
++++ lib/impersonation.cpp
+@@ -8,8 +8,6 @@
+ #include <tuple>
+ 
+ #if FZ_UNIX
+-#include <crypt.h>
+-#include <shadow.h>
+ #endif
+ #include <grp.h>
+ #include <limits.h>
+@@ -98,43 +96,7 @@ std::optional<gid_t> get_group(native_string const& gn
+ 	return {};
+ }
+ 
+-#if FZ_UNIX
+-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_;
+-	buffer buf_{};
+-};
+-
+-shadow_holder get_shadow(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;
+ }
+-#endif
+-}
+ 
+ class impersonation_token_impl final
+ {
+@@ -191,14 +153,7 @@ bool check_auth(native_string const& username, native_
+ bool check_auth(native_string const& username, native_string const& password)
+ {
+ #if FZ_UNIX
+-	auto shadow = get_shadow(username);
+-	if (shadow.shadow_) {
+-		struct crypt_data data{};
+-		char* encrypted = crypt_r(password.c_str(), shadow.shadow_->sp_pwdp, &data);
+-		if (encrypted && !strcmp(encrypted, shadow.shadow_->sp_pwdp)) {
+-			return true;
+-		}
+-	}
++	return false; // FreeBSD does not have shadow.h support
+ #elif FZ_MAC
+ 	bool ret{};
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404210722.43L7M0al031110>