doing mount with non-fake uid gid
This commit is contained in:
parent
a25a5221d9
commit
24c28df19d
4 changed files with 18 additions and 2 deletions
|
|
@ -72,6 +72,8 @@ static int handle_mount(nfs41_upcall *upcall)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
// add a mount
|
// add a mount
|
||||||
|
root->uid = upcall->uid;
|
||||||
|
root->gid = upcall->gid;
|
||||||
status = nfs41_root_mount_addrs(root, &addrs, 0, 0, &client);
|
status = nfs41_root_mount_addrs(root, &addrs, 0, 0, &client);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_root_mount() failed with %d\n", status);
|
eprintf("nfs41_root_mount() failed with %d\n", status);
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,8 @@ int nfs41_root_mount_addrs(
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* create an rpc client */
|
/* create an rpc client */
|
||||||
status = nfs41_rpc_clnt_create(addrs, root->wsize, root->rsize, !is_data, &rpc);
|
status = nfs41_rpc_clnt_create(addrs, root->wsize, root->rsize, !is_data,
|
||||||
|
root->uid, root->gid, &rpc);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_rpc_clnt_create() failed %d\n", status);
|
eprintf("nfs41_rpc_clnt_create() failed %d\n", status);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,8 @@ typedef struct __nfs41_root {
|
||||||
uint32_t wsize;
|
uint32_t wsize;
|
||||||
uint32_t rsize;
|
uint32_t rsize;
|
||||||
LONG ref_count;
|
LONG ref_count;
|
||||||
|
uint32_t uid;
|
||||||
|
uint32_t gid;
|
||||||
} nfs41_root;
|
} nfs41_root;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -348,6 +350,8 @@ int nfs41_rpc_clnt_create(
|
||||||
IN uint32_t wsize,
|
IN uint32_t wsize,
|
||||||
IN uint32_t rsize,
|
IN uint32_t rsize,
|
||||||
IN bool_t needcb,
|
IN bool_t needcb,
|
||||||
|
IN uint32_t uid,
|
||||||
|
IN uint32_t gid,
|
||||||
OUT nfs41_rpc_clnt **rpc_out);
|
OUT nfs41_rpc_clnt **rpc_out);
|
||||||
|
|
||||||
void nfs41_rpc_clnt_free(
|
void nfs41_rpc_clnt_free(
|
||||||
|
|
|
||||||
|
|
@ -101,12 +101,16 @@ int nfs41_rpc_clnt_create(
|
||||||
IN uint32_t wsize,
|
IN uint32_t wsize,
|
||||||
IN uint32_t rsize,
|
IN uint32_t rsize,
|
||||||
bool_t needcb,
|
bool_t needcb,
|
||||||
|
IN uint32_t uid,
|
||||||
|
IN uint32_t gid,
|
||||||
OUT nfs41_rpc_clnt **rpc_out)
|
OUT nfs41_rpc_clnt **rpc_out)
|
||||||
{
|
{
|
||||||
CLIENT *client;
|
CLIENT *client;
|
||||||
nfs41_rpc_clnt *rpc;
|
nfs41_rpc_clnt *rpc;
|
||||||
uint32_t addr_index;
|
uint32_t addr_index;
|
||||||
int status;
|
int status;
|
||||||
|
char machname[MAXHOSTNAMELEN + 1];
|
||||||
|
gid_t gids[1];
|
||||||
|
|
||||||
rpc = calloc(1, sizeof(nfs41_rpc_clnt));
|
rpc = calloc(1, sizeof(nfs41_rpc_clnt));
|
||||||
if (rpc == NULL) {
|
if (rpc == NULL) {
|
||||||
|
|
@ -127,7 +131,12 @@ int nfs41_rpc_clnt_create(
|
||||||
goto out_free_rpc_clnt;
|
goto out_free_rpc_clnt;
|
||||||
}
|
}
|
||||||
// XXX Pick credentials in better manner
|
// XXX Pick credentials in better manner
|
||||||
client->cl_auth = authsys_create_default();
|
if (gethostname(machname, sizeof(machname)) == -1) {
|
||||||
|
eprintf("nfs41_rpc_clnt_create: gethostname failed\n");
|
||||||
|
goto out_free_rpc_clnt;
|
||||||
|
}
|
||||||
|
machname[sizeof(machname) - 1] = '\0';
|
||||||
|
client->cl_auth = authsys_create(machname, uid, gid, 0, gids);
|
||||||
if (client->cl_auth == NULL) {
|
if (client->cl_auth == NULL) {
|
||||||
// XXX log failure in auth creation somewhere
|
// XXX log failure in auth creation somewhere
|
||||||
// XXX Better error return
|
// XXX Better error return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue