2011-11-30 02:54:00 +04:00
|
|
|
{ stdenv, fetchurl, readline, pam ? null, openldap ? null
|
|
|
|
, popt, iniparser, libunwind
|
|
|
|
, fam ? null , acl ? null, cups ? null
|
2010-09-26 09:07:41 +04:00
|
|
|
, useKerberos ? false, kerberos ? null, winbind ? true
|
2009-04-26 15:06:41 +04:00
|
|
|
|
|
|
|
# Eg. smbclient and smbspool require a smb.conf file.
|
|
|
|
# If you set configDir to "" an empty configuration file
|
|
|
|
# $out/lib/smb.conf is is created for you.
|
|
|
|
#
|
|
|
|
# configDir defaults to "/etc/samba" so that smbpassword picks up
|
|
|
|
# the location of its passwd db files from the system configuration file
|
|
|
|
# /etc/samba/smb.conf. That's why nixos touches /etc/samba/smb.conf even if you
|
|
|
|
# don't enable the samba upstart service.
|
|
|
|
, configDir ? "/etc/samba"
|
2007-05-28 19:40:17 +04:00
|
|
|
|
2010-09-26 09:07:41 +04:00
|
|
|
}:
|
2010-12-06 21:59:07 +03:00
|
|
|
|
2011-11-30 02:54:00 +04:00
|
|
|
assert useKerberos -> kerberos != null;
|
2010-12-06 21:59:07 +03:00
|
|
|
|
2008-01-28 22:46:27 +03:00
|
|
|
stdenv.mkDerivation rec {
|
2015-02-23 18:55:34 +03:00
|
|
|
name = "samba-3.6.25";
|
2007-05-28 19:40:17 +04:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-02-09 00:29:27 +03:00
|
|
|
url = "mirror://samba/pub/samba/stable/${name}.tar.gz";
|
2015-02-23 18:55:34 +03:00
|
|
|
sha256 = "0l9pz2m67vf398q3c2dwn8jwdxsjb20igncf4byhv6yq5dzqlb4g";
|
2007-05-28 19:40:17 +04:00
|
|
|
};
|
|
|
|
|
2016-09-28 21:23:11 +03:00
|
|
|
patches = [(fetchurl {
|
|
|
|
url = "https://download.samba.org/pub/samba/patches/security/"
|
|
|
|
+ "samba-3.6.25-security-2015-12-16.patch";
|
|
|
|
sha256 = "00dcjcn577825mfdwdp76jfy5kcrqw3s4d5c41gqdq5gfcdbmqdb";
|
|
|
|
})];
|
|
|
|
|
2011-04-14 11:25:06 +04:00
|
|
|
buildInputs = [ readline pam openldap popt iniparser libunwind fam acl cups ]
|
2010-04-28 13:39:01 +04:00
|
|
|
++ stdenv.lib.optional useKerberos kerberos;
|
2008-03-11 20:01:55 +03:00
|
|
|
|
2011-04-13 19:31:22 +04:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2011-11-30 02:54:00 +04:00
|
|
|
postPatch =
|
|
|
|
# XXX: Awful hack to allow cross-compilation.
|
|
|
|
'' sed -i source3/configure \
|
2012-10-11 14:02:46 +04:00
|
|
|
-e 's/^as_fn_error .. \("cannot run test program while cross compiling\)/$as_echo \1/g'
|
2012-02-23 04:01:24 +04:00
|
|
|
''; # "
|
2011-11-30 02:54:00 +04:00
|
|
|
|
|
|
|
preConfigure =
|
|
|
|
'' cd source3
|
|
|
|
export samba_cv_CC_NEGATIVE_ENUM_VALUES=yes
|
|
|
|
export libreplace_cv_HAVE_GETADDRINFO=yes
|
|
|
|
export ac_cv_file__proc_sys_kernel_core_pattern=no # XXX: true on Linux, false elsewhere
|
|
|
|
'';
|
2008-11-07 16:05:05 +03:00
|
|
|
|
2011-11-30 02:54:00 +04:00
|
|
|
configureFlags =
|
|
|
|
stdenv.lib.optionals (pam != null) [ "--with-pam" "--with-pam_smbpass" ]
|
|
|
|
++ [ "--with-aio-support"
|
|
|
|
"--disable-swat"
|
|
|
|
"--with-configdir=${configDir}"
|
|
|
|
"--with-fhs"
|
|
|
|
"--localstatedir=/var"
|
|
|
|
]
|
|
|
|
++ (stdenv.lib.optional winbind "--with-winbind")
|
2014-12-17 21:11:30 +03:00
|
|
|
++ (stdenv.lib.optional (stdenv.cc.libc != null) "--with-libiconv=${stdenv.cc.libc}");
|
2010-12-06 21:59:07 +03:00
|
|
|
|
|
|
|
# Need to use a DESTDIR because `make install' tries to write in /var and /etc.
|
|
|
|
installFlags = "DESTDIR=$(TMPDIR)/inst";
|
|
|
|
|
2011-08-11 00:19:36 +04:00
|
|
|
stripAllList = [ "bin" "sbin" ];
|
|
|
|
|
2010-12-06 21:59:07 +03:00
|
|
|
postInstall =
|
|
|
|
''
|
|
|
|
mkdir -p $out
|
|
|
|
mv $TMPDIR/inst/$out/* $out/
|
2012-10-09 17:49:51 +04:00
|
|
|
|
2014-05-30 13:15:15 +04:00
|
|
|
mkdir -p "$out/lib/pkgconfig"
|
|
|
|
cp pkgconfig/*.pc "$out/lib/pkgconfig"
|
|
|
|
|
2010-12-06 21:59:07 +03:00
|
|
|
mkdir -pv $out/lib/cups/backend
|
|
|
|
ln -sv ../../../bin/smbspool $out/lib/cups/backend/smb
|
2011-04-13 19:31:22 +04:00
|
|
|
mkdir -pv $out/etc/openldap/schema
|
|
|
|
cp ../examples/LDAP/samba.schema $out/etc/openldap/schema
|
2013-09-07 15:43:44 +04:00
|
|
|
|
|
|
|
# For nsswitch. Glibc >= 2.1 looks for libnss_<name>.so.2 (see man
|
|
|
|
# nsswitch.conf), so provide that too.
|
2013-08-25 20:41:35 +04:00
|
|
|
cp -v ../nsswitch/libnss_wins.so "$out/lib"
|
|
|
|
cp -v ../nsswitch/libnss_winbind.so "$out/lib"
|
2013-09-07 15:43:44 +04:00
|
|
|
(cd "$out/lib" && ln -s libnss_winbind.so libnss_winbind.so.2)
|
|
|
|
(cd "$out/lib" && ln -s libnss_wins.so libnss_wins.so.2)
|
2010-12-06 21:59:07 +03:00
|
|
|
'' # */
|
|
|
|
+ stdenv.lib.optionalString (configDir == "") "touch $out/lib/smb.conf";
|
2013-01-07 01:30:23 +04:00
|
|
|
|
2018-11-15 00:58:39 +03:00
|
|
|
meta = with stdenv.lib; {
|
2018-06-27 23:12:57 +03:00
|
|
|
homepage = https://www.samba.org/;
|
2013-01-07 01:30:23 +04:00
|
|
|
description = "The standard Windows interoperability suite of programs for Linux and Unix";
|
2018-11-15 00:58:39 +03:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl3;
|
2017-09-28 14:40:23 +03:00
|
|
|
knownVulnerabilities = [
|
|
|
|
"Numerous CVEs and no patches from upstream for 3.x since 2014."
|
|
|
|
];
|
2013-01-07 01:30:23 +04:00
|
|
|
};
|
2007-05-28 19:40:17 +04:00
|
|
|
}
|