[SCM] Samba Shared Repository - branch master updated

Björn Jacke bjacke at samba.org
Sun Feb 17 14:06:02 UTC 2019


The branch, master has been updated
       via  a87660b3c47 third_party/nss_wrapper/wscript: check for libnsl and libsocket
       via  b8bf7ef87e2 waf: add library dependency for sendfile on Solaris
       via  44ccba4088f third_party/nss_wrapper/wscript: fix check for gethostbyname
       via  c9bcde012e1 waf: fix setting of RPATH_ST variable
       via  f2c3d2b262d wafsamba: we should also remove stale symlinks here
       via  7058a88cbe3 waf: print the library name in which we search for a function
       via  918bf89dc76 waf: use the correct WERROR_CFLAGS in CHECK_CODE
       via  99dd2ae8107 waf: remove redundant WERROR flag
       via  c1715406f5b waf: remove duplicate WERROR cflags
       via  2ba972e90f2 waf: fix compiler warnings in configure checks
       via  decba07b092 waf: fix WERROR_CFLAGS check
       via  6e72fe8450d waf: fix some missing newline compiler warnings
       via  e8d1e04bb64 sysquotas_4B: raise log level of a sometimes too noisy message
       via  e2cc29daf73 waf/quotas: fail configure when quotas were requested but not found
       via  7859ebc55a4 quotas: remove legacy AIX quota code that is covered by sysquotas now
       via  0c9c51fa7a6 tests/sysquotas.c: include jfs/quota.h for 4B test on AIX
       via  204a03e0bba add sysquotas_jfs2.c
       via  c143de9af7f sysquotas_4B: enable for jfs/quota.h on AIX
       via  0d815dbb101 sysquotas_4B: make quota block calculation adopt to platform quota block size
       via  21e930adecf waf: check for jfs/quota.h
       via  2eca1a66764 sysquotas.h: collect more platform quotablock sizes
       via  56c198c0056 tests/quota: tidy up includes of sysquotas 4B
       via  e4abe870824 sysquotas_nfs: also honor reported inode/file limits
       via  28da0723193 sysquotas_xfs: fix inode limit setting, which is not depeding on blocksize
       via  99742c86a1b sysquotas_linux: fix inode limit setting, which is not depeding on blocksize
       via  bc2cc68713b ntquotas: do not set inode limits when setting space quota
       via  2888bee43cb replace: remove needless vxfs header file check
       via  cd1ac3668cd sambaundoguididx: use the right escaped oder unescaped sam ldb files
      from  8eac5a6bd5f .gitignore: add ignore rules for a few dev tools

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a87660b3c47e5bb362a89ad83f7deb2c8306aa24
Author: Björn Jacke <bj at sernet.de>
Date:   Sat Feb 16 01:23:29 2019 +0100

    third_party/nss_wrapper/wscript: check for libnsl and libsocket
    
    this is needed as there are HAVE_LIBNSL and HAVE_LIBSOCKET in the code and
    Samba fails to build in a terrible obscure way on Solaris if this is not
    working inside nss_wrapper here.
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Björn Jacke <bjacke at samba.org>
    Autobuild-Date(master): Sun Feb 17 15:05:20 CET 2019 on sn-devel-144

