summaryrefslogtreecommitdiffstats
path: root/rpc/xdr
diff options
context:
space:
mode:
authorKrishna Srinivas <ksriniva@redhat.com>2012-09-12 12:36:49 +0530
committerAnand Avati <avati@redhat.com>2012-11-13 23:24:46 -0800
commit1c4cb5237701bb138f9cce29036773086253f839 (patch)
treecafdfacc71618962a235a1c25921a72764490c37 /rpc/xdr
parentca666417f3e6f500ec75cb7389497e2f5c4bc6e6 (diff)
ACLv3 - Access Control Lists V3
Change-Id: I43e544d6cdeac5e3880141477461e7c22cbf6e91 BUG: 847622 Signed-off-by: Krishna Srinivas <ksriniva@redhat.com> Reviewed-on: http://review.gluster.org/4045 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'rpc/xdr')
-rw-r--r--rpc/xdr/src/Makefile.am4
-rw-r--r--rpc/xdr/src/acl.x48
-rw-r--r--rpc/xdr/src/acl3-xdr.c94
-rw-r--r--rpc/xdr/src/acl3-xdr.h107
-rw-r--r--rpc/xdr/src/msg-nfs3.c29
-rw-r--r--rpc/xdr/src/msg-nfs3.h13
6 files changed, 293 insertions, 2 deletions
diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am
index 7d3d00093c1..949e75e8d70 100644
--- a/rpc/xdr/src/Makefile.am
+++ b/rpc/xdr/src/Makefile.am
@@ -14,7 +14,7 @@ libgfxdr_la_SOURCES = xdr-generic.c rpc-common-xdr.c \
glusterd1-xdr.c \
portmap-xdr.c \
nlm4-xdr.c xdr-nfs3.c msg-nfs3.c nsm-xdr.c \
- nlmcbk-xdr.c
+ nlmcbk-xdr.c acl3-xdr.c
noinst_HEADERS = xdr-generic.h rpc-common-xdr.h \
glusterfs3-xdr.h glusterfs3.h \
@@ -22,4 +22,4 @@ noinst_HEADERS = xdr-generic.h rpc-common-xdr.h \
glusterd1-xdr.h \
portmap-xdr.h \
nlm4-xdr.h xdr-nfs3.h msg-nfs3.h nsm-xdr.h \
- nlmcbk-xdr.h
+ nlmcbk-xdr.h acl3-xdr.h
diff --git a/rpc/xdr/src/acl.x b/rpc/xdr/src/acl.x
new file mode 100644
index 00000000000..6cf4f1d3b61
--- /dev/null
+++ b/rpc/xdr/src/acl.x
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012 Red Hat, Inc. <http://www.redhat.com>
+ * This file is part of GlusterFS.
+ *
+ * This file is licensed to you under your choice of the GNU Lesser
+ * General Public License, version 3 or any later version (LGPLv3 or
+ * later), or the GNU General Public License, version 2 (GPLv2), in all
+ * cases as published by the Free Software Foundation.
+ */
+
+
+struct aclentry {
+ int type;
+ int uid;
+ int perm;
+};
+
+struct getaclargs {
+ netobj fh;
+ int mask;
+};
+
+struct getaclreply {
+ int status;
+ int attr_follows;
+ struct fattr3 attr;
+ int mask;
+ int aclcount;
+ struct aclentry aclentry<>;
+ int daclcount;
+ struct aclentry daclentry<>;
+};
+
+struct setaclargs {
+ netobj fh;
+ int mask;
+ int aclcount;
+ struct aclentry aclentry<>;
+ int daclcount;
+ struct aclentry daclentry<>;
+};
+
+struct setaclreply {
+ int status;
+ int attr_follows;
+ struct fattr3 attr;
+};
+
diff --git a/rpc/xdr/src/acl3-xdr.c b/rpc/xdr/src/acl3-xdr.c
new file mode 100644
index 00000000000..8fbaeff160c
--- /dev/null
+++ b/rpc/xdr/src/acl3-xdr.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012 Red Hat, Inc. <http://www.redhat.com>
+ * This file is part of GlusterFS.
+ *
+ * This file is licensed to you under your choice of the GNU Lesser
+ * General Public License, version 3 or any later version (LGPLv3 or
+ * later), or the GNU General Public License, version 2 (GPLv2), in all
+ * cases as published by the Free Software Foundation.
+ */
+
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "acl3-xdr.h"
+
+bool_t
+xdr_aclentry (XDR *xdrs, aclentry *objp)
+{
+ if (!xdr_int (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->uid))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->perm))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_getaclargs (XDR *xdrs, getaclargs *objp)
+{
+ if (!xdr_netobj (xdrs, &objp->fh))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_getaclreply (XDR *xdrs, getaclreply *objp)
+{
+ if (!xdr_int (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->attr_follows))
+ return FALSE;
+ if (!xdr_fattr3 (xdrs, &objp->attr))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->mask))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->aclcount))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->aclentry.aclentry_val, (u_int *) &objp->aclentry.aclentry_len, ~0,
+ sizeof (aclentry), (xdrproc_t) xdr_aclentry))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->daclcount))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->daclentry.daclentry_val, (u_int *) &objp->daclentry.daclentry_len, ~0,
+ sizeof (aclentry), (xdrproc_t) xdr_aclentry))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_setaclargs (XDR *xdrs, setaclargs *objp)
+{
+ if (!xdr_netobj (xdrs, &objp->fh))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->mask))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->aclcount))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->aclentry.aclentry_val, (u_int *) &objp->aclentry.aclentry_len, ~0,
+ sizeof (aclentry), (xdrproc_t) xdr_aclentry))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->daclcount))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->daclentry.daclentry_val, (u_int *) &objp->daclentry.daclentry_len, ~0,
+ sizeof (aclentry), (xdrproc_t) xdr_aclentry))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_setaclreply (XDR *xdrs, setaclreply *objp)
+{
+ if (!xdr_int (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->attr_follows))
+ return FALSE;
+ if (!xdr_fattr3 (xdrs, &objp->attr))
+ return FALSE;
+ return TRUE;
+}
diff --git a/rpc/xdr/src/acl3-xdr.h b/rpc/xdr/src/acl3-xdr.h
new file mode 100644
index 00000000000..7cebaed6908
--- /dev/null
+++ b/rpc/xdr/src/acl3-xdr.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2012 Red Hat, Inc. <http://www.redhat.com>
+ * This file is part of GlusterFS.
+ *
+ * This file is licensed to you under your choice of the GNU Lesser
+ * General Public License, version 3 or any later version (LGPLv3 or
+ * later), or the GNU General Public License, version 2 (GPLv2), in all
+ * cases as published by the Free Software Foundation.
+ */
+
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _ACL_H_RPCGEN
+#define _ACL_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "xdr-nfs3.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct aclentry {
+ int type;
+ int uid;
+ int perm;
+};
+typedef struct aclentry aclentry;
+
+struct getaclargs {
+ netobj fh;
+ int mask;
+};
+typedef struct getaclargs getaclargs;
+
+struct getaclreply {
+ int status;
+ int attr_follows;
+ struct fattr3 attr;
+ int mask;
+ int aclcount;
+ struct {
+ u_int aclentry_len;
+ struct aclentry *aclentry_val;
+ } aclentry;
+ int daclcount;
+ struct {
+ u_int daclentry_len;
+ struct aclentry *daclentry_val;
+ } daclentry;
+};
+typedef struct getaclreply getaclreply;
+
+struct setaclargs {
+ netobj fh;
+ int mask;
+ int aclcount;
+ struct {
+ u_int aclentry_len;
+ struct aclentry *aclentry_val;
+ } aclentry;
+ int daclcount;
+ struct {
+ u_int daclentry_len;
+ struct aclentry *daclentry_val;
+ } daclentry;
+};
+typedef struct setaclargs setaclargs;
+
+struct setaclreply {
+ int status;
+ int attr_follows;
+ struct fattr3 attr;
+};
+typedef struct setaclreply setaclreply;
+
+#define ACL3_NULL 0
+#define ACL3_GETACL 1
+#define ACL3_SETACL 2
+#define ACL3_PROC_COUNT 3
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_aclentry (XDR *, aclentry*);
+extern bool_t xdr_getaclargs (XDR *, getaclargs*);
+extern bool_t xdr_getaclreply (XDR *, getaclreply*);
+extern bool_t xdr_setaclargs (XDR *, setaclargs*);
+extern bool_t xdr_setaclreply (XDR *, setaclreply*);
+
+#else /* K&R C */
+extern bool_t xdr_aclentry ();
+extern bool_t xdr_getaclargs ();
+extern bool_t xdr_getaclreply ();
+extern bool_t xdr_setaclargs ();
+extern bool_t xdr_setaclreply ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_ACL_H_RPCGEN */
diff --git a/rpc/xdr/src/msg-nfs3.c b/rpc/xdr/src/msg-nfs3.c
index 97e62040df0..6cdb5d37eaf 100644
--- a/rpc/xdr/src/msg-nfs3.c
+++ b/rpc/xdr/src/msg-nfs3.c
@@ -541,3 +541,32 @@ xdr_to_nlm4_freeallargs (struct iovec inmsg, nlm4_freeallargs *args)
return xdr_to_generic (inmsg, (void*)args,
(xdrproc_t)xdr_nlm4_freeallargs);
}
+
+ssize_t
+xdr_to_getaclargs (struct iovec inmsg, getaclargs *args)
+{
+ return xdr_to_generic (inmsg, (void *) args,
+ (xdrproc_t)xdr_getaclargs);
+}
+
+ssize_t
+xdr_to_setaclargs (struct iovec inmsg, setaclargs *args)
+{
+ return xdr_to_generic (inmsg, (void *) args,
+ (xdrproc_t)xdr_setaclargs);
+}
+
+ssize_t
+xdr_serialize_getaclreply (struct iovec inmsg, getaclreply *res)
+{
+ return xdr_serialize_generic (inmsg, (void *) res,
+ (xdrproc_t)xdr_getaclreply);
+}
+
+ssize_t
+xdr_serialize_setaclreply (struct iovec inmsg, setaclreply *res)
+{
+ return xdr_serialize_generic (inmsg, (void *) res,
+ (xdrproc_t)xdr_setaclreply);
+}
+
diff --git a/rpc/xdr/src/msg-nfs3.h b/rpc/xdr/src/msg-nfs3.h
index 8df777c6c9b..b8e2c96945f 100644
--- a/rpc/xdr/src/msg-nfs3.h
+++ b/rpc/xdr/src/msg-nfs3.h
@@ -18,6 +18,7 @@
#include "xdr-nfs3.h"
#include "nlm4-xdr.h"
+#include "acl3-xdr.h"
#include <sys/types.h>
#include <sys/uio.h>
@@ -208,4 +209,16 @@ xdr_to_nlm4_res (struct iovec inmsg, nlm4_res *args);
extern ssize_t
xdr_to_nlm4_freeallargs (struct iovec inmsg, nlm4_freeallargs *args);
+extern ssize_t
+xdr_to_getaclargs (struct iovec inmsg, getaclargs *args);
+
+extern ssize_t
+xdr_to_setaclargs (struct iovec inmsg, setaclargs *args);
+
+extern ssize_t
+xdr_serialize_getaclreply (struct iovec inmsg, getaclreply *res);
+
+extern ssize_t
+xdr_serialize_setaclreply (struct iovec inmsg, setaclreply *res);
+
#endif