summaryrefslogtreecommitdiff
path: root/source3/smbd/quotas.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-05-31 15:13:29 +0000
committerAndrew Tridgell <tridge@samba.org>1996-05-31 15:13:29 +0000
commit58734631b4233ec08b7a262587e400792f31f185 (patch)
tree960d8520ca847203a89aee2ae9e7cd362d9d7730 /source3/smbd/quotas.c
parent26e045daff2762c3739609da19934aadc552cae8 (diff)
downloadsamba-58734631b4233ec08b7a262587e400792f31f185.tar.gz
samba-58734631b4233ec08b7a262587e400792f31f185.tar.bz2
samba-58734631b4233ec08b7a262587e400792f31f185.zip
Lots of changes!
- add faq info on NT printer handling - add "delete readonly" option to help rcs users - add stuff to man pages on new printer options - add "proxy name resolution" option - add "command string" -c option to smbclient (thanks Ken) - split time functions into time.c - rearrange the quotas stuff a bit and fix some bugs - complete rehash of the time handling code thanks to Paul Eggert - fix nmblookup output a bit - add plp print queue parsing from Bertrand Wallrich (This used to be commit 635b56f19c817527c52e9bbde31faa6a8a47777b)
Diffstat (limited to 'source3/smbd/quotas.c')
-rw-r--r--source3/smbd/quotas.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index 32c9fc35d3..81f2dcaab5 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -1,3 +1,4 @@
+#ifdef QUOTAS
/*
Unix SMB/Netbios implementation.
Version 1.9.
@@ -19,12 +20,28 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "includes.h"
+/*
+ * This is one of the most system dependent parts of Samba, and its
+ * done a litle differently. Each system has its own way of doing
+ * things :-(
+ */
+
+#include "includes.h"
-#ifdef QUOTAS
#ifdef LINUX
+
+#ifdef __KERNEL__
+# undef __KERNEL__
+# include <sys/quota.h>
+# define __KERNEL__
+#else
+# include <sys/quota.h>
+#endif
+
+#include <mntent.h>
+
/****************************************************************************
try to get the disk space from disk quotas (LINUX version)
****************************************************************************/
@@ -115,6 +132,10 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
}
#elif defined(CRAY)
+
+#include <sys/quota.h>
+#include <mntent.h>
+
/****************************************************************************
try to get the disk space from disk quotas (CRAY VERSION)
****************************************************************************/
@@ -214,6 +235,7 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
#elif defined(SUNOS5)
+#include <devnm.h>
#include <fcntl.h>
#include <sys/fs/ufs_quota.h>
@@ -228,30 +250,33 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
struct dqblk D;
struct quotctl command;
int file;
+ int ret;
if((file=open(path, O_RDONLY))<0) return(False);
euser_id = geteuid();
user_id = getuid();
- setuid(0); /* Solaris seems to want to give info only to super-user */
- seteuid(0);
-
command.op = Q_GETQUOTA;
command.uid = euser_id;
command.addr = (caddr_t) &D;
- if(ioctl(file, Q_QUOTACTL, &command)<0)
- {
- close(file);
- DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
- return(False);
- }
- close(file);
+ setuid(0); /* Solaris seems to want to give info only to super-user */
+ seteuid(0);
+
+ ret = ioctl(file, Q_QUOTACTL, &command);
setuid(user_id); /* Restore the original UID status */
seteuid(euser_id);
+ if (ret < 0) {
+ close(file);
+ DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
+ return(False);
+ }
+ close(file);
+
+
/* Use softlimit to determine disk space. A user exceeding the quota is told
* that there's no space left. Writes might actually work for a bit if the
* hardlimit is set higher than softlimit. Effectively the disk becomes
@@ -275,6 +300,9 @@ DEBUG(5,("disk_quotas for path \"%s\" returning bsize %d, dfree %d, dsize %d\n"
#else
+#include <sys/quota.h>
+#include <devnm.h>
+
/****************************************************************************
try to get the disk space from disk quotas - default version
****************************************************************************/
@@ -327,4 +355,5 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
}
#endif
-#endif
+#endif /* QUOTAS */
+