summaryrefslogtreecommitdiff
path: root/source3/smbd/quotas.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-11-06 18:40:51 +0000
committerJeremy Allison <jra@samba.org>1998-11-06 18:40:51 +0000
commit4bd1feb68c4f5134293d87433da932c20cded915 (patch)
treed25363592d47b9ef33a44af17d1852f5c8ae4a94 /source3/smbd/quotas.c
parent675e92301c5786ecaea29025598c76c5d7967c8b (diff)
downloadsamba-4bd1feb68c4f5134293d87433da932c20cded915.tar.gz
samba-4bd1feb68c4f5134293d87433da932c20cded915.tar.bz2
samba-4bd1feb68c4f5134293d87433da932c20cded915.zip
lib/charcnv.c: Improved debug comment.
libsmb/namequery.c: Fix to remove 2 second wait is we are doing a unicast and got a reply. smbd/dfree.c: smbd/noquotas.c: smbd/quotas.c: Fixes from Dejan Ilic <svedja@lysator.liu.se> for the quota code. utils/smbpasswd.c: Fixes to allow smbpasswd to be called from swat. Jeremy. (This used to be commit b5981c0149ad8c6f13ea87db450080616538b5d5)
Diffstat (limited to 'source3/smbd/quotas.c')
-rw-r--r--source3/smbd/quotas.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index d610bbe15a..d5ecf73451 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -45,7 +45,7 @@ _syscall4(int, quotactl, int, cmd, const char *, special, int, id, caddr_t, addr
try to get the disk space from disk quotas (LINUX version)
****************************************************************************/
-BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
{
uid_t euser_id;
int r;
@@ -130,7 +130,8 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
/****************************************************************************
try to get the disk space from disk quotas (CRAY VERSION)
****************************************************************************/
-BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+
+BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
{
struct mntent *mnt;
FILE *fd;
@@ -227,6 +228,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
#elif defined(SUNOS5) || defined(SUNOS4)
#include <fcntl.h>
+#include <sys/param.h>
#if defined(SUNOS5)
#include <sys/fs/ufs_quota.h>
#include <sys/mnttab.h>
@@ -236,10 +238,11 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
#endif
/****************************************************************************
-try to get the disk space from disk quotas (solaris 2 version)
-****************************************************************************/
+try to get the disk space from disk quotas (SunOS & Solaris2 version)
/* Quota code by Peter Urbanec (amiga@cse.unsw.edu.au) */
-BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+****************************************************************************/
+
+BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
{
uid_t user_id, euser_id;
int ret;
@@ -249,7 +252,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
int file;
struct mnttab mnt;
static pstring name;
-#else
+#else /* SunOS4 */
struct mntent *mnt;
static pstring name;
#endif
@@ -285,7 +288,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
pstrcpy(name,mnt.mnt_mountp) ;
pstrcat(name,"/quotas") ;
fclose(fd) ;
-#else
+#else /* SunOS4 */
if ((fd = setmntent(MOUNTED, "r")) == NULL)
return(False) ;
@@ -336,7 +339,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
seteuid(euser_id);
if (ret < 0) {
- DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
+ DEBUG(5,("disk_quotas ioctl (Solaris) failed. Error = %s\n", strerror(errno) ));
return(False);
}
@@ -349,17 +352,18 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
if (D.dqb_bsoftlimit==0)
return(False);
- *bsize = 512;
+ *bsize = DEV_BSIZE;
*dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
*dsize = D.dqb_bsoftlimit;
+
if(*dfree < 0)
{
*dfree = 0;
*dsize = D.dqb_curblocks;
}
-DEBUG(5,("disk_quotas for path \"%s\" returning bsize %d, dfree %d, dsize %d\n",
- path,*bsize,*dfree,*dsize));
+ DEBUG(5,("disk_quotas for path \"%s\" returning bsize %.0f, dfree %.0f, dsize %.0f\n",
+ path,(double)*bsize,(double)*dfree,(double)*dsize));
return(True);
}
@@ -371,7 +375,8 @@ DEBUG(5,("disk_quotas for path \"%s\" returning bsize %d, dfree %d, dsize %d\n"
/****************************************************************************
try to get the disk space from disk quotas - OFS1 version
****************************************************************************/
-BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+
+BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
{
uid_t user_id, euser_id;
int r, save_errno;
@@ -426,7 +431,7 @@ try to get the disk space from disk quotas (IRIX 6.2 version)
#include <sys/quota.h>
#include <mntent.h>
-BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
{
uid_t euser_id;
int r;
@@ -518,11 +523,8 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
(F.d_ino_hardlimit && F.d_icount>=F.d_ino_hardlimit)
)
{
- /*
- * Fixme!: these are __uint64_t, this may truncate values
- */
*dfree = 0;
- *dsize = (int) F.d_bcount;
+ *dsize = F.d_bcount;
}
else if (F.d_blk_softlimit==0 && F.d_blk_hardlimit==0)
{
@@ -530,8 +532,8 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
}
else
{
- *dfree = (int)(F.d_blk_softlimit - F.d_bcount);
- *dsize = (int)F.d_blk_softlimit;
+ *dfree = (F.d_blk_softlimit - F.d_bcount);
+ *dsize = F.d_blk_softlimit;
}
}
@@ -565,7 +567,8 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
/****************************************************************************
try to get the disk space from disk quotas - default version
****************************************************************************/
-BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
+
+BOOL disk_quotas(char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
{
uid_t euser_id;
int r;