commit b8bf7ef87e29daa18b079d221ffa3252d1719f2a
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 22:38:49 2019 +0100

    waf: add library dependency for sendfile on Solaris
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 44ccba4088ff1b653dd4735ca8bf13181a31dbfe
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 02:02:06 2019 +0100

    third_party/nss_wrapper/wscript: fix check for gethostbyname
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit c9bcde012e18446e3081e190c0a0858b37fda14c
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 03:41:50 2019 +0100

    waf: fix setting of RPATH_ST variable
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit f2c3d2b262d435e75debb00a43ed8d038f203abe
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Feb 11 15:30:24 2019 +0100

    wafsamba: we should also remove stale symlinks here
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 7058a88cbe3c1a2ad272b6debc1c9d09a259d116
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Feb 11 10:03:00 2019 +0100

    waf: print the library name in which we search for a function
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 918bf89dc760e007a36c90be34b4627eb2141157
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 01:29:22 2019 +0100

    waf: use the correct WERROR_CFLAGS in CHECK_CODE
    
    all the non gcc version were incorrectly set here till now
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 99dd2ae81079dd210612d97242ffc1835a23fdf0
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 00:47:59 2019 +0100

    waf: remove redundant WERROR flag
    
    CHECK_CFLAGS always uses WERROR flags
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit c1715406f5b66b73395c9155f782b5aaa9ea51e6
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 00:44:14 2019 +0100

    waf: remove duplicate WERROR cflags
    
    WERROR flags are already added by the strict=True switch.
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 2ba972e90f244089a1bc21f940c4edb75ae4e089
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 00:07:57 2019 +0100

    waf: fix compiler warnings in configure checks
    
    the studio compiler issued here:
    
    warning: statement not reached
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit decba07b092791d0f17b44b9c2a595545a34d93b
Author: Björn Jacke <bj at sernet.de>
Date:   Sat Feb 9 01:33:13 2019 +0100

    waf: fix WERROR_CFLAGS check
    
    if we found the right WERROR flags of the compiler then the compiler is right
    to fail because we explicitly give it an empty file to compile. We
    should not do that because that makes the almost successful test fail.
    This fixed the studio compiler test.
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 6e72fe8450d86fd6649dad7fbbc12655c36b0738
Author: Björn Jacke <bj at sernet.de>
Date:   Sat Feb 9 01:30:50 2019 +0100

    waf: fix some missing newline compiler warnings
    
    without a trailing newline the studio compiler issues:
    
    warning: newline not last character in file
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit e8d1e04bb64ea5e6cc17bf4a996fdee770a81967
Author: Björn Jacke <bj at sernet.de>
Date:   Tue Feb 12 19:07:38 2019 +0100

    sysquotas_4B: raise log level of a sometimes too noisy message
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit e2cc29daf7390b037014ebca67fa4480a1648787
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Feb 7 04:39:04 2019 +0100

    waf/quotas: fail configure when quotas were requested but not found
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 7859ebc55a4a61747902921c7616f77a0c73934e
Author: Bjoern Jacke <bj at sernet.de>
Date:   Wed Jan 30 21:57:38 2019 -0600

    quotas: remove legacy AIX quota code that is covered by sysquotas now
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 0c9c51fa7a69e1807c773a04247828046e98c7fc
Author: Bjoern Jacke <bj at sernet.de>
Date:   Wed Jan 30 18:35:55 2019 -0600

    tests/sysquotas.c: include jfs/quota.h for 4B test on AIX
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 204a03e0bba636d22b352d159815d2ed0be07354
Author: Bjoern Jacke <bj at sernet.de>
Date:   Tue Feb 5 16:52:33 2019 -0600

    add sysquotas_jfs2.c
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit c143de9af7f31b2ab9c85dee7c06b6b9cb2659d0
Author: Bjoern Jacke <bj at sernet.de>
Date:   Wed Jan 30 18:33:55 2019 -0600

    sysquotas_4B: enable for jfs/quota.h on AIX
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 0d815dbb10188ec7b9bd505668fe75b274b43fec
Author: Bjoern Jacke <bj at sernet.de>
Date:   Tue Feb 5 17:23:35 2019 -0600

    sysquotas_4B: make quota block calculation adopt to platform quota block size
    
    the correct QUOTABLOCK_SIZE for platform is taken from sysquotas.h
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 21e930adecf9307666c088e8e9a46e3a56eb6cdd
Author: Bjoern Jacke <bj at sernet.de>
Date:   Wed Jan 30 18:27:12 2019 -0600

    waf: check for jfs/quota.h
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 2eca1a6676401bdb33c53e3d435cc4f88e1eae26
Author: Bjoern Jacke <bj at sernet.de>
Date:   Thu Jan 31 12:01:36 2019 -0600

    sysquotas.h: collect more platform quotablock sizes
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 56c198c0056d57e767ab67bc4bbcab11afbc8f05
Author: Bjoern Jacke <bj at sernet.de>
Date:   Wed Jan 30 17:55:06 2019 -0600

    tests/quota: tidy up includes of sysquotas 4B
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit e4abe87082450dc3392365dd5e02cc2ff42545cd
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Feb 10 00:51:23 2019 +0100

    sysquotas_nfs: also honor reported inode/file limits
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 28da07231936dc8565a2ce2040ebad7b5e8da2e7
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Feb 7 04:23:13 2019 +0100

    sysquotas_xfs: fix inode limit setting, which is not depeding on blocksize
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit 99742c86a1b0aae983165f6010c4db3647a32d36
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Feb 7 03:35:01 2019 +0100

    sysquotas_linux: fix inode limit setting, which is not depeding on blocksize
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit bc2cc68713bcf4d8752cd33776f0bf9e36a4e8e3
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Feb 14 12:09:38 2019 +0100

    ntquotas: do not set inode limits when setting space quota
    
    we are supposed to set a space quota limit, we should not calculate an
    additional artifical inode limit out of that.
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>

