Bug 270383 - net/samba419: Add new port
Summary: net/samba419: Add new port
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mikael Urankar
URL:
Keywords:
Depends on:
Blocks: 276261
  Show dependency treegraph
 
Reported: 2023-03-21 11:30 UTC by Mikael Urankar
Modified: 2024-02-10 12:54 UTC (History)
26 users (show)

See Also:


Attachments
v0 (53.86 KB, patch)
2023-03-21 11:30 UTC, Mikael Urankar
no flags Details | Diff
Patch to incrementally update net/samba416 to net/samba417 (54.26 KB, patch)
2023-10-15 21:40 UTC, Joshua Kinard
no flags Details | Diff
Patch to incrementally update net/samba417 to net/samba418 (8.67 KB, patch)
2023-10-15 21:41 UTC, Joshua Kinard
no flags Details | Diff
Patch to incrementally update net/samba418 to net/samba419 (7.99 KB, patch)
2023-10-15 21:41 UTC, Joshua Kinard
no flags Details | Diff
Patch to directly update net/samba416 to net/samba419 (59.14 KB, patch)
2023-10-15 21:42 UTC, Joshua Kinard
no flags Details | Diff
Patch to update databases/tdb from 1.4.7 to 1.4.9 (825 bytes, patch)
2023-10-15 21:43 UTC, Joshua Kinard
no flags Details | Diff
Patch to update devel/talloc from 2.3.4 to 2.4.1 (835 bytes, patch)
2023-10-15 21:43 UTC, Joshua Kinard
no flags Details | Diff
Patch to update devel/tevent from 0.13.0 to 0.15.0 (876 bytes, patch)
2023-10-15 21:44 UTC, Joshua Kinard
no flags Details | Diff
Patch to update devel/tevent from 0.13.0 to 0.16.0 (1.13 KB, patch)
2023-11-18 04:38 UTC, Yasuhiro Kimura
no flags Details | Diff
Updated patch for Samba 4.19 (83.49 KB, patch)
2023-11-18 04:48 UTC, Yasuhiro Kimura
no flags Details | Diff
Updated patch for latest stable samba 4.19.4 (98.22 KB, patch)
2024-01-23 04:13 UTC, Siva Mahadevan
no flags Details | Diff
v1 (108.86 KB, patch)
2024-01-23 14:47 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Urankar freebsd_committer freebsd_triage 2023-03-21 11:30:39 UTC
Created attachment 241036 [details]
v0

The patch is on top of samba416
Comment 1 Joshua Kinard 2023-06-18 16:47:56 UTC
Works for samba-4.17.8.  Any thought as to converting to a "samba418" port and updating to the upstream samba-4.18.3 release?
Comment 2 Siva Mahadevan 2023-08-18 14:39:05 UTC
Any updates on this? Latest upstream stable version is 4.18.6. I can help refresh this patch if needed.
Comment 3 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-09-10 14:44:27 UTC
Samba 4.19;0 is released.
https://www.samba.org/samba/history/samba-4.19.0.html
Comment 4 Joshua Kinard 2023-10-15 21:38:44 UTC
I've taken a stab at updating the samba416 port into a samba419 port, and can report success, so an extent.  I iterated through both samba417 and samba418 ports in the process.  The samba417 port work is based on that which is already posted to this bug.  I am uploading all patches involved, just in case anyone wants to try the different versions.  There is also a direct patch that goes from net/samba416 to net/samba419 as well.

Of note, three of the ports that are dependencies for Samba also require updating.  I will attach patches for those here as well, but I can also create new bugs for each of them and link them as blockers, if that would be better from a bug management standpoint.  It also looks like FreeBSD relies on the bundled 'ldb' library within Samba, rather than using one of the versioned instances in ports.  I assume this is because ldb and Samba tend to be locked to specific versions, and this can create dependency nightmares (which I have had encounters with on the Linux-side of things before, so I am no stranger there).

The three dependencies that need to be bumped are:

    databases/tdb 1.4.7 --> 1.4.9
    devel/talloc 2.3.4 --> 2.4.1
    devel/tevent 0.13.0 --> 0.15.0

All of my testing/experimentation has been only on the file server elements of Samba.  I have no tested anything more advanced, like domain controller functionality, kerberos bits, etc.  I don't run those services on my network, so don't have a need to mess with them.  Additional eyes and scrutiny is going to be needed on those areas to make sure nothing breaking is missed before adding this all to Ports.

The change from 4.16.x to 4.17.x is fairly uneventful and are already documented in this bug.

