Opened 2 years ago

Last modified 2 years ago

#12554 new Patch

Fix building of libfilezilla-0.34.0 on OpenBSD

Reported by: Bjorn Ketelaars Owned by:
Priority: normal Component: libfilezilla
Keywords: Cc: Bjorn Ketelaars
Component version: Operating system type: BSD
Operating system version: OpenBSD current


r10380 (user impersonation), breaks compatibility with OpenBSD. OpenBSD does not support shadow(3) and crypt(3) causing building to fail.

As a workaround introduce FZ_OPENBSD, which is similar in behavior as FZ_MAC.

Attachments (2)

libfilezilla.patch (3.0 KB ) - added by Bjorn Ketelaars 2 years ago.
libfilezilla.2.patch (1.8 KB ) - added by Bjorn Ketelaars 2 years ago.

Download all attachments as: .zip

Change History (5)

by Bjorn Ketelaars, 2 years ago

Attachment: libfilezilla.patch added

comment:1 by Tim Kosse, 2 years ago

Status: newmoreinfo

Thank you for the patch. Unfortunately the chosen approach is not feasible, adding a major operating system family disambiguation like this will result in long-term maintenance overhead.

It should be possible to fix this issue without any change to the library API:

  • Add configure checks for crypt, shadow and any OpenBSD-specific replacement functions
  • In lib/impersonation.cpp use the appropriate functions depending oon the HAVE_... #defines

Could you please update your patch accordingly?

by Bjorn Ketelaars, 2 years ago

Attachment: libfilezilla.2.patch added

comment:2 by Bjorn Ketelaars, 2 years ago

Status: moreinfonew

New patch (libfilezilla.2.patch). This time configure checks for specific functions, and sets FZ_IMPERSONATION. The latter is used in demos/, lib/impersonation.cpp and lib/process.cpp.

comment:3 by Tim Kosse, 2 years ago

I had a closer look at OpenBSD. Unfortunately impersonation cannot currently be implemented due to a lack of a thread-safe getpwnam_shadow_r, non-_r functions like getpwnam_shadow are completely unsafe to use in any code that uses libraries or is itself part of a library.

Fixing OpenBSD should be fairly easy though, just add this to src/lib/libc/gen/getpwent.c, update the headers and manpages in the process (Alternatively, but probably much more involved, would be to make all non-_r functions use thread-local storage):

getshadow_r(const char *name, struct passwd *pw, char *buf, size_t buflen,
   struct passwd **pwretp)
	return getpwnam_internal(name, pw, buf, buflen, pwretp, true, true);

Can you please bring this to the attention of the relevant developers?

Leaving this bug open until the missing trivial functionality has been added to OpenBSD.

Note: See TracTickets for help on using tickets.