commit 2888bee43cb387f8d1037d017582e84160c3fd08
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Feb 6 22:53:00 2019 +0100

    replace: remove needless vxfs header file check
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>

commit cd1ac3668cd164bd5f7cadf7b59df9541aaef83e
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Jan 23 14:01:26 2019 +0100

    sambaundoguididx: use the right escaped oder unescaped sam ldb files
    
    the correct filename is taken from the partition database before, we should not
    unescape that because this can result in a new unescaped ldb file being created
    and the script not to work at all.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13759
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 buildtools/wafsamba/samba_autoconf.py  |  16 ++--
 buildtools/wafsamba/samba_conftests.py |  13 +--
 buildtools/wafsamba/wafsamba.py        |   2 +-
 buildtools/wafsamba/wscript            |  17 ++--
 lib/replace/system/filesys.h           |   8 --
 lib/replace/wscript                    |   2 +-
 lib/smbconf/wscript_build              |   2 +-
 source3/include/proto.h                |   3 +
 source3/include/sysquotas.h            |  10 +++
 source3/lib/sysquotas.c                |   3 +
 source3/lib/sysquotas_4B.c             |  51 ++++++-----
 source3/lib/sysquotas_jfs2.c           | 150 +++++++++++++++++++++++++++++++++
 source3/lib/sysquotas_linux.c          |   6 +-
 source3/lib/sysquotas_nfs.c            |   3 +
 source3/lib/sysquotas_xfs.c            |   6 +-
 source3/smbd/ntquotas.c                |  15 ----
 source3/smbd/quotas.c                  | 122 ---------------------------
 source3/wscript                        |  11 ++-
 source3/wscript_build                  |   1 +
 source4/scripting/bin/sambaundoguididx |   3 +-
 tests/sysquotas.c                      |   8 +-
 third_party/nss_wrapper/wscript        |   5 +-
 22 files changed, 243 insertions(+), 214 deletions(-)
 create mode 100644 source3/lib/sysquotas_jfs2.c


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 6208e3b0439..ee1fc231eb9 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -97,7 +97,7 @@ def CHECK_HEADER(conf, h, add_headers=False, lib=None):
     hdrs = hlist_to_string(conf, headers=h)
     if lib is None:
         lib = ""
