[SCM] Samba Shared Repository - branch master updated

Björn Jacke bjacke at samba.org
Thu Sep 6 02:48:01 MDT 2012


The branch, master has been updated
       via  146ad30 s3-smbd: Remove remaining references to removed OS support in old-style quota code
       via  9bfab7e s3-smbd: Remove IRIX support from old (pre-sysquotas) code
       via  79bc9e5 s3-smbd: Remove HPUX support from old (pre-sysquotas) code
       via  8b90f6a s3-smbd: Remove BSD support from old (pre-sysquotas) code
       via  28ccb67 s3-smbd: Remove Linux support from old (pre-sysquotas) code
       via  040a458 s3-configure: Only use sysquotas by default
       via  24013bd build: Remove Unicos support (quota in particular)
       via  b7b0d7d build: Do not compile lib/sysquotas*.c files as part of configure
       via  82cffc2 s3: Fix 64-bit warnings in vfs_media_harmony
       via  a6df44b sysquota: we need to list nfs4 as a separate fs name for the sys_get_nfs_quota backend
      from  baf2db6 selftest: Test configure stage of dlz_bind9

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


- Log -----------------------------------------------------------------
commit 146ad30387ebfeaa0269a26b1c5ee32ed13e095e
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Sep 3 13:16:38 2012 +1000

    s3-smbd: Remove remaining references to removed OS support in old-style quota code
    
    Signed-off-by: Björn Jacke <bj at sernet.de>
    
    Autobuild-User(master): Björn Jacke <bj at sernet.de>
    Autobuild-Date(master): Thu Sep  6 10:47:18 CEST 2012 on sn-devel-104

commit 9bfab7ec8cfb01f102e8e22b7f94cd772a8b5a00
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Sep 3 12:20:53 2012 +1000

    s3-smbd: Remove IRIX support from old (pre-sysquotas) code
    
    This should be essentially dead code, as while it is possible to disable sysquotas, the sysquotas has since 2003 supported the 4A varient used on IRIX.
    
    Andrew Bartlett
    
    Signed-off-by: Björn Jacke <bj at sernet.de>

commit 79bc9e5ace576e67ec14132b9b0c892c642cc98f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Sep 3 02:20:05 2012 +1000

    s3-smbd: Remove HPUX support from old (pre-sysquotas) code
    
    This should be essentially dead code, as while it is possible to disable sysquotas, the sysquotas has since 2003 supported the 4A varient used on HPUX.
    
    Andrew Bartlett
    
    Signed-off-by: Björn Jacke <bj at sernet.de>

commit 8b90f6ace30609b320cc306282488b8ee8397d7b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Sep 3 01:51:59 2012 +1000

    s3-smbd: Remove BSD support from old (pre-sysquotas) code
    
    This is essentially dead code, as while it is possible to disable
    sysquotas, the default for BSD is now to use sysquotas with the
    addition of 4B support via the recent Darwin patch by James Peach.
    
    NFS support has been in sysquotas for quite some time now.
    
    Andrew Bartlett
    
    Signed-off-by: Björn Jacke <bj at sernet.de>

commit 28ccb67170828d2fb739cdda1491434c8a2f5d65
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Sep 3 01:41:27 2012 +1000

    s3-smbd: Remove Linux support from old (pre-sysquotas) code
    
    This is essentially dead code, as while it is possible to disable sysquotas, the default
    for Linux has been to use sysquotas for quite some time now.
    
    Andrew Bartlett
    
    Signed-off-by: Björn Jacke <bj at sernet.de>

commit 040a45805f6796858cc916970db7dec2c7f81cf5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Sep 3 03:08:54 2012 +1000

    s3-configure: Only use sysquotas by default
    
    We now only use old quota code if --with-quotas=yes and there is no
    sysquotas support for this platform.
    
    This also removes --with-sys-quotas as an option, instead being the
    first choice if --with-quotas=yes or --with-quotas=auto
    
    sysquotas have been our preferred quota mechanism since 2003.
    
    Andrew Bartlett
    
    Signed-off-by: Björn Jacke <bj at sernet.de>

