diff options
| author | Xie Changlong <xiechanglong@cmss.chinamobile.com> | 2018-12-03 19:02:32 +0800 | 
|---|---|---|
| committer | Amar Tumballi <amarts@redhat.com> | 2018-12-05 21:45:49 +0000 | 
| commit | ad446dabb88439ba83e2092021b09894351e8e71 (patch) | |
| tree | e6c9185465db7ea058d1f3fbc46fd16624edd81f /rpc/rpc-lib/src/rpcsvc.h | |
| parent | 7f7716f8194e06754d0417f27bcc40638c9f9f83 (diff) | |
protocol/server: support server.all-squash
We still use gnfs on our side, so do a little work to support
server.all-squash. Just like server.root-squash, it's also a
volume wide option. Also see bz#1285126
$ gluster volume set <VOLNAME> server.all-squash on
Note: If you enable server.root-squash and server.all-squash
at the same time, only server.all-squash works. Please refer
to following table
+---------------+-----------------+---------------------------+
|               |all_squash       | no_all_squash             |
+-------------------------------------------------------------+
|               |                 |anonuid/anongid for root   |
|root_squash    |anonuid/anongid  |useruid/usergid for no-root|
+-------------------------------------------------------------+
|no_root_squash |anonuid/anongid  |useruid/usergid            |
+-------------------------------------------------------------+
Updates bz#1285126
Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
Signed-off-by: Xue Chuanyu <xuechuanyu@cmss.chinamobile.com>
Change-Id: Iea043318fe6e9a75fa92b396737985062a26b47e
Diffstat (limited to 'rpc/rpc-lib/src/rpcsvc.h')
| -rw-r--r-- | rpc/rpc-lib/src/rpcsvc.h | 16 | 
1 files changed, 16 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h index b296f9a4bde..3e25ef3a8e9 100644 --- a/rpc/rpc-lib/src/rpcsvc.h +++ b/rpc/rpc-lib/src/rpcsvc.h @@ -316,6 +316,20 @@ struct rpcsvc_request {          }                                                                      \      } while (0); +#define RPC_AUTH_ALL_SQUASH(req)                                               \ +    do {                                                                       \ +        int gidcount = 0;                                                      \ +        if (req->svc->all_squash) {                                            \ +            req->uid = req->svc->anonuid;                                      \ +            req->gid = req->svc->anongid;                                      \ +                                                                               \ +            for (gidcount = 0; gidcount < req->auxgidcount; ++gidcount) {      \ +                if (!req->auxgids[gidcount])                                   \ +                    req->auxgids[gidcount] = req->svc->anongid;                \ +            }                                                                  \ +        }                                                                      \ +    } while (0); +  #define RPCSVC_ACTOR_SUCCESS 0  #define RPCSVC_ACTOR_ERROR (-1)  #define RPCSVC_ACTOR_IGNORE (-2) @@ -659,6 +673,8 @@ rpcsvc_set_addr_namelookup(rpcsvc_t *svc, dict_t *options);  int  rpcsvc_set_root_squash(rpcsvc_t *svc, dict_t *options);  int +rpcsvc_set_all_squash(rpcsvc_t *svc, dict_t *options); +int  rpcsvc_set_outstanding_rpc_limit(rpcsvc_t *svc, dict_t *options, int defvalue);  int  | 
