Skip to content

Instantly share code, notes, and snippets.

@felixbuenemann
Created February 10, 2018 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixbuenemann/0bfe17b7da8a6470880f33008bae828a to your computer and use it in GitHub Desktop.
Save felixbuenemann/0bfe17b7da8a6470880f33008bae828a to your computer and use it in GitHub Desktop.
class Samba < Formula
desc "SMB/CIFS file, print, and login server for UNIX"
homepage "https://samba.org/"
url "https://download.samba.org/pub/samba/stable/samba-4.7.5.tar.gz"
sha256 "316d04fa9fbabad6f2739fe68e1928778af4866265409119aba6ef3435c8fe8d"
depends_on "pkg-config" => :build
depends_on "gnutls"
# Once the smbd daemon is executed with required root permissions
# contents of these two directories becomes owned by root. Sad face.
skip_clean "private"
skip_clean "var/locks"
# Fixes the Grouplimit of 16 users os OS X.
# Bug has been raised upstream:
# https://bugzilla.samba.org/show_bug.cgi?id=8773
patch :DATA
conflicts_with "jena",
:because => "both install `tdbbackup` and `tdbdump` binaries"
def install
args = %W[
--prefix=#{prefix}
--sysconfdir=#{etc}
--without-gettext
--enable-fhs
--enable-gnutls
]
# "ACL support not available on Darwin/MacOS".
args << "--without-acl-support"
# This tells the waf build process to ignore WAFCACHE if set.
args << "--nocache"
system "./configure", *args
(prefix/"private").mkpath
(prefix/"var/locks").mkpath
system "make"
system "make", "install"
# makefile doesn't have an install target for these
#(lib/"pkgconfig").install Dir["pkgconfig/*.pc"]
# Install basic example configuration
inreplace "examples/smb.conf.default" do |s|
s.gsub! "/usr/local/samba/var/log.%m", "#{prefix}/var/log/samba/log.%m"
end
(prefix/"etc").install "examples/smb.conf.default" => "smb.conf"
end
plist_options :manual => "smbd"
def plist; <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/smbd</string>
<string>-s</string>
<string>#{etc}/smb.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
system bin/"eventlogadm", "-h"
end
end
__END__
--- a/source3/lib/system.c 2012-02-22 22:46:14.000000000 -0200
+++ b/source3/lib/system.c 2012-02-22 22:47:51.000000000 -0200
@@ -1161,7 +1161,14 @@
int groups_max(void)
{
-#if defined(SYSCONF_SC_NGROUPS_MAX)
+#if defined(DARWINOS)
+ /* On OS X, sysconf(_SC_NGROUPS_MAX) returns 16
+ * due to OS X's group nesting and getgrouplist
+ * will return a flat list; users can exceed the
+ * maximum of 16 groups. And easily will.
+ */
+ return 32; // NGROUPS_MAX is defined, hence the define above is void.
+#elif defined(SYSCONF_SC_NGROUPS_MAX)
int ret = sysconf(_SC_NGROUPS_MAX);
return (ret == -1) ? NGROUPS_MAX : ret;
#else
--- a/source4/torture/local/nss_tests.c 2018-02-10 20:30:15.000000000 +0100
+++ b/source4/torture/local/nss_tests.c 2018-02-10 20:41:21.000000000 +0100
@@ -346,6 +346,7 @@
torture_comment(tctx, "Testing setpwent\n");
setpwent();
+#ifdef HAVE_GETPWENT_R
while (1) {
torture_comment(tctx, "Testing getpwent_r\n");
@@ -368,6 +369,7 @@
num_pwd++;
}
}
+#endif /* HAVE_GETPWENT_R */
torture_comment(tctx, "Testing endpwent\n");
endpwent();
@@ -544,6 +546,7 @@
torture_comment(tctx, "Testing setgrent\n");
setgrent();
+#ifdef HAVE_GETGRENT_R
while (1) {
torture_comment(tctx, "Testing getgrent_r\n");
@@ -566,6 +569,7 @@
num_grp++;
}
}
+#endif /* HAVE_GETGRENT_R */
torture_comment(tctx, "Testing endgrent\n");
endgrent();
--- a/source3/libads/kerberos_keytab.c 2018-02-10 20:44:45.000000000 +0100
+++ b/source3/libads/kerberos_keytab.c 2018-02-10 20:14:52.000000000 +0100
@@ -614,8 +614,6 @@
return ret;
}
-#endif /* HAVE_ADS */
-
/**********************************************************************
List system keytab.
***********************************************************************/
@@ -716,4 +714,6 @@
return ret;
}
+#endif /* HAVE_ADS */
+
#endif /* HAVE_KRB5 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment