* This is based on the FreeBSD / SUNOS5 section of quotas.c
*/
+/* <rpc/xdr.h> uses TRUE and FALSE */
+#ifdef TRUE
+#undef TRUE
+#endif
+
+#ifdef FALSE
+#undef FALSE
+#endif
+
#include <rpc/rpc.h>
#include <rpc/types.h>
+#include <rpc/xdr.h>
#include <rpcsvc/rquota.h>
#ifdef HAVE_RPC_NETTYPE_H
#include <rpc/nettype.h>
#endif
-#include <rpc/xdr.h>
#ifndef RQ_PATHLEN
#define RQ_PATHLEN 1024
enum clnt_stat clnt_stat;
int ret = -1;
- uint32 qflags = 0;
+ uint32_t qflags = 0;
if (!path || !bdev || !dp) {
smb_panic("sys_get_nfs_quota: called with NULL pointer");
DEBUG(10, ("sys_get_nfs_quotas: Asking for quota of path '%s' on "
"host '%s', rpcprog '%i', rpcvers '%i', network '%s'\n",
- host, testpath+1, RQUOTAPROG, RQUOTAVERS, "udp"));
+ host, testpath+1, (int)RQUOTAPROG, (int)RQUOTAVERS, "udp"));
clnt = clnt_create(host, RQUOTAPROG, RQUOTAVERS, "udp");
if (clnt == NULL) {
timeout);
if (clnt_stat != RPC_SUCCESS) {
- DEBUG(3, ("sys_get_nfs_quotas: clnt_call failed\n"));
- ret = -1;
+ if (errno == ECONNREFUSED) {
+ /* If we cannot connect with rpc.quotad, it may
+ * simply be because there's no quota on the remote
+ * system
+ */
+ DBG_INFO("clnt_call failed with ECONNREFUSED - "
+ "assuming no quotas on server\n");
+ ret = 0;
+ } else {
+ int save_errno = errno;
+ DBG_NOTICE("clnt_call failed - %s\n", strerror(errno));
+ errno = save_errno;
+ ret = -1;
+ }
goto out;
}
/*
* 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.
*/
switch (gq_rslt.GQR_STATUS) {
- case 0:
- DEBUG(3, ("sys_get_nfs_quotas: Remote Quotas Failed! "
- "Error '%i'\n", gq_rslt.GQR_STATUS));
- ret = -1;
- goto out;
-
case 1:
DEBUG(10, ("sys_get_nfs_quotas: Good quota data\n"));
dp->bsize = (uint64_t)gq_rslt.GQR_RQUOTA.rq_bsize;