@@ -938,327 +562,138 @@ END
&Header::openbox('100%', 'center', $Lang::tr{'shares'});
-my %shares = config("${General::swroot}/samba/shares");
-
-
-print <
-
-
-| $Lang::tr{'manage shares'} |
-| $Lang::tr{'sharename'} | $Lang::tr{'options'} |
+print <
+
+ | $Lang::tr{'sharename'} |
+ |
+
END
-;
-my @Shares = keys(%shares);
+my @shares = keys(%shares);
my $lines = 0;
my $col="";
-foreach my $shareentry (sort @Shares)
- {
+foreach my $shareentry (sort @shares) {
chomp $shareentry;
+
if ($lines % 2) {
- print "";
- $col="bgcolor='$color{'color20'}'";
+ $col = "bgcolor='$color{'color20'}'";
} else {
- print " ";
- $col="bgcolor='$color{'color22'}'";
+ $col = "bgcolor='$color{'color22'}'";
}
- print <$shareentry
- |
- |
+
+ print <
+ $shareentry |
+
+
+ |
+
+
+ |
+
END
;
- $lines++;
- }
-
-print <
-
-
-END
-;
-
-if ($sambasettings{'ACTION'} eq 'sharecaption')
- {
- print <
-
- | $Lang::tr{'caption'} |
-  | $Lang::tr{'add share'} |
-  | $Lang::tr{'edit share'} |
-  | $Lang::tr{'save config'} |
-  | $Lang::tr{'reset shares'} |
-  | $Lang::tr{'delete share'} |
-
-END
-;
- }
-
-if ($sambasettings{'ACTION'} eq 'shareadd' || $sambasettings{'ACTION'} eq 'optioncaption' )
- {
- print <
-
- | $Lang::tr{'add share'} |
- |
- $Lang::tr{'show share options'}
-  |
-
-
-
-END
-;
- }
-
-if ($sambasettings{'ACTION'} eq 'sharechange' || $sambasettings{'ACTION'} eq 'optioncaption2' )
- {
- my $shareoption = $shares{$sambasettings{'NAME'}};
- print <
-
- | $Lang::tr{'edit share'} |
- |
- $Lang::tr{'show share options'} |
- |
-
-
-
-END
-;
- }
-
-if ($sambasettings{'ACTION'} eq 'sharesresetyes')
- {
- system('/usr/local/bin/sambactrl smbsharesreset');
- my $shares = config("${General::swroot}/samba/shares");
- system("/usr/local/bin/sambactrl smbreload");
- }
-if ($sambasettings{'ACTION'} eq 'smbshareadd')
- {
- $shares{'xvx'}= "$sambasettings{'SHAREOPTION'}";
- save("shares");
- my $shares = config("${General::swroot}/samba/shares");
- }
-if ($sambasettings{'ACTION'} eq 'smbsharedel')
- {
- delete $shares{$sambasettings{'NAME'}};
- save("shares");
- my %shares = config("${General::swroot}/samba/shares");
- }
-if ($sambasettings{'ACTION'} eq 'smbsharechange')
- {
- $shares{$sambasettings{'NAME'}} = $sambasettings{'SHAREOPTION'};
- save("shares");
- my %shares = config("${General::swroot}/samba/shares");
- }
-
-&Header::closebox();
-
-############################################################################################################################
-################################################ Verwalten von Druckern ####################################################
-
-my %printer = config("${General::swroot}/samba/printer");
-
-if ( -e "/var/ipfire/cups/enable")
-{
-&Header::openbox('100%', 'center', $Lang::tr{'printer'});
-
-my @Printers = keys(%printer);
-print <
-
-
-| $Lang::tr{'manage printers'}
- | | $Lang::tr{'printername'} | $Lang::tr{'options'} |
-END
-;
-foreach my $printerentry (sort @Printers)
- {
- chomp $printerentry;
- print <$printerentry |
- |
- |
-END
-;
- }
-print <
-
-
-END
-;
-
-if ($sambasettings{'ACTION'} eq 'printeradd' || $sambasettings{'ACTION'} eq 'printercaption' )
- {
- print <
-
- | $Lang::tr{'add printer'} |
- |
- $Lang::tr{'show share options'}
-  |
-
-
-
-
-END
-;
- }
-
-if ($sambasettings{'ACTION'} eq 'printerchange' || $sambasettings{'ACTION'} eq 'printercaption2' )
- {
- my $printeroption = $printer{$sambasettings{'NAME'}};
- print <
-
- | $Lang::tr{'edit printer'} |
- |
- $Lang::tr{'show share options'} |
- |
-
-
-
-END
-;
- }
-
-if ($sambasettings{'ACTION'} eq 'smbprinteradd')
- {
- $printer{'xvx'}= "$sambasettings{'PRINTEROPTION'}";
- save("printer");
- my %printer = config("${General::swroot}/samba/printer");
- }
-
-if ($sambasettings{'ACTION'} eq 'smbprinterdel')
- {
- delete $printer{$sambasettings{'NAME'}};
- save("printer");
- my %printer = config("${General::swroot}/samba/printer");
- }
-
-if ($sambasettings{'ACTION'} eq 'smbprinterchange')
- {
- $printer{$sambasettings{'NAME'}} = $sambasettings{'PRINTEROPTION'};
- save("printer");
- my %printer = config("${General::swroot}/samba/printer");
- }
-
-&Header::closebox();
+ $lines++;
}
+print <
+
+
+
+
+END
+
+if ($sambasettings{'ACTION'} eq 'shareadd') {
+ print <
+
+
+END
+}
+
+if ($sambasettings{'ACTION'} eq 'sharechange') {
+ my $shareoption = $shares{$sambasettings{'NAME'}};
+
+ print <
+
+
+END
+}
+
+&Header::closebox();
+
############################################################################################################################
############################################### Anzeige des Sambastatus ####################################################
-&Header::openbox('100%', 'center', 'Status');
+&Header::openbox('100%', 'left', $Lang::tr{'status'});
-print <
-
-| $Lang::tr{'samba status'} |
-| $Status |
-
+my $status = qx(/usr/local/bin/sambactrl smbstatus);
+$status = &Header::cleanhtml($status);
+
+print <
+ $status
+
END
-;
+
&Header::closebox();
-############################################################################################################################
-############################################### Anzeige der Sambalogs ######################################################
-
-
-if ($sambasettings{'ACTION'} eq 'showlog')
-{
-$Log = qx(tail -n $sambasettings{'LOGLINES'} /var/log/samba/$sambasettings{'LOG'});
-$Log=~s/\n/ /g;
-}
-
-&Header::openbox('100%', 'center', $Lang::tr{'log'});
-
-print <
-
-
-END
-;
-&Header::closebox();
&Header::closebigbox();
&Header::closepage();
@@ -1306,27 +741,13 @@ my $smb = shift;
open (FILE, ">${General::swroot}/samba/$smb") or die "Can't $smb settings $!";
flock (FILE, 2);
-if ( $smb eq 'printer')
- {while (my ($name, $option) = each %printer){chomp $option;$option =~ s/\r\n/\n/gi;$option =~ s/^\n//gi;$option =~ s/^\r//gi;$option =~ s/^.\n//gi;$option =~ s/^.\r//gi;print FILE "$option\n";}}
-
if ( $smb eq 'shares')
{while (my ($name, $option) = each %shares){chomp $option;$option =~ s/\r\n/\n/gi;$option =~ s/^\n//gi;$option =~ s/^\r//gi;$option =~ s/^.\n//gi;$option =~ s/^.\r//gi;print FILE "$option\n";} }
close FILE;
-if ( -e "/var/ipfire/cups/enable")
- {
- if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdccups");}
- else {system("/usr/local/bin/sambactrl smbsafeconfcups");}
- }
-else
- {
- if ( $sambasettings{'SECURITY'} eq 'user' && $sambasettings{'DOMAINMASTER'} eq 'true' ){system("/usr/local/bin/sambactrl smbsafeconfpdc");}
- else{system("/usr/local/bin/sambactrl smbsafeconf");}
- }
-
+system("/usr/local/bin/sambactrl smbsafeconf");
system("/usr/local/bin/sambactrl smbreload");
-refreshpage();
}
sub isrunning
@@ -1363,6 +784,69 @@ sub isrunning
return $status;
}
+sub writeconfiguration() {
+ open (FILE, ">${General::swroot}/samba/global") or die "Can't save the global settings: $!";
+ flock (FILE, 2);
+
+ print FILE <. #
-# #
-###############################################################################
-
-use strict;
-# enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
-
-require '/var/ipfire/general-functions.pl';
-require "${General::swroot}/lang.pl";
-require "${General::swroot}/header.pl";
-
-&Header::showhttpheaders();
-&Header::openpagewithoutmenu('Samba', 1, '');
-&Header::openbigbox('100%', 'left', '', 'BigBox');
-&Header::openbox('100%', 'left', '', 'Sambahelp');
-
- print <
-
- | $Lang::tr{'caption'} |
- | $Lang::tr{'options'} | $Lang::tr{'meaning'} / $Lang::tr{'exampel'} |
- | comment | $Lang::tr{'comment'} |
- | comment = $Lang::tr{'my new share'} |
-
| |
- | path | $Lang::tr{'path to directory'} |
- | path = /tmp |
-
| |
- | writeable | $Lang::tr{'directory writeable'} |
- | writeable = yes |
-
| |
- | browseable | sichtbar in Verzeichnisliste |
- | browsable = yes |
-
| |
- | user | Besitzer der Freigabe |
- | user = samba |
-
| |
- | valid users | Liste der Zugriffsberechtigten |
- | valid users = samba, user1 |
-
| |
- | write list | $Lang::tr{'visible in browselist'} |
- | write list = samba |
-
| |
- | hosts allow | $Lang::tr{'host allow'} |
- | hosts allow = localhost 192.168.1.1 192.168.2.0/24 |
-
| |
- | hosts deny | $Lang::tr{'host deny'} |
- | hosts deny = 192.168.1.2 192.168.3.0/24 |
-
| |
- | read list | $Lang::tr{'read list'} |
- | read list = user1 |
-
| |
- | admin users | $Lang::tr{'admin users'} |
- | admin users = user1 |
-
| |
- | invalid users | $Lang::tr{'invalid users'} |
- | invalid users = user2 |
-
| |
- | force user | $Lang::tr{'force user'} |
- | force user = samba |
-
| |
- | directory mask | $Lang::tr{'directory mask'} |
- | directory mask = 0777 |
-
| |
- | create mask | U$Lang::tr{'create mask'} |
- | create mask = 0777 |
-
| |
- | guest ok | $Lang::tr{'guest ok'} |
- | guest ok = yes |
-
-END
-;
-
-&Header::closebox();
-&Header::closebigbox();
-&Header::closepage();
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index e632c9faa..0b4f098a7 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -756,6 +756,7 @@
'demon login script' => 'Demon login script',
'deprecated fs warn' => 'Deprecated filesystem! Newer kernel drop the support. Backup and reformat!',
'description' => 'Description',
+'desired' => 'Desired',
'dest ip and port' => 'Dest. IP: Port',
'destination' => 'Destination',
'destination ip' => 'Destination IP',
@@ -820,6 +821,7 @@
'dialup settings' => 'Dialup Settings',
'directory mask' => 'UNIX directory rights',
'directory writeable' => 'directory writeable',
+'disable' => 'Disable',
'disabled' => 'disabled',
'disconnect' => 'OVPN Stop / Disconnect',
'disconnected' => 'Disconnected',
@@ -988,6 +990,7 @@
'emerging rules' => 'Emergingthreats.net Community Rules',
'empty' => 'This field may be left blank',
'empty profile' => 'empty',
+'enable' => 'Enable',
'enable ignore filter' => 'Enable ignore filter',
'enable javascript' => 'Enable javascript',
'enable smt' => 'Enable Simultaneous Multi-Threading (SMT)',
@@ -1781,6 +1784,7 @@
'net traffic newversion' => 'New Net-Traffic version is available:',
'net-traffic configuration' => 'Net-Traffic Configuration',
'netbios name' => 'Netbios Name',
+'netbios nameserver daemon' => 'NetBIOS Nameserver Daemon',
'netmask' => 'Netmask',
'network' => 'Network',
'network added' => 'Custom network added',
@@ -1876,6 +1880,7 @@
'openvpn prefix remote subnet' => 'Using the prefix notation is not supported for the remote subnet. Please enter a subnet mask like 255.255.255.0.',
'openvpn server' => 'OpenVPN server',
'openvpn subnet is used' => 'The given subnet is used by another OpenVPN server.',
+'optional' => 'Optional',
'optional at cmd' => 'optional AT command',
'optional data' => '3. Optional Settings:',
'options' => 'Options',
@@ -2041,7 +2046,7 @@
'port' => 'Port',
'port forwarding configuration' => 'Port forwarding configuration',
'ports' => 'Ports',
-'portscans' => 'portscancs',
+'portscans' => 'Port Scans',
'pots' => 'Analog classic line',
'ppp setup' => 'PPP setup',
'pppoe' => 'PPPoE',
@@ -2145,6 +2150,7 @@
'reportlevel' => 'Reportlevel',
'request' => 'Request',
'requested data' => '1. Connection Settings:',
+'required' => 'Required',
'required field' => 'Required field',
'reserved dst port' => 'Destination port is reserved for IPFire use only:',
'reserved src port' => 'Source port is reserved for IPFire use only:',
@@ -2177,6 +2183,8 @@
'samba' => 'Samba',
'samba join a domain' => 'Join a domain',
'samba join domain' => 'Join domain',
+'samba server role member' => 'Domain Member',
+'samba server role standalone' => 'Standalone',
'samba status' => 'Samba Status',
'saturday' => 'Saturday',
'save' => 'Save',
@@ -2252,6 +2260,7 @@
'smart information' => 'S.M.A.R.T. information',
'smartwarn1' => 'Device:',
'smartwarn2' => 'reports S.M.A.R.T. error',
+'smb daemon' => 'SMB Daemon',
'smbreload' => 'Reload samba',
'smbrestart' => 'Restart samba',
'smbstart' => 'Start samba',
@@ -2825,6 +2834,7 @@
'used swap' => 'Used Swap',
'user' => 'User',
'user log' => 'user log',
+'user management' => 'User Management',
'user proxy logs' => 'user proxy log',
'username' => 'Username:',
'username not set' => 'Username not set.',
@@ -2898,6 +2908,7 @@
'weekly firewallhits' => 'weekly firewallhits',
'weeks' => 'Weeks',
'wildcards' => 'Wildcards',
+'winbind daemon' => 'Winbind Daemon',
'wins server' => 'Wins Server',
'wins support' => 'Wins Support',
'wireless' => 'Wireless',
diff --git a/lfs/borgbackup b/lfs/borgbackup
index 66e35c71a..aafef36d8 100644
--- a/lfs/borgbackup
+++ b/lfs/borgbackup
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = borgbackup
-PAK_VER = 7
+PAK_VER = 8
DEPS = python3-llfuse python3-msgpack
diff --git a/lfs/ca-certificates b/lfs/ca-certificates
index 96f778f93..4317657c6 100644
--- a/lfs/ca-certificates
+++ b/lfs/ca-certificates
@@ -24,7 +24,7 @@
include Config
-VER = 20200620
+VER = 20201023
THISAPP = ca-certificates
DIR_APP = $(DIR_SRC)/$(THISAPP)
diff --git a/lfs/freeradius b/lfs/freeradius
index b24d2884b..7f39ad8e1 100644
--- a/lfs/freeradius
+++ b/lfs/freeradius
@@ -32,9 +32,9 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = freeradius
-PAK_VER = 11
+PAK_VER = 12
-DEPS = samba
+DEPS = libtalloc
ifeq "$(BUILD_ARCH)" "armv5tel"
LDFLAGS += -latomic
diff --git a/lfs/knot b/lfs/knot
index 153a9841b..e1fb0fac7 100644
--- a/lfs/knot
+++ b/lfs/knot
@@ -24,7 +24,7 @@
include Config
-VER = 3.0.0
+VER = 3.0.1
THISAPP = knot-$(VER)
DL_FILE = $(THISAPP).tar.xz
@@ -40,7 +40,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = a49754adf3b76db78df678f2cb87fc54
+$(DL_FILE)_MD5 = 7dc32e034bab142c7a0fcf6d531ee881
install : $(TARGET)
diff --git a/lfs/libhtp b/lfs/libhtp
index 9cbc8480a..29f90b0b3 100644
--- a/lfs/libhtp
+++ b/lfs/libhtp
@@ -24,7 +24,7 @@
include Config
-VER = 0.5.33
+VER = 0.5.35
THISAPP = libhtp-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = d01e386d1d8f13774239e920fcf143da
+$(DL_FILE)_MD5 = 188ebe7e1804f8bfaf00db007736f3f6
install : $(TARGET)
diff --git a/lfs/libtalloc b/lfs/libtalloc
new file mode 100644
index 000000000..546524be5
--- /dev/null
+++ b/lfs/libtalloc
@@ -0,0 +1,84 @@
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007-2018 IPFire Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see . #
+# #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER = 2.3.1
+
+THISAPP = talloc-$(VER)
+DL_FILE = $(THISAPP).tar.gz
+DL_FROM = $(URL_IPFIRE)
+DIR_APP = $(DIR_SRC)/$(THISAPP)
+TARGET = $(DIR_INFO)/$(THISAPP)
+PROG = libtalloc
+PAK_VER = 1
+
+DEPS =
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = ce40593428c0de6b85946189dcc37b5e
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+dist:
+ $(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+ @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+ @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+ @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+ @$(PREBUILD)
+ @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+ cd $(DIR_APP) && ./configure --prefix=/usr --disable-python
+ cd $(DIR_APP) && make $(MAKETUNING)
+ cd $(DIR_APP) && make install
+ @rm -rf $(DIR_APP)
+ @$(POSTBUILD)
diff --git a/lfs/mtr b/lfs/mtr
index c812b6ff8..679e66fd4 100644
--- a/lfs/mtr
+++ b/lfs/mtr
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2019 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 0.93
+VER = 0.94
THISAPP = mtr-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = mtr
-PAK_VER = 4
+PAK_VER = 5
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = f68c397310ec2275736e2e19727c22c0
+$(DL_FILE)_MD5 = 3468a94927109981de49957d0cc6d50e
install : $(TARGET)
@@ -77,7 +77,6 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
- cd $(DIR_APP) && ./bootstrap.sh
cd $(DIR_APP) && ./configure --prefix=/usr
cd $(DIR_APP) && make $(MAKETUNING)
cd $(DIR_APP) && make install
diff --git a/lfs/nano b/lfs/nano
index c65a4e408..36a1e25d9 100644
--- a/lfs/nano
+++ b/lfs/nano
@@ -24,7 +24,7 @@
include Config
-VER = 5.2
+VER = 5.3
THISAPP = nano-$(VER)
DL_FILE = $(THISAPP).tar.xz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = nano
-PAK_VER = 32
+PAK_VER = 33
DEPS = ""
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 7bde1cb929be2a7596ff207afc68d218
+$(DL_FILE)_MD5 = 0ff50c2d3068c6ce9e77b1f6a485eb19
install : $(TARGET)
diff --git a/lfs/perl-Parse-Yapp b/lfs/perl-Parse-Yapp
new file mode 100644
index 000000000..e061b96a1
--- /dev/null
+++ b/lfs/perl-Parse-Yapp
@@ -0,0 +1,83 @@
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007-2020 IPFire Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see . #
+# #
+###############################################################################
+
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+VER = 1.21
+
+THISAPP = Parse-Yapp-$(VER)
+DL_FILE = ${THISAPP}.tar.gz
+DL_FROM = $(URL_IPFIRE)
+DIR_APP = $(DIR_SRC)/$(THISAPP)
+TARGET = $(DIR_INFO)/$(THISAPP)
+PROG = perl-Parse-Yapp
+DEPS =
+PAK_VER = 1
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = 69584d5b0f0304bb2a23cffcd982c5de
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+dist:
+ @$(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+ @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+ @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+ @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+ @$(PREBUILD)
+ @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+ cd $(DIR_APP) && perl Makefile.PL
+ cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE)
+ cd $(DIR_APP) && make install
+ @rm -rf $(DIR_APP)
+ @$(POSTBUILD)
diff --git a/lfs/python b/lfs/python
index c2638baec..5b386e298 100644
--- a/lfs/python
+++ b/lfs/python
@@ -26,7 +26,7 @@ include Config
# If you update this make sure that you also change the VER and PAK_VER of
# python-optional-src !
-VER = 2.7.17
+VER = 2.7.18
THISAPP = Python-$(VER)
DL_FILE = $(THISAPP).tar.xz
@@ -42,7 +42,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = b3b6d2c92f42a60667814358ab9f0cfd
+$(DL_FILE)_MD5 = fd6cc8ec0a78c44036f825e739f36e5a
install : $(TARGET)
diff --git a/lfs/python-optional-src b/lfs/python-optional-src
index 2439c4899..eef3872af 100644
--- a/lfs/python-optional-src
+++ b/lfs/python-optional-src
@@ -24,12 +24,12 @@
include Config
-VER = 2.7.17
+VER = 2.7.18
include python
PROG = python-optional-src
-PAK_VER = 6
+PAK_VER = 7
DEPS =
dist:
diff --git a/lfs/python3 b/lfs/python3
index 3d3a27861..14bdfa584 100644
--- a/lfs/python3
+++ b/lfs/python3
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 3.8.1
+VER = 3.8.2
THISAPP = Python-$(VER)
DL_FILE = $(THISAPP).tar.xz
@@ -60,7 +60,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = b3fb85fd479c0bf950c626ef80cacb57
+$(DL_FILE)_MD5 = e9d6ebc92183a177b8e8a58cad5b8d67
install : $(TARGET)
diff --git a/lfs/python3-botocore b/lfs/python3-botocore
index bfa51eaca..a3083b41a 100644
--- a/lfs/python3-botocore
+++ b/lfs/python3-botocore
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 1.10.76
+VER = 1.16.1
THISAPP = botocore-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-botocore
-PAK_VER = 2
+PAK_VER = 3
DEPS = python3-dateutil python3-jmespath
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = decef6de0649195cd6fa5647fdcaf4d6
+$(DL_FILE)_MD5 = 12a0d999c364985f1e21a36286c4ab57
install : $(TARGET)
diff --git a/lfs/python3-colorama b/lfs/python3-colorama
index e7bc004b1..3dcef17d2 100644
--- a/lfs/python3-colorama
+++ b/lfs/python3-colorama
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 0.3.9
+VER = 0.4.3
THISAPP = colorama-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-colorama
-PAK_VER = 2
+PAK_VER = 3
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 3a0e415259690f4dd7455c2683ee5850
+$(DL_FILE)_MD5 = 02daee502863d24112a8c05a5d69a612
install : $(TARGET)
diff --git a/lfs/python3-dateutil b/lfs/python3-dateutil
index 3ac80b60d..1d70ac1c2 100644
--- a/lfs/python3-dateutil
+++ b/lfs/python3-dateutil
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 2.7.3
+VER = 2.8.1
THISAPP = python-dateutil-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-dateutil
-PAK_VER = 2
+PAK_VER = 3
DEPS = python3-six
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 175b7c1a3cc0cb01151eced07c61c0b8
+$(DL_FILE)_MD5 = f2a1d4b680b297b367a974664ca3a4f6
install : $(TARGET)
diff --git a/lfs/python3-docutils b/lfs/python3-docutils
index d0c9518d3..a67a21dce 100644
--- a/lfs/python3-docutils
+++ b/lfs/python3-docutils
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 0.14
+VER = 0.16
THISAPP = docutils-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-docutils
-PAK_VER = 2
+PAK_VER = 3
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = c53768d63db3873b7d452833553469de
+$(DL_FILE)_MD5 = 44952782107930ddfcd37ae48eee0857
install : $(TARGET)
diff --git a/lfs/python3-jmespath b/lfs/python3-jmespath
index 4db53be67..d49a429a6 100644
--- a/lfs/python3-jmespath
+++ b/lfs/python3-jmespath
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,15 +24,15 @@
include Config
-VER = 0.9.3
+VER = 0.9.5
THISAPP = jmespath-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
-DIR_APP = $(DIR_SRC)/$(THISAPP)
+DIR_APP = $(DIR_SRC)/jmespath.py-$(VER)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-jmespath
-PAK_VER = 2
+PAK_VER = 3
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 37a906c06de62bed25ec5cf99cee04a6
+$(DL_FILE)_MD5 = 81edf8744cade9793164daff3bd16a65
install : $(TARGET)
diff --git a/lfs/python3-pyasn1 b/lfs/python3-pyasn1
index 1092395b5..f8ecfa1d8 100644
--- a/lfs/python3-pyasn1
+++ b/lfs/python3-pyasn1
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 0.4.4
+VER = 0.4.8
THISAPP = pyasn1-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-pyasn1
-PAK_VER = 2
+PAK_VER = 3
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 0d182b71e1f72fe147d7957bc90be7f2
+$(DL_FILE)_MD5 = d2a9b5dc2a245553adb8939bbb21ad55
install : $(TARGET)
diff --git a/lfs/python3-rsa b/lfs/python3-rsa
index c3d3a9d1e..79a835220 100644
--- a/lfs/python3-rsa
+++ b/lfs/python3-rsa
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,15 +24,15 @@
include Config
-VER = 3.4.2
+VER = 4.0
THISAPP = rsa-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
-DIR_APP = $(DIR_SRC)/$(THISAPP)
+DIR_APP = $(DIR_SRC)/python-rsa-version-$(VER)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-rsa
-PAK_VER = 2
+PAK_VER = 3
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = b315f47882c24030ee6b5aad628cccdb
+$(DL_FILE)_MD5 = 13a71a55588c97de45fb9887cae6da90
install : $(TARGET)
diff --git a/lfs/python3-s3transfer b/lfs/python3-s3transfer
index 04989b601..365200448 100644
--- a/lfs/python3-s3transfer
+++ b/lfs/python3-s3transfer
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 0.1.13
+VER = 0.3.3
THISAPP = s3transfer-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-s3transfer
-PAK_VER = 2
+PAK_VER = 3
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 7bad7a38ca2442d650455fadeb3578b0
+$(DL_FILE)_MD5 = 9f90989a42a0f02f388d15928aa96c5f
install : $(TARGET)
diff --git a/lfs/python3-six b/lfs/python3-six
index 9e1f721a9..9d467f273 100644
--- a/lfs/python3-six
+++ b/lfs/python3-six
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 1.11.0
+VER = 1.14.0
THISAPP = six-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = python3-six
-PAK_VER = 2
+PAK_VER = 3
DEPS =
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = d12789f9baf7e9fb2524c0c64f1773f8
+$(DL_FILE)_MD5 = 21674588a57e649d1a6d977ec3122140
install : $(TARGET)
diff --git a/lfs/samba b/lfs/samba
index aa6f1fd62..3a2a5bbd4 100644
--- a/lfs/samba
+++ b/lfs/samba
@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007-2018 IPFire Team #
+# Copyright (C) 2007-2020 IPFire Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -24,7 +24,7 @@
include Config
-VER = 3.6.25
+VER = 4.13.0
THISAPP = samba-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,9 +32,9 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = samba
-PAK_VER = 68
+PAK_VER = 72
-DEPS = cups krb5
+DEPS = avahi cups libtirpc krb5 perl-Parse-Yapp
###############################################################################
# Top-level Rules
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 76da2fa64edd94a0188531e7ecb27c4e
+$(DL_FILE)_MD5 = a7f5cccac09d638b3bd11204003b7e7b
install : $(TARGET)
@@ -77,134 +77,43 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
- $(UPDATE_AUTOMAKE)
-
- # Apply patches from RHEL6
- # Upstream patches
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_nbt_query_with_many_components.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_group_expansion_with_nss_templates.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_group_expansion_in_service_path.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_memleak_in_printer_list.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_lookups_with_one_way_trusts.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_setup_domain_child_logic.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_force_user_with_security_ads.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-add_timeout_option_to_smbclient.patch
- # Additional Red Hat patches
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.2.0pre1-pipedir.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.2.0pre1-grouppwd.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.2.5-inotify.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.5.11-idmapdebug.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.5.11-docs.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.5.11-nss_info_doc.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.5.11-wbinfo_manpage.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.5.12-dns.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.5.12-pam_radio_type.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.18-fix_net_ads_join_segfault.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.19-valid_users_doc.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.23-gecos.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.23-glusterfs.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.23-libsmbclient.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.23-fix_libads_krb5_ipv6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.26-smb2_case_sensitive.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_gecos_interactive.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_dropbox_share.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-add_spoolss_os_version.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-nt_printer_publish_guid.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_keytab_null_termination.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_printcap_cpu_utilization.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_smbclient_ntlmv2_auth.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_smb_conf_doc.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-bug-1117059.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-bug-1192211.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_usergroup_cache_lookup.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_force_user_winbind_default_domain.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_rpcclient_timeout_command.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_force_group.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_pam_winbind_parsing_segfault.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_mangling_hash_segfault.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-doc_netbios_name_length_limit.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_map_to_guest_bad_uid.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_security_server_share_access.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_stale_printer_entries_on_rename.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2015-5299-v3-6-bso11529.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2015-5296-v3-6-bso11536.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2015-5252-v3-6-bso11395.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2015-5330-v3-6-bso11599.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-net_ads_join_no_dns_updates.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-asserted_identity_sid-S-1-18-1.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2015-7560-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_symlink_verification.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-preparation-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2016-2110-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2016-2111-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2016-2112-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2016-2115-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2016-2118-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2015-5370-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_winbind_cache_memory_leak.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_memleak_winbind_cached_creds.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-idmap_ad_memleak.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-libsmb_fix_dfs_connections.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-2110-ntlmssp-session-setup-nas.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_rpc_query_user_list.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-nt_printer_unpublish_fix.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2016-2126-v3.6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2016-2125-v3.6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_member_auth_after_changed_secret.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-fix_dirsort_ea-support.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2017-7494-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/samba-3.6.99-winbind_fix_trusted_domain_handling.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2017-2619.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2017-12150-v3-6.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2017-12163.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/CVE-2017-15275.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/samba/doc-update.patch
-
- cd $(DIR_APP)/source3 && ./autogen.sh
- cd $(DIR_APP)/source3 && ./configure \
+ cd $(DIR_APP) && ./configure \
--prefix=/usr \
--libdir=/usr/lib/ \
--sysconfdir=/var/ipfire \
--localstatedir=/var \
+ --without-ad-dc \
--with-cachedir=/var/lib/samba \
--with-lockdir=/var/lib/samba \
--with-piddir=/var/run \
--with-ads \
--with-acl-support \
- --with-libsmbclient \
- --with-libsmbsharemodes \
--with-sendfile-support \
- --with-fhs \
--with-winbind \
- --disable-swat \
+ --enable-avahi \
--enable-cups \
- --disable-avahi \
+ --enable-fhs \
--with-syslog
- cd $(DIR_APP)/source3 && make $(MAKETUNING) idl_full
- cd $(DIR_APP)/source3 && make $(MAKETUNING) proto && make all $(MAKETUNING) $(EXTRA_MAKE)
- cd $(DIR_APP)/source3 && make install
- cd $(DIR_APP)/source3 && chmod -v 644 /usr/include/libsmbclient.h
- #cd $(DIR_APP)/source3 && install -v -m755 nsswitch/libnss_wins.so /lib
- #cd $(DIR_APP)/source3 && install -v -m755 nsswitch/libnss_winbind.so /lib
- #cd $(DIR_APP)/source3 && ln -v -sf libnss_winbind.so /lib/libnss_winbind.so.2
- #cd $(DIR_APP)/source3 && ln -v -sf libnss_wins.so /lib/libnss_wins.so.2
+ cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE)
+ cd $(DIR_APP) && make install
+
-mkdir -p /var/ipfire/samba
cd $(DIR_APP)/source3 && install -v -m644 ../examples/smb.conf.default /var/ipfire/samba
cp -vrf $(DIR_SRC)/config/samba/* /var/ipfire/samba/
chown nobody:nobody -R /var/ipfire/samba/
- cp -vfp /var/ipfire/samba/default.global /var/ipfire/samba/global
- cp -vfp /var/ipfire/samba/default.pdc /var/ipfire/samba/pdc
- cp -vfp /var/ipfire/samba/default.settings /var/ipfire/samba/settings
- cp -vfp /var/ipfire/samba/default.shares /var/ipfire/samba/shares
- cp -vfp /var/ipfire/samba/default.printer /var/ipfire/samba/printer
cat /var/ipfire/samba/global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf
- -mkdir -p /var/log/samba
+ rm -rf /var/lib/samba/private
+ ln -s /var/ipfire/samba/private /var/lib/samba/private
install -v -m 644 $(DIR_SRC)/config/backup/includes/samba /var/ipfire/backup/addons/includes/samba
-mkdir -p /var/lib/samba/winbindd_privileged
chmod 750 /var/lib/samba/winbindd_privileged
chgrp wbpriv /var/lib/samba/winbindd_privileged
+ # Create spool directory for print jobs
+ mkdir -p /var/spool/samba
+ chmod -v 1777 /var/spool/samba/
+
#install initscripts
$(call INSTALL_INITSCRIPT,samba)
diff --git a/lfs/suricata b/lfs/suricata
index 9369500ac..f981232a2 100644
--- a/lfs/suricata
+++ b/lfs/suricata
@@ -24,7 +24,7 @@
include Config
-VER = 5.0.3
+VER = 5.0.4
THISAPP = suricata-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = d302ae41735551e2e1198e965d452664
+$(DL_FILE)_MD5 = c08809d5641a790a95a56d4dc7eba2f2
install : $(TARGET)
diff --git a/lfs/tor b/lfs/tor
index 7525445f5..956458407 100644
--- a/lfs/tor
+++ b/lfs/tor
@@ -24,7 +24,7 @@
include Config
-VER = 0.4.3.6
+VER = 0.4.4.5
THISAPP = tor-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = tor
-PAK_VER = 52
+PAK_VER = 53
DEPS = libseccomp
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 78a733e2f528354c1706b143119579f6
+$(DL_FILE)_MD5 = b061b7c4ce6102fb7c800b73c8573388
install : $(TARGET)
diff --git a/lfs/unbound b/lfs/unbound
index 5ad3b4e60..5ffadff9b 100644
--- a/lfs/unbound
+++ b/lfs/unbound
@@ -24,7 +24,7 @@
include Config
-VER = 1.11.0
+VER = 1.12.0
THISAPP = unbound-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 528dcf9bb9aa693a14f9ad5bab417b85
+$(DL_FILE)_MD5 = eb03869cea5dd2b65e21ca068e78d6b0
install : $(TARGET)
diff --git a/lfs/wio b/lfs/wio
index e0dd53689..b4222f1b5 100644
--- a/lfs/wio
+++ b/lfs/wio
@@ -15,7 +15,7 @@ THISAPP = wio-$(VER)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = wio
-PAK_VER = 10
+PAK_VER = 11
###############################################################################
# Top-level Rules
diff --git a/lfs/yaml b/lfs/yaml
index 81cdd4fd1..c4d347e77 100644
--- a/lfs/yaml
+++ b/lfs/yaml
@@ -24,7 +24,7 @@
include Config
-VER = 0.2.1
+VER = 0.2.5
THISAPP = yaml-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = 72724b9736923c517e5a8fc6757ef03d
+$(DL_FILE)_MD5 = bb15429d8fb787e7d3f1c83ae129a999
install : $(TARGET)
diff --git a/make.sh b/make.sh
index 7b4ffc1f7..9ddfd4c07 100755
--- a/make.sh
+++ b/make.sh
@@ -26,7 +26,7 @@ NAME="IPFire" # Software name
SNAME="ipfire" # Short name
# If you update the version don't forget to update backupiso and add it to core update
VERSION="2.25" # Version number
-CORE="151" # Core Level (Filename)
+CORE="152" # Core Level (Filename)
SLOGAN="www.ipfire.org" # Software slogan
CONFIG_ROOT=/var/ipfire # Configuration rootdir
NICE=10 # Nice level
@@ -1296,6 +1296,7 @@ buildipfire() {
lfsmake2 perl-Device-SerialPort
lfsmake2 perl-Device-Modem
lfsmake2 perl-Apache-Htpasswd
+ lfsmake2 perl-Parse-Yapp
lfsmake2 gnupg
lfsmake2 hdparm
lfsmake2 sdparm
@@ -1402,6 +1403,7 @@ buildipfire() {
lfsmake2 hplip
lfsmake2 cifs-utils
lfsmake2 krb5
+ lfsmake2 rpcsvc-proto
lfsmake2 samba
lfsmake2 netatalk
lfsmake2 sudo
@@ -1438,7 +1440,6 @@ buildipfire() {
lfsmake2 rsync
lfsmake2 rpcbind
lfsmake2 keyutils
- lfsmake2 rpcsvc-proto
lfsmake2 libnfsidmap
lfsmake2 nfs
lfsmake2 gnu-netcat
@@ -1621,6 +1622,7 @@ buildipfire() {
lfsmake2 libpciaccess
lfsmake2 libyajl
lfsmake2 libvirt
+ lfsmake2 libtalloc
lfsmake2 freeradius
lfsmake2 perl-common-sense
lfsmake2 perl-inotify2
diff --git a/src/initscripts/helper/aws-setup b/src/initscripts/helper/aws-setup
index 9b67019d6..4867540bd 100644
--- a/src/initscripts/helper/aws-setup
+++ b/src/initscripts/helper/aws-setup
@@ -146,12 +146,10 @@ import_aws_configuration() {
local prefix="${subnet#*/}"
local netmask="$(prefix2netmask "${prefix}")"
- local netmask_num="$(to_integer "${netmask}")"
# Calculate the network and broadcast addresses
local netaddress="${subnet%/*}"
local netaddress_num="$(to_integer "${netaddress}")"
- local broadcast="$(to_address $(( ipv4_address_num | (0xffffffff ^ netmask_num) )))"
case "${device_number}" in
# RED
@@ -169,7 +167,6 @@ import_aws_configuration() {
echo "RED_ADDRESS=${ipv4_address}"
echo "RED_NETMASK=${netmask}"
echo "RED_NETADDRESS=${netaddress}"
- echo "RED_BROADCAST=${broadcast}"
echo "RED_MTU=1500"
echo "DEFAULT_GATEWAY=${gateway}"
) >> /var/ipfire/ethernet/settings
@@ -191,7 +188,6 @@ import_aws_configuration() {
echo "GREEN_ADDRESS=${ipv4_address}"
echo "GREEN_NETMASK=${netmask}"
echo "GREEN_NETADDRESS=${netaddress}"
- echo "GREEN_BROADCAST=${broadcast}"
echo "GREEN_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
@@ -208,7 +204,6 @@ import_aws_configuration() {
echo "ORANGE_ADDRESS=${ipv4_address}"
echo "ORANGE_NETMASK=${netmask}"
echo "ORANGE_NETADDRESS=${netaddress}"
- echo "ORANGE_BROADCAST=${broadcast}"
echo "ORANGE_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
diff --git a/src/initscripts/helper/azure-setup b/src/initscripts/helper/azure-setup
index 291b8e0a4..5157712fc 100644
--- a/src/initscripts/helper/azure-setup
+++ b/src/initscripts/helper/azure-setup
@@ -160,12 +160,10 @@ import_azure_configuration() {
local ipv4_address_num="$(to_integer "${ipv4_address}")"
local prefix="$(get "network/interface/${device_number}/ipv4/subnet/0/prefix")"
local netmask="$(prefix2netmask "${prefix}")"
- local netmask_num="$(to_integer "${netmask}")"
- # Calculate the network and broadcast addresses
+ # Get the network address
local netaddress="$(get "network/interface/${device_number}/ipv4/subnet/0/address")"
local netaddress_num="$(to_integer "${netaddress}")"
- local broadcast="$(to_address $(( ipv4_address_num | (0xffffffff ^ netmask_num) )))"
case "${device_number}" in
# RED
@@ -183,7 +181,6 @@ import_azure_configuration() {
echo "RED_ADDRESS=${ipv4_address}"
echo "RED_NETMASK=${netmask}"
echo "RED_NETADDRESS=${netaddress}"
- echo "RED_BROADCAST=${broadcast}"
echo "DEFAULT_GATEWAY=${gateway}"
) >> /var/ipfire/ethernet/settings
@@ -213,7 +210,6 @@ import_azure_configuration() {
echo "GREEN_ADDRESS=${ipv4_address}"
echo "GREEN_NETMASK=${netmask}"
echo "GREEN_NETADDRESS=${netaddress}"
- echo "GREEN_BROADCAST=${broadcast}"
) >> /var/ipfire/ethernet/settings
;;
@@ -229,7 +225,6 @@ import_azure_configuration() {
echo "ORANGE_ADDRESS=${ipv4_address}"
echo "ORANGE_NETMASK=${netmask}"
echo "ORANGE_NETADDRESS=${netaddress}"
- echo "ORANGE_BROADCAST=${broadcast}"
) >> /var/ipfire/ethernet/settings
;;
esac
diff --git a/src/initscripts/helper/exoscale-setup b/src/initscripts/helper/exoscale-setup
index 24e98d38b..2ff8a18a2 100644
--- a/src/initscripts/helper/exoscale-setup
+++ b/src/initscripts/helper/exoscale-setup
@@ -122,7 +122,6 @@ import_exoscale_configuration() {
GREEN_ADDRESS="10.0.0.1"
GREEN_NETMASK="255.255.255.0"
GREEN_NETADDRESS="10.0.0.0"
- GREEN_BROADCAST="10.0.0.255"
fi
(
@@ -132,7 +131,6 @@ import_exoscale_configuration() {
echo "GREEN_ADDRESS=${GREEN_ADDRESS}"
echo "GREEN_NETMASK=${GREEN_NETMASK}"
echo "GREEN_NETADDRESS=${GREEN_NETADDRESS}"
- echo "GREEN_BROADCAST=${GREEN_BROADCAST}"
echo "GREEN_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
@@ -146,7 +144,6 @@ import_exoscale_configuration() {
ORANGE_ADDRESS="10.0.1.1"
ORANGE_NETMASK="255.255.255.0"
ORANGE_NETADDRESS="10.0.1.0"
- ORANGE_BROADCAST="10.0.1.255"
fi
(
@@ -156,7 +153,6 @@ import_exoscale_configuration() {
echo "ORANGE_ADDRESS=${ORANGE_ADDRESS}"
echo "ORANGE_NETMASK=${ORANGE_NETMASK}"
echo "ORANGE_NETADDRESS=${ORANGE_NETADDRESS}"
- echo "ORANGE_BROADCAST=${ORANGE_BROADCAST}"
echo "ORANGE_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
diff --git a/src/initscripts/helper/gcp-setup b/src/initscripts/helper/gcp-setup
index eab09eb2c..8868750db 100644
--- a/src/initscripts/helper/gcp-setup
+++ b/src/initscripts/helper/gcp-setup
@@ -142,7 +142,6 @@ import_gcp_configuration() {
# Calculate the network and broadcast addresses
local netaddress="$(to_address $(( ipv4_address_num & netmask_num )))"
- local broadcast="$(to_address $(( ipv4_address_num | (0xffffffff ^ netmask_num) )))"
case "${device_number}" in
# RED
@@ -158,7 +157,6 @@ import_gcp_configuration() {
echo "RED_ADDRESS=${ipv4_address}"
echo "RED_NETMASK=${netmask}"
echo "RED_NETADDRESS=${netaddress}"
- echo "RED_BROADCAST=${broadcast}"
echo "RED_MTU=${DEFAULT_MTU}"
echo "DEFAULT_GATEWAY=${gateway}"
) >> /var/ipfire/ethernet/settings
@@ -180,7 +178,6 @@ import_gcp_configuration() {
echo "GREEN_ADDRESS=${ipv4_address}"
echo "GREEN_NETMASK=${netmask}"
echo "GREEN_NETADDRESS=${netaddress}"
- echo "GREEN_BROADCAST=${broadcast}"
echo "GREEN_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
@@ -197,7 +194,6 @@ import_gcp_configuration() {
echo "ORANGE_ADDRESS=${ipv4_address}"
echo "ORANGE_NETMASK=${netmask}"
echo "ORANGE_NETADDRESS=${netaddress}"
- echo "ORANGE_BROADCAST=${broadcast}"
echo "ORANGE_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
diff --git a/src/initscripts/helper/oci-setup b/src/initscripts/helper/oci-setup
index aca09e673..0763a96e7 100644
--- a/src/initscripts/helper/oci-setup
+++ b/src/initscripts/helper/oci-setup
@@ -147,11 +147,9 @@ import_oci_configuration() {
local prefix="${subnet#*/}"
local netmask="$(prefix2netmask "${prefix}")"
- local netmask_num="$(to_integer "${netmask}")"
# Calculate the network and broadcast addresses
local netaddress="${subnet%/*}"
- local broadcast="$(to_address $(( ipv4_address_num | (0xffffffff ^ netmask_num) )))"
local index="$(oci_get_interface_param "${id}" "nicIndex")"
@@ -174,7 +172,6 @@ import_oci_configuration() {
echo "RED_ADDRESS=${ipv4_address}"
echo "RED_NETMASK=${netmask}"
echo "RED_NETADDRESS=${netaddress}"
- echo "RED_BROADCAST=${broadcast}"
echo "RED_MTU=1500"
echo "DEFAULT_GATEWAY=${gateway}"
) >> /var/ipfire/ethernet/settings
@@ -196,7 +193,6 @@ import_oci_configuration() {
echo "GREEN_ADDRESS=${ipv4_address}"
echo "GREEN_NETMASK=${netmask}"
echo "GREEN_NETADDRESS=${netaddress}"
- echo "GREEN_BROADCAST=${broadcast}"
echo "GREEN_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
@@ -213,7 +209,6 @@ import_oci_configuration() {
echo "ORANGE_ADDRESS=${ipv4_address}"
echo "ORANGE_NETMASK=${netmask}"
echo "ORANGE_NETADDRESS=${netaddress}"
- echo "ORANGE_BROADCAST=${broadcast}"
echo "ORANGE_MTU=${DEFAULT_MTU}"
) >> /var/ipfire/ethernet/settings
;;
diff --git a/src/initscripts/networking/any b/src/initscripts/networking/any
index 0cf107f48..7ca1ab2c3 100644
--- a/src/initscripts/networking/any
+++ b/src/initscripts/networking/any
@@ -22,7 +22,6 @@ eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
if [ "$(basename $0)" == "green" ]; then
DEVICE="${GREEN_DEV}"
ADDRESS="${GREEN_ADDRESS}"
- BROADCAST="${GREEN_BROADCAST}"
NETADDRESS="${GREEN_NETADDRESS}"
NETMASK="${GREEN_NETMASK}"
DEVICE="${GREEN_DEV}"
@@ -30,7 +29,6 @@ if [ "$(basename $0)" == "green" ]; then
elif [ "$(basename $0)" == "blue" ]; then
DEVICE="${BLUE_DEV}"
ADDRESS="${BLUE_ADDRESS}"
- BROADCAST="${BLUE_BROADCAST}"
NETADDRESS="${BLUE_NETADDRESS}"
NETMASK="${BLUE_NETMASK}"
DEVICE="${BLUE_DEV}"
@@ -38,22 +36,15 @@ elif [ "$(basename $0)" == "blue" ]; then
elif [ "$(basename $0)" == "orange" ]; then
DEVICE="${ORANGE_DEV}"
ADDRESS="${ORANGE_ADDRESS}"
- BROADCAST="${ORANGE_BROADCAST}"
NETADDRESS="${ORANGE_NETADDRESS}"
NETMASK="${ORANGE_NETMASK}"
DEVICE="${ORANGE_DEV}"
MTU="${ORANGE_MTU}"
fi
-if [ -z "${BROADCAST}" ]; then
- boot_mesg "BROADCAST variable missing from input, cannot continue." ${FAILURE}
- echo_failure
- exit 1
-fi
-
if [ -n "${ADDRESS}" -a -n "${NETMASK}" ]; then
PREFIX=`whatmask ${NETMASK} | grep -e ^CIDR | awk -F': ' '{ print $2 }' | cut -c 2-`
- args="${args} ${ADDRESS}/${PREFIX} broadcast ${BROADCAST}"
+ args="${args} ${ADDRESS}/${PREFIX}"
else
boot_mesg "ADDRESS and/or NETMASK variable missing from input, cannot continue." ${FAILURE}
echo_failure
diff --git a/src/initscripts/networking/red b/src/initscripts/networking/red
index 44e0daa68..ca0a8ae58 100644
--- a/src/initscripts/networking/red
+++ b/src/initscripts/networking/red
@@ -51,13 +51,11 @@ fi
if [ "${TYPE}" == "STATIC" ]; then
if [ "${DEVICE}" != "${GREEN_DEV}" ]; then
ADDRESS="${RED_ADDRESS}"
- BROADCAST="${RED_BROADCAST}"
NETADDRESS="${RED_NETADDRESS}"
NETMASK="${RED_NETMASK}"
MTU="${RED_MTU}"
else
ADDRESS="${GREEN_ADDRESS}"
- BROADCAST="${GREEN_BROADCAST}"
NETADDRESS="${GREEN_NETADDRESS}"
NETMASK="${GREEN_NETMASK}"
MTU="${GREEN_MTU}"
@@ -66,14 +64,9 @@ if [ "${TYPE}" == "STATIC" ]; then
# DNS1
# DNS2
- if [ -z "${BROADCAST}" ]; then
- boot_mesg "BROADCAST variable missing, cannot continue." ${FAILURE}
- echo_failure
- exit 1
- fi
if [ -n "${ADDRESS}" -a -n "${NETMASK}" ]; then
PREFIX=`whatmask ${NETMASK} | grep -e ^CIDR | awk -F': ' '{ print $2 }' | cut -c 2-`
- args="${args} ${ADDRESS}/${PREFIX} broadcast ${BROADCAST}"
+ args="${args} ${ADDRESS}/${PREFIX}"
else
boot_mesg "ADDRESS and/or NETMASK variable missing from input, cannot continue." ${FAILURE}
echo_failure
diff --git a/src/initscripts/packages/samba b/src/initscripts/packages/samba
index 614c9b834..2aab39977 100644
--- a/src/initscripts/packages/samba
+++ b/src/initscripts/packages/samba
@@ -9,9 +9,10 @@
function fix_permissions() {
local lockdir="/var/lib/samba/winbindd_privileged"
-
chmod 750 "${lockdir}"
chgrp wbpriv "${lockdir}"
+
+ mkdir -p /var/run/samba/{nmbd,ncalrpc,winbindd}
}
case "$1" in
diff --git a/src/misc-progs/sambactrl.c b/src/misc-progs/sambactrl.c
index 45c166d46..91761a422 100644
--- a/src/misc-progs/sambactrl.c
+++ b/src/misc-progs/sambactrl.c
@@ -37,29 +37,9 @@ int main(int argc, char *argv[]) {
} else if (strcmp(argv[1], "smbsafeconf") == 0) {
safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
- } else if (strcmp(argv[1], "smbsafeconfcups") == 0) {
- safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
-
} else if (strcmp(argv[1], "smbsafeconfpdc") == 0) {
safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
- } else if (strcmp(argv[1], "smbsafeconfpdccups") == 0) {
- safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/pdc /var/ipfire/samba/shares /var/ipfire/samba/printer > /var/ipfire/samba/smb.conf");
-
- } else if (strcmp(argv[1], "smbglobalreset") == 0) {
- safe_system("/bin/cat /var/ipfire/samba/default.global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf");
- safe_system("/bin/cat /var/ipfire/samba/default.settings > /var/ipfire/samba/settings");
- safe_system("/bin/cat /var/ipfire/samba/default.global > /var/ipfire/samba/global");
- safe_system("/bin/cat /var/ipfire/samba/default.pdc > /var/ipfire/samba/pdc");
-
- } else if (strcmp(argv[1], "smbsharesreset") == 0) {
- safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/default.shares > /var/ipfire/samba/smb.conf");
- safe_system("/bin/cat /var/ipfire/samba/default.shares > /var/ipfire/samba/shares");
-
- } else if (strcmp(argv[1], "smbprinterreset") == 0) {
- safe_system("/bin/cat /var/ipfire/samba/global /var/ipfire/samba/shares /var/default.printer > /var/ipfire/samba/smb.conf");
- safe_system("/bin/cat /var/ipfire/samba/default.printer > /var/ipfire/samba/printer");
-
} else if (strcmp(argv[1], "smbstop") == 0) {
safe_system("/etc/rc.d/init.d/samba stop >/dev/null");
safe_system("/usr/local/bin/sambactrl disable");
@@ -91,16 +71,6 @@ int main(int argc, char *argv[]) {
snprintf(command, BUFFER_SIZE-1, "/usr/bin/printf '%s\n%s\n' | /usr/bin/smbpasswd -as %s >/dev/null", argv[3], argv[3], argv[2]);
safe_system(command);
- } else if (strcmp(argv[1], "smbpcadd") == 0) {
- snprintf(command, BUFFER_SIZE-1, "/usr/sbin/groupadd sambawks >/dev/null");
- safe_system(command);
-
- snprintf(command, BUFFER_SIZE-1, "/usr/sbin/useradd -c 'Samba Workstation' -g %s -s %s %s >/dev/null", argv[3], argv[4], argv[2]);
- safe_system(command);
-
- snprintf(command, BUFFER_SIZE-1, "/usr/bin/smbpasswd -a -m %s >/dev/null", argv[2]);
- safe_system(command);
-
} else if (strcmp(argv[1], "smbchangepw") == 0) {
snprintf(command, BUFFER_SIZE-1, "echo %s:%s | chpasswd", argv[2], argv[3]);
safe_system(command);
diff --git a/src/misc-progs/setaliases.c b/src/misc-progs/setaliases.c
index 93af1cb0a..10ffd438d 100644
--- a/src/misc-progs/setaliases.c
+++ b/src/misc-progs/setaliases.c
@@ -39,7 +39,6 @@ int main(void)
char s[STRING_SIZE];
char command[STRING_SIZE];
char red_netmask[STRING_SIZE];
- char red_broadcast[STRING_SIZE];
char red_dev[STRING_SIZE];
char default_gateway[STRING_SIZE];
char *aliasip;
@@ -94,7 +93,7 @@ int main(void)
exit(0);
/* Get the RED interface details */
- if((!findkey(kv, "RED_NETMASK", red_netmask)) || (!findkey(kv, "RED_BROADCAST", red_broadcast)) ||
+ if((!findkey(kv, "RED_NETMASK", red_netmask)) ||
(!findkey(kv, "RED_DEV", red_dev)) || (!findkey(kv, "DEFAULT_GATEWAY", default_gateway)))
{
fprintf(stderr, "Cannot read RED settings\n");
@@ -113,12 +112,6 @@ int main(void)
exit(1);
}
- if (!VALID_IP(red_broadcast))
- {
- fprintf(stderr, "Bad red_broadcast : %s\n", red_broadcast);
- exit(1);
- }
-
if (!VALID_IP(default_gateway))
{
fprintf(stderr, "Bad default_gateway : %s\n", default_gateway);
@@ -184,8 +177,8 @@ int main(void)
memset(command, 0, STRING_SIZE);
snprintf(command, STRING_SIZE-1,
- "/sbin/ifconfig %s:%d %s netmask %s broadcast %s up",
- red_dev, alias, aliasip, red_netmask, red_broadcast);
+ "/sbin/ifconfig %s:%d %s netmask %s up",
+ red_dev, alias, aliasip, red_netmask);
safe_system(command);
memset(command, 0, STRING_SIZE);
snprintf(command, STRING_SIZE-1,
diff --git a/src/paks/samba/install.sh b/src/paks/samba/install.sh
index b7a2fc1cc..06a5b0358 100644
--- a/src/paks/samba/install.sh
+++ b/src/paks/samba/install.sh
@@ -32,4 +32,16 @@ fi
extract_files
restore_backup ${NAME}
+
+# Migrate SECURITY to ROLE
+sed -i /var/ipfire/samba/settings \
+ -e "s/^SECURITY=ADS/ROLE=member/" \
+ -e "s/^SECURITY=server/ROLE=standalone/" \
+ -e "s/^SECURITY=share/ROLE=standalone/" \
+ -e "s/^SECURITY=user/ROLE=standalone/"
+
+# Rewrite configuration files
+sudo -u nobody /srv/web/ipfire/cgi-bin/samba.cgi
+
+# Start the service
/usr/local/bin/sambactrl smbstart
diff --git a/src/paks/samba/update.sh b/src/paks/samba/update.sh
index 648b025b7..99776659c 100644
--- a/src/paks/samba/update.sh
+++ b/src/paks/samba/update.sh
@@ -17,21 +17,11 @@
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
-# Copyright (C) 2010 IPFire-Team . #
+# Copyright (C) 2007-2020 IPFire-Team . #
# #
############################################################################
#
. /opt/pakfire/lib/functions.sh
+extract_backup_includes
./uninstall.sh
-
-# If the wbpriv group does not exist yet, then create it and put squid
-# into it.
-if ! getent group wbpriv >/dev/null; then
- groupadd -g 88 wbpriv
- usermod -a -G wbpriv squid
-fi
-
-extract_files
-restore_backup ${NAME}
-echo "passdb backend = smbpasswd" >> /var/ipfire/samba/smb.conf
-/usr/local/bin/sambactrl smbstart
+./install.sh
diff --git a/src/patches/samba/CVE-2015-5252-v3-6-bso11395.patch b/src/patches/samba/CVE-2015-5252-v3-6-bso11395.patch
deleted file mode 100644
index b7580fba3..000000000
--- a/src/patches/samba/CVE-2015-5252-v3-6-bso11395.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 2e94b6ec10f1d15e24867bab3063bb85f173406a Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Thu, 9 Jul 2015 10:58:11 -0700
-Subject: [PATCH] CVE-2015-5252: s3: smbd: Fix symlink verification (file
- access outside the share).
-
-Ensure matching component ends in '/' or '\0'.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11395
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Volker Lendecke
----
- source3/smbd/vfs.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
-index 6c56964..bd93b7f 100644
---- a/source3/smbd/vfs.c
-+++ b/source3/smbd/vfs.c
-@@ -982,6 +982,7 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
- if (!allow_widelinks || !allow_symlinks) {
- const char *conn_rootdir;
- size_t rootdir_len;
-+ bool matched;
-
- conn_rootdir = SMB_VFS_CONNECTPATH(conn, fname);
- if (conn_rootdir == NULL) {
-@@ -992,8 +993,10 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
- }
-
- rootdir_len = strlen(conn_rootdir);
-- if (strncmp(conn_rootdir, resolved_name,
-- rootdir_len) != 0) {
-+ matched = (strncmp(conn_rootdir, resolved_name,
-+ rootdir_len) == 0);
-+ if (!matched || (resolved_name[rootdir_len] != '/' &&
-+ resolved_name[rootdir_len] != '\0')) {
- DEBUG(2, ("check_reduced_name: Bad access "
- "attempt: %s is a symlink outside the "
- "share path\n", fname));
---
-2.5.0
-
diff --git a/src/patches/samba/CVE-2015-5296-v3-6-bso11536.patch b/src/patches/samba/CVE-2015-5296-v3-6-bso11536.patch
deleted file mode 100644
index 4b722a56a..000000000
--- a/src/patches/samba/CVE-2015-5296-v3-6-bso11536.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 25139116756cc285a3a5534834cc276ef1b7baaa Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 30 Sep 2015 21:17:02 +0200
-Subject: [PATCH 1/2] CVE-2015-5296: s3:libsmb: force signing when requiring
- encryption in do_connect()
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11536
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Jeremy Allison
----
- source3/libsmb/clidfs.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
-index 23e1471..f153b6b 100644
---- a/source3/libsmb/clidfs.c
-+++ b/source3/libsmb/clidfs.c
-@@ -98,6 +98,11 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
- const char *username;
- const char *password;
- NTSTATUS status;
-+ int signing_state = get_cmdline_auth_info_signing_state(auth_info);
-+
-+ if (force_encrypt) {
-+ signing_state = Required;
-+ }
-
- /* make a copy so we don't modify the global string 'service' */
- servicename = talloc_strdup(ctx,share);
-@@ -132,7 +137,7 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
- zero_sockaddr(&ss);
-
- /* have to open a new connection */
-- c = cli_initialise_ex(get_cmdline_auth_info_signing_state(auth_info));
-+ c = cli_initialise_ex(signing_state);
- if (c == NULL) {
- d_printf("Connection to %s failed\n", server_n);
- return NULL;
---
-2.5.0
-
-
-From 060adb0abdeda51b8b622c6020b5dea0c8dde1cf Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 30 Sep 2015 21:17:02 +0200
-Subject: [PATCH 2/2] CVE-2015-5296: s3:libsmb: force signing when requiring
- encryption in SMBC_server_internal()
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11536
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Jeremy Allison
----
- source3/libsmb/libsmb_server.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
-index 45be660..167f2c9 100644
---- a/source3/libsmb/libsmb_server.c
-+++ b/source3/libsmb/libsmb_server.c
-@@ -258,6 +258,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
- const char *username_used;
- NTSTATUS status;
- char *newserver, *newshare;
-+ int signing_state = Undefined;
-
- zero_sockaddr(&ss);
- ZERO_STRUCT(c);
-@@ -404,8 +405,12 @@ again:
-
- zero_sockaddr(&ss);
-
-+ if (context->internal->smb_encryption_level != SMBC_ENCRYPTLEVEL_NONE) {
-+ signing_state = Required;
-+ }
-+
- /* have to open a new connection */
-- if ((c = cli_initialise()) == NULL) {
-+ if ((c = cli_initialise_ex(signing_state)) == NULL) {
- errno = ENOMEM;
- return NULL;
- }
-@@ -750,6 +755,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
- ipc_srv = SMBC_find_server(ctx, context, server, "*IPC$",
- pp_workgroup, pp_username, pp_password);
- if (!ipc_srv) {
-+ int signing_state = Undefined;
-
- /* We didn't find a cached connection. Get the password */
- if (!*pp_password || (*pp_password)[0] == '\0') {
-@@ -771,6 +777,9 @@ SMBC_attr_server(TALLOC_CTX *ctx,
- if (smbc_getOptionUseCCache(context)) {
- flags |= CLI_FULL_CONNECTION_USE_CCACHE;
- }
-+ if (context->internal->smb_encryption_level != SMBC_ENCRYPTLEVEL_NONE) {
-+ signing_state = Required;
-+ }
-
- zero_sockaddr(&ss);
- nt_status = cli_full_connection(&ipc_cli,
-@@ -780,7 +789,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
- *pp_workgroup,
- *pp_password,
- flags,
-- Undefined);
-+ signing_state);
- if (! NT_STATUS_IS_OK(nt_status)) {
- DEBUG(1,("cli_full_connection failed! (%s)\n",
- nt_errstr(nt_status)));
---
-2.5.0
-
diff --git a/src/patches/samba/CVE-2015-5299-v3-6-bso11529.patch b/src/patches/samba/CVE-2015-5299-v3-6-bso11529.patch
deleted file mode 100644
index 38936bb91..000000000
--- a/src/patches/samba/CVE-2015-5299-v3-6-bso11529.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From 8e49de7754f7171a58a1f94dee0f1138dbee3c60 Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Fri, 23 Oct 2015 14:54:31 -0700
-Subject: [PATCH] CVE-2015-5299: s3-shadow-copy2: fix missing access check on
- snapdir
-
-Fix originally from
-
-https://bugzilla.samba.org/show_bug.cgi?id=11529
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: David Disseldorp
----
- source3/modules/vfs_shadow_copy2.c | 47 ++++++++++++++++++++++++++++++++++++++
- 1 file changed, 47 insertions(+)
-
-diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
-index fedfb53..16c1ed7 100644
---- a/source3/modules/vfs_shadow_copy2.c
-+++ b/source3/modules/vfs_shadow_copy2.c
-@@ -21,6 +21,8 @@
-
- #include "includes.h"
- #include "smbd/smbd.h"
-+#include "smbd/globals.h"
-+#include "../libcli/security/security.h"
- #include "system/filesys.h"
- #include "ntioctl.h"
-
-@@ -764,6 +766,43 @@ static int shadow_copy2_mkdir(vfs_handle_struct *handle, const char *fname, mod
- SHADOW2_NEXT(MKDIR, (handle, name, mode), int, -1);
- }
-
-+static bool check_access_snapdir(struct vfs_handle_struct *handle,
-+ const char *path)
-+{
-+ struct smb_filename smb_fname;
-+ int ret;
-+ NTSTATUS status;
-+ uint32_t access_granted = 0;
-+
-+ ZERO_STRUCT(smb_fname);
-+ smb_fname.base_name = talloc_asprintf(talloc_tos(),
-+ "%s",
-+ path);
-+ if (smb_fname.base_name == NULL) {
-+ return false;
-+ }
-+
-+ ret = SMB_VFS_NEXT_STAT(handle, &smb_fname);
-+ if (ret != 0 || !S_ISDIR(smb_fname.st.st_ex_mode)) {
-+ TALLOC_FREE(smb_fname.base_name);
-+ return false;
-+ }
-+
-+ status = smbd_check_open_rights(handle->conn,
-+ &smb_fname,
-+ SEC_DIR_LIST,
-+ &access_granted);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ DEBUG(0,("user does not have list permission "
-+ "on snapdir %s\n",
-+ smb_fname.base_name));
-+ TALLOC_FREE(smb_fname.base_name);
-+ return false;
-+ }
-+ TALLOC_FREE(smb_fname.base_name);
-+ return true;
-+}
-+
- static int shadow_copy2_rmdir(vfs_handle_struct *handle, const char *fname)
- {
- SHADOW2_NEXT(RMDIR, (handle, name), int, -1);
-@@ -877,6 +916,7 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
- SMB_STRUCT_DIRENT *d;
- TALLOC_CTX *tmp_ctx = talloc_new(handle->data);
- char *snapshot;
-+ bool ret;
-
- snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
- if (snapdir == NULL) {
-@@ -886,6 +926,13 @@ static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
- talloc_free(tmp_ctx);
- return -1;
- }
-+ ret = check_access_snapdir(handle, snapdir);
-+ if (!ret) {
-+ DEBUG(0,("access denied on listing snapdir %s\n", snapdir));
-+ errno = EACCES;
-+ talloc_free(tmp_ctx);
-+ return -1;
-+ }
-
- p = SMB_VFS_NEXT_OPENDIR(handle, snapdir, NULL, 0);
-
---
-2.5.0
-
diff --git a/src/patches/samba/CVE-2015-5330-v3-6-bso11599.patch b/src/patches/samba/CVE-2015-5330-v3-6-bso11599.patch
deleted file mode 100644
index 4ae1473bc..000000000
--- a/src/patches/samba/CVE-2015-5330-v3-6-bso11599.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From a96c0528c68093d155b674269a9c8bf48315fc01 Mon Sep 17 00:00:00 2001
-From: Douglas Bagnall
-Date: Tue, 24 Nov 2015 13:47:16 +1300
-Subject: [PATCH 1/3] CVE-2015-5330: Fix handling of unicode near string
- endings
-
-Until now next_codepoint_ext() and next_codepoint_handle_ext() were
-using strnlen(str, 5) to determine how much string they should try to
-decode. This ended up looking past the end of the string when it was not
-null terminated and the final character looked like a multi-byte encoding.
-The fix is to let the caller say how long the string can be.
-
-Bug: https://bugzilla.samba.org/show_bug.cgi?id=11599
-
-Signed-off-by: Douglas Bagnall
-Pair-programmed-with: Andrew Bartlett
-Reviewed-by: Ralph Boehme
----
- lib/util/charset/charset.h | 9 +++++----
- lib/util/charset/codepoints.c | 19 +++++++++++++------
- lib/util/charset/util_unistr.c | 5 ++++-
- source3/lib/util_str.c | 2 +-
- 4 files changed, 23 insertions(+), 12 deletions(-)
-
-diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
-index 474d77e..b70aa61 100644
---- a/lib/util/charset/charset.h
-+++ b/lib/util/charset/charset.h
-@@ -175,15 +175,16 @@ smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic,
- charset_t from, charset_t to);
- const char *charset_name(struct smb_iconv_convenience *ic, charset_t ch);
-
--codepoint_t next_codepoint_ext(const char *str, charset_t src_charset,
-- size_t *size);
-+codepoint_t next_codepoint_ext(const char *str, size_t len,
-+ charset_t src_charset, size_t *size);
- codepoint_t next_codepoint(const char *str, size_t *size);
- ssize_t push_codepoint(char *str, codepoint_t c);
-
- /* codepoints */
- codepoint_t next_codepoint_convenience_ext(struct smb_iconv_convenience *ic,
-- const char *str, charset_t src_charset,
-- size_t *size);
-+ const char *str, size_t len,
-+ charset_t src_charset,
-+ size_t *size);
- codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic,
- const char *str, size_t *size);
- ssize_t push_codepoint_convenience(struct smb_iconv_convenience *ic,
-diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c
-index 5ee95a8..8dd647e 100644
---- a/lib/util/charset/codepoints.c
-+++ b/lib/util/charset/codepoints.c
-@@ -346,7 +346,8 @@ smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic,
- */
- _PUBLIC_ codepoint_t next_codepoint_convenience_ext(
- struct smb_iconv_convenience *ic,
-- const char *str, charset_t src_charset,
-+ const char *str, size_t len,
-+ charset_t src_charset,
- size_t *bytes_consumed)
- {
- /* it cannot occupy more than 4 bytes in UTF16 format */
-@@ -366,7 +367,7 @@ _PUBLIC_ codepoint_t next_codepoint_convenience_ext(
- * we assume that no multi-byte character can take more than 5 bytes.
- * This is OK as we only support codepoints up to 1M (U+100000)
- */
-- ilen_orig = strnlen(str, 5);
-+ ilen_orig = MIN(len, 5);
- ilen = ilen_orig;
-
- descriptor = get_conv_handle(ic, src_charset, CH_UTF16);
-@@ -424,7 +425,13 @@ _PUBLIC_ codepoint_t next_codepoint_convenience_ext(
- _PUBLIC_ codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic,
- const char *str, size_t *size)
- {
-- return next_codepoint_convenience_ext(ic, str, CH_UNIX, size);
-+ /*
-+ * We assume that no multi-byte character can take more than 5 bytes
-+ * thus avoiding walking all the way down a long string. This is OK as
-+ * Unicode codepoints only go up to (U+10ffff), which can always be
-+ * encoded in 4 bytes or less.
-+ */
-+ return next_codepoint_convenience_ext(ic, str, strnlen(str, 5), CH_UNIX, size);
- }
-
- /*
-@@ -486,10 +493,10 @@ _PUBLIC_ ssize_t push_codepoint_convenience(struct smb_iconv_convenience *ic,
- return 5 - olen;
- }
-
--_PUBLIC_ codepoint_t next_codepoint_ext(const char *str, charset_t src_charset,
-- size_t *size)
-+_PUBLIC_ codepoint_t next_codepoint_ext(const char *str, size_t len,
-+ charset_t src_charset, size_t *size)
- {
-- return next_codepoint_convenience_ext(get_iconv_convenience(), str,
-+ return next_codepoint_convenience_ext(get_iconv_convenience(), str, len,
- src_charset, size);
- }
-
-diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c
-index 760be77..d9e9b34 100644
---- a/lib/util/charset/util_unistr.c
-+++ b/lib/util/charset/util_unistr.c
-@@ -485,7 +485,10 @@ _PUBLIC_ char *strupper_talloc_n(TALLOC_CTX *ctx, const char *src, size_t n)
-
- while (n-- && *src) {
- size_t c_size;
-- codepoint_t c = next_codepoint_convenience(iconv_convenience, src, &c_size);
-+ codepoint_t c = next_codepoint_convenience_ext(iconv_convenience,
-+ src,
-+ n,
-+ &c_size);
- src += c_size;
-
- c = toupper_m(c);
-diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
-index 4701528..f8a5160 100644
---- a/source3/lib/util_str.c
-+++ b/source3/lib/util_str.c
-@@ -1486,7 +1486,7 @@ size_t strlen_m_ext(const char *s, const charset_t src_charset,
-
- while (*s) {
- size_t c_size;
-- codepoint_t c = next_codepoint_ext(s, src_charset, &c_size);
-+ codepoint_t c = next_codepoint_ext(s, strnlen(s, 5), src_charset, &c_size);
- s += c_size;
-
- switch (dst_charset) {
---
-2.5.0
-
-
-From 8298252a1ba9c014f7ceb76736abb38132181f79 Mon Sep 17 00:00:00 2001
-From: Douglas Bagnall
-Date: Tue, 24 Nov 2015 13:54:09 +1300
-Subject: [PATCH 2/3] CVE-2015-5330: next_codepoint_handle_ext: don't
- short-circuit UTF16 low bytes
-
-UTF16 contains zero bytes when it is encoding ASCII (for example), so we
-can't assume the absense of the 0x80 bit means a one byte encoding. No
-current callers use UTF16.
-
-Bug: https://bugzilla.samba.org/show_bug.cgi?id=11599
-
-Signed-off-by: Douglas Bagnall
-Pair-programmed-with: Andrew Bartlett
-Reviewed-by: Ralph Boehme
----
- lib/util/charset/codepoints.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c
-index 8dd647e..cf5f3e6 100644
---- a/lib/util/charset/codepoints.c
-+++ b/lib/util/charset/codepoints.c
-@@ -358,7 +358,10 @@ _PUBLIC_ codepoint_t next_codepoint_convenience_ext(
- size_t olen;
- char *outbuf;
-
-- if ((str[0] & 0x80) == 0) {
-+
-+ if (((str[0] & 0x80) == 0) && (src_charset == CH_DOS ||
-+ src_charset == CH_UNIX ||
-+ src_charset == CH_UTF8)) {
- *bytes_consumed = 1;
- return (codepoint_t)str[0];
- }
---
-2.5.0
-
-
-From 0988b7cb606a7e4cd73fd8db02806abbc9d8f2e0 Mon Sep 17 00:00:00 2001
-From: Douglas Bagnall
-Date: Tue, 24 Nov 2015 13:49:09 +1300
-Subject: [PATCH 3/3] CVE-2015-5330: strupper_talloc_n_handle(): properly count
- characters
-
-When a codepoint eats more than one byte we really want to know,
-especially if the string is not NUL terminated.
-
-Bug: https://bugzilla.samba.org/show_bug.cgi?id=11599
-
-Signed-off-by: Douglas Bagnall
-Pair-programmed-with: Andrew Bartlett
-Reviewed-by: Ralph Boehme
----
- lib/util/charset/util_unistr.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c
-index d9e9b34..6dad43f 100644
---- a/lib/util/charset/util_unistr.c
-+++ b/lib/util/charset/util_unistr.c
-@@ -483,13 +483,14 @@ _PUBLIC_ char *strupper_talloc_n(TALLOC_CTX *ctx, const char *src, size_t n)
- return NULL;
- }
-
-- while (n-- && *src) {
-+ while (n && *src) {
- size_t c_size;
- codepoint_t c = next_codepoint_convenience_ext(iconv_convenience,
- src,
- n,
- &c_size);
- src += c_size;
-+ n -= c_size;
-
- c = toupper_m(c);
-
---
-2.5.0
-
diff --git a/src/patches/samba/CVE-2015-5370-v3-6.patch b/src/patches/samba/CVE-2015-5370-v3-6.patch
deleted file mode 100644
index 7af1dd362..000000000
--- a/src/patches/samba/CVE-2015-5370-v3-6.patch
+++ /dev/null
@@ -1,3080 +0,0 @@
-From 8368c32cb69da82c8df36404ec8042c3046866ca Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Thu, 16 Jul 2015 22:46:05 +0200
-Subject: [PATCH 01/40] CVE-2015-5370: dcerpc.idl: add
- DCERPC_{NCACN_PAYLOAD,FRAG}_MAX_SIZE defines
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
----
- librpc/idl/dcerpc.idl | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl
-index 75ef2ec..bbb42d1 100644
---- a/librpc/idl/dcerpc.idl
-+++ b/librpc/idl/dcerpc.idl
-@@ -475,9 +475,11 @@ interface dcerpc
- const uint8 DCERPC_PFC_OFFSET = 3;
- const uint8 DCERPC_DREP_OFFSET = 4;
- const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
-+ const uint32 DCERPC_FRAG_MAX_SIZE = 5840;
- const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
- const uint8 DCERPC_CALL_ID_OFFSET = 12;
- const uint8 DCERPC_NCACN_PAYLOAD_OFFSET = 16;
-+ const uint32 DCERPC_NCACN_PAYLOAD_MAX_SIZE = 0x400000; /* 4 MByte */
-
- /* little-endian flag */
- const uint8 DCERPC_DREP_LE = 0x10;
---
-2.8.1
-
-
-From e3043ba5aafdb0605ab14b11917d497b59d82bec Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Sun, 28 Jun 2015 01:19:57 +0200
-Subject: [PATCH 02/40] CVE-2015-5370: librpc/rpc: simplify and harden
- dcerpc_pull_auth_trailer()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
----
- librpc/rpc/dcerpc_util.c | 63 ++++++++++++++++++++++++++++++++++++------------
- librpc/rpc/rpc_common.h | 4 +--
- 2 files changed, 49 insertions(+), 18 deletions(-)
-
-diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
-index 97ef798..f936ef4 100644
---- a/librpc/rpc/dcerpc_util.c
-+++ b/librpc/rpc/dcerpc_util.c
-@@ -92,31 +92,44 @@ uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob)
- *
- * @return - A NTSTATUS error code.
- */
--NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
-+NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
- TALLOC_CTX *mem_ctx,
-- DATA_BLOB *pkt_trailer,
-+ const DATA_BLOB *pkt_trailer,
- struct dcerpc_auth *auth,
-- uint32_t *auth_length,
-+ uint32_t *_auth_length,
- bool auth_data_only)
- {
- struct ndr_pull *ndr;
- enum ndr_err_code ndr_err;
-- uint32_t data_and_pad;
-+ uint16_t data_and_pad;
-+ uint16_t auth_length;
-+ uint32_t tmp_length;
-
-- data_and_pad = pkt_trailer->length
-- - (DCERPC_AUTH_TRAILER_LENGTH + pkt->auth_length);
-+ ZERO_STRUCTP(auth);
-+ if (_auth_length != NULL) {
-+ *_auth_length = 0;
-+ }
-
-- /* paranoia check for pad size. This would be caught anyway by
-- the ndr_pull_advance() a few lines down, but it scared
-- Jeremy enough for him to call me, so we might as well check
-- it now, just to prevent someone posting a bogus YouTube
-- video in the future.
-- */
-- if (data_and_pad > pkt_trailer->length) {
-- return NT_STATUS_INFO_LENGTH_MISMATCH;
-+ /* Paranoia checks for auth_length. The caller should check this... */
-+ if (pkt->auth_length > pkt->frag_length) {
-+ return NT_STATUS_INTERNAL_ERROR;
-+ }
-+ tmp_length = DCERPC_NCACN_PAYLOAD_OFFSET;
-+ tmp_length += DCERPC_AUTH_TRAILER_LENGTH;
-+ tmp_length += pkt->auth_length;
-+ if (tmp_length > pkt->frag_length) {
-+ return NT_STATUS_INTERNAL_ERROR;
-+ }
-+ if (pkt_trailer->length > UINT16_MAX) {
-+ return NT_STATUS_INTERNAL_ERROR;
- }
-
-- *auth_length = pkt_trailer->length - data_and_pad;
-+ auth_length = DCERPC_AUTH_TRAILER_LENGTH + pkt->auth_length;
-+ if (pkt_trailer->length < auth_length) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
-+ data_and_pad = pkt_trailer->length - auth_length;
-
- ndr = ndr_pull_init_blob(pkt_trailer, mem_ctx);
- if (!ndr) {
-@@ -136,14 +149,28 @@ NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
- ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(ndr);
-+ ZERO_STRUCTP(auth);
- return ndr_map_error2ntstatus(ndr_err);
- }
-
-+ if (data_and_pad < auth->auth_pad_length) {
-+ DEBUG(1, (__location__ ": ERROR: pad length mismatch. "
-+ "Calculated %u got %u\n",
-+ (unsigned)data_and_pad,
-+ (unsigned)auth->auth_pad_length));
-+ talloc_free(ndr);
-+ ZERO_STRUCTP(auth);
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
- if (auth_data_only && data_and_pad != auth->auth_pad_length) {
-- DEBUG(1, (__location__ ": WARNING: pad length mismatch. "
-+ DEBUG(1, (__location__ ": ERROR: pad length mismatch. "
- "Calculated %u got %u\n",
- (unsigned)data_and_pad,
- (unsigned)auth->auth_pad_length));
-+ talloc_free(ndr);
-+ ZERO_STRUCTP(auth);
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
- }
-
- DEBUG(6,(__location__ ": auth_pad_length %u\n",
-@@ -152,6 +179,10 @@ NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
- talloc_steal(mem_ctx, auth->credentials.data);
- talloc_free(ndr);
-
-+ if (_auth_length != NULL) {
-+ *_auth_length = auth_length;
-+ }
-+
- return NT_STATUS_OK;
- }
-
-diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h
-index fe8129d..98a2e95 100644
---- a/librpc/rpc/rpc_common.h
-+++ b/librpc/rpc/rpc_common.h
-@@ -158,9 +158,9 @@ uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
- *
- * @return - A NTSTATUS error code.
- */
--NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
-+NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
- TALLOC_CTX *mem_ctx,
-- DATA_BLOB *pkt_trailer,
-+ const DATA_BLOB *pkt_trailer,
- struct dcerpc_auth *auth,
- uint32_t *auth_length,
- bool auth_data_only);
---
-2.8.1
-
-
-From 397300d996299400842938131691fbbeb88c2c82 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Mon, 29 Jun 2015 10:24:45 +0200
-Subject: [PATCH 03/40] CVE-2015-5370: s3:librpc/rpc: don't call
- dcerpc_pull_auth_trailer() if auth_length is 0
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-All other paranoia checks are done within dcerpc_pull_auth_trailer()
-now.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
----
- source3/librpc/rpc/dcerpc_helpers.c | 12 ++----------
- 1 file changed, 2 insertions(+), 10 deletions(-)
-
-diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
-index 24f2f52..76f2acc 100644
---- a/source3/librpc/rpc/dcerpc_helpers.c
-+++ b/source3/librpc/rpc/dcerpc_helpers.c
-@@ -899,16 +899,8 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- return NT_STATUS_INVALID_PARAMETER;
- }
-
-- /* Paranioa checks for auth_length. */
-- if (pkt->auth_length > pkt->frag_length) {
-- return NT_STATUS_INFO_LENGTH_MISMATCH;
-- }
-- if (((unsigned int)pkt->auth_length
-- + DCERPC_AUTH_TRAILER_LENGTH < (unsigned int)pkt->auth_length) ||
-- ((unsigned int)pkt->auth_length
-- + DCERPC_AUTH_TRAILER_LENGTH < DCERPC_AUTH_TRAILER_LENGTH)) {
-- /* Integer wrap attempt. */
-- return NT_STATUS_INFO_LENGTH_MISMATCH;
-+ if (pkt->auth_length == 0) {
-+ return NT_STATUS_INVALID_PARAMETER;
- }
-
- status = dcerpc_pull_auth_trailer(pkt, pkt, pkt_trailer,
---
-2.8.1
-
-
-From faa20091b4a456a5e29f852561f6f5e9863860e0 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Fri, 26 Jun 2015 08:10:46 +0200
-Subject: [PATCH 04/40] CVE-2015-5370: librpc/rpc: add a
- dcerpc_verify_ncacn_packet_header() helper function
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 8266be48f455a5e541d0f7f62a1c8c38e0835976)
----
- librpc/rpc/dcerpc_util.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
- librpc/rpc/rpc_common.h | 5 ++++
- 2 files changed, 78 insertions(+)
-
-diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
-index f936ef4..2f599d5 100644
---- a/librpc/rpc/dcerpc_util.c
-+++ b/librpc/rpc/dcerpc_util.c
-@@ -186,6 +186,79 @@ NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
- return NT_STATUS_OK;
- }
-
-+/**
-+* @brief Verify the fields in ncacn_packet header.
-+*
-+* @param pkt - The ncacn_packet strcuture
-+* @param ptype - The expected PDU type
-+* @param max_auth_info - The maximum size of a possible auth trailer
-+* @param required_flags - The required flags for the pdu.
-+* @param optional_flags - The possible optional flags for the pdu.
-+*
-+* @return - A NTSTATUS error code.
-+*/
-+NTSTATUS dcerpc_verify_ncacn_packet_header(const struct ncacn_packet *pkt,
-+ enum dcerpc_pkt_type ptype,
-+ size_t max_auth_info,
-+ uint8_t required_flags,
-+ uint8_t optional_flags)
-+{
-+ if (pkt->rpc_vers != 5) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
-+ if (pkt->rpc_vers_minor != 0) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
-+ if (pkt->auth_length > pkt->frag_length) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
-+ if (pkt->ptype != ptype) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
-+ if (max_auth_info > UINT16_MAX) {
-+ return NT_STATUS_INTERNAL_ERROR;
-+ }
-+
-+ if (pkt->auth_length > 0) {
-+ size_t max_auth_length;
-+
-+ if (max_auth_info <= DCERPC_AUTH_TRAILER_LENGTH) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+ max_auth_length = max_auth_info - DCERPC_AUTH_TRAILER_LENGTH;
-+
-+ if (pkt->auth_length > max_auth_length) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+ }
-+
-+ if ((pkt->pfc_flags & required_flags) != required_flags) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+ if (pkt->pfc_flags & ~(optional_flags|required_flags)) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
-+ if (pkt->drep[0] & ~DCERPC_DREP_LE) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+ if (pkt->drep[1] != 0) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+ if (pkt->drep[2] != 0) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+ if (pkt->drep[3] != 0) {
-+ return NT_STATUS_RPC_PROTOCOL_ERROR;
-+ }
-+
-+ return NT_STATUS_OK;
-+}
-+
- struct dcerpc_read_ncacn_packet_state {
- #if 0
- struct {
-diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h
-index 98a2e95..b3ae5b2 100644
---- a/librpc/rpc/rpc_common.h
-+++ b/librpc/rpc/rpc_common.h
-@@ -164,6 +164,11 @@ NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
- struct dcerpc_auth *auth,
- uint32_t *auth_length,
- bool auth_data_only);
-+NTSTATUS dcerpc_verify_ncacn_packet_header(const struct ncacn_packet *pkt,
-+ enum dcerpc_pkt_type ptype,
-+ size_t max_auth_info,
-+ uint8_t required_flags,
-+ uint8_t optional_flags);
- struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct tstream_context *stream);
---
-2.8.1
-
-
-From c176174588c1119a11066b6188ac50cd3c9603f4 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 05/40] CVE-2015-5370: s3:rpc_client: move AS/U hack to the top
- of cli_pipe_validate_current_pdu()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 665b874b6022bfcdec3f13a9f5a844e5d1784aba)
----
- source3/rpc_client/cli_pipe.c | 24 +++++++++++++-----------
- 1 file changed, 13 insertions(+), 11 deletions(-)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 5ddabb7..295b88f 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -414,6 +414,19 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
- */
- *rdata = *pdu;
-
-+ if ((pkt->ptype == DCERPC_PKT_BIND_ACK) &&
-+ !(pkt->pfc_flags & DCERPC_PFC_FLAG_LAST)) {
-+ /*
-+ * TODO: do we still need this hack which was introduced
-+ * in commit a42afcdcc7ab9aa9ed193ae36d3dbb10843447f0.
-+ *
-+ * I don't even know what AS/U might be...
-+ */
-+ DEBUG(5, (__location__ ": bug in server (AS/U?), setting "
-+ "fragment first/last ON.\n"));
-+ pkt->pfc_flags |= DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST;
-+ }
-+
- /* Ensure we have the correct type. */
- switch (pkt->ptype) {
- case DCERPC_PKT_ALTER_RESP:
-@@ -518,17 +531,6 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
- return NT_STATUS_RPC_PROTOCOL_ERROR;
- }
-
-- /* Do this just before return - we don't want to modify any rpc header
-- data before now as we may have needed to do cryptographic actions on
-- it before. */
--
-- if ((pkt->ptype == DCERPC_PKT_BIND_ACK) &&
-- !(pkt->pfc_flags & DCERPC_PFC_FLAG_LAST)) {
-- DEBUG(5, (__location__ ": bug in server (AS/U?), setting "
-- "fragment first/last ON.\n"));
-- pkt->pfc_flags |= DCERPC_PFC_FLAG_FIRST | DCERPC_PFC_FLAG_LAST;
-- }
--
- return NT_STATUS_OK;
- }
-
---
-2.8.1
-
-
-From b9ae0068be4dfc6f7d09144c353689ab01955b93 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 06/40] CVE-2015-5370: s3:rpc_client: remove useless
- frag_length check in rpc_api_pipe_got_pdu()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-dcerpc_pull_ncacn_packet() already verifies this.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 9a3f045244b12ff9f77d2664396137c390042297)
----
- source3/rpc_client/cli_pipe.c | 8 --------
- 1 file changed, 8 deletions(-)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 295b88f..2787fbc 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -898,14 +898,6 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
- return;
- }
-
-- if (state->incoming_frag.length != state->pkt->frag_length) {
-- DEBUG(5, ("Incorrect pdu length %u, expected %u\n",
-- (unsigned int)state->incoming_frag.length,
-- (unsigned int)state->pkt->frag_length));
-- tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
-- return;
-- }
--
- status = cli_pipe_validate_current_pdu(state,
- state->cli, state->pkt,
- &state->incoming_frag,
---
-2.8.1
-
-
-From 05688274f03e6086e3ba4d7b4cb4409f9c4d9cb1 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Fri, 26 Jun 2015 08:10:46 +0200
-Subject: [PATCH 07/40] CVE-2015-5370: s4:rpc_server: no authentication is
- indicated by pkt->auth_length == 0
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-pkt->u.*.auth_info.length is not the correct thing to check.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(packported from commit c0236de09e542dbb168969d8ae9f0c150a75198e)
----
- source4/rpc_server/dcesrv_auth.c | 23 ++++++++++++++---------
- 1 file changed, 14 insertions(+), 9 deletions(-)
-
-diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c
-index 1e6aa24..61f2176 100644
---- a/source4/rpc_server/dcesrv_auth.c
-+++ b/source4/rpc_server/dcesrv_auth.c
-@@ -46,7 +46,7 @@ bool dcesrv_auth_bind(struct dcesrv_call_state *call)
- NTSTATUS status;
- uint32_t auth_length;
-
-- if (pkt->u.bind.auth_info.length == 0) {
-+ if (pkt->auth_length == 0) {
- dce_conn->auth_state.auth_info = NULL;
- return true;
- }
-@@ -108,7 +108,7 @@ NTSTATUS dcesrv_auth_bind_ack(struct dcesrv_call_state *call, struct ncacn_packe
- struct dcesrv_connection *dce_conn = call->conn;
- NTSTATUS status;
-
-- if (!call->conn->auth_state.gensec_security) {
-+ if (call->pkt.auth_length == 0) {
- return NT_STATUS_OK;
- }
-
-@@ -155,10 +155,16 @@ bool dcesrv_auth_auth3(struct dcesrv_call_state *call)
- NTSTATUS status;
- uint32_t auth_length;
-
-- /* We can't work without an existing gensec state, and an new blob to feed it */
-- if (!dce_conn->auth_state.auth_info ||
-- !dce_conn->auth_state.gensec_security ||
-- pkt->u.auth3.auth_info.length == 0) {
-+ if (pkt->auth_length == 0) {
-+ return false;
-+ }
-+
-+ if (!dce_conn->auth_state.auth_info) {
-+ return false;
-+ }
-+
-+ /* We can't work without an existing gensec state */
-+ if (!dce_conn->auth_state.gensec_security) {
- return false;
- }
-
-@@ -203,7 +209,7 @@ bool dcesrv_auth_alter(struct dcesrv_call_state *call)
- uint32_t auth_length;
-
- /* on a pure interface change there is no auth blob */
-- if (pkt->u.alter.auth_info.length == 0) {
-+ if (pkt->auth_length == 0) {
- return true;
- }
-
-@@ -238,8 +244,7 @@ NTSTATUS dcesrv_auth_alter_ack(struct dcesrv_call_state *call, struct ncacn_pack
-
- /* on a pure interface change there is no auth_info structure
- setup */
-- if (!call->conn->auth_state.auth_info ||
-- dce_conn->auth_state.auth_info->credentials.length == 0) {
-+ if (call->pkt.auth_length == 0) {
- return NT_STATUS_OK;
- }
-
---
-2.8.1
-
-
-From 57230961cee9e82ab060b54b5fb8c2b19f672111 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Sat, 27 Jun 2015 10:31:48 +0200
-Subject: [PATCH 08/40] CVE-2015-5370: s4:librpc/rpc: check pkt->auth_length
- before calling dcerpc_pull_auth_trailer
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Ralph Boehme
-(backported from 630dcb55ad7a3a89bcd8643c98a5cdbfb8735ef7)
----
- source4/librpc/rpc/dcerpc.c | 13 ++++++++++---
- source4/rpc_server/dcesrv_auth.c | 5 +++++
- 2 files changed, 15 insertions(+), 3 deletions(-)
-
-diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
-index 742d710..cfbccd6 100644
---- a/source4/librpc/rpc/dcerpc.c
-+++ b/source4/librpc/rpc/dcerpc.c
-@@ -701,6 +701,14 @@ static NTSTATUS ncacn_pull_request_auth(struct dcecli_connection *c, TALLOC_CTX
- return NT_STATUS_INVALID_LEVEL;
- }
-
-+ if (pkt->auth_length == 0) {
-+ return NT_STATUS_INVALID_NETWORK_RESPONSE;
-+ }
-+
-+ if (c->security_state.generic_state == NULL) {
-+ return NT_STATUS_INTERNAL_ERROR;
-+ }
-+
- status = dcerpc_pull_auth_trailer(pkt, mem_ctx,
- &pkt->u.response.stub_and_verifier,
- &auth, &auth_length, false);
-@@ -1074,7 +1082,7 @@ static void dcerpc_bind_recv_handler(struct rpc_request *req,
- }
-
- /* the bind_ack might contain a reply set of credentials */
-- if (conn->security_state.auth_info && pkt->u.bind_ack.auth_info.length) {
-+ if (conn->security_state.auth_info && pkt->auth_length) {
- NTSTATUS status;
- uint32_t auth_length;
- status = dcerpc_pull_auth_trailer(pkt, conn, &pkt->u.bind_ack.auth_info,
-@@ -1847,8 +1855,7 @@ static void dcerpc_alter_recv_handler(struct rpc_request *req,
- }
-
- /* the alter_resp might contain a reply set of credentials */
-- if (recv_pipe->conn->security_state.auth_info &&
-- pkt->u.alter_resp.auth_info.length) {
-+ if (recv_pipe->conn->security_state.auth_info && pkt->auth_length) {
- struct dcecli_connection *conn = recv_pipe->conn;
- NTSTATUS status;
- uint32_t auth_length;
-diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c
-index 61f2176..3051c1c 100644
---- a/source4/rpc_server/dcesrv_auth.c
-+++ b/source4/rpc_server/dcesrv_auth.c
-@@ -320,6 +320,11 @@ bool dcesrv_auth_request(struct dcesrv_call_state *call, DATA_BLOB *full_packet)
- return false;
- }
-
-+ if (pkt->auth_length == 0) {
-+ DEBUG(1,("dcesrv_auth_request: unexpected auth_length of 0\n"));
-+ return false;
-+ }
-+
- status = dcerpc_pull_auth_trailer(pkt, call,
- &pkt->u.request.stub_and_verifier,
- &auth, &auth_length, false);
---
-2.8.1
-
-
-From c35b0e37f7d37459f55d67a5037c08bea4d33acf Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Sun, 28 Jun 2015 01:19:57 +0200
-Subject: [PATCH 09/40] CVE-2015-5370: librpc/rpc: don't allow pkt->auth_length
- == 0 in dcerpc_pull_auth_trailer()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-All callers should have already checked that.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 1ed83c7657a3b405db1928db06c29f41d2738186)
----
- librpc/rpc/dcerpc_util.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
-index 2f599d5..89b7597 100644
---- a/librpc/rpc/dcerpc_util.c
-+++ b/librpc/rpc/dcerpc_util.c
-@@ -111,6 +111,11 @@ NTSTATUS dcerpc_pull_auth_trailer(const struct ncacn_packet *pkt,
- }
-
- /* Paranoia checks for auth_length. The caller should check this... */
-+ if (pkt->auth_length == 0) {
-+ return NT_STATUS_INTERNAL_ERROR;
-+ }
-+
-+ /* Paranoia checks for auth_length. The caller should check this... */
- if (pkt->auth_length > pkt->frag_length) {
- return NT_STATUS_INTERNAL_ERROR;
- }
---
-2.8.1
-
-
-From 2341eb0cf8395b1fed628ee6779207d916827a5d Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Thu, 9 Jul 2015 07:59:24 +0200
-Subject: [PATCH 10/40] CVE-2015-5370: s3:librpc/rpc: remove auth trailer and
- possible padding within dcerpc_check_auth()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This simplifies the callers a lot.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit df3cdf072d1c1e6fd0a58e0374348758f5c65a49)
----
- source3/librpc/rpc/dcerpc.h | 5 ++---
- source3/librpc/rpc/dcerpc_helpers.c | 31 ++++++++++++++++++++-----------
- source3/rpc_client/cli_pipe.c | 33 ++++++++++-----------------------
- source3/rpc_server/srv_pipe.c | 17 +----------------
- 4 files changed, 33 insertions(+), 53 deletions(-)
-
-diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
-index d14d8e0..e7cca9e 100644
---- a/source3/librpc/rpc/dcerpc.h
-+++ b/source3/librpc/rpc/dcerpc.h
-@@ -85,9 +85,8 @@ NTSTATUS dcerpc_add_auth_footer(struct pipe_auth_data *auth,
- NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- struct ncacn_packet *pkt,
- DATA_BLOB *pkt_trailer,
-- size_t header_size,
-- DATA_BLOB *raw_pkt,
-- size_t *pad_len);
-+ uint8_t header_size,
-+ DATA_BLOB *raw_pkt);
-
- /* The following definitions come from librpc/rpc/rpc_common.c */
-
-diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
-index 76f2acc..d871339 100644
---- a/source3/librpc/rpc/dcerpc_helpers.c
-+++ b/source3/librpc/rpc/dcerpc_helpers.c
-@@ -844,19 +844,18 @@ NTSTATUS dcerpc_add_auth_footer(struct pipe_auth_data *auth,
- *
- * @param auth The auth data for the connection
- * @param pkt The actual ncacn_packet
--* @param pkt_trailer The stub_and_verifier part of the packet
-+* @param pkt_trailer [in][out] The stub_and_verifier part of the packet,
-+* the auth_trailer and padding will be removed.
- * @param header_size The header size
- * @param raw_pkt The whole raw packet data blob
--* @param pad_len [out] The padding length used in the packet
- *
- * @return A NTSTATUS error code
- */
- NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- struct ncacn_packet *pkt,
- DATA_BLOB *pkt_trailer,
-- size_t header_size,
-- DATA_BLOB *raw_pkt,
-- size_t *pad_len)
-+ uint8_t header_size,
-+ DATA_BLOB *raw_pkt)
- {
- struct schannel_state *schannel_auth;
- struct auth_ntlmssp_state *ntlmssp_ctx;
-@@ -868,6 +867,14 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- DATA_BLOB full_pkt;
- DATA_BLOB data;
-
-+ /*
-+ * These check should be done in the caller.
-+ */
-+ SMB_ASSERT(raw_pkt->length == pkt->frag_length);
-+ SMB_ASSERT(header_size <= pkt->frag_length);
-+ SMB_ASSERT(pkt_trailer->length < pkt->frag_length);
-+ SMB_ASSERT((pkt_trailer->length + header_size) <= pkt->frag_length);
-+
- switch (auth->auth_level) {
- case DCERPC_AUTH_LEVEL_PRIVACY:
- DEBUG(10, ("Requested Privacy.\n"));
-@@ -881,7 +888,6 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- if (pkt->auth_length != 0) {
- break;
- }
-- *pad_len = 0;
- return NT_STATUS_OK;
-
- case DCERPC_AUTH_LEVEL_NONE:
-@@ -890,7 +896,6 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- "authenticated connection!\n"));
- return NT_STATUS_INVALID_PARAMETER;
- }
-- *pad_len = 0;
- return NT_STATUS_OK;
-
- default:
-@@ -909,10 +914,11 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- return status;
- }
-
-+ pkt_trailer->length -= auth_length;
- data = data_blob_const(raw_pkt->data + header_size,
-- pkt_trailer->length - auth_length);
-- full_pkt = data_blob_const(raw_pkt->data,
-- raw_pkt->length - auth_info.credentials.length);
-+ pkt_trailer->length);
-+ full_pkt = data_blob_const(raw_pkt->data, raw_pkt->length);
-+ full_pkt.length -= auth_info.credentials.length;
-
- switch (auth->auth_type) {
- case DCERPC_AUTH_TYPE_NONE:
-@@ -988,10 +994,13 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- * pkt_trailer actually has a copy of the raw data, and they
- * are still both used in later calls */
- if (auth->auth_level == DCERPC_AUTH_LEVEL_PRIVACY) {
-+ if (pkt_trailer->length != data.length) {
-+ return NT_STATUS_INVALID_PARAMETER;
-+ }
- memcpy(pkt_trailer->data, data.data, data.length);
- }
-
-- *pad_len = auth_info.auth_pad_length;
-+ pkt_trailer->length -= auth_info.auth_pad_length;
- data_blob_free(&auth_info.credentials);
- return NT_STATUS_OK;
- }
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 2787fbc..776e2bf 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -404,9 +404,9 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
- DATA_BLOB *rdata,
- DATA_BLOB *reply_pdu)
- {
-- struct dcerpc_response *r;
-+ const struct dcerpc_response *r = NULL;
-+ DATA_BLOB tmp_stub = data_blob_null;
- NTSTATUS ret = NT_STATUS_OK;
-- size_t pad_len = 0;
-
- /*
- * Point the return values at the real data including the RPC
-@@ -440,37 +440,24 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
-
- r = &pkt->u.response;
-
-+ tmp_stub.data = r->stub_and_verifier.data;
-+ tmp_stub.length = r->stub_and_verifier.length;
-+
- /* Here's where we deal with incoming sign/seal. */
- ret = dcerpc_check_auth(cli->auth, pkt,
-- &r->stub_and_verifier,
-+ &tmp_stub,
- DCERPC_RESPONSE_LENGTH,
-- pdu, &pad_len);
-+ pdu);
- if (!NT_STATUS_IS_OK(ret)) {
- return ret;
- }
-
-- if (pkt->frag_length < DCERPC_RESPONSE_LENGTH + pad_len) {
-- return NT_STATUS_BUFFER_TOO_SMALL;
-- }
--
- /* Point the return values at the NDR data. */
-- rdata->data = r->stub_and_verifier.data;
--
-- if (pkt->auth_length) {
-- /* We've already done integer wrap tests in
-- * dcerpc_check_auth(). */
-- rdata->length = r->stub_and_verifier.length
-- - pad_len
-- - DCERPC_AUTH_TRAILER_LENGTH
-- - pkt->auth_length;
-- } else {
-- rdata->length = r->stub_and_verifier.length;
-- }
-+ *rdata = tmp_stub;
-
-- DEBUG(10, ("Got pdu len %lu, data_len %lu, ss_len %u\n",
-+ DEBUG(10, ("Got pdu len %lu, data_len %lu\n",
- (long unsigned int)pdu->length,
-- (long unsigned int)rdata->length,
-- (unsigned int)pad_len));
-+ (long unsigned int)rdata->length));
-
- /*
- * If this is the first reply, and the allocation hint is
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 964b843..0ab7dc6 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1848,7 +1848,6 @@ static NTSTATUS dcesrv_auth_request(struct pipe_auth_data *auth,
- {
- NTSTATUS status;
- size_t hdr_size = DCERPC_REQUEST_LENGTH;
-- size_t pad_len;
-
- DEBUG(10, ("Checking request auth.\n"));
-
-@@ -1859,25 +1858,11 @@ static NTSTATUS dcesrv_auth_request(struct pipe_auth_data *auth,
- /* in case of sealing this function will unseal the data in place */
- status = dcerpc_check_auth(auth, pkt,
- &pkt->u.request.stub_and_verifier,
-- hdr_size, raw_pkt,
-- &pad_len);
-+ hdr_size, raw_pkt);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
--
-- /* remove padding and auth trailer,
-- * this way the caller will get just the data */
-- if (pkt->auth_length) {
-- size_t trail_len = pad_len
-- + DCERPC_AUTH_TRAILER_LENGTH
-- + pkt->auth_length;
-- if (pkt->u.request.stub_and_verifier.length < trail_len) {
-- return NT_STATUS_INFO_LENGTH_MISMATCH;
-- }
-- pkt->u.request.stub_and_verifier.length -= trail_len;
-- }
--
- return NT_STATUS_OK;
- }
-
---
-2.8.1
-
-
-From 9ecba8f4635aa5dbd42e4838ce124a92395b64ab Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Thu, 9 Jul 2015 07:59:24 +0200
-Subject: [PATCH 11/40] CVE-2015-5370: s3:librpc/rpc: let dcerpc_check_auth()
- auth_{type,level} against the expected values.
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 19f489d32c03ff5fafd34fe86a075d782af1989a)
----
- source3/librpc/rpc/dcerpc_helpers.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
-index d871339..c07835f 100644
---- a/source3/librpc/rpc/dcerpc_helpers.c
-+++ b/source3/librpc/rpc/dcerpc_helpers.c
-@@ -914,6 +914,14 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- return status;
- }
-
-+ if (auth_info.auth_type != auth->auth_type) {
-+ return NT_STATUS_INVALID_PARAMETER;
-+ }
-+
-+ if (auth_info.auth_level != auth->auth_level) {
-+ return NT_STATUS_INVALID_PARAMETER;
-+ }
-+
- pkt_trailer->length -= auth_length;
- data = data_blob_const(raw_pkt->data + header_size,
- pkt_trailer->length);
---
-2.8.1
-
-
-From 765c10dacf39a3c06c6b12651c205ac270e7fcea Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 12/40] CVE-2015-5370: s3:rpc_client: make use of
- dcerpc_pull_auth_trailer()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The does much more validation than dcerpc_pull_dcerpc_auth().
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit acea87f158f02c3240abff45c3e54c7d5fa60b29)
----
- source3/rpc_client/cli_pipe.c | 20 ++++++--------------
- 1 file changed, 6 insertions(+), 14 deletions(-)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 776e2bf..27e37f8 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -1938,20 +1938,15 @@ static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq)
- rpc_pipe_bind_step_two_trigger(req);
- return;
-
-- case DCERPC_AUTH_TYPE_NTLMSSP:
-- case DCERPC_AUTH_TYPE_SPNEGO:
-- case DCERPC_AUTH_TYPE_KRB5:
-- /* Paranoid lenght checks */
-- if (pkt->frag_length < DCERPC_AUTH_TRAILER_LENGTH
-- + pkt->auth_length) {
-- tevent_req_nterror(req,
-- NT_STATUS_INFO_LENGTH_MISMATCH);
-+ default:
-+ if (pkt->auth_length == 0) {
-+ tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
- return;
- }
- /* get auth credentials */
-- status = dcerpc_pull_dcerpc_auth(talloc_tos(),
-- &pkt->u.bind_ack.auth_info,
-- &auth, false);
-+ status = dcerpc_pull_auth_trailer(pkt, talloc_tos(),
-+ &pkt->u.bind_ack.auth_info,
-+ &auth, NULL, true);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to pull dcerpc auth: %s.\n",
- nt_errstr(status)));
-@@ -1959,9 +1954,6 @@ static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq)
- return;
- }
- break;
--
-- default:
-- goto err_out;
- }
-
- /*
---
-2.8.1
-
-
-From b58616bbcc810b076e5fd9dd976272847f832b06 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 13/40] CVE-2015-5370: s3:rpc_client: make use of
- dcerpc_verify_ncacn_packet_header() in cli_pipe_validate_current_pdu()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 81bbffa14f5f6faa9801a3bf2d564d2762d49bb6)
----
- source3/rpc_client/cli_pipe.c | 111 ++++++++++++++++++++++++++++++++++++------
- 1 file changed, 96 insertions(+), 15 deletions(-)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 27e37f8..6a22d38 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -429,17 +429,89 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
-
- /* Ensure we have the correct type. */
- switch (pkt->ptype) {
-- case DCERPC_PKT_ALTER_RESP:
-+ case DCERPC_PKT_BIND_NAK:
-+ DEBUG(1, (__location__ ": Bind NACK received from %s!\n",
-+ rpccli_pipe_txt(talloc_tos(), cli)));
-+
-+ ret = dcerpc_verify_ncacn_packet_header(pkt,
-+ DCERPC_PKT_BIND_NAK,
-+ 0, /* max_auth_info */
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST,
-+ 0); /* optional flags */
-+ if (!NT_STATUS_IS_OK(ret)) {
-+ DEBUG(1, (__location__ ": Connection to %s got an unexpected "
-+ "RPC packet type - %u, expected %u: %s\n",
-+ rpccli_pipe_txt(talloc_tos(), cli),
-+ pkt->ptype, expected_pkt_type,
-+ nt_errstr(ret)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ return ret;
-+ }
-+
-+ /* Use this for now... */
-+ return NT_STATUS_NETWORK_ACCESS_DENIED;
-+
- case DCERPC_PKT_BIND_ACK:
-+ ret = dcerpc_verify_ncacn_packet_header(pkt,
-+ expected_pkt_type,
-+ pkt->u.bind_ack.auth_info.length,
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST,
-+ DCERPC_PFC_FLAG_CONC_MPX |
-+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN);
-+ if (!NT_STATUS_IS_OK(ret)) {
-+ DEBUG(1, (__location__ ": Connection to %s got an unexpected "
-+ "RPC packet type - %u, expected %u: %s\n",
-+ rpccli_pipe_txt(talloc_tos(), cli),
-+ pkt->ptype, expected_pkt_type,
-+ nt_errstr(ret)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ return ret;
-+ }
-
-- /* Client code never receives this kind of packets */
- break;
-
-+ case DCERPC_PKT_ALTER_RESP:
-+ ret = dcerpc_verify_ncacn_packet_header(pkt,
-+ expected_pkt_type,
-+ pkt->u.alter_resp.auth_info.length,
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST,
-+ DCERPC_PFC_FLAG_CONC_MPX |
-+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN);
-+ if (!NT_STATUS_IS_OK(ret)) {
-+ DEBUG(1, (__location__ ": Connection to %s got an unexpected "
-+ "RPC packet type - %u, expected %u: %s\n",
-+ rpccli_pipe_txt(talloc_tos(), cli),
-+ pkt->ptype, expected_pkt_type,
-+ nt_errstr(ret)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ return ret;
-+ }
-+
-+ break;
-
- case DCERPC_PKT_RESPONSE:
-
- r = &pkt->u.response;
-
-+ ret = dcerpc_verify_ncacn_packet_header(pkt,
-+ expected_pkt_type,
-+ r->stub_and_verifier.length,
-+ 0, /* required_flags */
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST);
-+ if (!NT_STATUS_IS_OK(ret)) {
-+ DEBUG(1, (__location__ ": Connection to %s got an unexpected "
-+ "RPC packet type - %u, expected %u: %s\n",
-+ rpccli_pipe_txt(talloc_tos(), cli),
-+ pkt->ptype, expected_pkt_type,
-+ nt_errstr(ret)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ return ret;
-+ }
-+
- tmp_stub.data = r->stub_and_verifier.data;
- tmp_stub.length = r->stub_and_verifier.length;
-
-@@ -449,6 +521,12 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
- DCERPC_RESPONSE_LENGTH,
- pdu);
- if (!NT_STATUS_IS_OK(ret)) {
-+ DEBUG(1, (__location__ ": Connection to %s got an unexpected "
-+ "RPC packet type - %u, expected %u: %s\n",
-+ rpccli_pipe_txt(talloc_tos(), cli),
-+ pkt->ptype, expected_pkt_type,
-+ nt_errstr(ret)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
- return ret;
- }
-
-@@ -478,14 +556,24 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
-
- break;
-
-- case DCERPC_PKT_BIND_NAK:
-- DEBUG(1, (__location__ ": Bind NACK received from %s!\n",
-- rpccli_pipe_txt(talloc_tos(), cli)));
-- /* Use this for now... */
-- return NT_STATUS_NETWORK_ACCESS_DENIED;
--
- case DCERPC_PKT_FAULT:
-
-+ ret = dcerpc_verify_ncacn_packet_header(pkt,
-+ DCERPC_PKT_FAULT,
-+ 0, /* max_auth_info */
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST,
-+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE);
-+ if (!NT_STATUS_IS_OK(ret)) {
-+ DEBUG(1, (__location__ ": Connection to %s got an unexpected "
-+ "RPC packet type - %u, expected %u: %s\n",
-+ rpccli_pipe_txt(talloc_tos(), cli),
-+ pkt->ptype, expected_pkt_type,
-+ nt_errstr(ret)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ return ret;
-+ }
-+
- DEBUG(1, (__location__ ": RPC fault code %s received "
- "from %s!\n",
- dcerpc_errstr(talloc_tos(),
-@@ -502,13 +590,6 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
- return NT_STATUS_RPC_PROTOCOL_ERROR;
- }
-
-- if (pkt->ptype != expected_pkt_type) {
-- DEBUG(3, (__location__ ": Connection to %s got an unexpected "
-- "RPC packet type - %u, not %u\n",
-- rpccli_pipe_txt(talloc_tos(), cli),
-- pkt->ptype, expected_pkt_type));
-- return NT_STATUS_RPC_PROTOCOL_ERROR;
-- }
-
- if (pkt->call_id != call_id) {
- DEBUG(3, (__location__ ": Connection to %s got an unexpected "
---
-2.8.1
-
-
-From 3e03b1e6d5b20c14d53763f22442bf510a8d6dcd Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Fri, 10 Jul 2015 14:48:38 +0200
-Subject: [PATCH 14/40] CVE-2015-5370: s3:rpc_client: protect
- rpc_api_pipe_got_pdu() against too large payloads
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 98182969e761429e577064e1a0fd5cbc6b50d7d9)
----
- source3/rpc_client/cli_pipe.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 6a22d38..755b458 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -1007,6 +1007,11 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
- return;
- }
-
-+ if (state->reply_pdu_offset + rdata.length > MAX_RPC_DATA_SIZE) {
-+ tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
-+ return;
-+ }
-+
- /* Now copy the data portion out of the pdu into rbuf. */
- if (state->reply_pdu.length < state->reply_pdu_offset + rdata.length) {
- if (!data_blob_realloc(NULL, &state->reply_pdu,
---
-2.8.1
-
-
-From fa884c266be5d808d19955f92921417f435b2957 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 22:51:18 +0200
-Subject: [PATCH 15/40] CVE-2015-5370: s3:rpc_client: verify auth_{type,level}
- in rpc_pipe_bind_step_one_done()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit df51c22bea7fbf906613ceb160f16f298b2e3106)
----
- source3/rpc_client/cli_pipe.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 755b458..1c4ff01 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -2039,6 +2039,21 @@ static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq)
- tevent_req_nterror(req, status);
- return;
- }
-+
-+ if (auth.auth_type != pauth->auth_type) {
-+ DEBUG(0, (__location__ " Auth type %u mismatch expected %u.\n",
-+ auth.auth_type, pauth->auth_type));
-+ tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
-+ return;
-+ }
-+
-+ if (auth.auth_level != pauth->auth_level) {
-+ DEBUG(0, (__location__ " Auth level %u mismatch expected %u.\n",
-+ auth.auth_level, pauth->auth_level));
-+ tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
-+ return;
-+ }
-+
- break;
- }
-
---
-2.8.1
-
-
-From 6d2767ad8b084590c572e90d1985ca6d7d36b188 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 16/40] CVE-2015-5370: s3:rpc_server: make use of
- dcerpc_pull_auth_trailer() in api_pipe_{bind_req,alter_context,bind_auth3}()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 2a92546590a78760d2fe0e63067a3888dbce53be)
----
- source3/rpc_server/srv_pipe.c | 62 +++++++++----------------------------------
- 1 file changed, 13 insertions(+), 49 deletions(-)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 0ab7dc6..40b1b8e 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1012,25 +1012,12 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- * Check if this is an authenticated bind request.
- */
- if (pkt->auth_length) {
-- /* Quick length check. Won't catch a bad auth footer,
-- * prevents overrun. */
--
-- if (pkt->frag_length < RPC_HEADER_LEN +
-- DCERPC_AUTH_TRAILER_LENGTH +
-- pkt->auth_length) {
-- DEBUG(0,("api_pipe_bind_req: auth_len (%u) "
-- "too long for fragment %u.\n",
-- (unsigned int)pkt->auth_length,
-- (unsigned int)pkt->frag_length));
-- goto err_exit;
-- }
--
- /*
- * Decode the authentication verifier.
- */
-- status = dcerpc_pull_dcerpc_auth(pkt,
-- &pkt->u.bind.auth_info,
-- &auth_info, p->endian);
-+ status = dcerpc_pull_auth_trailer(pkt, pkt,
-+ &pkt->u.bind.auth_info,
-+ &auth_info, NULL, true);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Unable to unmarshall dcerpc_auth.\n"));
- goto err_exit;
-@@ -1233,23 +1220,13 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
- goto err;
- }
-
-- /* Ensure there's enough data for an authenticated request. */
-- if (pkt->frag_length < RPC_HEADER_LEN
-- + DCERPC_AUTH_TRAILER_LENGTH
-- + pkt->auth_length) {
-- DEBUG(0,("api_pipe_ntlmssp_auth_process: auth_len "
-- "%u is too large.\n",
-- (unsigned int)pkt->auth_length));
-- goto err;
-- }
--
- /*
- * Decode the authentication verifier response.
- */
-
-- status = dcerpc_pull_dcerpc_auth(pkt,
-- &pkt->u.auth3.auth_info,
-- &auth_info, p->endian);
-+ status = dcerpc_pull_auth_trailer(pkt, pkt,
-+ &pkt->u.auth3.auth_info,
-+ &auth_info, NULL, true);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to unmarshall dcerpc_auth.\n"));
- goto err;
-@@ -1382,34 +1359,21 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- * Check if this is an authenticated alter context request.
- */
- if (pkt->auth_length) {
-- /* Quick length check. Won't catch a bad auth footer,
-- * prevents overrun. */
--
-- if (pkt->frag_length < RPC_HEADER_LEN +
-- DCERPC_AUTH_TRAILER_LENGTH +
-- pkt->auth_length) {
-- DEBUG(0,("api_pipe_alter_context: auth_len (%u) "
-- "too long for fragment %u.\n",
-- (unsigned int)pkt->auth_length,
-- (unsigned int)pkt->frag_length ));
-+ /* We can only finish if the pipe is unbound for now */
-+ if (p->pipe_bound) {
-+ DEBUG(0, (__location__ ": Pipe already bound, "
-+ "Altering Context not yet supported!\n"));
- goto err_exit;
- }
-
-- status = dcerpc_pull_dcerpc_auth(pkt,
-- &pkt->u.bind.auth_info,
-- &auth_info, p->endian);
-+ status = dcerpc_pull_auth_trailer(pkt, pkt,
-+ &pkt->u.bind.auth_info,
-+ &auth_info, NULL, true);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Unable to unmarshall dcerpc_auth.\n"));
- goto err_exit;
- }
-
-- /* We can only finish if the pipe is unbound for now */
-- if (p->pipe_bound) {
-- DEBUG(0, (__location__ ": Pipe already bound, "
-- "Altering Context not yet supported!\n"));
-- goto err_exit;
-- }
--
- if (auth_info.auth_type != p->auth.auth_type) {
- DEBUG(0, ("Auth type mismatch! Client sent %d, "
- "but auth was started as type %d!\n",
---
-2.8.1
-
-
-From 7400ac11282d540d4f5f80d0f58ec99beabb7d8e Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 23 Dec 2015 12:38:55 +0100
-Subject: [PATCH 17/40] CVE-2015-5370: s3:rpc_server: let a failing
- sec_verification_trailer mark the connection as broken
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-(cherry picked from commit 189c0fbb7a3405f0893f23e5b8d755d259f98eaf)
----
- source3/rpc_server/srv_pipe.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 40b1b8e..da9b91c 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1663,6 +1663,7 @@ static bool api_pipe_request(struct pipes_struct *p,
-
- if (!srv_pipe_check_verification_trailer(p, pkt, pipe_fns)) {
- DEBUG(1, ("srv_pipe_check_verification_trailer: failed\n"));
-+ set_incoming_fault(p);
- setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_ACCESS_DENIED));
- data_blob_free(&p->out_data.rdata);
- TALLOC_FREE(frame);
---
-2.8.1
-
-
-From 55da4653f5986989e46be6320f96590f8ebb4ef7 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 18/40] CVE-2015-5370: s3:rpc_server: don't ignore failures of
- dcerpc_push_ncacn_packet()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 25bf597124f217c55b5ca71a5ea9cb0ea83943e5)
----
- source3/rpc_server/srv_pipe.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index da9b91c..71b4665 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1152,6 +1152,7 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to marshall bind_ack packet. (%s)\n",
- nt_errstr(status)));
-+ goto err_exit;
- }
-
- if (auth_resp.length) {
-@@ -1469,6 +1470,7 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Failed to marshall bind_ack packet. (%s)\n",
- nt_errstr(status)));
-+ goto err_exit;
- }
-
- if (auth_resp.length) {
---
-2.8.1
-
-
-From 893c840a1aac6711a081eb8e25f2c2a6078fc373 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 19/40] CVE-2015-5370: s3:rpc_server: don't allow auth3 if the
- authentication was already finished
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 69280e6acef7c3941407d4308b659c5e90ed702d)
----
- source3/rpc_server/srv_pipe.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 71b4665..4e5b50d4 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1216,8 +1216,15 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
-
- DEBUG(5, ("api_pipe_bind_auth3: decode request. %d\n", __LINE__));
-
-+ /* We can only finish if the pipe is unbound for now */
-+ if (p->pipe_bound) {
-+ DEBUG(0, (__location__ ": Pipe already bound, "
-+ "AUTH3 not supported!\n"));
-+ goto err;
-+ }
-+
- if (pkt->auth_length == 0) {
-- DEBUG(0, ("No auth field sent for bind request!\n"));
-+ DEBUG(1, ("No auth field sent for auth3 request!\n"));
- goto err;
- }
-
---
-2.8.1
-
-
-From a66baed0c65b7acb4d76ef9ea3ae1248a6b5773a Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 14 Jul 2015 16:18:45 +0200
-Subject: [PATCH 20/40] CVE-2015-5370: s3:rpc_server: let a failing auth3 mark
- the authentication as invalid
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 8c96ef7b4fbd925607b26d351b14ad9a95febd88)
----
- source3/rpc_server/srv_pipe.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 4e5b50d4..d28ba8e 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1304,7 +1304,7 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
- return true;
-
- err:
--
-+ p->pipe_bound = false;
- TALLOC_FREE(p->auth.auth_ctx);
- return false;
- }
---
-2.8.1
-
-
-From e47becdf2c03d68662ab998c4608adb371ca2f08 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 21/40] CVE-2015-5370: s3:rpc_server: make sure auth_level
- isn't changed by alter_context or auth3
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 63d21d2546a1064be73582a499ec15b0e11e2708)
----
- source3/rpc_server/srv_pipe.c | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index d28ba8e..1b81a4c 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1252,6 +1252,13 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
- goto err;
- }
-
-+ if (auth_info.auth_level != p->auth.auth_level) {
-+ DEBUG(1, ("Auth level mismatch! Client sent %d, "
-+ "but auth was started as level %d!\n",
-+ auth_info.auth_level, p->auth.auth_level));
-+ goto err;
-+ }
-+
- switch (auth_info.auth_type) {
- case DCERPC_AUTH_TYPE_NTLMSSP:
- ntlmssp_ctx = talloc_get_type_abort(p->auth.auth_ctx,
-@@ -1389,6 +1396,12 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- goto err_exit;
- }
-
-+ if (auth_info.auth_level != p->auth.auth_level) {
-+ DEBUG(0, ("Auth level mismatch! Client sent %d, "
-+ "but auth was started as level %d!\n",
-+ auth_info.auth_level, p->auth.auth_level));
-+ goto err_exit;
-+ }
-
- switch (auth_info.auth_type) {
- case DCERPC_AUTH_TYPE_SPNEGO:
---
-2.8.1
-
-
-From 687a4801391c946a62d07a7bdad096a97da0d432 Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 7 Jul 2015 09:15:39 +0200
-Subject: [PATCH 22/40] CVE-2015-5370: s3:rpc_server: ensure that the message
- ordering doesn't violate the spec
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The first pdu is always a BIND.
-
-REQUEST pdus are only allowed once the authentication
-is finished.
-
-A simple anonymous authentication is finished after the BIND.
-Real authentication may need additional ALTER or AUTH3 exchanges.
-
-Pair-Programmed-With: Stefan Metzmacher
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Jeremy Allison
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 0239bfa562ee303c4ac204375b3c66ca287f6cb0)
----
- source3/include/ntdomain.h | 7 ++++++
- source3/rpc_server/rpc_ncacn_np.c | 1 +
- source3/rpc_server/rpc_server.c | 1 +
- source3/rpc_server/srv_pipe.c | 51 ++++++++++++++++++++++++++++++++++-----
- 4 files changed, 54 insertions(+), 6 deletions(-)
-
-diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
-index 650f1d0..b3c5451 100644
---- a/source3/include/ntdomain.h
-+++ b/source3/include/ntdomain.h
-@@ -139,6 +139,13 @@ struct pipes_struct {
- bool pipe_bound;
-
- /*
-+ * States we can be in.
-+ */
-+ bool allow_alter;
-+ bool allow_bind;
-+ bool allow_auth3;
-+
-+ /*
- * Set the DCERPC_FAULT to return.
- */
-
-diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c
-index efdee27..f2e9d10 100644
---- a/source3/rpc_server/rpc_ncacn_np.c
-+++ b/source3/rpc_server/rpc_ncacn_np.c
-@@ -171,6 +171,7 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
-
- p->syntax = *syntax;
- p->transport = NCALRPC;
-+ p->allow_bind = true;
-
- DEBUG(4,("Created internal pipe %s (pipes_open=%d)\n",
- get_pipe_name_from_syntax(talloc_tos(), syntax), pipes_open));
-diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
-index 8ec55bb..376d26a 100644
---- a/source3/rpc_server/rpc_server.c
-+++ b/source3/rpc_server/rpc_server.c
-@@ -102,6 +102,7 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx,
- p->syntax = id;
- p->transport = transport;
- p->ncalrpc_as_system = ncalrpc_as_system;
-+ p->allow_bind = true;
-
- p->mem_ctx = talloc_named(p, 0, "pipe %s %p", pipe_name, p);
- if (!p->mem_ctx) {
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 1b81a4c..41111aa 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -279,6 +279,9 @@ static bool setup_bind_nak(struct pipes_struct *p, struct ncacn_packet *pkt)
- p->auth.auth_level = DCERPC_AUTH_LEVEL_NONE;
- p->auth.auth_type = DCERPC_AUTH_TYPE_NONE;
- p->pipe_bound = False;
-+ p->allow_bind = false;
-+ p->allow_alter = false;
-+ p->allow_auth3 = false;
-
- return True;
- }
-@@ -828,6 +831,11 @@ static NTSTATUS pipe_auth_verify_final(struct pipes_struct *p)
- void *mech_ctx;
- NTSTATUS status;
-
-+ if (p->auth.auth_type == DCERPC_AUTH_TYPE_NONE) {
-+ p->pipe_bound = true;
-+ return NT_STATUS_OK;
-+ }
-+
- switch (p->auth.auth_type) {
- case DCERPC_AUTH_TYPE_NTLMSSP:
- ntlmssp_ctx = talloc_get_type_abort(p->auth.auth_ctx,
-@@ -919,13 +927,11 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- DATA_BLOB auth_resp = data_blob_null;
- DATA_BLOB auth_blob = data_blob_null;
-
-- /* No rebinds on a bound pipe - use alter context. */
-- if (p->pipe_bound) {
-- DEBUG(2,("api_pipe_bind_req: rejecting bind request on bound "
-- "pipe %s.\n",
-- get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
-+ if (!p->allow_bind) {
-+ DEBUG(2,("Pipe not in allow bind state\n"));
- return setup_bind_nak(p, pkt);
- }
-+ p->allow_bind = false;
-
- if (pkt->u.bind.num_contexts == 0) {
- DEBUG(0, ("api_pipe_bind_req: no rpc contexts around\n"));
-@@ -1192,6 +1198,22 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- p->out_data.current_pdu_sent = 0;
-
- TALLOC_FREE(auth_blob.data);
-+
-+ if (bind_ack_ctx.result == 0) {
-+ p->allow_alter = true;
-+ p->allow_auth3 = true;
-+ if (p->auth.auth_type == DCERPC_AUTH_TYPE_NONE) {
-+ status = pipe_auth_verify_final(p);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ DEBUG(0, ("pipe_auth_verify_final failed: %s\n",
-+ nt_errstr(status)));
-+ goto err_exit;
-+ }
-+ }
-+ } else {
-+ goto err_exit;
-+ }
-+
- return True;
-
- err_exit:
-@@ -1216,6 +1238,11 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
-
- DEBUG(5, ("api_pipe_bind_auth3: decode request. %d\n", __LINE__));
-
-+ if (!p->allow_auth3) {
-+ DEBUG(1, ("Pipe not in allow auth3 state.\n"));
-+ goto err;
-+ }
-+
- /* We can only finish if the pipe is unbound for now */
- if (p->pipe_bound) {
- DEBUG(0, (__location__ ": Pipe already bound, "
-@@ -1312,6 +1339,10 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
-
- err:
- p->pipe_bound = false;
-+ p->allow_bind = false;
-+ p->allow_alter = false;
-+ p->allow_auth3 = false;
-+
- TALLOC_FREE(p->auth.auth_ctx);
- return false;
- }
-@@ -1338,6 +1369,11 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
-
- DEBUG(5,("api_pipe_alter_context: make response. %d\n", __LINE__));
-
-+ if (!p->allow_alter) {
-+ DEBUG(1, ("Pipe not in allow alter state.\n"));
-+ goto err_exit;
-+ }
-+
- if (pkt->u.bind.assoc_group_id != 0) {
- assoc_gid = pkt->u.bind.assoc_group_id;
- } else {
-@@ -1363,7 +1399,6 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- bind_ack_ctx.reason = 0;
- bind_ack_ctx.syntax = pkt->u.bind.ctx_list[0].transfer_syntaxes[0];
- } else {
-- p->pipe_bound = False;
- /* Rejection reason: abstract syntax not supported */
- bind_ack_ctx.result = DCERPC_BIND_PROVIDER_REJECT;
- bind_ack_ctx.reason = DCERPC_BIND_REASON_ASYNTAX;
-@@ -1826,6 +1861,10 @@ void set_incoming_fault(struct pipes_struct *p)
- p->in_data.pdu.length = 0;
- p->fault_state = DCERPC_FAULT_CANT_PERFORM;
-
-+ p->allow_alter = false;
-+ p->allow_auth3 = false;
-+ p->pipe_bound = false;
-+
- DEBUG(10, ("Setting fault state\n"));
- }
-
---
-2.8.1
-
-
-From 45701966d49ec1003f19c137a548c26915f75a99 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 16:06:59 +0200
-Subject: [PATCH 23/40] CVE-2015-5370: s3:rpc_server: use 'alter' instead of
- 'bind' for variables in api_pipe_alter_context()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit cdefee174d2f8920323e9e62966df4f4ced49ed3)
----
- source3/rpc_server/srv_pipe.c | 32 ++++++++++++++++----------------
- 1 file changed, 16 insertions(+), 16 deletions(-)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 41111aa..382d94a 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1359,7 +1359,7 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- uint16 assoc_gid;
- NTSTATUS status;
- union dcerpc_payload u;
-- struct dcerpc_ack_ctx bind_ack_ctx;
-+ struct dcerpc_ack_ctx alter_ack_ctx;
- DATA_BLOB auth_resp = data_blob_null;
- DATA_BLOB auth_blob = data_blob_null;
- int pad_len = 0;
-@@ -1374,8 +1374,8 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- goto err_exit;
- }
-
-- if (pkt->u.bind.assoc_group_id != 0) {
-- assoc_gid = pkt->u.bind.assoc_group_id;
-+ if (pkt->u.alter.assoc_group_id != 0) {
-+ assoc_gid = pkt->u.alter.assoc_group_id;
- } else {
- assoc_gid = 0x53f0;
- }
-@@ -1385,24 +1385,24 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- */
-
- /* If the requested abstract synt uuid doesn't match our client pipe,
-- reject the bind_ack & set the transfer interface synt to all 0's,
-+ reject the alter_ack & set the transfer interface synt to all 0's,
- ver 0 (observed when NT5 attempts to bind to abstract interfaces
- unknown to NT4)
- Needed when adding entries to a DACL from NT5 - SK */
-
- if (check_bind_req(p,
-- &pkt->u.bind.ctx_list[0].abstract_syntax,
-- &pkt->u.bind.ctx_list[0].transfer_syntaxes[0],
-- pkt->u.bind.ctx_list[0].context_id)) {
-+ &pkt->u.alter.ctx_list[0].abstract_syntax,
-+ &pkt->u.alter.ctx_list[0].transfer_syntaxes[0],
-+ pkt->u.alter.ctx_list[0].context_id)) {
-
-- bind_ack_ctx.result = 0;
-- bind_ack_ctx.reason = 0;
-- bind_ack_ctx.syntax = pkt->u.bind.ctx_list[0].transfer_syntaxes[0];
-+ alter_ack_ctx.result = 0;
-+ alter_ack_ctx.reason = 0;
-+ alter_ack_ctx.syntax = pkt->u.alter.ctx_list[0].transfer_syntaxes[0];
- } else {
- /* Rejection reason: abstract syntax not supported */
-- bind_ack_ctx.result = DCERPC_BIND_PROVIDER_REJECT;
-- bind_ack_ctx.reason = DCERPC_BIND_REASON_ASYNTAX;
-- bind_ack_ctx.syntax = null_ndr_syntax_id;
-+ alter_ack_ctx.result = DCERPC_BIND_PROVIDER_REJECT;
-+ alter_ack_ctx.reason = DCERPC_BIND_REASON_ASYNTAX;
-+ alter_ack_ctx.syntax = null_ndr_syntax_id;
- }
-
- /*
-@@ -1417,7 +1417,7 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- }
-
- status = dcerpc_pull_auth_trailer(pkt, pkt,
-- &pkt->u.bind.auth_info,
-+ &pkt->u.alter.auth_info,
- &auth_info, NULL, true);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Unable to unmarshall dcerpc_auth.\n"));
-@@ -1503,7 +1503,7 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- u.alter_resp.secondary_address_size = 1;
-
- u.alter_resp.num_results = 1;
-- u.alter_resp.ctx_list = &bind_ack_ctx;
-+ u.alter_resp.ctx_list = &alter_ack_ctx;
-
- /* NOTE: We leave the auth_info empty so we can calculate the padding
- * later and then append the auth_info --simo */
-@@ -1523,7 +1523,7 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- &u,
- &p->out_data.frag);
- if (!NT_STATUS_IS_OK(status)) {
-- DEBUG(0, ("Failed to marshall bind_ack packet. (%s)\n",
-+ DEBUG(0, ("Failed to marshall alter_resp packet. (%s)\n",
- nt_errstr(status)));
- goto err_exit;
- }
---
-2.8.1
-
-
-From 62b936e134a53662601b0f614f95dbca5ff7a369 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 16:06:59 +0200
-Subject: [PATCH 24/40] CVE-2015-5370: s3:rpc_server: verify presentation
- context arrays
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 1e6b4abac14840e4cee1afc5d4811b0f0277eade)
----
- source3/rpc_server/srv_pipe.c | 17 ++++++++++++++++-
- 1 file changed, 16 insertions(+), 1 deletion(-)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 382d94a..335af2a 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -934,7 +934,12 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- p->allow_bind = false;
-
- if (pkt->u.bind.num_contexts == 0) {
-- DEBUG(0, ("api_pipe_bind_req: no rpc contexts around\n"));
-+ DEBUG(1, ("api_pipe_bind_req: no rpc contexts around\n"));
-+ goto err_exit;
-+ }
-+
-+ if (pkt->u.bind.ctx_list[0].num_transfer_syntaxes == 0) {
-+ DEBUG(1, ("api_pipe_bind_req: no transfer syntaxes around\n"));
- goto err_exit;
- }
-
-@@ -1374,6 +1379,16 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- goto err_exit;
- }
-
-+ if (pkt->u.alter.num_contexts == 0) {
-+ DEBUG(1, ("api_pipe_alter_context: no rpc contexts around\n"));
-+ goto err_exit;
-+ }
-+
-+ if (pkt->u.alter.ctx_list[0].num_transfer_syntaxes == 0) {
-+ DEBUG(1, ("api_pipe_alter_context: no transfer syntaxes around\n"));
-+ goto err_exit;
-+ }
-+
- if (pkt->u.alter.assoc_group_id != 0) {
- assoc_gid = pkt->u.alter.assoc_group_id;
- } else {
---
-2.8.1
-
-
-From 585e8aefafcb5f8c501cdf4454b375ebda82f7a6 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 16:06:59 +0200
-Subject: [PATCH 25/40] CVE-2015-5370: s3:rpc_server: make use of
- dcerpc_verify_ncacn_packet_header() to verify incoming pdus
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit e39fdceb25fc75b6f8c77c097bf8dbd2f4286618)
----
- source3/rpc_server/srv_pipe.c | 81 +++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 81 insertions(+)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 335af2a..2f404b4 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -42,6 +42,7 @@
- #include "auth.h"
- #include "ntdomain.h"
- #include "rpc_server/srv_pipe.h"
-+#include "../librpc/gen_ndr/ndr_dcerpc.h"
- #include "../librpc/ndr/ndr_dcerpc.h"
- #include "../librpc/gen_ndr/ndr_samr.h"
- #include "../librpc/gen_ndr/ndr_lsa.h"
-@@ -933,6 +934,25 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- }
- p->allow_bind = false;
-
-+ status = dcerpc_verify_ncacn_packet_header(pkt,
-+ DCERPC_PKT_BIND,
-+ pkt->u.bind.auth_info.length,
-+ 0, /* required flags */
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST |
-+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN |
-+ 0x08 | /* this is not defined, but should be ignored */
-+ DCERPC_PFC_FLAG_CONC_MPX |
-+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
-+ DCERPC_PFC_FLAG_MAYBE |
-+ DCERPC_PFC_FLAG_OBJECT_UUID);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ DEBUG(1, ("api_pipe_bind_req: invalid pdu: %s\n",
-+ nt_errstr(status)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ goto err_exit;
-+ }
-+
- if (pkt->u.bind.num_contexts == 0) {
- DEBUG(1, ("api_pipe_bind_req: no rpc contexts around\n"));
- goto err_exit;
-@@ -1248,6 +1268,25 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
- goto err;
- }
-
-+ status = dcerpc_verify_ncacn_packet_header(pkt,
-+ DCERPC_PKT_AUTH3,
-+ pkt->u.auth3.auth_info.length,
-+ 0, /* required flags */
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST |
-+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN |
-+ 0x08 | /* this is not defined, but should be ignored */
-+ DCERPC_PFC_FLAG_CONC_MPX |
-+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
-+ DCERPC_PFC_FLAG_MAYBE |
-+ DCERPC_PFC_FLAG_OBJECT_UUID);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ DEBUG(1, ("api_pipe_bind_auth3: invalid pdu: %s\n",
-+ nt_errstr(status)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ goto err;
-+ }
-+
- /* We can only finish if the pipe is unbound for now */
- if (p->pipe_bound) {
- DEBUG(0, (__location__ ": Pipe already bound, "
-@@ -1379,6 +1418,25 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- goto err_exit;
- }
-
-+ status = dcerpc_verify_ncacn_packet_header(pkt,
-+ DCERPC_PKT_ALTER,
-+ pkt->u.alter.auth_info.length,
-+ 0, /* required flags */
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST |
-+ DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN |
-+ 0x08 | /* this is not defined, but should be ignored */
-+ DCERPC_PFC_FLAG_CONC_MPX |
-+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
-+ DCERPC_PFC_FLAG_MAYBE |
-+ DCERPC_PFC_FLAG_OBJECT_UUID);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ DEBUG(1, ("api_pipe_alter_context: invalid pdu: %s\n",
-+ nt_errstr(status)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ goto err_exit;
-+ }
-+
- if (pkt->u.alter.num_contexts == 0) {
- DEBUG(1, ("api_pipe_alter_context: no rpc contexts around\n"));
- goto err_exit;
-@@ -1923,6 +1981,29 @@ static bool process_request_pdu(struct pipes_struct *p, struct ncacn_packet *pkt
- return False;
- }
-
-+ /*
-+ * We don't ignore DCERPC_PFC_FLAG_PENDING_CANCEL.
-+ * TODO: we can reject it with DCERPC_FAULT_NO_CALL_ACTIVE later.
-+ */
-+ status = dcerpc_verify_ncacn_packet_header(pkt,
-+ DCERPC_PKT_REQUEST,
-+ pkt->u.request.stub_and_verifier.length,
-+ 0, /* required_flags */
-+ DCERPC_PFC_FLAG_FIRST |
-+ DCERPC_PFC_FLAG_LAST |
-+ 0x08 | /* this is not defined, but should be ignored */
-+ DCERPC_PFC_FLAG_CONC_MPX |
-+ DCERPC_PFC_FLAG_DID_NOT_EXECUTE |
-+ DCERPC_PFC_FLAG_MAYBE |
-+ DCERPC_PFC_FLAG_OBJECT_UUID);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ DEBUG(1, ("process_request_pdu: invalid pdu: %s\n",
-+ nt_errstr(status)));
-+ NDR_PRINT_DEBUG(ncacn_packet, pkt);
-+ set_incoming_fault(p);
-+ return false;
-+ }
-+
- /* Store the opnum */
- p->opnum = pkt->u.request.opnum;
-
---
-2.8.1
-
-
-From b16b1a5f331adc3bb2f3d0bee586ec084935a202 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 23 Dec 2015 12:40:58 +0100
-Subject: [PATCH 26/40] CVE-2015-5370: s3:rpc_server: disconnect the connection
- after a fatal FAULT pdu
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 664d7ace0e68b42d2de99583757e0a985647eb4b)
----
- source3/rpc_server/rpc_server.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
-index 376d26a..3ba83e0 100644
---- a/source3/rpc_server/rpc_server.c
-+++ b/source3/rpc_server/rpc_server.c
-@@ -664,6 +664,12 @@ static void named_pipe_packet_done(struct tevent_req *subreq)
- goto fail;
- }
-
-+ if (npc->p->fault_state != 0) {
-+ DEBUG(2, ("Disconnect after fault\n"));
-+ sys_errno = EINVAL;
-+ goto fail;
-+ }
-+
- /* clear out any data that may have been left around */
- npc->count = 0;
- TALLOC_FREE(npc->iov);
-@@ -1392,6 +1398,12 @@ static void dcerpc_ncacn_packet_done(struct tevent_req *subreq)
- goto fail;
- }
-
-+ if (ncacn_conn->p->fault_state != 0) {
-+ DEBUG(2, ("Disconnect after fault\n"));
-+ sys_errno = EINVAL;
-+ goto fail;
-+ }
-+
- /* clear out any data that may have been left around */
- ncacn_conn->count = 0;
- TALLOC_FREE(ncacn_conn->iov);
---
-2.8.1
-
-
-From 642d2b7090e46a87bc94cabf29eccb09e329c125 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 23 Dec 2015 12:38:55 +0100
-Subject: [PATCH 27/40] CVE-2015-5370: s3:rpc_server: let a failing BIND mark
- the connection as broken
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 8d97085efd8782e48d0f1162e3f56756acb99472)
----
- source3/rpc_server/srv_pipe.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 2f404b4..6275190 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -276,6 +276,7 @@ static bool setup_bind_nak(struct pipes_struct *p, struct ncacn_packet *pkt)
- p->out_data.data_sent_length = 0;
- p->out_data.current_pdu_sent = 0;
-
-+ set_incoming_fault(p);
- TALLOC_FREE(p->auth.auth_ctx);
- p->auth.auth_level = DCERPC_AUTH_LEVEL_NONE;
- p->auth.auth_type = DCERPC_AUTH_TYPE_NONE;
---
-2.8.1
-
-
-From f4aa07176636982d9be3c0ce2452fc43a8781d47 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 23 Dec 2015 12:38:55 +0100
-Subject: [PATCH 28/40] CVE-2015-5370: s3:rpc_server: use
- DCERPC_NCA_S_PROTO_ERROR FAULTs for protocol errors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit d30363f08efb81b22055d4445977c96df3737adf)
----
- source3/rpc_server/srv_pipe.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 6275190..3fb8855 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1933,7 +1933,7 @@ void set_incoming_fault(struct pipes_struct *p)
- data_blob_free(&p->in_data.data);
- p->in_data.pdu_needed_len = 0;
- p->in_data.pdu.length = 0;
-- p->fault_state = DCERPC_FAULT_CANT_PERFORM;
-+ p->fault_state = DCERPC_NCA_S_PROTO_ERROR;
-
- p->allow_alter = false;
- p->allow_auth3 = false;
-@@ -2254,7 +2254,7 @@ done:
- "pipe %s\n", get_pipe_name_from_syntax(talloc_tos(),
- &p->syntax)));
- set_incoming_fault(p);
-- setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR));
-+ setup_fault_pdu(p, NT_STATUS(DCERPC_NCA_S_PROTO_ERROR));
- TALLOC_FREE(pkt);
- } else {
- /*
---
-2.8.1
-
-
-From ef175975f587d73092461c36b10e4c9cf1805727 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Sat, 11 Jul 2015 10:58:07 +0200
-Subject: [PATCH 29/40] CVE-2015-5370: s3:librpc/rpc: remove unused
- dcerpc_pull_dcerpc_auth()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 02aef978ff8f16009a52c2d981d414d019bc8dd9)
----
- source3/librpc/rpc/dcerpc.h | 4 ----
- source3/librpc/rpc/dcerpc_helpers.c | 41 -------------------------------------
- 2 files changed, 45 deletions(-)
-
-diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
-index e7cca9e..9452e85 100644
---- a/source3/librpc/rpc/dcerpc.h
-+++ b/source3/librpc/rpc/dcerpc.h
-@@ -71,10 +71,6 @@ NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx,
- uint32_t auth_context_id,
- const DATA_BLOB *credentials,
- DATA_BLOB *blob);
--NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
-- const DATA_BLOB *blob,
-- struct dcerpc_auth *r,
-- bool bigendian);
- NTSTATUS dcerpc_guess_sizes(struct pipe_auth_data *auth,
- size_t header_len, size_t data_left,
- size_t max_xmit_frag, size_t pad_alignment,
-diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
-index c07835f..e4d0e3a 100644
---- a/source3/librpc/rpc/dcerpc_helpers.c
-+++ b/source3/librpc/rpc/dcerpc_helpers.c
-@@ -210,47 +210,6 @@ NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx,
- }
-
- /**
--* @brief Decodes a dcerpc_auth blob
--*
--* @param mem_ctx The memory context on which to allocate the packet
--* elements
--* @param blob The blob of data to decode
--* @param r An empty dcerpc_auth structure, must not be NULL
--*
--* @return a NTSTATUS error code
--*/
--NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
-- const DATA_BLOB *blob,
-- struct dcerpc_auth *r,
-- bool bigendian)
--{
-- enum ndr_err_code ndr_err;
-- struct ndr_pull *ndr;
--
-- ndr = ndr_pull_init_blob(blob, mem_ctx);
-- if (!ndr) {
-- return NT_STATUS_NO_MEMORY;
-- }
-- if (bigendian) {
-- ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
-- }
--
-- ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, r);
--
-- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-- talloc_free(ndr);
-- return ndr_map_error2ntstatus(ndr_err);
-- }
-- talloc_free(ndr);
--
-- if (DEBUGLEVEL >= 10) {
-- NDR_PRINT_DEBUG(dcerpc_auth, r);
-- }
--
-- return NT_STATUS_OK;
--}
--
--/**
- * @brief Calculate how much data we can in a packet, including calculating
- * auth token and pad lengths.
- *
---
-2.8.1
-
-
-From 49d0e60d28d3b615d4ee368cd3f260b3a6386858 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 30/40] CVE-2015-5370: s3:rpc_server: check the transfer syntax
- in check_bind_req() first
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 9464684010461947fa98d8ee084069e9cf362625)
----
- source3/rpc_server/srv_pipe.c | 20 ++++++++++++++------
- 1 file changed, 14 insertions(+), 6 deletions(-)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 3fb8855..0e6b073 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -351,16 +351,24 @@ static bool check_bind_req(struct pipes_struct *p,
- DEBUG(3,("check_bind_req for %s\n",
- get_pipe_name_from_syntax(talloc_tos(), abstract)));
-
-+ ok = ndr_syntax_id_equal(transfer, &ndr_transfer_syntax);
-+ if (!ok) {
-+ DEBUG(1,("check_bind_req unknown transfer syntax for "
-+ "%s context_id=%u\n",
-+ get_pipe_name_from_syntax(talloc_tos(), abstract),
-+ (unsigned)context_id));
-+ return false;
-+ }
-+
- /* we have to check all now since win2k introduced a new UUID on the lsaprpc pipe */
-- if (rpc_srv_pipe_exists_by_id(abstract) &&
-- ndr_syntax_id_equal(transfer, &ndr_transfer_syntax)) {
-- DEBUG(3, ("check_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n",
-- rpc_srv_get_pipe_cli_name(abstract),
-- rpc_srv_get_pipe_srv_name(abstract)));
-- } else {
-+ if (!rpc_srv_pipe_exists_by_id(abstract)) {
- return false;
- }
-
-+ DEBUG(3, ("check_bind_req: %s -> %s rpc service\n",
-+ rpc_srv_get_pipe_cli_name(abstract),
-+ rpc_srv_get_pipe_srv_name(abstract)));
-+
- context_fns = SMB_MALLOC_P(struct pipe_rpc_fns);
- if (context_fns == NULL) {
- DEBUG(0,("check_bind_req: malloc() failed!\n"));
---
-2.8.1
-
-
-From 7ee6698f706e51568f53347f422ac6671cdba9a4 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 13:05:01 +0200
-Subject: [PATCH 31/40] CVE-2015-5370: s3:rpc_server: don't allow an existing
- context to be changed in check_bind_req()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-An alter context can't change the syntax of an existing context,
-a new context_id will be used for that.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit a995740d4e7fbd8fbb5c8c6280b73eaceae53574)
----
- source3/rpc_server/srv_pipe.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 0e6b073..4263a91 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -360,6 +360,28 @@ static bool check_bind_req(struct pipes_struct *p,
- return false;
- }
-
-+ for (context_fns = p->contexts;
-+ context_fns != NULL;
-+ context_fns = context_fns->next)
-+ {
-+ if (context_fns->context_id != context_id) {
-+ continue;
-+ }
-+
-+ ok = ndr_syntax_id_equal(&context_fns->syntax,
-+ abstract);
-+ if (ok) {
-+ return true;
-+ }
-+
-+ DEBUG(1,("check_bind_req: changing abstract syntax for "
-+ "%s context_id=%u into %s not supported\n",
-+ get_pipe_name_from_syntax(talloc_tos(), &context_fns->syntax),
-+ (unsigned)context_id,
-+ get_pipe_name_from_syntax(talloc_tos(), abstract)));
-+ return false;
-+ }
-+
- /* we have to check all now since win2k introduced a new UUID on the lsaprpc pipe */
- if (!rpc_srv_pipe_exists_by_id(abstract)) {
- return false;
---
-2.8.1
-
-
-From 79a238d0c868c7e182f49637b66f544dc1dd86da Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 8 Jul 2015 00:01:37 +0200
-Subject: [PATCH 32/40] CVE-2015-5370: s3:rpc_client: pass struct
- pipe_auth_data to create_rpc_{bind_auth3,alter_context}()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit f556d9245c13d018d4e772f06d013ebe558703d9)
----
- source3/rpc_client/cli_pipe.c | 26 ++++++++++----------------
- 1 file changed, 10 insertions(+), 16 deletions(-)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 1c4ff01..3af3d8f 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -1816,9 +1816,8 @@ static bool check_bind_response(const struct dcerpc_bind_ack *r,
-
- static NTSTATUS create_rpc_bind_auth3(TALLOC_CTX *mem_ctx,
- struct rpc_pipe_client *cli,
-- uint32 rpc_call_id,
-- enum dcerpc_AuthType auth_type,
-- enum dcerpc_AuthLevel auth_level,
-+ struct pipe_auth_data *auth,
-+ uint32_t rpc_call_id,
- DATA_BLOB *pauth_blob,
- DATA_BLOB *rpc_out)
- {
-@@ -1828,8 +1827,8 @@ static NTSTATUS create_rpc_bind_auth3(TALLOC_CTX *mem_ctx,
- u.auth3._pad = 0;
-
- status = dcerpc_push_dcerpc_auth(mem_ctx,
-- auth_type,
-- auth_level,
-+ auth->auth_type,
-+ auth->auth_level,
- 0, /* auth_pad_length */
- 1, /* auth_context_id */
- pauth_blob,
-@@ -1861,9 +1860,8 @@ static NTSTATUS create_rpc_bind_auth3(TALLOC_CTX *mem_ctx,
- ********************************************************************/
-
- static NTSTATUS create_rpc_alter_context(TALLOC_CTX *mem_ctx,
-- enum dcerpc_AuthType auth_type,
-- enum dcerpc_AuthLevel auth_level,
-- uint32 rpc_call_id,
-+ struct pipe_auth_data *auth,
-+ uint32_t rpc_call_id,
- const struct ndr_syntax_id *abstract,
- const struct ndr_syntax_id *transfer,
- const DATA_BLOB *pauth_blob, /* spnego auth blob already created. */
-@@ -1873,8 +1871,8 @@ static NTSTATUS create_rpc_alter_context(TALLOC_CTX *mem_ctx,
- NTSTATUS status;
-
- status = dcerpc_push_dcerpc_auth(mem_ctx,
-- auth_type,
-- auth_level,
-+ auth->auth_type,
-+ auth->auth_level,
- 0, /* auth_pad_length */
- 1, /* auth_context_id */
- pauth_blob,
-@@ -2300,9 +2298,7 @@ static NTSTATUS rpc_bind_next_send(struct tevent_req *req,
- /* Now prepare the alter context pdu. */
- data_blob_free(&state->rpc_out);
-
-- status = create_rpc_alter_context(state,
-- auth->auth_type,
-- auth->auth_level,
-+ status = create_rpc_alter_context(state, auth,
- state->rpc_call_id,
- &state->cli->abstract_syntax,
- &state->cli->transfer_syntax,
-@@ -2335,10 +2331,8 @@ static NTSTATUS rpc_bind_finish_send(struct tevent_req *req,
- /* Now prepare the auth3 context pdu. */
- data_blob_free(&state->rpc_out);
-
-- status = create_rpc_bind_auth3(state, state->cli,
-+ status = create_rpc_bind_auth3(state, state->cli, auth,
- state->rpc_call_id,
-- auth->auth_type,
-- auth->auth_level,
- auth_token,
- &state->rpc_out);
- if (!NT_STATUS_IS_OK(status)) {
---
-2.8.1
-
-
-From 18a50ed6ead11287ff72cb38f100d0f2641c3e7d Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 8 Jul 2015 00:01:37 +0200
-Subject: [PATCH 33/40] CVE-2015-5370: s3:librpc/rpc: add auth_context_id to
- struct pipe_auth_data
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit cbf20b43d7b40e3b6ccf044f6f51a5adff1f5e6d)
----
- source3/librpc/rpc/dcerpc.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
-index 9452e85..c25b0f5 100644
---- a/source3/librpc/rpc/dcerpc.h
-+++ b/source3/librpc/rpc/dcerpc.h
-@@ -42,6 +42,7 @@ struct pipe_auth_data {
- bool verified_bitmask1;
-
- void *auth_ctx;
-+ uint32_t auth_context_id;
-
- /* Only the client code uses these 3 for now */
- char *domain;
---
-2.8.1
-
-
-From 7dbaaca2a638406331d4653e1afdc18f7c8502f6 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 8 Jul 2015 00:01:37 +0200
-Subject: [PATCH 34/40] CVE-2015-5370: s3:rpc_client: make use of
- pipe_auth_data->auth_context_id
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is better than using hardcoded values.
-We need to use auth_context_id = 1 for authenticated
-connections, as old Samba server (before this patchset)
-will use a hardcoded value of 1.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit ae68d3f325c3880144b80385779c9445897646e6)
----
- source3/rpc_client/cli_pipe.c | 13 ++++++++++---
- 1 file changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 3af3d8f..755d676 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -1314,7 +1314,7 @@ static NTSTATUS create_rpc_bind_req(TALLOC_CTX *mem_ctx,
- auth->auth_type,
- auth->auth_level,
- 0, /* auth_pad_length */
-- 1, /* auth_context_id */
-+ auth->auth_context_id,
- &auth_token,
- &auth_info);
- if (!NT_STATUS_IS_OK(ret)) {
-@@ -1830,7 +1830,7 @@ static NTSTATUS create_rpc_bind_auth3(TALLOC_CTX *mem_ctx,
- auth->auth_type,
- auth->auth_level,
- 0, /* auth_pad_length */
-- 1, /* auth_context_id */
-+ auth->auth_context_id,
- pauth_blob,
- &u.auth3.auth_info);
- if (!NT_STATUS_IS_OK(status)) {
-@@ -1874,7 +1874,7 @@ static NTSTATUS create_rpc_alter_context(TALLOC_CTX *mem_ctx,
- auth->auth_type,
- auth->auth_level,
- 0, /* auth_pad_length */
-- 1, /* auth_context_id */
-+ auth->auth_context_id,
- pauth_blob,
- &auth_info);
- if (!NT_STATUS_IS_OK(status)) {
-@@ -2704,6 +2704,7 @@ NTSTATUS rpccli_ncalrpc_bind_data(TALLOC_CTX *mem_ctx,
-
- result->auth_type = DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM;
- result->auth_level = DCERPC_AUTH_LEVEL_CONNECT;
-+ result->auth_context_id = 1;
-
- result->user_name = talloc_strdup(result, "");
- result->domain = talloc_strdup(result, "");
-@@ -2728,6 +2729,7 @@ NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
-
- result->auth_type = DCERPC_AUTH_TYPE_NONE;
- result->auth_level = DCERPC_AUTH_LEVEL_NONE;
-+ result->auth_context_id = 0;
-
- result->user_name = talloc_strdup(result, "");
- result->domain = talloc_strdup(result, "");
-@@ -2765,6 +2767,7 @@ static NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
-
- result->auth_type = auth_type;
- result->auth_level = auth_level;
-+ result->auth_context_id = 1;
-
- result->user_name = talloc_strdup(result, username);
- result->domain = talloc_strdup(result, domain);
-@@ -2836,6 +2839,7 @@ NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
-
- result->auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
- result->auth_level = auth_level;
-+ result->auth_context_id = 1;
-
- result->user_name = talloc_strdup(result, "");
- result->domain = talloc_strdup(result, domain);
-@@ -3500,6 +3504,7 @@ NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
- }
- auth->auth_type = DCERPC_AUTH_TYPE_KRB5;
- auth->auth_level = auth_level;
-+ auth->auth_context_id = 1;
-
- if (!username) {
- username = "";
-@@ -3570,6 +3575,7 @@ NTSTATUS cli_rpc_pipe_open_spnego_krb5(struct cli_state *cli,
- }
- auth->auth_type = DCERPC_AUTH_TYPE_SPNEGO;
- auth->auth_level = auth_level;
-+ auth->auth_context_id = 1;
-
- if (!username) {
- username = "";
-@@ -3644,6 +3650,7 @@ NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
- }
- auth->auth_type = DCERPC_AUTH_TYPE_SPNEGO;
- auth->auth_level = auth_level;
-+ auth->auth_context_id = 1;
-
- if (!username) {
- username = "";
---
-2.8.1
-
-
-From 82cd4e90c70d1ababd5fa1ee61206e37edbf40e4 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 8 Jul 2015 00:01:37 +0200
-Subject: [PATCH 35/40] CVE-2015-5370: s3:rpc_server: make use of
- pipe_auth_data->auth_context_id
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is better than using hardcoded values.
-We need to use the value the client used in the BIND request.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 2bc617293a5d8652e484af69660b3646f3d48690)
----
- source3/rpc_server/rpc_ncacn_np.c | 1 +
- source3/rpc_server/srv_pipe.c | 11 +++++++----
- 2 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c
-index f2e9d10..c0f24a6 100644
---- a/source3/rpc_server/rpc_ncacn_np.c
-+++ b/source3/rpc_server/rpc_ncacn_np.c
-@@ -781,6 +781,7 @@ static NTSTATUS rpc_pipe_open_external(TALLOC_CTX *mem_ctx,
- }
- result->auth->auth_type = DCERPC_AUTH_TYPE_NONE;
- result->auth->auth_level = DCERPC_AUTH_LEVEL_NONE;
-+ result->auth->auth_context_id = 0;
-
- status = rpccli_anon_bind_data(result, &auth);
- if (!NT_STATUS_IS_OK(status)) {
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index 4263a91..d6c4118 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -534,6 +534,7 @@ static bool pipe_spnego_auth_bind(struct pipes_struct *p,
-
- p->auth.auth_ctx = spnego_ctx;
- p->auth.auth_type = DCERPC_AUTH_TYPE_SPNEGO;
-+ p->auth.auth_context_id = auth_info->auth_context_id;
-
- DEBUG(10, ("SPNEGO auth started\n"));
-
-@@ -644,6 +645,7 @@ static bool pipe_schannel_auth_bind(struct pipes_struct *p,
- /* We're finished with this bind - no more packets. */
- p->auth.auth_ctx = schannel_auth;
- p->auth.auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
-+ p->auth.auth_context_id = auth_info->auth_context_id;
-
- p->pipe_bound = True;
-
-@@ -688,6 +690,7 @@ static bool pipe_ntlmssp_auth_bind(struct pipes_struct *p,
-
- p->auth.auth_ctx = ntlmssp_state;
- p->auth.auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
-+ p->auth.auth_context_id = auth_info->auth_context_id;
-
- DEBUG(10, (__location__ ": NTLMSSP auth started\n"));
-
-@@ -1173,6 +1176,7 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- p->pipe_bound = True;
- /* The session key was initialized from the SMB
- * session in make_internal_rpc_pipe_p */
-+ p->auth.auth_context_id = 0;
- }
-
- ZERO_STRUCT(u.bind_ack);
-@@ -1218,12 +1222,11 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
- }
-
- if (auth_resp.length) {
--
- status = dcerpc_push_dcerpc_auth(pkt,
- auth_type,
- auth_info.auth_level,
-- 0,
-- 1, /* auth_context_id */
-+ 0, /* pad_len */
-+ p->auth.auth_context_id,
- &auth_resp,
- &auth_blob);
- if (!NT_STATUS_IS_OK(status)) {
-@@ -1646,7 +1649,7 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- auth_info.auth_type,
- auth_info.auth_level,
- pad_len,
-- 1, /* auth_context_id */
-+ p->auth.auth_context_id,
- &auth_resp,
- &auth_blob);
- if (!NT_STATUS_IS_OK(status)) {
---
-2.8.1
-
-
-From 8d1fb1fcf58b08cbf27579382ea648aefb9e7dc6 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 8 Jul 2015 00:01:37 +0200
-Subject: [PATCH 36/40] CVE-2015-5370: s3:librpc/rpc: make use of
- auth->auth_context_id in dcerpc_add_auth_footer()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 61faaa63e7e610308c72ae4c41a5c7b5b7312685)
----
- source3/librpc/rpc/dcerpc_helpers.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
-index e4d0e3a..977a372 100644
---- a/source3/librpc/rpc/dcerpc_helpers.c
-+++ b/source3/librpc/rpc/dcerpc_helpers.c
-@@ -741,7 +741,7 @@ NTSTATUS dcerpc_add_auth_footer(struct pipe_auth_data *auth,
- auth->auth_type,
- auth->auth_level,
- pad_len,
-- 1 /* context id. */,
-+ auth->auth_context_id,
- &auth_blob,
- &auth_info);
- if (!NT_STATUS_IS_OK(status)) {
---
-2.8.1
-
-
-From 2a44cfc65f7dc1ccfd2d6a5abe5d26e94a085aa9 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 8 Jul 2015 00:01:37 +0200
-Subject: [PATCH 37/40] CVE-2015-5370: s3:librpc/rpc: verify auth_context_id in
- dcerpc_check_auth()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 0cf3151c843e2c779b534743b455e630d89e2ba9)
----
- source3/librpc/rpc/dcerpc_helpers.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
-index 977a372..b00cf1bf 100644
---- a/source3/librpc/rpc/dcerpc_helpers.c
-+++ b/source3/librpc/rpc/dcerpc_helpers.c
-@@ -881,6 +881,10 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
- return NT_STATUS_INVALID_PARAMETER;
- }
-
-+ if (auth_info.auth_context_id != auth->auth_context_id) {
-+ return NT_STATUS_INVALID_PARAMETER;
-+ }
-+
- pkt_trailer->length -= auth_length;
- data = data_blob_const(raw_pkt->data + header_size,
- pkt_trailer->length);
---
-2.8.1
-
-
-From 68dcc277d5af506706d3fdac43891e43ccb4ceea Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 7 Jul 2015 22:51:18 +0200
-Subject: [PATCH 38/40] CVE-2015-5370: s3:rpc_client: verify auth_context_id in
- rpc_pipe_bind_step_one_done()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 93a0f92b8ebecb38f92d3b2c9a946b486ee91d3c)
----
- source3/rpc_client/cli_pipe.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index 755d676..ee33e80 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -2052,6 +2052,14 @@ static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq)
- return;
- }
-
-+ if (auth.auth_context_id != pauth->auth_context_id) {
-+ DEBUG(0, (__location__ " Auth context id %u mismatch expected %u.\n",
-+ (unsigned)auth.auth_context_id,
-+ (unsigned)pauth->auth_context_id));
-+ tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
-+ return;
-+ }
-+
- break;
- }
-
---
-2.8.1
-
-
-From 8787dd5053974c1f42ae85a310e9522795f4ccfe Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Wed, 8 Jul 2015 00:01:37 +0200
-Subject: [PATCH 39/40] CVE-2015-5370: s3:rpc_server: verify auth_context_id in
- api_pipe_{bind_auth3,alter_context}
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 3ef461d8304ee36184cd7a3963676eedff4ef1eb)
----
- source3/rpc_server/srv_pipe.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
-index d6c4118..26c4ee0 100644
---- a/source3/rpc_server/srv_pipe.c
-+++ b/source3/rpc_server/srv_pipe.c
-@@ -1364,6 +1364,14 @@ bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt)
- goto err;
- }
-
-+ if (auth_info.auth_context_id != p->auth.auth_context_id) {
-+ DEBUG(0, ("Auth context id mismatch! Client sent %u, "
-+ "but auth was started as level %u!\n",
-+ (unsigned)auth_info.auth_context_id,
-+ (unsigned)p->auth.auth_context_id));
-+ goto err;
-+ }
-+
- switch (auth_info.auth_type) {
- case DCERPC_AUTH_TYPE_NTLMSSP:
- ntlmssp_ctx = talloc_get_type_abort(p->auth.auth_ctx,
-@@ -1545,6 +1553,14 @@ static bool api_pipe_alter_context(struct pipes_struct *p,
- goto err_exit;
- }
-
-+ if (auth_info.auth_context_id != p->auth.auth_context_id) {
-+ DEBUG(0, ("Auth context id mismatch! Client sent %u, "
-+ "but auth was started as level %u!\n",
-+ (unsigned)auth_info.auth_context_id,
-+ (unsigned)p->auth.auth_context_id));
-+ goto err_exit;
-+ }
-+
- switch (auth_info.auth_type) {
- case DCERPC_AUTH_TYPE_SPNEGO:
- spnego_ctx = talloc_get_type_abort(p->auth.auth_ctx,
---
-2.8.1
-
-
-From bf0040fb860527cb0c54ab0ef301153bdad650c0 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 22 Dec 2015 21:23:14 +0100
-Subject: [PATCH 40/40] CVE-2015-5370: s3:rpc_client: disconnect connection on
- protocol errors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11344
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
-(cherry picked from commit 024d3b263a2879cee4fb7794d70f253c948cc043)
----
- source3/rpc_client/cli_pipe.c | 67 +++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 64 insertions(+), 3 deletions(-)
-
-diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
-index ee33e80..a3810f0 100644
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -953,6 +953,12 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
-
- state->pkt = talloc(state, struct ncacn_packet);
- if (!state->pkt) {
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
- tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
- return;
- }
-@@ -962,6 +968,12 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
- state->pkt,
- !state->endianess);
- if (!NT_STATUS_IS_OK(status)) {
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
- tevent_req_nterror(req, status);
- return;
- }
-@@ -979,6 +991,28 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
- (unsigned)state->reply_pdu_offset,
- nt_errstr(status)));
-
-+ if (state->pkt->ptype != DCERPC_PKT_FAULT && !NT_STATUS_IS_OK(status)) {
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
-+ } else if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTOCOL_ERROR)) {
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
-+ } else if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_SEC_PKG_ERROR)) {
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
-+ }
- if (!NT_STATUS_IS_OK(status)) {
- tevent_req_nterror(req, status);
- return;
-@@ -1003,12 +1037,24 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
- "%s\n",
- state->endianess?"little":"big",
- state->pkt->drep[0]?"little":"big"));
-- tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
-+ tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
- return;
- }
-
- if (state->reply_pdu_offset + rdata.length > MAX_RPC_DATA_SIZE) {
-- tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
-+ tevent_req_nterror(req, NT_STATUS_RPC_PROTOCOL_ERROR);
- return;
- }
-
-@@ -1016,6 +1062,12 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
- if (state->reply_pdu.length < state->reply_pdu_offset + rdata.length) {
- if (!data_blob_realloc(NULL, &state->reply_pdu,
- state->reply_pdu_offset + rdata.length)) {
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
- tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
- return;
- }
-@@ -1045,6 +1097,14 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
- subreq = get_complete_frag_send(state, state->ev, state->cli,
- state->call_id,
- &state->incoming_frag);
-+ if (subreq == NULL) {
-+ /*
-+ * TODO: do a real async disconnect ...
-+ *
-+ * For now do it sync...
-+ */
-+ TALLOC_FREE(state->cli->transport);
-+ }
- if (tevent_req_nomem(subreq, req)) {
- return;
- }
-@@ -2574,8 +2634,9 @@ static struct tevent_req *rpccli_bh_disconnect_send(TALLOC_CTX *mem_ctx,
- /*
- * TODO: do a real async disconnect ...
- *
-- * For now the caller needs to free rpc_cli
-+ * For now we do it sync...
- */
-+ TALLOC_FREE(hs->rpc_cli->transport);
- hs->rpc_cli = NULL;
-
- tevent_req_done(req);
---
-2.8.1
-
diff --git a/src/patches/samba/CVE-2015-7560-v3-6.patch b/src/patches/samba/CVE-2015-7560-v3-6.patch
deleted file mode 100644
index 1cf30aeca..000000000
--- a/src/patches/samba/CVE-2015-7560-v3-6.patch
+++ /dev/null
@@ -1,341 +0,0 @@
-From eb27f9b7bf9c1dc902d9545eecf805831bd4e46c Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 11:18:12 -0800
-Subject: [PATCH 1/8] CVE-2015-7560: s3: smbd: Add refuse_symlink() function
- that can be used to prevent operations on a symlink.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/trans2.c | 28 ++++++++++++++++++++++++++++
- 1 file changed, 28 insertions(+)
-
-diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
-index 26b6523..7f47579 100644
---- a/source3/smbd/trans2.c
-+++ b/source3/smbd/trans2.c
-@@ -51,6 +51,34 @@ static char *store_file_unix_basic_info2(connection_struct *conn,
- files_struct *fsp,
- const SMB_STRUCT_STAT *psbuf);
-
-+/****************************************************************************
-+ Check if an open file handle or pathname is a symlink.
-+****************************************************************************/
-+
-+static NTSTATUS refuse_symlink(connection_struct *conn,
-+ const files_struct *fsp,
-+ const char *name)
-+{
-+ SMB_STRUCT_STAT sbuf;
-+ const SMB_STRUCT_STAT *pst = NULL;
-+
-+ if (fsp) {
-+ pst = &fsp->fsp_name->st;
-+ } else {
-+ int ret = vfs_stat_smb_fname(conn,
-+ name,
-+ &sbuf);
-+ if (ret == -1) {
-+ return map_nt_error_from_unix(errno);
-+ }
-+ pst = &sbuf;
-+ }
-+ if (S_ISLNK(pst->st_ex_mode)) {
-+ return NT_STATUS_ACCESS_DENIED;
-+ }
-+ return NT_STATUS_OK;
-+}
-+
- /********************************************************************
- Roundup a value to the nearest allocation roundup size boundary.
- Only do this for Windows clients.
---
-2.5.0
-
-
-From f5b1bcc51e18bc85f376701bb4ae6894d97addfd Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 10:38:28 -0800
-Subject: [PATCH 2/8] CVE-2015-7560: s3: smbd: Refuse to get an ACL from a
- POSIX file handle on a symlink.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/nttrans.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
-index 4c145e0..7255600 100644
---- a/source3/smbd/nttrans.c
-+++ b/source3/smbd/nttrans.c
-@@ -1925,6 +1925,12 @@ NTSTATUS smbd_do_query_security_desc(connection_struct *conn,
- return NT_STATUS_ACCESS_DENIED;
- }
-
-+ if (S_ISLNK(fsp->fsp_name->st.st_ex_mode)) {
-+ DEBUG(10, ("ACL get on symlink %s denied.\n",
-+ fsp_str_dbg(fsp)));
-+ return NT_STATUS_ACCESS_DENIED;
-+ }
-+
- if (security_info_wanted & (SECINFO_DACL|SECINFO_OWNER|
- SECINFO_GROUP|SECINFO_SACL)) {
- /* Don't return SECINFO_LABEL if anything else was
---
-2.5.0
-
-
-From 8bdbe1c90c98efbd08fc70d773d236c4ba00b1ae Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 10:52:50 -0800
-Subject: [PATCH 3/8] CVE-2015-7560: s3: smbd: Refuse to set an ACL from a
- POSIX file handle on a symlink.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/nttrans.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
-index 7255600..d2102ca 100644
---- a/source3/smbd/nttrans.c
-+++ b/source3/smbd/nttrans.c
-@@ -877,6 +877,12 @@ NTSTATUS set_sd(files_struct *fsp, struct security_descriptor *psd,
- return NT_STATUS_OK;
- }
-
-+ if (S_ISLNK(fsp->fsp_name->st.st_ex_mode)) {
-+ DEBUG(10, ("ACL set on symlink %s denied.\n",
-+ fsp_str_dbg(fsp)));
-+ return NT_STATUS_ACCESS_DENIED;
-+ }
-+
- if (psd->owner_sid == NULL) {
- security_info_sent &= ~SECINFO_OWNER;
- }
---
-2.5.0
-
-
-From 612b032e2dedd3e07bbe79718ecbb3b68ffbb7a5 Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 11:22:12 -0800
-Subject: [PATCH 4/8] CVE-2015-7560: s3: smbd: Refuse to set a POSIX ACL on a
- symlink.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/trans2.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
-index 7f47579..2f01e87 100644
---- a/source3/smbd/trans2.c
-+++ b/source3/smbd/trans2.c
-@@ -6480,6 +6480,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
- uint16 num_def_acls;
- bool valid_file_acls = True;
- bool valid_def_acls = True;
-+ NTSTATUS status;
-
- if (total_data < SMB_POSIX_ACL_HEADER_SIZE) {
- return NT_STATUS_INVALID_PARAMETER;
-@@ -6507,6 +6508,11 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn,
- return NT_STATUS_INVALID_PARAMETER;
- }
-
-+ status = refuse_symlink(conn, fsp, smb_fname->base_name);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ return status;
-+ }
-+
- DEBUG(10,("smb_set_posix_acl: file %s num_file_acls = %u, num_def_acls = %u\n",
- smb_fname ? smb_fname_str_dbg(smb_fname) : fsp_str_dbg(fsp),
- (unsigned int)num_file_acls,
---
-2.5.0
-
-
-From 28e6120d14e5a942df386db0444abaa93a764207 Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 11:24:36 -0800
-Subject: [PATCH 5/8] CVE-2015-7560: s3: smbd: Refuse to get a POSIX ACL on a
- symlink.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/trans2.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
-index 2f01e87..3a098d1 100644
---- a/source3/smbd/trans2.c
-+++ b/source3/smbd/trans2.c
-@@ -4959,6 +4959,13 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
- uint16 num_file_acls = 0;
- uint16 num_def_acls = 0;
-
-+ status = refuse_symlink(conn,
-+ fsp,
-+ smb_fname->base_name);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ return status;
-+ }
-+
- if (fsp && fsp->fh->fd != -1) {
- file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp);
- } else {
---
-2.5.0
-
-
-From 659bdb80aa65c02cf4f44377cc3bcffb2a817ee0 Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 11:05:48 -0800
-Subject: [PATCH 6/8] CVE-2015-7560: s3: smbd: Set return values early, allows
- removal of code duplication.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/trans2.c | 13 +++++--------
- 1 file changed, 5 insertions(+), 8 deletions(-)
-
-diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
-index 3a098d1..6fdd1da 100644
---- a/source3/smbd/trans2.c
-+++ b/source3/smbd/trans2.c
-@@ -210,11 +210,12 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
- size_t num_names;
- ssize_t sizeret = -1;
-
-+ if (pnames) {
-+ *pnames = NULL;
-+ }
-+ *pnum_names = 0;
-+
- if (!lp_ea_support(SNUM(conn))) {
-- if (pnames) {
-- *pnames = NULL;
-- }
-- *pnum_names = 0;
- return NT_STATUS_OK;
- }
-
-@@ -264,10 +265,6 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
-
- if (sizeret == 0) {
- TALLOC_FREE(names);
-- if (pnames) {
-- *pnames = NULL;
-- }
-- *pnum_names = 0;
- return NT_STATUS_OK;
- }
-
---
-2.5.0
-
-
-From 4ba5e7cf01b8074b0313ecb7e218355d771df1cc Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 11:29:38 -0800
-Subject: [PATCH 7/8] CVE-2015-7560: s3: smbd: Silently return no EA's
- available on a symlink.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/trans2.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
-index 6fdd1da..8b6e4b2 100644
---- a/source3/smbd/trans2.c
-+++ b/source3/smbd/trans2.c
-@@ -209,6 +209,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
- char **names, **tmp;
- size_t num_names;
- ssize_t sizeret = -1;
-+ NTSTATUS status;
-
- if (pnames) {
- *pnames = NULL;
-@@ -219,6 +220,14 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
- return NT_STATUS_OK;
- }
-
-+ status = refuse_symlink(conn, fsp, fname);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ /*
-+ * Just return no EA's on a symlink.
-+ */
-+ return NT_STATUS_OK;
-+ }
-+
- /*
- * TALLOC the result early to get the talloc hierarchy right.
- */
---
-2.5.0
-
-
-From 9d8c7274ab87a0c07367e872ca1db7fd72886fde Mon Sep 17 00:00:00 2001
-From: Jeremy Allison
-Date: Tue, 5 Jan 2016 11:33:48 -0800
-Subject: [PATCH 8/8] CVE-2015-7560: s3: smbd: Refuse to set EA's on a symlink.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11648
-
-Signed-off-by: Jeremy Allison
-Reviewed-by: Michael Adam
----
- source3/smbd/trans2.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
-index 8b6e4b2..98fd2af 100644
---- a/source3/smbd/trans2.c
-+++ b/source3/smbd/trans2.c
-@@ -584,6 +584,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
- const struct smb_filename *smb_fname, struct ea_list *ea_list)
- {
- char *fname = NULL;
-+ NTSTATUS status;
-
- if (!lp_ea_support(SNUM(conn))) {
- return NT_STATUS_EAS_NOT_SUPPORTED;
-@@ -593,6 +594,12 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
- return NT_STATUS_ACCESS_DENIED;
- }
-
-+ status = refuse_symlink(conn, fsp, smb_fname->base_name);
-+ if (!NT_STATUS_IS_OK(status)) {
-+ return status;
-+ }
-+
-+
- /* For now setting EAs on streams isn't supported. */
- fname = smb_fname->base_name;
-
---
-2.5.0
-
diff --git a/src/patches/samba/CVE-2016-2110-v3-6.patch b/src/patches/samba/CVE-2016-2110-v3-6.patch
deleted file mode 100644
index 1f454bec8..000000000
--- a/src/patches/samba/CVE-2016-2110-v3-6.patch
+++ /dev/null
@@ -1,670 +0,0 @@
-From 202d69267c8550b850438877fb51c3d2c992949d Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Tue, 1 Dec 2015 08:46:45 +0100
-Subject: [PATCH 01/10] CVE-2016-2110: s3:ntlmssp: set and use
- ntlmssp_state->allow_lm_key
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11644
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
----
- source3/libsmb/ntlmssp.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
-index 1de6189..20a5987 100644
---- a/source3/libsmb/ntlmssp.c
-+++ b/source3/libsmb/ntlmssp.c
-@@ -530,7 +530,8 @@ noccache:
- DEBUG(3, ("Got challenge flags:\n"));
- debug_ntlmssp_flags(chal_flags);
-
-- ntlmssp_handle_neg_flags(ntlmssp_state, chal_flags, lp_client_lanman_auth());
-+ ntlmssp_handle_neg_flags(ntlmssp_state, chal_flags,
-+ ntlmssp_state->allow_lm_key);
-
- if (ntlmssp_state->unicode) {
- if (chal_flags & NTLMSSP_NEGOTIATE_TARGET_INFO) {
-@@ -769,6 +770,7 @@ NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
- ntlmssp_state->unicode = True;
-
- ntlmssp_state->use_ntlmv2 = use_ntlmv2;
-+ ntlmssp_state->allow_lm_key = lp_client_lanman_auth();
-
- ntlmssp_state->expected_state = NTLMSSP_INITIAL;
-
---
-2.8.1
-
-
-From a701bc5f8a76584a2e0680b2c3dd9afb77f12430 Mon Sep 17 00:00:00 2001
-From: Stefan Metzmacher
-Date: Fri, 11 Dec 2015 14:50:23 +0100
-Subject: [PATCH 02/10] CVE-2016-2110: s3:ntlmssp: add
- ntlmssp3_handle_neg_flags()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is a copy of ntlmssp_handle_neg_flags(), which will be changed
-in an incompatible way in the following commits.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11644
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner
----
- source3/libsmb/ntlmssp.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 56 insertions(+), 2 deletions(-)
-
-diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
-index 20a5987..ad09f9f 100644
---- a/source3/libsmb/ntlmssp.c
-+++ b/source3/libsmb/ntlmssp.c
-@@ -422,6 +422,60 @@ static NTSTATUS ntlmssp_client_initial(struct ntlmssp_state *ntlmssp_state,
- return NT_STATUS_MORE_PROCESSING_REQUIRED;
- }
-
-+static void ntlmssp3_handle_neg_flags(struct ntlmssp_state *ntlmssp_state,
-+ uint32_t neg_flags, bool allow_lm)
-+{
-+ if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) {
-+ ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_UNICODE;
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_OEM;
-+ ntlmssp_state->unicode = true;
-+ } else {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_UNICODE;
-+ ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_OEM;
-+ ntlmssp_state->unicode = false;
-+ }
-+
-+ if ((neg_flags & NTLMSSP_NEGOTIATE_LM_KEY) && allow_lm) {
-+ /* other end forcing us to use LM */
-+ ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_LM_KEY;
-+ ntlmssp_state->use_ntlmv2 = false;
-+ } else {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY;
-+ }
-+
-+ if (!(neg_flags & NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_ALWAYS_SIGN;
-+ }
-+
-+ if (!(neg_flags & NTLMSSP_NEGOTIATE_NTLM2)) {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_NTLM2;
-+ }
-+
-+ if (!(neg_flags & NTLMSSP_NEGOTIATE_128)) {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_128;
-+ }
-+
-+ if (!(neg_flags & NTLMSSP_NEGOTIATE_56)) {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_56;
-+ }
-+
-+ if (!(neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH)) {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_KEY_EXCH;
-+ }
-+
-+ if (!(neg_flags & NTLMSSP_NEGOTIATE_SIGN)) {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_SIGN;
-+ }
-+
-+ if (!(neg_flags & NTLMSSP_NEGOTIATE_SEAL)) {
-+ ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_SEAL;
-+ }
-+
-+ if ((neg_flags & NTLMSSP_REQUEST_TARGET)) {
-+ ntlmssp_state->neg_flags |= NTLMSSP_REQUEST_TARGET;
-+ }
-+}
-+
- /**
- * Next state function for the Challenge Packet. Generate an auth packet.
- *
-@@ -530,8 +584,8 @@ noccache:
- DEBUG(3, ("Got challenge flags:\n"));
- debug_ntlmssp_flags(chal_flags);
-
-- ntlmssp_handle_neg_flags(ntlmssp_state, chal_flags,
-- ntlmssp_state->allow_lm_key);
-+ ntlmssp3_handle_neg_flags(ntlmssp_state, chal_flags,
-+ ntlmssp_state->allow_lm_key);
-
- if (ntlmssp_state->unicode) {
- if (chal_flags & NTLMSSP_NEGOTIATE_TARGET_INFO) {
---
-2.8.1
-
-
-From 92b2f5315d135b7b83a3ae106b43d18181be2f02 Mon Sep 17 00:00:00 2001
-From: Andreas Schneider
-Date: Thu, 31 Mar 2016 12:39:50 +0200
-Subject: [PATCH 03/10] CVE-2016-2110: s3:ntlmssp: let
- ntlmssp3_handle_neg_flags() return NTSTATUS
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-In future we can do a more fine granted negotiation
-and assert specific security features.
-
-BUG: https://bugzilla.samba.org/show_bug.cgi?id=11644
-
-Signed-off-by: Stefan Metzmacher
-Reviewed-by: Günther Deschner |