Things got more interesting when going from 4.17.x to 4.18.x...  Back in net/samba416, when that was added, it included a patch, files/0099-s3-modules-zfsacl-fix-get-set-ACL-on-FreeBSD-13.patch, which added some O_PATH logic to the `fget_zfsacl` function, which included calling the `get_zfsacl` function.  In mid-summer 2022, the `get_zfsacl` function was removed in commit 09a844c69ebf, and while this won't immediately cause a build error, when you go to connect to a Samba instance built this way, the connection will fail because the dynamic loader is unable to locate the symbol for `get_zfsacl`.

A quick and dirty fix for this is to add that function back in by reversing the commit that removed it.  I suspect this is not a viable long-term fix and that the O_PATH logic needs to be fixed to deal with this function's removal, but I wasn't able to locate any information about that O_PATH patch, so I leave that to those who better understand the code.  For now, the patch to go from 4.17.x to 4.18.x reverses the upstream commit and adds `get_zfsacl` back in, and thus, we get a working net/samba418 port.  Additionally, the patch files/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch, is removed due to being in upstream now.

Going from 4.18.x to 4.19.x is less complicated.  The patch, files/0100-From-872ea49ac6dced44f114f80b7065017a381f46d7.patch, added by the net/samba417 update, is dropped, as it's merged into the upstream source now, and a few additional pkg-plist entries were added for a new log-parser binary and removing an old man page.

The end result is a net/samba419 port updated to samba-4.19.1, the latest release (as of writing), and it's been running on my home NAS system for several days now with no noticeable impacts, and no glaring issues in the logging.  One configuration directive is dropped, "directory name cache size", but this doesn't impact the running of the server process.

So I think the primary fix here is handling the removal of `get_zfsacl` from the upstream code in the added O_PATH logic.  If better minds have ideas for that, I am willing to test.

PS, can this bug be assigned to the samba port maintainer?
Comment 5 Joshua Kinard 2023-10-15 21:40:25 UTC
Created attachment 245651 [details]
Patch to incrementally update net/samba416 to net/samba417

> net/samba417/Makefile                                                              |   18
> net/samba417/distinfo                                                              |    6
> net/samba417/files/0026-vfs-add-a-compatibility-option-to-the-vfs_streams_xa.patch |   75
> net/samba417/files/0099-s4-mitkdc-Add-support-for-MIT-Kerberos-1.20.patch          |  942 ----------
> net/samba417/files/0100-From-872ea49ac6dced44f114f80b7065017a381f46d7.patch        |  116 +
> net/samba417/pkg-plist                                                             |    2
> net/samba417/pkg-plist.python                                                      |   52
> 7 files changed, 200 insertions(+), 1011 deletions(-)
Comment 6 Joshua Kinard 2023-10-15 21:41:06 UTC
Created attachment 245652 [details]
Patch to incrementally update net/samba417 to net/samba418

> net/samba418/Makefile                                                                |    6
> net/samba418/distinfo                                                                |    6
> net/samba418/files/0028-Reverse-upstream-commit-09a844c6-get_zfsacl-FreeBSD-13.patch |   60 ++++
> net/samba418/files/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch              |  149 ----------
> net/samba418/pkg-plist                                                               |    1
> 5 files changed, 67 insertions(+), 155 deletions(-)
Comment 7 Joshua Kinard 2023-10-15 21:41:45 UTC
Created attachment 245653 [details]
Patch to incrementally update net/samba418 to net/samba419

> net/samba419/Makefile                                                       |   14 -
> net/samba419/distinfo                                                       |    6
> net/samba419/files/0100-From-872ea49ac6dced44f114f80b7065017a381f46d7.patch |  116 ----------
> net/samba419/pkg-plist                                                      |    4
> net/samba419/pkg-plist.python                                               |    2
> 5 files changed, 8 insertions(+), 134 deletions(-)
Comment 8 Joshua Kinard 2023-10-15 21:42:30 UTC
Created attachment 245654 [details]
Patch to directly update net/samba416 to net/samba419

> net/samba419/Makefile                                                                |   28
> net/samba419/distinfo                                                                |    6
> net/samba419/files/0026-vfs-add-a-compatibility-option-to-the-vfs_streams_xa.patch   |   75
> net/samba419/files/0028-Reverse-upstream-commit-09a844c6-get_zfsacl-FreeBSD-13.patch |   60
> net/samba419/files/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch              |  149 -
> net/samba419/files/0099-s4-mitkdc-Add-support-for-MIT-Kerberos-1.20.patch            |  942 ----------
> net/samba419/pkg-plist                                                               |    7
> net/samba419/pkg-plist.python                                                        |   54
> 8 files changed, 148 insertions(+), 1173 deletions(-)
Comment 9 Joshua Kinard 2023-10-15 21:43:22 UTC
Created attachment 245655 [details]
Patch to update databases/tdb from 1.4.7 to 1.4.9

