summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-08 10:43:10 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-08 12:22:20 +0100
commit256101b02244633d5da6d82ba94b620f1f2acf69 (patch)
tree8dd9fe04b27f5d0c31b32af0864e1a2c60dea6b1
parent0a0cd1396a0572dd1f04e8fdd99f682e4e4f91ee (diff)
downloadsamba-256101b02244633d5da6d82ba94b620f1f2acf69.tar.gz
samba-256101b02244633d5da6d82ba94b620f1f2acf69.tar.bz2
samba-256101b02244633d5da6d82ba94b620f1f2acf69.zip
s3:smbd: remove stupid static variables for the nfs quota code
metze
-rw-r--r--source3/smbd/quotas.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index 3aa4652508..c4664e71cf 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -413,8 +413,6 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
#include <rpc/nettype.h>
#include <rpc/xdr.h>
-static int quotastat;
-
static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
{
if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
@@ -426,10 +424,14 @@ static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
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;
@@ -503,14 +505,14 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
}
/*
- * quotastat returns 0 if the rpc call fails, 1 if quotas exist, 2 if there is
+ * 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 ( quotastat ) {
+ switch (gqr.status) {
case 0:
- DEBUG(9,("nfs_quotas: Remote Quotas Failed! Error \"%i\" \n", quotastat ));
+ DEBUG(9,("nfs_quotas: Remote Quotas Failed! Error \"%i\" \n", gqr.status));
ret = False;
goto out;
@@ -525,16 +527,16 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
case 3:
D.dqb_bsoftlimit = 1;
D.dqb_curblocks = 1;
- DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", quotastat ));
+ DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", gqr.status));
break;
default:
- DEBUG(9,("nfs_quotas: Remote Quotas Questionable! Error \"%i\" \n", quotastat ));
+ 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",
- quotastat,
+ 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,
@@ -968,8 +970,6 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
#endif
#include <rpc/xdr.h>
-static int quotastat;
-
static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
{
if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
@@ -981,10 +981,14 @@ static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
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;
@@ -1058,14 +1062,14 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
}
/*
- * quotastat returns 0 if the rpc call fails, 1 if quotas exist, 2 if there is
+ * 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 ( quotastat ) {
+ switch (gqr.status) {
case 0:
- DEBUG(9,("nfs_quotas: Remote Quotas Failed! Error \"%i\" \n", quotastat ));
+ DEBUG(9,("nfs_quotas: Remote Quotas Failed! Error \"%i\" \n", gqr.status));
ret = False;
goto out;
@@ -1080,16 +1084,16 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t
case 3:
D.dqb_bsoftlimit = 1;
D.dqb_curblocks = 1;
- DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", quotastat ));
+ DEBUG(9,("nfs_quotas: Remote Quotas returned \"%i\" \n", gqr.status));
break;
default:
- DEBUG(9,("nfs_quotas: Remote Quotas Questionable! Error \"%i\" \n", quotastat ));
+ 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",
- quotastat,
+ 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,