commit 24013bda4526b1f1cb1c245da83f290210f6e6bc
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jun 13 12:20:07 2012 +1000

    build: Remove Unicos support (quota in particular)
    
    Unicos machines are long gone now (Cray now make Linux compute nodes),
    so remove the quota support.
    
    Andrew Bartlett
    
    Signed-off-by: Björn Jacke <bj at sernet.de>

commit b7b0d7d868027e6a9e63639838d811febc946109
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jun 5 06:39:28 2012 +1000

    build: Do not compile lib/sysquotas*.c files as part of configure
    
    Instead, use the tests in tests/sysquotas.c.
    
    It is better that we see any compile failures, and then expand the
    tests than 'automatically' disable the support.  Users can always use
    --without-quotas if the quotas code does not work on their system.
    
    Andrew Bartlett
    
    Signed-off-by: Björn Jacke <bj at sernet.de>

commit 82cffc2bdbfec4f5c50514c1e08ed342f8f9d189
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 5 10:15:48 2012 +0200

    s3: Fix 64-bit warnings in vfs_media_harmony

commit a6df44b3ae1ca6395d05e1af804a779d785358db
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Sep 6 07:58:00 2012 +0200

    sysquota: we need to list nfs4 as a separate fs name for the sys_get_nfs_quota backend
    
    at least the Linux kernel up to 3.5.0 lists NFSv4 aѕ nfs4 and not as nfs

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

Summary of changes:
 source3/configure.in                |  211 ++-------
 source3/lib/sysquotas.c             |    1 +
 source3/modules/vfs_media_harmony.c |    2 +-
 source3/smbd/quotas.c               |  915 +----------------------------------
 source3/tests/sysquotas.c           |   20 -
 5 files changed, 39 insertions(+), 1110 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/configure.in b/source3/configure.in
index 324d03a..c144e6f 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -500,13 +500,6 @@ case "$host_os" in
       ;;
 
 #
-# CRAY Unicos has broken const handling
-       *unicos*)
-	  AC_MSG_RESULT([disabling const])
-	  CPPFLAGS="$CPPFLAGS -Dconst="
-	  ;;
-	
-#
 # AIX4.x doesn't even admit to having large
 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
 #
@@ -4523,10 +4516,6 @@ AC_ARG_WITH(syslog-facility,
 # check for experimental disk-quotas support
 
 samba_cv_WITH_QUOTAS=auto
-samba_cv_TRY_QUOTAS=no
-samba_cv_RUN_QUOTA_TESTS=auto
-samba_cv_WITH_SYS_QUOTAS=auto
-samba_cv_TRY_SYS_QUOTAS=auto
 samba_cv_SYSQUOTA_FOUND=no
 
 AC_MSG_CHECKING(whether to try disk-quotas support)
@@ -4536,78 +4525,25 @@ AC_ARG_WITH(quotas,
   yes)
     AC_MSG_RESULT(yes)
     samba_cv_WITH_QUOTAS=yes
-    samba_cv_TRY_QUOTAS=yes
-    samba_cv_RUN_QUOTA_TESTS=yes
-    #set sys quotas to auto in this case
-    samba_cv_TRY_SYS_QUOTAS=auto
     ;;
   auto)
     AC_MSG_RESULT(auto)
     samba_cv_WITH_QUOTAS=auto
-    samba_cv_TRY_QUOTAS=auto
-    samba_cv_RUN_QUOTA_TESTS=auto
-    #set sys quotas to auto in this case
-    samba_cv_TRY_SYS_QUOTAS=auto
     ;;
   no)
     AC_MSG_RESULT(no)
     samba_cv_WITH_QUOTAS=no
-    samba_cv_TRY_QUOTAS=no
-    samba_cv_RUN_QUOTA_TESTS=no
     ;;
   *)
