summaryrefslogtreecommitdiff
path: root/source3/smbd/quotas.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1997-09-23 19:19:06 +0000
committerJeremy Allison <jra@samba.org>1997-09-23 19:19:06 +0000
commit81eb442e88e8231b8e9c556c1ee393e99269af78 (patch)
tree0d9d7fda9d4556ef4bfb329fd9321b24c84f8c41 /source3/smbd/quotas.c
parentb3c610541b7284cbd59827b13af86a457268ae96 (diff)
downloadsamba-81eb442e88e8231b8e9c556c1ee393e99269af78.tar.gz
samba-81eb442e88e8231b8e9c556c1ee393e99269af78.tar.bz2
samba-81eb442e88e8231b8e9c556c1ee393e99269af78.zip
Checkin to sync up oplock development code so that NT
domain development code won't diverge. Makefile: Fixed make proto (again). Added GLIBC2 fixes for Linux. includes.h: Added GLIBC2 fixes for Linux. proto.h: Much tidier. quotas.c: OSF/1 quota fix. reply.c: Fix from Ray Frush <frush@engr.colostate.edu> for zero NT timestamps. server.c util.c: First oplock checkin - nowhere near finished so bracketed with #ifdef USE_OPLOCKS. Done to make sync with NT domain code easier. Jeremy (jallison@whistle.com) (This used to be commit 7dce7d84473beb5663b14a8ab32781970819c19d)
Diffstat (limited to 'source3/smbd/quotas.c')
-rw-r--r--source3/smbd/quotas.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index d19d386e27..d4f746c9e3 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -373,22 +373,34 @@ try to get the disk space from disk quotas - OFS1 version
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
{
uid_t user_id, euser_id;
- int r;
+ int r, save_errno;
struct dqblk D;
struct stat S;
euser_id = geteuid();
user_id = getuid();
- setreuid(euser_id, euser_id);
+ setreuid(euser_id, -1);
r= quotactl(path,QCMD(Q_GETQUOTA, USRQUOTA),euser_id,(char *) &D);
- if (setreuid(user_id, euser_id) == -1)
+ if (r)
+ save_errno = errno;
+
+ if (setreuid(user_id, -1) == -1)
DEBUG(5,("Unable to reset uid to %d\n", user_id));
*bsize = DEV_BSIZE;
if (r)
- return(False);
+ {
+ if (save_errno == EDQUOT) // disk quota exceeded
+ {
+ *dfree = 0;
+ *dsize = D.dqb_curblocks;
+ return (True);
+ }
+ else
+ return (False);
+ }
/* Use softlimit to determine disk space, except when it has been exceeded */