-    ret = conf.check(fragment='%s\nint main(void) { return 0; }' % hdrs,
+    ret = conf.check(fragment='%s\nint main(void) { return 0; }\n' % hdrs,
                      type='nolink',
                      execute=0,
                      cflags=ccflags,
@@ -251,7 +251,10 @@ def CHECK_FUNC(conf, f, link=True, lib=None, headers=None):
 
     ret = False
 
-    conf.COMPOUND_START('Checking for %s' % f)
+    in_lib_str = ""
+    if lib:
+        in_lib_str = " in %s" % lib
+    conf.COMPOUND_START('Checking for %s%s' % (f, in_lib_str))
 
     if link is None or link:
         ret = CHECK_CODE(conf,
@@ -397,13 +400,8 @@ def CHECK_CODE(conf, code, define,
     # Be strict when relying on a compiler check
     # Some compilers (e.g. xlc) ignore non-supported features as warnings
     if strict:
-        extra_cflags = None
-        if conf.env["CC_NAME"] == "gcc":
-            extra_cflags = "-Werror"
-        elif conf.env["CC_NAME"] == "xlc":
-            extra_cflags = "-qhalt=w"
-        if extra_cflags:
-            cflags.append(extra_cflags)
+        if 'WERROR_CFLAGS' in conf.env:
+            cflags.extend(conf.env['WERROR_CFLAGS'])
 
     if local_include:
         cflags.append('-I%s' % conf.path.abspath())
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index 7d9b5316902..ef632ba9033 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -86,7 +86,7 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
     '''see what we need for largefile support'''
     getconf_cflags = conf.CHECK_COMMAND(['getconf', 'LFS_CFLAGS']);
     if getconf_cflags is not False:
-        if (conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+        if (conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                             define='WORKING_GETCONF_LFS_CFLAGS',
                             execute=True,
                             cflags=getconf_cflags,
@@ -101,13 +101,13 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
                     else:
                         conf.DEFINE(flag_split[0], flag_split[1])
 
-    if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+    if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                        define,
                        execute=True,
                        msg='Checking for large file support without additional flags'):
         return True
 
-    if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+    if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                        define,
                        execute=True,
                        cflags='-D_FILE_OFFSET_BITS=64',
@@ -115,7 +115,7 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
         conf.DEFINE('_FILE_OFFSET_BITS', 64)
         return True
 
-    if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+    if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                        define,
                        execute=True,
                        cflags='-D_LARGE_FILES',
@@ -258,7 +258,8 @@ int foo(int v) {
     environ[0] = 1;
     ldb_module = PyImport_ImportModule("ldb");
     return v * 2;
-}'''
+}
+'''
     return conf.check(features='c cshlib',uselib='PYEMBED',fragment=snip,msg=msg, mandatory=False)
 
 # this one is quite complex, and should probably be broken up
@@ -463,7 +464,7 @@ def CHECK_INLINE(conf):
         ret = conf.CHECK_CODE('''
         typedef int foo_t;
         static %s foo_t static_foo () {return 0; }
-        %s foo_t foo () {return 0; }''' % (i, i),
+        %s foo_t foo () {return 0; }\n''' % (i, i),
                               define='INLINE_MACRO',
                               addmain=False,
                               link=False)
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 70ab736e2a7..1b98e1ceb2c 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -740,7 +740,7 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
         link_dst = os.path.join(tgtdir, os.path.basename(iname))
         if os.path.islink(link_dst) and os.readlink(link_dst) == link_src:
             continue
-        if os.path.exists(link_dst):
+        if os.path.islink(link_dst):
             os.unlink(link_dst)
         Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname))
         symlink(link_src, link_dst)
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 57d8a1504e1..ab19859a83f 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -308,15 +308,16 @@ def configure(conf):
               "-qhalt=w",     # IBM xlc
               "-w2",           # Tru64
              ]:
-        if conf.CHECK_CFLAGS([f], '''
-'''):
+        if conf.CHECK_CFLAGS([f]):
             if not 'WERROR_CFLAGS' in conf.env:
                 conf.env['WERROR_CFLAGS'] = []
             conf.env['WERROR_CFLAGS'].extend([f])
             break
 
     # check which compiler/linker flags are needed for rpath support
-    if not conf.CHECK_LDFLAGS(['-Wl,-rpath,.']) and conf.CHECK_LDFLAGS(['-Wl,-R,.']):
+    if conf.CHECK_LDFLAGS(['-Wl,-rpath,.']):
+        conf.env['RPATH_ST'] = '-Wl,-rpath,%s'
+    elif conf.CHECK_LDFLAGS(['-Wl,-R,.']):
         conf.env['RPATH_ST'] = '-Wl,-R,%s'
 
     # check for rpath
@@ -348,10 +349,10 @@ def configure(conf):
     else:
         conf.env.HAVE_LD_VERSION_SCRIPT = False
 
-    if conf.CHECK_CFLAGS(['-fvisibility=hidden'] + conf.env.WERROR_CFLAGS):
+    if conf.CHECK_CFLAGS(['-fvisibility=hidden']):
         conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
         conf.CHECK_CODE('''int main(void) { return 0; }
-                           __attribute__((visibility("default"))) void vis_foo2(void) {}''',
+                           __attribute__((visibility("default"))) void vis_foo2(void) {}\n''',
                         cflags=conf.env.VISIBILITY_CFLAGS,
                         strict=True,
                         define='HAVE_VISIBILITY_ATTR', addmain=False)
@@ -450,7 +451,7 @@ def configure(conf):
     # See memset_s() details here:
     # https://en.cppreference.com/w/c/string/byte/memset
     #
-    if conf.CHECK_CFLAGS(['-D__STDC_WANT_LIB_EXT1__=1'] + conf.env.WERROR_CFLAGS):
+    if conf.CHECK_CFLAGS(['-D__STDC_WANT_LIB_EXT1__=1']):
         conf.ADD_CFLAGS('-D__STDC_WANT_LIB_EXT1__=1')
 
     # on Tru64 certain features are only available with _OSF_SOURCE set to 1
@@ -521,7 +522,7 @@ struct foo bar = { .y = 'X', .x = 1 };
                         #if !defined(LITTLE) || !defined(B) || LITTLE != B
                         #error Not little endian.
                         #endif
-                        int main(void) { return 0; }""",
+                        int main(void) { return 0; }\n""",
                             addmain=False,
                             headers="endian.h sys/endian.h",
                             define="HAVE_LITTLE_ENDIAN")
@@ -540,7 +541,7 @@ struct foo bar = { .y = 'X', .x = 1 };
                         #if !defined(BIG) || !defined(B) || BIG != B
                         #error Not big endian.
                         #endif
-                        int main(void) { return 0; }""",
+                        int main(void) { return 0; }\n""",
                             addmain=False,
                             headers="endian.h sys/endian.h",
                             define="HAVE_BIG_ENDIAN")
diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h
index b9ce41a4b38..1a8cb68103d 100644
--- a/lib/replace/system/filesys.h
+++ b/lib/replace/system/filesys.h
@@ -107,14 +107,6 @@
 #include <sys/uio.h>
 #endif
 
-/*
- * Veritas File System.  Often in addition to native.
- * Quotas different.
- */
-#if defined(HAVE_SYS_FS_VX_QUOTA_H)
-#define VXFS_QUOTA
-#endif
-
 #if defined(HAVE_SYS_ATTRIBUTES_H)
 #include <sys/attributes.h>
 #elif defined(HAVE_ATTR_ATTRIBUTES_H)
diff --git a/lib/replace/wscript b/lib/replace/wscript
index a7fd25d15bc..1d01e1e2b55 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -41,7 +41,7 @@ def configure(conf):
     conf.CHECK_HEADERS('shadow.h sys/acl.h')
     conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h')
     conf.CHECK_HEADERS('port.h')
-    conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h sys/fs/vx/quota.h')
+    conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h')
     conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h')
     conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h')
     conf.CHECK_HEADERS('sys/vfs.h sys/xattr.h termio.h termios.h sys/file.h')
diff --git a/lib/smbconf/wscript_build b/lib/smbconf/wscript_build
index 9879624726b..4f9930a1ae0 100644
--- a/lib/smbconf/wscript_build
+++ b/lib/smbconf/wscript_build
@@ -1,5 +1,5 @@
 bld.SAMBA_SUBSYSTEM('LIBSMBCONF',
                     source='smbconf.c smbconf_txt.c smbconf_util.c',
-                    deps='talloc'
+                    deps='talloc sendfile'
                     )
 
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9d6192967ba..93d01a06be0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -203,6 +203,9 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
 int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
 int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
 
+int sys_get_jfs2_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
+int sys_set_jfs2_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
+
 int sys_get_nfs_quota(const char *path, const char *bdev,
 		      enum SMB_QUOTA_TYPE qtype,
 		      unid_t id, SMB_DISK_QUOTA *dp);
diff --git a/source3/include/sysquotas.h b/source3/include/sysquotas.h
index 71d5e9b2640..7ba631e4e76 100644
--- a/source3/include/sysquotas.h
+++ b/source3/include/sysquotas.h
@@ -69,7 +69,17 @@ typedef struct _SMB_DISK_QUOTA {
 } SMB_DISK_QUOTA;
 
 #ifndef QUOTABLOCK_SIZE
+#if defined(DQBSIZE)                          /* AIX */
+#define QUOTABLOCK_SIZE    DQBSIZE
+#elif defined(QIF_DQBLKSIZE)                  /* Linux */
+#define QUOTABLOCK_SIZE    QIF_DQBLKSIZE
+#elif defined(HAVE_STRUCT_DQBLK_DQB_CURBYTES) /*Darwin */
+#define QUOTABLOCK_SIZE 1
+#elif defined(HAVE_UFS_UFS_QUOTA_H)           /* BSDs */
+#define QUOTABLOCK_SIZE 512
+#else
 #define QUOTABLOCK_SIZE 1024
 #endif
+#endif /* QUOTABLOCK_SIZE */
 
 #endif /*_SYSQUOTAS_H */
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index 9b2d37b8375..40b421c056f 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -227,6 +227,9 @@ static struct {
 	int (*get_quota)(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
 	int (*set_quota)(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
 } sys_quota_backends[] = {
+#ifdef HAVE_JFS_QUOTA_H
+	{"jfs2", sys_get_jfs2_quota, 	sys_set_jfs2_quota},
+#endif
 #if defined HAVE_XFS_QUOTAS
 	{"xfs", sys_get_xfs_quota, 	sys_set_xfs_quota},
 	{"gfs", sys_get_xfs_quota, 	sys_set_xfs_quota},
diff --git a/source3/lib/sysquotas_4B.c b/source3/lib/sysquotas_4B.c
index ee56432211e..d9beb924ad9 100644
--- a/source3/lib/sysquotas_4B.c
+++ b/source3/lib/sysquotas_4B.c
@@ -47,11 +47,20 @@
 #include <ufs/ufs/quota.h>
 #endif
 
+#ifdef HAVE_JFS_QUOTA_H
+#include <jfs/quota.h>
+#endif
+
 #if defined(DARWINOS)
 /* WorkARound broken HFS access checks in hfs_quotactl. Darwin only(?) */
 #define HFS_QUOTACTL_WAR 1
 #endif
 
+#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
+/* we handle the byte vs. block count dynamically via QUOTABLOCK_SIZE 1 */
+#define dqb_curblocks dqb_curbytes
+#endif
+
 static void xlate_qblk_to_smb(const struct dqblk * const qblk,
 			SMB_DISK_QUOTA *dp)
 {
@@ -59,35 +68,25 @@ static void xlate_qblk_to_smb(const struct dqblk * const qblk,
 
 	DEBUG(10, ("unix softlimit=%u hardlimit=%u curblock=%u\n",
 	    (unsigned)qblk->dqb_bsoftlimit, (unsigned)qblk->dqb_bhardlimit,
-#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
-	    (unsigned)qblk->dqb_curbytes));
-#else
 	    (unsigned)qblk->dqb_curblocks));
-#endif
 
 	DEBUGADD(10, ("unix softinodes=%u hardinodes=%u curinodes=%u\n",
 	    (unsigned)qblk->dqb_isoftlimit, (unsigned)qblk->dqb_ihardlimit,
 	    (unsigned)qblk->dqb_curinodes));
 
-#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
-	/* On Darwin, quotas are counted in bytes. We report them
-	 * in 512b blocks because various callers have assumptions
-	 * about the block size.
-	 */
-#define XLATE_TO_BLOCKS(bytes) (((bytes) + 1) / 512)
-	dp->bsize = 512;
-
-	dp->softlimit = XLATE_TO_BLOCKS(qblk->dqb_bsoftlimit);
-	dp->hardlimit = XLATE_TO_BLOCKS(qblk->dqb_bhardlimit);
-	dp->curblocks = XLATE_TO_BLOCKS(qblk->dqb_curbytes);
-#undef XLATE_TO_BLOCKS
-#else
-	dp->bsize = DEV_BSIZE;
+	dp->bsize = QUOTABLOCK_SIZE;
 
 	dp->softlimit = qblk->dqb_bsoftlimit;
 	dp->hardlimit = qblk->dqb_bhardlimit;
 	dp->curblocks = qblk->dqb_curblocks;
+/* our Darwin quotas used to never return 0byte usage but this is probably not needed,
+ * let's comment this out for now
+#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
+	if (dp->curblocks == 0) {
+		dp->curblocks = 1;
+	}
 #endif
+ */
 
 	dp->ihardlimit = qblk->dqb_ihardlimit;
 	dp->isoftlimit = qblk->dqb_isoftlimit;
@@ -110,13 +109,13 @@ static void xlate_smb_to_qblk(const SMB_DISK_QUOTA * const dp,
 {
 	ZERO_STRUCTP(qblk);
 
-	qblk->dqb_bsoftlimit = dp->softlimit;
-	qblk->dqb_bhardlimit = dp->hardlimit;
-#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
-	/* On Darwin, quotas are counted in bytes. */
-	qblk->dqb_bsoftlimit *= dp->bsize;
-	qblk->dqb_bhardlimit *= dp->bsize;
-#endif
+	if (dp->bsize == QUOTABLOCK_SIZE) {
+		qblk->dqb_bsoftlimit = dp->softlimit;
+		qblk->dqb_bhardlimit = dp->hardlimit;
+	} else {
+		qblk->dqb_bsoftlimit = dp->softlimit * dp->bsize / QUOTABLOCK_SIZE;
+		qblk->dqb_bhardlimit = dp->hardlimit * dp->bsize / QUOTABLOCK_SIZE;
+	}
 	qblk->dqb_ihardlimit = dp->ihardlimit;
 	qblk->dqb_isoftlimit = dp->isoftlimit;
 }
@@ -142,7 +141,7 @@ static int sys_quotactl_4B(const char * path, int cmd,
 		 * means that quotas are not configured (commonly).
 		 */
 		if (errno != ENOTSUP && errno != EINVAL) {
-			DEBUG(0, ("failed to %s quota for %s ID %u on %s: %s\n",
+			DEBUG(5, ("failed to %s quota for %s ID %u on %s: %s\n",
 				    (cmd & QCMD(Q_GETQUOTA, 0)) ? "get" : "set",
 				    (cmd & QCMD(0, GRPQUOTA)) ? "group" : "user",
 				    (unsigned)id, path, strerror(errno)));
diff --git a/source3/lib/sysquotas_jfs2.c b/source3/lib/sysquotas_jfs2.c
new file mode 100644
index 00000000000..999b7e08941
--- /dev/null
+++ b/source3/lib/sysquotas_jfs2.c
@@ -0,0 +1,150 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * System QUOTA function wrappers for JFS2 on AIX
+
+ * Copyright (C) 2019 Bjoern Jacke
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_QUOTA
+
+#if defined(HAVE_JFS_QUOTA_H)
+#include <jfs/quota.h>
+
+#if defined(Q_J2GETQUOTA) /* when have JFS2 */
+
+/* int quotactl(const char *path, int cmd, int id, char *addr)
+ *
+ * This is very similar to sysquotas_4B but JFS2 has different quota cmds
+ * (why?) and for some reason wants root even for querying your own quota,
+ * which seems to be an AIX bug because the docs say root is only
+ * required for querying other users' quota
+ */
+
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_JFS_QUOTA_H
+#include <jfs/quota.h>
+#endif
+
+
+static int sys_quotactl_JFS2(const char * path, int cmd,
+		int id, quota64_t *quota)
+{
+	int ret;
+
+	/* NB: We must test GRPQUOTA here, because USRQUOTA is 0. */
+	DEBUG(10, ("%s quota for %s ID %u on %s\n",
+		    (cmd & QCMD(Q_J2GETQUOTA, 0)) ? "getting" : "setting",
+		    (cmd & QCMD(0, GRPQUOTA)) ? "group" : "user",
+		    (unsigned)id, path));
+
+	become_root();
+
+	ret = quotactl((char *) path, cmd, id, (char *) quota);
+	if (ret == -1) {
+		/* ENOTSUP means quota support is not compiled in. EINVAL
+		 * means that quotas are not configured (commonly).
+		 */
+		if (errno != ENOTSUP && errno != EINVAL) {
+			DEBUG(0, ("failed to %s quota for %s ID %u on %s: %s\n",
+				    (cmd & QCMD(Q_J2GETQUOTA, 0)) ? "get" : "set",
+				    (cmd & QCMD(0, GRPQUOTA)) ? "group" : "user",
+				    (unsigned)id, path, strerror(errno)));
+		}
+	}
+
+	unbecome_root();
+
+	return ret;
+}
+
+
+int sys_get_jfs2_quota(const char *path, const char *bdev,
+	enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp)
+{
+	int ret;
+	quota64_t quota;
+
+	ZERO_STRUCT(quota);
+
+	switch (qtype) {
+	case SMB_USER_QUOTA_TYPE:
+		/* Get quota for provided UID. */
+		ret = sys_quotactl_JFS2(path, QCMD(Q_J2GETQUOTA, USRQUOTA),
+					id.uid, &quota);
+		break;
+	case SMB_USER_FS_QUOTA_TYPE:
+		/* Get quota for current UID. */
+		ret = sys_quotactl_JFS2(path, QCMD(Q_J2GETQUOTA, USRQUOTA),
+					geteuid(), &quota);
+		break;
+	case SMB_GROUP_QUOTA_TYPE:
+		/* Get quota for provided GID. */
+		ret = sys_quotactl_JFS2(path, QCMD(Q_J2GETQUOTA, GRPQUOTA),
+					id.gid, &quota);
+		break;
+	case SMB_GROUP_FS_QUOTA_TYPE:
+		/* Get quota for current GID. */
+		ret = sys_quotactl_JFS2(path, QCMD(Q_J2GETQUOTA, GRPQUOTA),
+					getegid(), &quota);
+		break;
+	default:
+		DEBUG(0, ("cannot get unsupported quota type: %u\n",
+			    (unsigned)qtype));
+		errno = ENOSYS;
+		return -1;
+	}
+
+	if (ret == -1) {
+		return -1;
+	}
+
+	dp->softlimit = quota.bsoft;
+	dp->hardlimit = quota.bhard;
+	dp->ihardlimit = quota.ihard;
+	dp->isoftlimit = quota.isoft;
+	dp->curinodes = quota.iused;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list