diff options
author | Jeremy Allison <jra@samba.org> | 1998-11-06 18:40:51 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-11-06 18:40:51 +0000 |
commit | 4bd1feb68c4f5134293d87433da932c20cded915 (patch) | |
tree | d25363592d47b9ef33a44af17d1852f5c8ae4a94 /source3/smbd | |
parent | 675e92301c5786ecaea29025598c76c5d7967c8b (diff) | |
download | samba-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')
-rw-r--r-- | source3/smbd/dfree.c | 11 | ||||
-rw-r--r-- | source3/smbd/noquotas.c | 10 | ||||
-rw-r--r-- | source3/smbd/quotas.c | 43 |
3 files changed, 43 insertions, 21 deletions
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c index c96a599e77..020386645c 100644 --- a/source3/smbd/dfree.c +++ b/source3/smbd/dfree.c @@ -188,13 +188,24 @@ static int fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) static SMB_BIG_UINT disk_free(char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize) { int dfree_retval; + SMB_BIG_UINT dfree_q = 0; + SMB_BIG_UINT bsize_q = 0; + SMB_BIG_UINT dsize_q = 0; (*dfree) = (*dsize) = 0; (*bsize) = 512; fsusage(path, dfree, dsize); + if (disk_quotas(path, &bsize_q, &dfree_q, &dsize_q)) { + (*bsize) = bsize_q; + (*dfree) = MIN(*dfree,dfree_q); + (*dsize) = MIN(*dsize,dsize_q); + } + + /* FIXME : Any reason for this assumption ? */ if (*bsize < 256) { + DEBUG(5,("disk_free:Warning: bsize == %d < 256 . Changing to assumed correct bsize = 512\n",*bsize)); *bsize = 512; } diff --git a/source3/smbd/noquotas.c b/source3/smbd/noquotas.c index c62fb368c7..5c55bb47c8 100644 --- a/source3/smbd/noquotas.c +++ b/source3/smbd/noquotas.c @@ -25,7 +25,15 @@ * Needed for auto generation of proto.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) { + (*bsize) = 512; /* This value should be ignored */ + + /* And just to be sure we set some values that hopefully */ + /* will be larger that any possible real-world value */ + (*dfree) = (SMB_BIG_UINT)-1; + (*dsize) = (SMB_BIG_UINT)-1; + + /* As we have select not to use quotas, allways fail */ return False; } 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; |