]> arthur.barton.de Git - netatalk.git/blob - libatalk/compat/rquota_xdr.c
Active Directory LDAP queries for ACL support
[netatalk.git] / libatalk / compat / rquota_xdr.c
1 /*
2  *
3  * taken from the quota-1.55 used on linux. here's the bsd copyright:
4  *
5  * Copyright (c) 1980, 1990 Regents of the University of California. All
6  * rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by Robert Elz at
9  * The University of Melbourne.
10  */
11
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif /* HAVE_CONFIG_H */
15
16 #include <stdio.h> /* to get __GNU_LIBRARY__ */
17
18 /* list of machines that don't have these functions:
19         solaris
20         linux libc5
21 */
22 #if defined(NEED_RQUOTA) || defined(SOLARIS) || (defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ < 6)
23
24 #include <rpc/rpc.h>
25 #include <rpcsvc/rquota.h>
26
27 #ifndef u_int
28 #define u_int unsigned
29 #endif
30
31 bool_t
32 xdr_getquota_args(xdrs, objp)
33         XDR *xdrs;
34         getquota_args *objp;
35 {
36         if (!xdr_string(xdrs, &objp->gqa_pathp, RQ_PATHLEN)) {
37                 return (FALSE);
38         }
39         if (!xdr_int(xdrs, &objp->gqa_uid)) {
40                 return (FALSE);
41         }
42         return (TRUE);
43 }
44
45
46 bool_t
47 xdr_rquota(xdrs, objp)
48         XDR *xdrs;
49         rquota *objp;
50 {
51         if (!xdr_int(xdrs, &objp->rq_bsize)) {
52                 return (FALSE);
53         }
54         if (!xdr_bool(xdrs, &objp->rq_active)) {
55                 return (FALSE);
56         }
57         if (!xdr_u_int(xdrs, &objp->rq_bhardlimit)) {
58                 return (FALSE);
59         }
60         if (!xdr_u_int(xdrs, &objp->rq_bsoftlimit)) {
61                 return (FALSE);
62         }
63         if (!xdr_u_int(xdrs, &objp->rq_curblocks)) {
64                 return (FALSE);
65         }
66         if (!xdr_u_int(xdrs, &objp->rq_fhardlimit)) {
67                 return (FALSE);
68         }
69         if (!xdr_u_int(xdrs, &objp->rq_fsoftlimit)) {
70                 return (FALSE);
71         }
72         if (!xdr_u_int(xdrs, &objp->rq_curfiles)) {
73                 return (FALSE);
74         }
75         if (!xdr_u_int(xdrs, &objp->rq_btimeleft)) {
76                 return (FALSE);
77         }
78         if (!xdr_u_int(xdrs, &objp->rq_ftimeleft)) {
79                 return (FALSE);
80         }
81         return (TRUE);
82 }
83
84
85
86
87 bool_t
88 xdr_gqr_status(xdrs, objp)
89         XDR *xdrs;
90         gqr_status *objp;
91 {
92         if (!xdr_enum(xdrs, (enum_t *)objp)) {
93                 return (FALSE);
94         }
95         return (TRUE);
96 }
97
98
99 bool_t
100 xdr_getquota_rslt(xdrs, objp)
101         XDR *xdrs;
102         getquota_rslt *objp;
103 {
104         if (!xdr_gqr_status(xdrs, &objp->status)) {
105                 return (FALSE);
106         }
107         switch (objp->status) {
108         case Q_OK:
109                 if (!xdr_rquota(xdrs, &objp->getquota_rslt_u.gqr_rquota)) {
110                         return (FALSE);
111                 }
112                 break;
113         case Q_NOQUOTA:
114                 break;
115         case Q_EPERM:
116                 break;
117         default:
118                 return (FALSE);
119         }
120         return (TRUE);
121 }
122 #endif