> databases/tdb/Makefile |    2 +-
> databases/tdb/distinfo |    6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 10 Joshua Kinard 2023-10-15 21:43:52 UTC
Created attachment 245656 [details]
Patch to update devel/talloc from 2.3.4 to 2.4.1

> devel/talloc/Makefile |    2 +-
> devel/talloc/distinfo |    6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 11 Joshua Kinard 2023-10-15 21:44:17 UTC
Created attachment 245657 [details]
Patch to update devel/tevent from 0.13.0 to 0.15.0

> devel/tevent/Makefile |    4 ++--
> devel/tevent/distinfo |    6 +++---
> 2 files changed, 5 insertions(+), 5 deletions(-)
Comment 12 Joshua Kinard 2023-10-15 21:47:31 UTC
Upstream commit that removed `get_zfsacl`:
https://git.samba.org/?p=samba.git;a=commitdiff;h=09a844c69ebf29b437199f43c1c5d81d5cacb2e4
Comment 13 Timur I. Bakeyev freebsd_committer freebsd_triage 2023-10-16 00:27:56 UTC
Hi Joshua!

First of all let me say that you've done great work, which I was slacking from for quite a while. Thank you!

Not sure how I got a link to this PR though, seems someone added my address finally to the CC list. I've taken it now, so can see at least it in my PRs.

I'll try to go through the patches you've made.