-    AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
+    AC_MSG_RESULT(${samba_cv_WITH_QUOTAS})
     ;;
   esac ],
-  AC_MSG_RESULT(${samba_cv_TRY_QUOTAS})
+  AC_MSG_RESULT(${samba_cv_WITH_QUOTAS})
 )
 
-AC_MSG_CHECKING(whether to try the new lib/sysquotas.c interface)
-AC_ARG_WITH(sys-quotas,
-[AS_HELP_STRING([--with-sys-quotas], [Include lib/sysquotas.c support (default=auto)])],
-[ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
-    samba_cv_WITH_SYS_QUOTAS=yes
-    samba_cv_TRY_SYS_QUOTAS=yes
-    samba_cv_RUN_QUOTA_TESTS=yes
-    ;;
-  auto)
-    AC_MSG_RESULT(auto)
-    samba_cv_WITH_SYS_QUOTAS=auto
-    samba_cv_TRY_SYS_QUOTAS=auto
-    samba_cv_RUN_QUOTA_TESTS=auto
-    ;;
-  no)
-    AC_MSG_RESULT(no)
-    samba_cv_WITH_SYS_QUOTAS=no
-    samba_cv_TRY_SYS_QUOTAS=no
-    ;;
-  *)
-    AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
-    ;;
-  esac ],
-  AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS})
-)
-
-if test x"$samba_cv_TRY_SYS_QUOTAS" = x"auto"; then
-AC_MSG_CHECKING(whether to try the lib/sysquotas.c interface on ${host_os})
-  case "$host_os" in
-	*linux*)
-	    AC_MSG_RESULT(yes)
-            samba_cv_TRY_SYS_QUOTAS=yes
-            samba_cv_RUN_QUOTA_TESTS=yes
-	    ;;
-	*)
-	    AC_MSG_RESULT(no)
-            samba_cv_TRY_SYS_QUOTAS=no
-	    ;;
-  esac
-fi
-
 #############################################
 # only check for quota stuff if --with-quotas
-if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then
+if test x"$samba_cv_WITH_QUOTAS" != x"no"; then
 
 case "$host_os" in
 	# on linux we didn't need to test we have builtin support
@@ -4619,7 +4555,6 @@ case "$host_os" in
 	    AC_MSG_RESULT(yes)
 
 	    AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available])
-	    samba_cv_found_xfs_header=yes
 	    AC_MSG_CHECKING(whether to use the lib/sysquotas_xfs.c builtin support)
 	    AC_MSG_RESULT(yes)
 	    ;;
@@ -4722,20 +4657,20 @@ if test x"$samba_cv_HAVE_QUOTACTL_4B" = x"yes"; then
 fi
 fi
 
