[SCM] Samba Shared Repository - branch v4-3-test updated

Karolin Seeger kseeger at samba.org
Thu Mar 24 11:13:09 UTC 2016


The branch, v4-3-test has been updated
       via  ca09ef7 build: fix build when --without-quota specified
       via  0380ec6 build: fix disk-free quota support on Solaris 10
       via  12c0248 s3:winbindd: don't unclude two '
       via  596a51e smbd: Only check dev/inode in open_directory, not the full stat()
      from  b28fea7 VERSION: Bump version up to 4.3.7...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-3-test


- Log -----------------------------------------------------------------
commit ca09ef77a5a1f2912d5417ab1934e38a052510f7
Author: Uri Simchoni <uri at samba.org>
Date:   Wed Mar 16 20:20:02 2016 +0200

    build: fix build when --without-quota specified
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11798
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 228ab3466d0e5af46313de200b5b976d46838378)
    
    Autobuild-User(v4-3-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-3-test): Thu Mar 24 12:12:39 CET 2016 on sn-devel-104

commit 0380ec624a3dafe29317a5f765230421236322a9
Author: Uri Simchoni <uri at samba.org>
Date:   Wed Feb 3 06:41:42 2016 +0200

    build: fix disk-free quota support on Solaris 10
    
    Samba has no code to support quota on Solaris 10 (and possibly other
    os's such as AIX) using the new quota interface. The new interface
    serves both disk size/free space reporting (clamping the underlying
    file system numbers with quota), and direct manipulation of the user's
    quota.
    
    However, there's legacy code that supports only disk size/free space on
    Solaris 10. In the waf build, this code is not compiled because there is
    no test for it.
    
    This patch adds a test to see whether the legacy code can be used.
    
    Issue reported and fix tested by Andrew Morgan <morgan at orst.edu>.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11788
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sun Mar 13 01:37:58 CET 2016 on sn-devel-144
    
    (cherry picked from commit 0a9acd445d246c7758e994b0c69cc90bdbbef2fe)

commit 12c02486c6b6f05f85ce70eb82a2431da428b5c9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 10 12:17:43 2016 +0100

    s3:winbindd: don't unclude two '\0' at the end of the domain list
    
    This avoids a scary "trustdom_list_done: Got invalid trustdom response" message.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11782
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: G√ľnther Deschner <gd at samba.org>
    (cherry picked from commit bb387c5b90e19b5a2f7d65fb8db816e9da51d090)

commit 596a51e0d7fc535b9aa71ea640894bf0ad3c0b2f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 11 14:27:53 2016 +1300

    smbd: Only check dev/inode in open_directory, not the full stat()
    
    This is needed because the smb2.create.mkdir-dup test creates a race,
    and against an AD DC this can cause a flapping test if the lstat() and
    stat() calls are made either side of the chown() due to creation of a
    file by administrator.
    
    Fix based on original patches by myself, by Douglas Bagnall
    <douglas.bagnall at catalyst.net.nz>.  and Jeremy Allison <jra at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11780
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Mar 12 09:43:21 CET 2016 on sn-devel-144
    
    (cherry picked from commit 5fc6d2dabdf2aeef74fdefaa67eae0348bbf7a44)

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/open.c              |  14 +++-
 source3/winbindd/winbindd_misc.c |   2 +-
 source3/wscript                  |  24 ++++++
 source3/wscript_build            |   1 +
 tests/oldquotas.c                | 174 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 212 insertions(+), 3 deletions(-)
 create mode 100644 tests/oldquotas.c


Changeset truncated at 500 lines:

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index eb6058f..5cf0f44 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3622,8 +3622,18 @@ static NTSTATUS open_directory(connection_struct *conn,
 		return status;
 	}
 
-	/* Ensure there was no race condition. */
-	if (!check_same_stat(&smb_dname->st, &fsp->fsp_name->st)) {
+	if(!S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
+		DEBUG(5,("open_directory: %s is not a directory !\n",
+			 smb_fname_str_dbg(smb_dname)));
+                fd_close(fsp);
+                file_free(req, fsp);
+		return NT_STATUS_NOT_A_DIRECTORY;
+	}
+
+	/* Ensure there was no race condition.  We need to check
+	 * dev/inode but not permissions, as these can change
+	 * legitimately */
+	if (!check_same_dev_ino(&smb_dname->st, &fsp->fsp_name->st)) {
 		DEBUG(5,("open_directory: stat struct differs for "
 			"directory %s.\n",
 			smb_fname_str_dbg(smb_dname)));
diff --git a/source3/winbindd/winbindd_misc.c b/source3/winbindd/winbindd_misc.c
index d32a71e..df43d20 100644
--- a/source3/winbindd/winbindd_misc.c
+++ b/source3/winbindd/winbindd_misc.c
@@ -214,7 +214,7 @@ enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *
 		extra_data[extra_data_len-1] = '\0';
 
 		state->response->extra_data.data = extra_data;
-		state->response->length += extra_data_len+1;
+		state->response->length += extra_data_len;
 	}
 
 	return WINBINDD_OK;
diff --git a/source3/wscript b/source3/wscript
index 4e940fa..1a31fb2 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1377,6 +1377,7 @@ main() {
     conf.CHECK_FUNCS_IN('getspnam', 'security')
     conf.CHECK_FUNCS_IN('getspnam', 'sec')
 
+    legacy_quota_libs = ''
     if Options.options.with_quotas:
         # For quotas on Veritas VxFS filesystems
         conf.CHECK_HEADERS('sys/fs/vx_quota.h')
@@ -1457,6 +1458,29 @@ main() {
             conf.DEFINE('HAVE_SYS_QUOTAS', '1')
             conf.DEFINE('WITH_QUOTAS', '1')
 
+        #
+        # check if Legacy quota code can be brought in
+        # if standard interfaces are not supported
+        #
+        if not conf.CONFIG_SET('WITH_QUOTAS'):
+            if host_os.rfind('sunos5') > -1:
+                conf.DEFINE('SUNOS5', '1')
+                legacy_quota_libs = 'nsl'
+            conf.CHECK_CODE('''
+            #define WITH_QUOTAS 1
+            #define AUTOCONF_TEST 1
+            #include "../tests/oldquotas.c"
+            ''',
+                            cflags=conf.env['WERROR_CFLAGS'],
+                            define='WITH_QUOTAS',
+                            lib=legacy_quota_libs,
+                            msg='Checking whether legacy quota code can be used',
+                            execute=False,
+                            addmain=False)
+            if not conf.CONFIG_SET('WITH_QUOTAS'):
+                legacy_quota_libs = ''
+    conf.env['legacy_quota_libs'] = legacy_quota_libs
+
     #
     # cluster support (CTDB)
     #
diff --git a/source3/wscript_build b/source3/wscript_build
index ba670d3..09da206 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -641,6 +641,7 @@ bld.SAMBA3_LIBRARY('smbd_base',
                    notifyd
                    ''' +
                    bld.env['dmapi_lib'] +
+                   bld.env['legacy_quota_libs'] +
                    NOTIFY_DEPS,
                    private_library=True)
 
diff --git a/tests/oldquotas.c b/tests/oldquotas.c
new file mode 100644
index 0000000..bdb2beb
--- /dev/null
+++ b/tests/oldquotas.c
@@ -0,0 +1,174 @@
+/* this test should find out whether legacy quota code in disk_quotas.c
+ * compiles. It is a stripped-down version of disk_quotas.c, with samba
+ * stuff removed and only system calls, header files, and constants left.
+ */
+
+#ifndef HAVE_SYS_QUOTAS
+
+/* just a quick hack because sysquotas.h is included before linux/quota.h */
+#ifdef QUOTABLOCK_SIZE
+#undef QUOTABLOCK_SIZE
+#endif
+
+#ifdef WITH_QUOTAS
+
+#if defined(VXFS_QUOTA)
+
+bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
+		      uint64_t *dfree, uint64_t *dsize);
+
+#endif /* VXFS_QUOTA */
+
+#if defined(SUNOS5) || defined(SUNOS4)
+
+#include <fcntl.h>
+#include <sys/param.h>
+#if defined(SUNOS5)
+#include <sys/fs/ufs_quota.h>
+#include <sys/mnttab.h>
+#include <sys/mntent.h>
+#else /* defined(SUNOS4) */
+#include <ufs/quota.h>
+#include <mntent.h>
+#endif
+
+#if defined(SUNOS5)
+
+/****************************************************************************
+ Allows querying of remote hosts for quotas on NFS mounted shares.
+ Supports normal NFS and AMD mounts.
+ Alan Romeril <a.romeril at ic.ac.uk> July 2K.
+****************************************************************************/
+
+#include <rpc/rpc.h>
+#include <rpc/types.h>
+#include <rpcsvc/rquota.h>
+#include <rpc/nettype.h>
+#include <rpc/xdr.h>
+
+static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize,
+		       uint64_t *dfree, uint64_t *dsize)
+{
+	CLIENT *clnt;
+	clnt = clnt_create("host", RQUOTAPROG, RQUOTAVERS, "udp");
+	return true;
+}
+#endif
+
+/****************************************************************************
+try to get the disk space from disk quotas (SunOS & Solaris2 version)
+Quota code by Peter Urbanec (amiga at cse.unsw.edu.au).
+****************************************************************************/
+
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
+		 uint64_t *dsize)
+{
+	int ret;
+#if defined(SUNOS5)
+	struct quotctl command;
+#else /* SunOS4 */
+	struct mntent *mnt;
+#endif
+#if defined(SUNOS5)
+	nfs_quotas("", 0, bsize, dfree, dsize);
+
+	command.op = Q_GETQUOTA;
+	command.uid = 0;
+	command.addr = NULL;
+	ret = ioctl(1, Q_QUOTACTL, &command);
+#else
+	ret = quotactl(Q_GETQUOTA, "", 0, NULL);
+#endif
+
+#if defined(SUNOS5) && defined(VXFS_QUOTA)
+	disk_quotas_vxfs("", path, bsize, dfree, dsize);
+#endif
+	return true;
+}
+
+#else
+
+#if AIX
+/* AIX quota patch from Ole Holm Nielsen <ohnielse at fysik.dtu.dk> */
+#include <jfs/quota.h>
+/* AIX 4.X: Rename members of the dqblk structure (ohnielse at fysik.dtu.dk) */
+#define dqb_curfiles dqb_curinodes
+#define dqb_fhardlimit dqb_ihardlimit
+#define dqb_fsoftlimit dqb_isoftlimit
+#ifdef _AIXVERSION_530
+#include <sys/statfs.h>
+#include <sys/vmount.h>
+#endif /* AIX 5.3 */
+#else  /* !AIX */
+#include <sys/quota.h>
+#include <devnm.h>
+#endif
+
+/****************************************************************************
+try to get the disk space from disk quotas - default version
+****************************************************************************/
+
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
+		 uint64_t *dsize)
+{
+	struct dqblk D;
+#if defined(AIX)
+#ifdef _AIXVERSION_530
+	quota64_t user_quota;
+	quotactl(path, QCMD(Q_J2GETQUOTA, USRQUOTA), 0, (char *)&user_quota);
+#endif /* AIX 5.3 */
+	quotactl(path, QCMD(Q_GETQUOTA, USRQUOTA), 0, (char *)&D);
+#else  /* !AIX */
+	quotactl(Q_GETQUOTA, "", 0, &D);
+#endif /* !AIX */
+	return (true);
+}
+
+#endif
+
+#if defined(VXFS_QUOTA)
+
+#if defined(SUNOS5)
+
+#include <sys/fs/vx_solaris.h>
+#include <sys/fs/vx_machdep.h>
+#include <sys/fs/vx_layout.h>
+#include <sys/fs/vx_quota.h>
+#include <sys/fs/vx_aioctl.h>
+#include <sys/fs/vx_ioctl.h>
+
+bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
+		      uint64_t *dfree, uint64_t *dsize)
+{
+	struct vx_dqblk D;
+	struct vx_quotctl quotabuf;
+	struct vx_genioctl genbuf;
+
+	genbuf.ioc_cmd = VX_QUOTACTL;
+	genbuf.ioc_up = (void *)"abuf;
+
+	quotabuf.cmd = VX_GETQUOTA;
+	quotabuf.uid = 0;
+	quotabuf.addr = (caddr_t)&D;
+	ret = ioctl(1, VX_ADMIN_IOCTL, &genbuf);
+
+	return true;
+}
+
+#endif /* SUNOS5 || ... */
+
+#endif /* VXFS_QUOTA */
+
+#else /* WITH_QUOTAS */
+
+#error "This test should be called with WITH_QUOTAS defined"
+
+#endif /* WITH_QUOTAS */
+
+#else /* HAVE_SYS_QUOTAS */
+
+#error "This test should not be called for systems with new quota interface"
+
+#endif /* HAVE_SYS_QUOTAS */
+
+int main() { return disk_quotas(NULL, NULL, NULL, NULL); }


-- 
Samba Shared Repository



More information about the samba-cvs mailing list