You are right about the reasons why ldb became the bundled library for samba416. In particular, it creates(ed) a dependency nightmare for the sssd port(which also can't stay up-to-date enough due to all the Linuxisms in the recent versions).

So I was thinking that the next(presumably samba419) port shouldn't depend on separate supplementary libraries but should be self-contained in that regard. An additional reason for such an approach is the number of problems that arise with each (quite frequent) major update of Python, as corresponding .py modules don't get updated properly, causing a lot of confusion.

I wanted to point you to https://gitlab.com/samba-freebsd/samba for the collaboration, but seems OSS license just expired. I'd try to restore it ASAP.

With best regards,
Timur
Comment 14 Mikael Urankar freebsd_committer freebsd_triage 2023-10-16 10:55:42 UTC
FYI, provisioning a samba dc on top of zfs doesn't work with my patch for samba 4.17 (it works fine with ufs though).
I did not manage to troubleshoot it as it's quite hard to debug the vfs / acl code.
Comment 15 ml 2023-10-17 13:17:00 UTC
(In reply to Joshua Kinard from comment #4)

> The three dependencies that need to be bumped are:
>     databases/tdb 1.4.7 --> 1.4.9
>     devel/talloc 2.3.4 --> 2.4.1
>     devel/tevent 0.13.0 --> 0.15.0

To be clear, these are needed for 4.18? 4.19?
I tried compiling 4.17.11 without these updates and it worked.



> All of my testing/experimentation has been only on the file server elements of Samba.
> I have no tested anything more advanced, like domain controller functionality,
> kerberos bits, etc.

I've currently upgraded one DC and found no issues so far.
In the next few days I'll upgrade all of them and report any issue.



I'll also try to upgrade 4.17.11 -> 4.17.12. I guess it'll be trivial.



I'd be glad to test 4.19 (in fact I'd need it in one case), but for now I'm cautios :)
Comment 16 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-10-23 15:41:17 UTC
I tried attachment 245654 [details] with poudriere and 13.2-RELEASE amd64 jail but build fails because of stage-qa error as following.

===========================================================================
====> Running Q/A tests (stage-qa)
Error: '/usr/bin/env python3' is an invalid shebang you need USES=shebangfix for 'bin/samba-log-parser'
Warning: you might not need LIB_DEPENDS on libiconv.so
Warning: you might not need LIB_DEPENDS on libunwind.so
Warning: you might not need LIB_DEPENDS on libgcrypt.so
Warning: you might not need LIB_DEPENDS on libintl.so
Warning: you might not need LIB_DEPENDS on libfam.so.0
Warning: you might not need LIB_DEPENDS on libldap.so.2
Notice: You have some Perl modules as dependencies but you do not have devel/p5-Module-CoreList installed, the perlcore QA check gets better results when using it, especially with older Perl versions.
*** Error code 1

Stop.
make: stopped in /usr/ports/net/samba419
=>> Error: stage-qa failures detected
build of net/samba419 | samba419-4.19.1 ended at Tue Oct 24 00:32:06 JST 2023
build time: 00:02:39
!!! build failure encountered !!!
[00:02:41] Error: Build failed in phase: stage-qa
[00:02:41] Cleaning up
[00:02:41] Unmounting file systems

Full build log:
https://people.freebsd.org/~yasu/poudriere/data/logs/bulk/132amd64-default-samba/2023-10-24_00h29m25s/logs/samba419-4.19.1.log
Comment 17 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-11-18 04:38:48 UTC
Created attachment 246382 [details]
Patch to update devel/tevent from 0.13.0 to 0.16.0

Patch to update devel/tevent from 0.13.0 to 0.16.0.
Comment 18 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-11-18 04:48:34 UTC
Created attachment 246383 [details]
Updated patch for Samba 4.19

Updated patch for Samba 4.19. It includes following changes from attachment 245654 [details]:

* Updated to 4.19.2, latest release of 4.19 series.
* Fix plist error with some options settings including default one.
* Fix shebang line error.

To apply attached patch, please take following steps.

1. cd /usr/ports
2. cp -a net/samba416 net/samba419
3. git add net/samba419
4. git commit
5. git apply /path/to/atttached/patch
Comment 19 Joseph Anthony Pasquale Holsten 2023-11-21 06:51:42 UTC
Hi there! I just filed bug275224 to update the samba default version, not least because 4.13 is EOL. Was directed over here.

Does this feel like the place to also discuss updating the samba default version? I’m inclined to update only to 4.16 until these patches get some users to whack at them, but I’d love to get all the way up-to-date.

I’m particularly wanting to use a newer release to work on sssd-devel against AD & FreeIPA. If there’s any other testing I can help with, please let me know.
Comment 20 dewayne 2023-11-28 08:00:35 UTC
(In reply to Joseph Anthony Pasquale Holsten from comment #19)
Its good to be enthusiastic Joseph, though I think we all need to build/test what's available.  To that end, I think the patch and steps provided by Yasuhiro Kimura (comment 18) appears to be a good approach in the short term.  Reviewing the diffs, it looks like Joshua's patches form the basis of Kimura-san's patch kit  :)

If you find the time and build/test, it would be very helpful to know the version of: FreeBSD, talloc, tdb, tevent, python thats used.  

Mikael's note provides hope that a 4.19 DC will function, as I will need to migrate ufs2 jailed samba4.13: DC, fileshare and standalone samba's to FreeBSD14 very soon.

Timur, 
1. Bundling the libraries into a samba release is a good idea, didn't it used to be that way?  It would make the management of dependencies for the application easier (similar to the way lorikeet (heimdal) is integrated).
2. I've just had a look at https://gitlab.com/samba-freebsd/samba which seems to be 806 updates behind master.  If this is the collaboration point, is it "better" to pull from that site?

I appreciate the collaboration effort to keep this very complex and useful port alive for FreeBSD.
Comment 21 ml 2023-11-28 08:43:41 UTC
(In reply to ml from comment #15)

> I've currently upgraded one DC and found no issues so far.
> In the next few days I'll upgrade all of them and report any issue.

Just to report that I've been running 4.17.12 everywhere for six weeks with no issues so far.

What I've tried:
_ DC;
_ fileserver;
_ NSS/PAM;
_ migrating from Windows DC to Samba DC.

What I didn't try:
_ provisioning new domain.



I'm just getting warnings:
>smbd[75999]:   parse_dfs_path: can't parse hostname from path 
>smbd[75999]:   parse_dfs_path: trying to convert  to a local path
However, these are harmless to me (I don't use DFS); maybe the older versions were just less chatty?


I think at least 4.17 could make it into the port tree and perhaps be made the default version (given 4.16 is out of support).
If it's unable to provision domains (at least with ZFS), 4.16 can be kept for that.

(Of course I'm looking forward to running 4.19, but I couldn't try yet).
Comment 22 Mark Linimon freebsd_committer freebsd_triage 2023-12-29 05:19:04 UTC
Comment on attachment 246383 [details]
Updated patch for Samba 4.19

^Triage: convert this to text/plain and set the Patch flag so that the
automation can see it.
Comment 23 Alexander Leidinger freebsd_committer freebsd_triage 2024-01-01 16:10:19 UTC
I did not try any of the patches in this PR, but I tried the 4.16 port. This contains the patch files/0099-s3-modules-zfsacl-fix-get-set-ACL-on-FreeBSD-13.patch which is removed in the patches in this PR. If this is removed because it is integrated upstream: the code as is in the 4.16 port contains issues if samba is run in a jail.

As a workaround I commented out (2 times in the patch)
/*             if (!fsp->fsp_flags.have_proc_fds) {
+                       DBG_ERR("fdescfs filesystem must be mounted with 'nodup' "
+                               "option \n");
+                       errno = EBADF;
+                       return -1;
+               }*/
which makes it work in a jail (if fdescfs is mounted inside the pidfile directroy with nodup on jail startup).

So the have_proc_fds check is not OK for use inside jails (which is a working use case with 4.13).
Comment 24 Siva Mahadevan 2024-01-23 04:13:30 UTC
Created attachment 247866 [details]
Updated patch for latest stable samba 4.19.4

Adding an updated patch for the latest stable samba 4.19.4. This is mostly the following small changes on top of Yasuhiro Kimura's earlier patch:
1) Remove the unnecessary 0099-s3-modules-zfsacl-fix-get-set-ACL-on-FreeBSD-13.patch
2) Add a patch from Samba's bugzilla bug[0] to fix the pathref file handling issues.
3) Refresh XML catalog manpage patch

The instructions to apply this patch remain the same from Yasuhiro Kimura's comment:
 
> 1. cd /usr/ports
> 2. cp -a net/samba416 net/samba419
> 3. git add net/samba419
> 4. git commit
> 5. git apply /path/to/atttached/patch

This patch also requires the above patches to databases/tdb, devel/talloc, and devel/tevent.

I have tested this inside a FreeBSD 14.0-RELEASE-p4 jail and it works perfectly with a simple standalone CIFS file sharing setup (with both default acl and zfsacl)

Alexander Leidinger's commenting out of the 'fdescfs nodup' err code section did not work for me to fix the issue, but (2) from the above changes did.

Please let me know if I can help push this further. There may be some further minor cleanup required (or even deleting more obsolete patches from the extra patchlist).

In any case, even if it'll take a bit longer to push the addition of the samba419 port, can we at least submit the updates to databases/tdb, devel/talloc, and devel/tevent from the above patch list? Those are simple changes that are working in my setup.
Comment 25 Siva Mahadevan 2024-01-23 04:16:27 UTC
Samba Bugzilla discussion here: https://bugzilla.samba.org/show_bug.cgi?id=15376
Comment 26 Mikael Urankar freebsd_committer freebsd_triage 2024-01-23 14:47:37 UTC
Created attachment 247890 [details]
v1

This patch is based on Siva's (and other) work
As Timur proposed, use bundled libraries for talloc, tevent, tdb, ldb and mocka.
Timur do you want to maintain the port?
Comment 27 Mikhail Teterin freebsd_committer freebsd_triage 2024-01-23 17:10:25 UTC
(In reply to Mikael Urankar from comment #26)
> v1

I just tested these changes on my FreeBSD-11.4/i386 VM here, which I cannot upgrade for private reasons. My own needs for Samba only involve the client side of things (should we have a client-only flavor, perhaps?).

The feedback:

0. The good news is, it builds! Thank you!
1. I had to remove the part ignoring the port on the OS-versions prior to 13.
2. I had to remove the part adding --undefined-version to LDFLAGS

Maybe, the IGNORE I removed in 1. should be turned into a WARNING? Those earlier FreeBSD versions aren't officially supported anyway, but there is no need to deliberately break things for them.

The change to LDFLAGS, if it really is needed, should be made conditional on the OS-version -- my older ld simply choked on that flag.

Maybe, it is time to /unconditionally/ depend on tevent, cmocka, talloc -- and keep those ports with the latest versions -- this should simplify the samba ports quite a bit.

Finally, to stick with the tradition, we should, probably, create a /new/ port net/samba419 -- perhaps as a copy/upgrade of 416 -- but leaving the samba416 alone for the time being.

Oh, and then don't forget to add 4.19 as a valid version to Mk/Uses/samba.mk.

Thanks again, gentlemen.
Comment 28 shellingfield 2024-01-25 10:00:47 UTC
(In reply to Mikael Urankar from comment #26)

> v1
> As Timur proposed, use bundled libraries for talloc, tevent, tdb, ldb and mocka.
I've try your patch to build package of net/samba419, and then upgrade from net/samba416 (4.16.11_3) as AD DC(provisioned net/samba416).

I haven't done a detailed verification yet, but I noticed one thing.
running samba-tool dump error like below


# samba-tool dns query vm-freebsd ad.example.com @ ALL  --use-kerberos=required
Traceback (most recent call last):
  File "/usr/local/bin/samba-tool", line 33, in <module>
    from samba.netcmd.main import samba_tool
  File "/usr/local/lib/python3.9/site-packages/samba/__init__.py", line 28, in <module>
    import ldb
ModuleNotFoundError: No module named 'ldb'


I think this problem was caused the files

%%SAMBA4_BUNDLED_LDB%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/_ldb_text.py
%%SAMBA4_BUNDLED_LDB%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/ldb%%PYTHON_EXT_SUFFIX%%.so
(and also)
%%SAMBA4_BUNDLED_TALLOC%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/talloc%%PYTHON_EXT_SUFFIX%%.so
%%SAMBA4_BUNDLED_TDB%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/_tdb_text.py
%%SAMBA4_BUNDLED_TDB%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/tdb%%PYTHON_EXT_SUFFIX%%.so
%%SAMBA4_BUNDLED_TEVENT%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/_tevent%%PYTHON_EXT_SUFFIX%%.so
%%SAMBA4_BUNDLED_TEVENT%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/tevent.py

that listed on pkg-plist. they should be stored into

%%SAMBA4_BUNDLED_LDB%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/

not

%%SAMBA4_BUNDLED_LDB%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/samba/

at least on net/samba416, these are on %%SAMBA4_BUNDLED_LDB%%%%PYTHON3%%%%PYTHON_SITELIBDIR%%/ .
and my small fix to pkg-plist and files/patch-lib_* solves the problem (ostensibly)


without this, most of things are working well.

best regards
Comment 29 shellingfield 2024-02-02 05:55:21 UTC
(In reply to Mikael Urankar from comment #26)

> v1
> As Timur proposed, use bundled libraries for talloc, tevent, tdb, ldb and mocka.
I also found a problem about using bundled libraries when changing DNS backend from SAMBA_INTERNAL to BIND9_DLZ


# samba_upgradedns --dns-backend=BIND9_DLZ
Reading domain information
DNS accounts already exist
No zone file /var/db/samba4/bind-dns/dns/AD.EXAMPLE.COM.zone (normal)
DNS partitions already exist
dns-vm-freebsd account already exists
Failed to setup database for BIND, AD based DNS cannot be used
Traceback (most recent call last):
  File "/usr/local/sbin/samba_upgradedns", line 508, in <module>
    create_samdb_copy(ldbs.sam, logger, paths, names, domainsid,
  File "/usr/local/lib/python3.9/site-packages/samba/provision/sambadns.py", line 933, in create_samdb_copy
    tdb_copy(os.path.join(private_dir, "sam.ldb"),
  File "/usr/local/lib/python3.9/site-packages/samba/tdb_util.py", line 37, in tdb_copy
    raise FileNotFoundError(2, "could not find tdbbackup tool: "
FileNotFoundError: [Errno 2] could not find tdbbackup tool: is tdb-tools installed?


like above, tdb_util.py called "tdbbackup", not samba-tdbbackup included net/samba419 w/ SAMBA4_BUNDLED_TDB.
as temporary workaround, just create symlink at /usr/local/bin/ like

# ln -s samba-tdbtool    tdbtool
# ln -s samba-tdbbackup  tdbbackup
# ln -s samba-tdbdump    tdbdump
# ln -s samba-tdbrestore tdbrestore

solved this.
(needless to say, ad-hoc patch to tdb_util.py also solved.)

I don't know any plan "use bundled libraries" or not for net/samba419 and later, we need solutions for (both?) case.


best regards,
Comment 30 Mikael Urankar freebsd_committer freebsd_triage 2024-02-06 08:41:14 UTC
(In reply to shellingfield from comment #29)
I've renamed the binaries

Latest patch available here (too big to attach):
https://people.freebsd.org/~mikael/patches/0001-net-samba419-Add-new-port.patch

I'll try to commit it by the end of the week.
Comment 31 Mikael Urankar freebsd_committer freebsd_triage 2024-02-08 14:15:00 UTC
Some quick notes about the DC provisioning issue:

this is the error message:
python3.9: acl_from_aces: a_type is 0x5
python3.9: aces_from_acl failed

The error message comes from sysutils/libsunacl.

It seems samba 4.17 started to use SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT (its definition is in librpc/idl/security.idl) which is not handled by 
libsunacl
I put a naive fix at [1] and I can provision a domain on top of zfs with it. I'm not sure the fix is correct though.

[1] https://people.freebsd.org/~mikael/patches/0001-sysutils-libsunacl-Add-missing-ACEs-definition-neede.patch
Comment 32 commit-hook freebsd_committer freebsd_triage 2024-02-09 15:34:12 UTC
A commit in branch main references this bug:

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

commit b0a4fa4a12b096897f347755106940220e94c114
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-02-05 12:56:27 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2024-02-09 15:33:54 +0000

    net/samba419: Add new port

    Many thanks to Joshua Kinard, Siva Mahadevan, Yasuhiro Kimura, Andrew Walker, and Peter Eriksson for their patches.

    PR:             270383

 Mk/Uses/samba.mk                                   |     2 +-
 Mk/bsd.default-versions.mk                         |     2 +-
 net/Makefile                                       |     1 +
 net/samba419/Makefile (new)                        |   701 +
 net/samba419/distinfo (new)                        |     3 +
 ...ify-modules-build-and-config-genera.patch (new) |   292 +
 ...-script-to-run-under-FreeBSD-with-i.patch (new) |    35 +
 ...prototype-warnings-in-kadm5-admin.h.patch (new) |    32 +
 ...-has-different-semantics-than-on-Li.patch (new) |    38 +
 ...jemalloc.h-if-ENABLE_JEMALLOC-is-se.patch (new) |    26 +
 ...ss_-modules-into-PAMMODULESDIR-path.patch (new) |    32 +
 ...s-a-default-backlog-size-for-the-li.patch (new) |   105 +
 ...around-usage-of-Linux-specific-m-fl.patch (new) |   111 +
 ...nfig-checks-fail-if-the-warning-is-.patch (new) |    39 +
 ...kgconfigdir-to-specify-alternative-.patch (new) |    54 +
 ...by-port-location-of-the-XML-catalog.patch (new) |    28 +
 ...raries-according-to-the-FreeBSD-spe.patch (new) |    29 +
 ...sg-parameter-to-CHECK_LIB-so-it-can.patch (new) |    70 +
 ...able-CTDB-tests-failing-on-FreeBSD-.patch (new) |    77 +
 ...-class-to-trck-down-DB-locking-code.patch (new) |   132 +
 ...ttribute_compare-a-stable-comparisi.patch (new) |    29 +
 ...en-available-to-generate-random-tal.patch (new) |    49 +
 ...-option-that-allows-to-choose-alter.patch (new) |    65 +
 ...0b920e60e14846987ae1d2d7dca4-Mon-Se.patch (new) |   544 +
 ...n-r336017-and-r342928-wrongfuly-ret.patch (new) |    35 +
 ...ings-in-the-nfs_quota-debug-message.patch (new) |    36 +
 ...dling-code-and-add-FreeBSD-support..patch (new) |   340 +
 ...-test-function-into-vfstest-to-test.patch (new) |   121 +
 ...-provisioning-code-by-iXsystems-Inc.patch (new) |   367 +
 ...4018ebee302aae8246bf29f60309-Mon-Se.patch (new) |   101 +
 ...bility-option-to-the-vfs_streams_xa.patch (new) |   335 +
 ...s_freebsd-that-implements-FreeBSD-s.patch (new) |   932 ++
 ...fsacl-fix-get-set-ACL-on-FreeBSD-13.patch (new) |   164 +
 ...pathref-handling-for-FreeBSD-13plus.patch (new) |   485 +
 net/samba419/files/README.FreeBSD.in (new)         |    94 +
 net/samba419/files/man/ctdb-script.options.5 (new) |   558 +
 net/samba419/files/man/ctdb-statistics.7 (new)     |   550 +
 net/samba419/files/man/ctdb-tunables.7 (new)       |   406 +
 net/samba419/files/man/ctdb.1 (new)                |  1526 ++
 net/samba419/files/man/ctdb.7 (new)                |   783 ++
 net/samba419/files/man/ctdb.conf.5 (new)           |   359 +
 net/samba419/files/man/ctdb.sysconfig.5 (new)      |   139 +
 net/samba419/files/man/ctdb_diagnostics.1 (new)    |    79 +
 net/samba419/files/man/ctdbd.1 (new)               |    83 +
 net/samba419/files/man/ctdbd_wrapper.1 (new)       |    63 +
 net/samba419/files/man/dbwrap_tool.1 (new)         |   329 +
 net/samba419/files/man/gentest.1 (new)             |   133 +
 net/samba419/files/man/ldb.3 (new)                 |   427 +
 net/samba419/files/man/ldbadd.1 (new)              |    78 +
 net/samba419/files/man/ldbdel.1 (new)              |    80 +
 net/samba419/files/man/ldbedit.1 (new)             |   111 +
 net/samba419/files/man/ldbmodify.1 (new)           |    73 +
 net/samba419/files/man/ldbrename.1 (new)           |    81 +
 net/samba419/files/man/ldbsearch.1 (new)           |    91 +
 net/samba419/files/man/libsmbclient.7 (new)        |    94 +
 net/samba419/files/man/lmhosts.5 (new)             |   123 +
 net/samba419/files/man/locktest.1 (new)            |   137 +
 net/samba419/files/man/log2pcap.1 (new)            |   124 +
 net/samba419/files/man/ltdbtool.1 (new)            |   256 +
 net/samba419/files/man/masktest.1 (new)            |   113 +
 net/samba419/files/man/mdfind.1 (new)              |   166 +
 net/samba419/files/man/mdsearch.1 (new)            |   357 +
 net/samba419/files/man/mvxattr.1 (new)             |    84 +
 net/samba419/files/man/ndrdump.1 (new)             |    84 +
 net/samba419/files/man/nmblookup.1 (new)           |   341 +
 net/samba419/files/man/nmblookup4.1 (new)          |   157 +
 net/samba419/files/man/ntlm_auth.1 (new)           |   458 +
 net/samba419/files/man/ntlm_auth4.1 (new)          |   233 +
 net/samba419/files/man/oLschema2ldif.1 (new)       |    74 +
 net/samba419/files/man/onnode.1 (new)              |   218 +
 net/samba419/files/man/pam_winbind.conf.5 (new)    |   161 +
 net/samba419/files/man/ping_pong.1 (new)           |   122 +
 net/samba419/files/man/profiles.1 (new)            |   136 +
 net/samba419/files/man/regdiff.1 (new)             |    87 +
 net/samba419/files/man/regpatch.1 (new)            |    81 +
 net/samba419/files/man/regshell.1 (new)            |   177 +
 net/samba419/files/man/regtree.1 (new)             |    89 +
 net/samba419/files/man/rpcclient.1 (new)           |  1961 +++
 net/samba419/files/man/samba-gpupdate.8 (new)      |   122 +
 net/samba419/files/man/samba.7 (new)               |   254 +
 net/samba419/files/man/sharesec.1 (new)            |   364 +
 net/samba419/files/man/smb.conf.5 (new)            | 13994 +++++++++++++++++++
 net/samba419/files/man/smbcacls.1 (new)            |  1044 ++
 net/samba419/files/man/smbclient.1 (new)           |  1253 ++
 net/samba419/files/man/smbcontrol.1 (new)          |   343 +
 net/samba419/files/man/smbcquotas.1 (new)          |   440 +
 net/samba419/files/man/smbget.1 (new)              |   197 +
 net/samba419/files/man/smbgetrc.5 (new)            |   100 +
 net/samba419/files/man/smbpasswd.5 (new)           |   175 +
 net/samba419/files/man/smbstatus.1 (new)           |   186 +
 net/samba419/files/man/smbtar.1 (new)              |   163 +
 net/samba419/files/man/smbtorture.1 (new)          |   362 +
 net/samba419/files/man/smbtree.1 (new)             |   252 +
 net/samba419/files/man/talloc.3 (new)              |   683 +
 net/samba419/files/man/tdbbackup.8 (new)           |   129 +
 net/samba419/files/man/tdbdump.8 (new)             |    72 +
 net/samba419/files/man/tdbrestore.8 (new)          |    54 +
 net/samba419/files/man/tdbtool.8 (new)             |   170 +
 net/samba419/files/man/testparm.1 (new)            |   194 +
 net/samba419/files/man/traffic_learner.7 (new)     |   128 +
 net/samba419/files/man/traffic_replay.7 (new)      |   380 +
 net/samba419/files/man/vfs_freebsd.8 (new)         |   204 +
 net/samba419/files/man/wbinfo.1 (new)              |   490 +
 .../files/patch-examples_pdb_wscript__build (new)  |    11 +
 net/samba419/files/patch-lib_ldb_wscript (new)     |    61 +
 net/samba419/files/patch-lib_talloc_wscript (new)  |    11 +
 .../files/patch-lib_util_wscript__build (new)      |    11 +
 net/samba419/files/patch-source3_lib_util.c (new)  |    14 +
 .../files/patch-source3_librpc_crypto_gse.c (new)  |    16 +
 ...source3_modules_vfs__virusfilter__utils.c (new) |    36 +
 ...tch-source3_registry_tests_test__regfio.c (new) |    10 +
 .../patch-source3_winbindd_wscript__build (new)    |    11 +
 .../files/patch-source3_wscript__build (new)       |    44 +
 net/samba419/files/pkg-message.in (new)            |    31 +
 net/samba419/files/samba_server.in (new)           |   251 +
 net/samba419/pkg-descr (new)                       |     6 +
 net/samba419/pkg-plist (new)                       |   467 +
 net/samba419/pkg-plist.ad_dc (new)                 |   179 +
 net/samba419/pkg-plist.cluster (new)               |    76 +
 net/samba419/pkg-plist.python (new)                |   505 +
 120 files changed, 40779 insertions(+), 2 deletions(-)