-if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
-AC_CACHE_CHECK([for CRAY int quotactl (char *spec, int request, char *arg)],samba_cv_HAVE_QUOTACTL_3,[
-AC_TRY_RUN_STRICT([
-#define HAVE_QUOTACTL_3 1
-#define AUTOCONF_TEST 1
-#include "confdefs.h"
-#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
-           samba_cv_HAVE_QUOTACTL_3=yes,samba_cv_HAVE_QUOTACTL_3=no,samba_cv_HAVE_QUOTACTL_3=cross)])
-if test x"$samba_cv_HAVE_QUOTACTL_3" = x"yes"; then
-    echo "CRAY int quotactl (char *spec, int request, char *arg) is NOT reworked for the sys_quota api"
-    samba_cv_SYSQUOTA_FOUND=yes;
-    AC_DEFINE(HAVE_QUOTACTL_3,1,[Whether CRAY int quotactl (char *spec, int request, char *arg); is available])
-    samba_cv_sysquotas_file="lib/sysquotas_3.c"
-fi
+AC_CACHE_CHECK([for NFS QUOTAS],samba_cv_HAVE_NFS_QUOTAS,[
+AC_TRY_COMPILE([
+#include <rpc/rpc.h>
+#include <rpc/types.h>
+#include <rpcsvc/rquota.h>
+#ifdef HAVE_RPC_NETTYPE_H
+#include <rpc/nettype.h>
+#endif
+#include <rpc/xdr.h>
+],[clnt_create("", RQUOTAPROG, RQUOTAVERS, "udp");],
+		   samba_cv_HAVE_NFS_QUOTAS=yes, samba_cv_HAVE_NFS_QUOTAS=no)])
+
+if test x"$samba_cv_HAVE_NFS_QUOTAS" = x"yes"; then
+    AC_DEFINE(HAVE_NFS_QUOTAS,1,[NFS quota support is available])
 fi
 
 #################################################
@@ -4752,117 +4687,27 @@ AC_CHECK_HEADERS(devnm.h)
 # check for devnm
 AC_CHECK_FUNCS(devnm)
 
-if test x"$samba_cv_WITH_SYS_QUOTAS" = x"yes"; then
-    if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then
-	# if --with-sys-quotas=yes then build it
-	# you have can use the get/set quota command smb.conf
-	# options then
-	samba_cv_SYSQUOTA_FOUND=auto
-    fi
-    if test x"$samba_cv_TRY_SYS_QUOTAS" != x"yes"; then
-	# if --with-sys-quotas=yes then build it
-	# you have can use the get/set quota command smb.conf
-	# options then
-	samba_cv_TRY_SYS_QUOTAS=auto
-    fi
-fi
-
-if test x"$samba_cv_SYSQUOTA_FOUND" != x"no"; then
-AC_CACHE_CHECK([whether the sys_quota interface works],samba_cv_SYSQUOTA_WORKS,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
-AC_TRY_COMPILE([
-#include "confdefs.h"
-#define NO_PROTO_H 1
-#define NO_CONFIG_H 1
-#define HAVE_SYS_QUOTAS 1
-#include "${srcdir-.}/${samba_cv_sysquotas_file}"
-#include "${srcdir-.}/lib/sysquotas.c"
-],[],samba_cv_SYSQUOTA_WORKS=yes,samba_cv_SYSQUOTA_WORKS=no)
-CPPFLAGS="$SAVE_CPPFLAGS"
-])
-if test x"$samba_cv_SYSQUOTA_WORKS" = x"yes"; then
 AC_MSG_CHECKING(whether to use the new lib/sysquotas.c interface)
-    if test x"$samba_cv_TRY_SYS_QUOTAS" != x"no"; then
+if test x"$samba_cv_SYSQUOTA_FOUND" = x"yes"; then
+	AC_MSG_RESULT(yes)
 	AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
 	AC_DEFINE(HAVE_SYS_QUOTAS,1,[Whether the new lib/sysquotas.c interface can be used])
-	samba_cv_WE_USE_SYS_QUOTAS=yes
+	if test x"$samba_cv_found_xfs_header" = x"yes"; then
+	   AC_DEFINE(HAVE_XFS_QUOTAS,1,[Whether xfs quota support is available])
+	fi
+else
+    AC_MSG_RESULT(no)
+    AC_MSG_CHECKING(whether to use the old quota support)
+    if test x"$samba_cv_WITH_QUOTAS" = x"yes"; then
+        AC_DEFINE(WITH_QUOTAS,1,[Whether to use old quota support])
 	AC_MSG_RESULT(yes)
     else
