diff options
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/client/src/client-protocol.c | 19 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-protocol.c | 21 |
2 files changed, 40 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index d0f33e730f8..3ad41009c05 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -539,6 +539,24 @@ out: } int +client_encode_groups (call_frame_t *frame, gf_hdr_common_t *hdr) +{ + int i = 0; + if ((!frame) || (!hdr)) + return -1; + + hdr->req.ngrps = hton32 (frame->root->ngrps); + if (frame->root->ngrps == 0) + return 0; + + for (; i < frame->root->ngrps; ++i) + hdr->req.groups[i] = hton32 (frame->root->groups[i]); + + return 0; +} + + +int protocol_client_xfer (call_frame_t *frame, xlator_t *this, transport_t *trans, int type, int op, gf_hdr_common_t *hdr, size_t hdrlen, @@ -572,6 +590,7 @@ protocol_client_xfer (call_frame_t *frame, xlator_t *this, transport_t *trans, hdr->req.uid = hton32 (frame->root->uid); hdr->req.gid = hton32 (frame->root->gid); hdr->req.pid = hton32 (frame->root->pid); + client_encode_groups (frame, hdr); } if (conn->connected == 0) diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index b7b64476518..94a1ded3270 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -6108,6 +6108,26 @@ out: return frame; } + +int +server_decode_groups (call_frame_t *frame, gf_hdr_common_t *hdr) +{ + int i = 0; + + if ((!frame) || (!hdr)) + return 0; + + frame->root->ngrps = ntoh32 (hdr->req.ngrps); + if (frame->root->ngrps == 0) + return 0; + + for (; i < frame->root->ngrps; ++i) + frame->root->groups[i] = ntoh32 (hdr->req.groups[i]); + + return 0; +} + + /* * get_frame_for_call - create a frame into the capable of * generating and replying the reply packet by itself. @@ -6134,6 +6154,7 @@ get_frame_for_call (transport_t *trans, gf_hdr_common_t *hdr) frame->root->unique = ntoh64 (hdr->callid); /* which call */ frame->root->gid = ntoh32 (hdr->req.gid); frame->root->pid = ntoh32 (hdr->req.pid); + server_decode_groups (frame, hdr); return frame; } |