-        AC_MSG_RESULT(no)
-    fi
-fi
-fi
-
-if test x"$samba_cv_SYSQUOTA_FOUND" != x"no"; then
-AC_CACHE_CHECK([whether the sys_quota interface works with NFS],samba_cv_SYSQUOTA_WORKS_NFS,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
-AC_TRY_COMPILE([
-#include "confdefs.h"
-#define NO_PROTO_H 1
-#define NO_CONFIG_H 1
-#define HAVE_SYS_QUOTAS 1
-#define HAVE_NFS_QUOTAS 1
-#include "${srcdir-.}/lib/sysquotas_nfs.c"
-],[],samba_cv_SYSQUOTA_WORKS_NFS=yes,samba_cv_SYSQUOTA_WORKS_NFS=no)
-CPPFLAGS="$SAVE_CPPFLAGS"
-])
-if test x"$samba_cv_SYSQUOTA_WORKS_NFS" = x"yes"; then
-    if test x"$samba_cv_WE_USE_SYS_QUOTAS" = x"yes"; then
-	AC_DEFINE(HAVE_NFS_QUOTAS,1,[Whether nfs quota support is available])
-    fi
-fi
-fi
-
-if test x"$samba_cv_SYSQUOTA_FOUND" != x"no" -a x"$samba_cv_found_xfs_header" = x"yes"; then
-AC_CACHE_CHECK([whether the sys_quota interface works with XFS],samba_cv_SYSQUOTA_WORKS_XFS,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
-AC_TRY_COMPILE([
-#include "confdefs.h"
-#define NO_PROTO_H 1
-#define NO_CONFIG_H 1
-#define HAVE_SYS_QUOTAS 1
-#define HAVE_XFS_QUOTAS 1
-#include "${srcdir-.}/lib/sysquotas_xfs.c"
-],[],samba_cv_SYSQUOTA_WORKS_XFS=yes,samba_cv_SYSQUOTA_WORKS_XFS=no)
-CPPFLAGS="$SAVE_CPPFLAGS"
-])
-if test x"$samba_cv_SYSQUOTA_WORKS_XFS" = x"yes"; then
-    if test x"$samba_cv_WE_USE_SYS_QUOTAS" = x"yes"; then
-	AC_DEFINE(HAVE_XFS_QUOTAS,1,[Whether xfs quota support is available])
-    fi
-fi
-fi
-
-AC_CACHE_CHECK([whether the old quota support works],samba_cv_QUOTA_WORKS,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
-AC_TRY_COMPILE([
-#include "confdefs.h"
-#define NO_PROTO_H 1
-#define NO_CONFIG_H 1
-#include "${srcdir-.}/smbd/quotas.c"
-],[],samba_cv_QUOTA_WORKS=yes,samba_cv_QUOTA_WORKS=no)
-CPPFLAGS="$SAVE_CPPFLAGS"
-])
-if test x"$samba_cv_QUOTA_WORKS" = x"yes"; then
-AC_MSG_CHECKING(whether to use the old quota support)
-    if test x"$samba_cv_WE_USE_SYS_QUOTAS" != x"yes"; then
-      if test x"$samba_cv_TRY_QUOTAS" != x"no"; then
-        AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support])
-	AC_MSG_RESULT(yes)
-      else
 	AC_MSG_RESULT(no)
-      fi
-    else
-      AC_MSG_RESULT(no)
     fi
 fi
 
 ####################
-# End of quota check samba_cv_RUN_QUOTA_TESTS
+# End of quota check samba_cv_WITH_QUOTAS
 fi
 
 #################################################
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index ecd5147..84679f4 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -177,6 +177,7 @@ static struct {
 #endif /* HAVE_XFS_QUOTAS */
 #ifdef HAVE_NFS_QUOTAS
 	{"nfs", sys_get_nfs_quota,	sys_set_nfs_quota},
+	{"nfs4", sys_get_nfs_quota,	sys_set_nfs_quota},
 #endif /* HAVE_NFS_QUOTAS */
 	{NULL, 	NULL, 			NULL}
 };
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index e1de153..647db7c 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -344,7 +344,7 @@ static bool is_avid_database(
 			      "path_len '%i', "
 			      "avid_db_filename_len '%i'\n",
 			      path, avid_db_filename,
-			      path_len, avid_db_filename_len));
+			      (int)path_len, (int)avid_db_filename_len));
 
 	if (
 		path_len > avid_db_filename_len
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index d8bdb02..339952e 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -52,533 +52,7 @@ bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *d
 #endif /* VXFS_QUOTA */
 
 
-#ifdef LINUX
-
-#include <sys/types.h>
-#include <mntent.h>
-
-/*
- * This shouldn't be neccessary - it should be /usr/include/sys/quota.h
- * So we include all the files has *should* be in the system into a large,
- * grungy samba_linux_quoatas.h Sometimes I *hate* Linux :-). JRA.
- */
-
-#include "samba_linux_quota.h"
-
-typedef struct _LINUX_SMB_DISK_QUOTA {
-	uint64_t bsize;
-	uint64_t hardlimit; /* In bsize units. */
-	uint64_t softlimit; /* In bsize units. */
-	uint64_t curblocks; /* In bsize units. */
-	uint64_t ihardlimit; /* inode hard limit. */
-	uint64_t isoftlimit; /* inode soft limit. */
-	uint64_t curinodes; /* Current used inodes. */
-} LINUX_SMB_DISK_QUOTA;
-
-
-/*
- * nfs quota support
- * (essentially taken from FreeBSD / SUNOS5 section)
- */
-#include <rpc/rpc.h>
-#include <rpc/types.h>
-#include <rpcsvc/rquota.h>
-#ifdef HAVE_RPC_NETTYPE_H
-#include <rpc/nettype.h>
-#endif
-#include <rpc/xdr.h>
-
-static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
-{
-	int quotastat;
-
-	if (!xdr_int(xdrsp, &quotastat)) {
-		DEBUG(6,("nfs_quotas: Status bad or zero\n"));
-		return 0;
-	}
-	gqr->status = quotastat;
-
-	if (!xdr_int(xdrsp, &gqr->getquota_rslt_u.gqr_rquota.rq_bsize)) {
-		DEBUG(6,("nfs_quotas: Block size bad or zero\n"));
-		return 0;
-	}
-	if (!xdr_bool(xdrsp, &gqr->getquota_rslt_u.gqr_rquota.rq_active)) {
-		DEBUG(6,("nfs_quotas: Active bad or zero\n"));
-		return 0;
-	}
-	if (!xdr_int(xdrsp, (int *)&gqr->getquota_rslt_u.gqr_rquota.rq_bhardlimit)) {
-		DEBUG(6,("nfs_quotas: Hardlimit bad or zero\n"));
-		return 0;
-	}
-	if (!xdr_int(xdrsp, (int *)&gqr->getquota_rslt_u.gqr_rquota.rq_bsoftlimit)) {
-		DEBUG(6,("nfs_quotas: Softlimit bad or zero\n"));
-		return 0;
-	}
-	if (!xdr_int(xdrsp, (int *)&gqr->getquota_rslt_u.gqr_rquota.rq_curblocks)) {
-		DEBUG(6,("nfs_quotas: Currentblocks bad or zero\n"));
-		return 0;
-	}
-	return 1;
-}
-
-static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize,
-		       uint64_t *dfree, uint64_t *dsize)
-{
-	uid_t uid = euser_id;
-	LINUX_SMB_DISK_QUOTA D;
-	char *mnttype = nfspath;
-	CLIENT *clnt;
-	struct getquota_rslt gqr;
-	struct getquota_args args;
-	char *cutstr, *pathname, *host, *testpath;
-	int len;
-	static struct timeval timeout = {2,0};
-	enum clnt_stat clnt_stat;
-	bool ret = True;
-
-	*bsize = *dfree = *dsize = (uint64_t)0;
-
-	len=strcspn(mnttype, ":");
-	pathname=strstr(mnttype, ":");
-	cutstr = (char *) SMB_MALLOC(len+1);
-	if (!cutstr)
-		return False;
-
-	memset(cutstr, '\0', len+1);
-	host = strncat(cutstr,mnttype, sizeof(char) * len );
-	DEBUG(5,("nfs_quotas: looking for mount on \"%s\"\n", cutstr));
-	DEBUG(5,("nfs_quotas: of path \"%s\"\n", mnttype));
-	testpath=strchr_m(mnttype, ':');
-	args.gqa_pathp = testpath+1;
-	args.gqa_uid = uid;
-
-	DEBUG(5, ("nfs_quotas: Asking for host \"%s\" rpcprog \"%i\" rpcvers "
-		  "\"%i\" network \"%s\"\n", host, RQUOTAPROG, RQUOTAVERS,
-		  "udp"));
-
-	if ((clnt = clnt_create(host, RQUOTAPROG, RQUOTAVERS, "udp")) == NULL) {
-		ret = False;
-		goto out;
-	}
-
-	clnt->cl_auth = authunix_create_default();
-	DEBUG(9,("nfs_quotas: auth_success\n"));
-
-	clnt_stat=clnt_call(clnt,
-			    RQUOTAPROC_GETQUOTA,
-			    (const xdrproc_t)my_xdr_getquota_args,
-			    (caddr_t)&args,
-			    (const xdrproc_t)my_xdr_getquota_rslt,
-			    (caddr_t)&gqr, timeout);
-
-	if (clnt_stat != RPC_SUCCESS) {
-		DEBUG(9,("nfs_quotas: clnt_call fail\n"));
-		ret = False;
-		goto out;
-	}
-
-	/*
-	 * gqr.status returns 0 if the rpc call fails, 1 if quotas exist, 2 if there is
-	 * no quota set, and 3 if no permission to get the quota.  If 0 or 3 return
-	 * something sensible.
-	 */
-
-	switch (gqr.status) {
-	case 0:
-		DEBUG(9, ("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n",
-			  gqr.status));
-		ret = False;
-		goto out;
-
-	case 1:
-		DEBUG(9,("nfs_quotas: Good quota data\n"));
-		D.softlimit = gqr.getquota_rslt_u.gqr_rquota.rq_bsoftlimit;
-		D.hardlimit = gqr.getquota_rslt_u.gqr_rquota.rq_bhardlimit;
-		D.curblocks = gqr.getquota_rslt_u.gqr_rquota.rq_curblocks;
-		break;
-
-	case 2:
-	case 3:
-		D.softlimit = 1;
-		D.curblocks = 1;
-		DEBUG(9, ("nfs_quotas: Remote Quotas returned \"%i\" \n",
-			  gqr.status));
-		break;
-
-	default:
-		DEBUG(9, ("nfs_quotas: Remote Quotas Questionable!  "
-			  "Error \"%i\" \n", gqr.status));
-		break;
-	}
-
-	DEBUG(10, ("nfs_quotas: Let`s look at D a bit closer... "
-		   "status \"%i\" bsize \"%i\" active? \"%i\" bhard "
-		   "\"%i\" bsoft \"%i\" curb \"%i\" \n",
-		   gqr.status,
-		   gqr.getquota_rslt_u.gqr_rquota.rq_bsize,
-		   gqr.getquota_rslt_u.gqr_rquota.rq_active,
-		   gqr.getquota_rslt_u.gqr_rquota.rq_bhardlimit,
-		   gqr.getquota_rslt_u.gqr_rquota.rq_bsoftlimit,
-		   gqr.getquota_rslt_u.gqr_rquota.rq_curblocks));
-
-	if (D.softlimit == 0)
-		D.softlimit = D.hardlimit;
-	if (D.softlimit == 0)
-		return False;
-
-	*bsize = gqr.getquota_rslt_u.gqr_rquota.rq_bsize;
-	*dsize = D.softlimit;
-
-	if (D.curblocks == 1)
-		*bsize = DEV_BSIZE;
-
-	if (D.curblocks > D.softlimit) {
-		*dfree = 0;
-		*dsize = D.curblocks;
-	} else


-- 
Samba Shared Repository


More information about the samba-cvs mailing list