- diff --git a/daemon/namespace.c b/daemon/namespace.c
- index e490aad..7a22e5c 100644
- --- a/daemon/namespace.c
- +++ b/daemon/namespace.c
- @@ -23,11 +23,12 @@
- #include <strsafe.h>
- #include "nfs41_ops.h"
- +#include "nfs41_daemon.h"
- #include "util.h"
- #include "daemon_debug.h"
- -#define NSLVL 2 /* dprintf level for namespace logging */
- +#define NSLVL 0 /* dprintf level for namespace logging */
- #define client_entry(pos) list_container(pos, nfs41_client, root_entry)
- @@ -97,7 +98,7 @@ void nfs41_root_ref(
- {
- const LONG count = InterlockedIncrement(&root->ref_count);
- - DPRINTF(NSLVL, ("nfs41_root_ref() count %d\n", count));
- +// DPRINTF(NSLVL, ("nfs41_root_ref() count %d\n", count));
- }
- void nfs41_root_deref(
- @@ -105,7 +106,7 @@ void nfs41_root_deref(
- {
- const LONG count = InterlockedDecrement(&root->ref_count);
- - DPRINTF(NSLVL, ("nfs41_root_deref() count %d\n", count));
- +// DPRINTF(NSLVL, ("nfs41_root_deref() count %d\n", count));
- if (count == 0)
- root_free(root);
- }
- @@ -115,6 +116,8 @@ void nfs41_root_deref(
- struct cl_addr_info {
- const multi_addr4 *addrs;
- uint32_t roles;
- + uid_t uid;
- + gid_t gid;
- };
- static int cl_addr_compare(
- @@ -136,6 +139,8 @@ static int cl_addr_compare(
- /* match any address in 'addrs' with any address in client->rpc->addrs */
- for (i = 0; i < info->addrs->count; i++)
- if (multi_addr_find(&client->rpc->addrs, &info->addrs->arr[i], NULL))
- + if ((client->rpc->uid == info->uid) &&
- + (client->rpc->gid == info->gid))
- return NO_ERROR;
- return ERROR_FILE_NOT_FOUND;
- @@ -156,6 +161,13 @@ static int root_client_find_addrs(
- info.addrs = addrs;
- info.roles = nfs41_exchange_id_flags(is_data) & EXCHGID4_FLAG_MASK_PNFS;
- +#if 1
- +extern nfs41_daemon_globals nfs41_dg;
- +int map_current_user_to_ids(nfs41_idmapper *idmapper, uid_t *puid, gid_t *pgid);
- +
- + (void)map_current_user_to_ids(nfs41_dg.idmapper, &info.uid, &info.gid);
- +#endif
- +
- entry = list_search(&root->clients, &info, cl_addr_compare);
- if (entry) {
- *client_out = client_entry(entry);
- diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c
- index 2707414..c081df5 100644
- --- a/daemon/nfs41_client.c
- +++ b/daemon/nfs41_client.c
- @@ -369,6 +369,7 @@ int nfs41_client_owner(
- const ULONGLONG time_created = GetTickCount64();
- int status;
- char username[UNLEN+1];
- + char pgroupname[GNLEN+1];
- /*
- * gisburn: What about primary group (for /usr/bin/newgrp
- @@ -380,6 +381,12 @@ int nfs41_client_owner(
- eprintf("get_token_user_name() failed with %d\n", status);
- goto out;
- }
- + if (!get_token_primarygroup_name(GetCurrentThreadEffectiveToken(),
- + pgroupname)) {
- + status = GetLastError();
- + eprintf("get_token_primary_group_name() failed with %d\n", status);
- + goto out;
- + }
- /* owner.verifier = "time created" */
- memcpy(owner->co_verifier, &time_created, sizeof(time_created));
- @@ -403,11 +410,26 @@ int nfs41_client_owner(
- goto out_hash;
- }
- +#if 1
- + /* hack */
- + static int uniq_counter = 0;
- + uniq_counter++;
- + if (!CryptHashData(hash, (const BYTE*)&uniq_counter, (DWORD)sizeof(uniq_counter), 0)) {
- + status = GetLastError();
- + eprintf("CryptHashData() failed with %d\n", status);
- + goto out_hash;
- + }
- +#endif
- if (!CryptHashData(hash, (const BYTE*)username, (DWORD)strlen(username), 0)) {
- status = GetLastError();
- eprintf("CryptHashData() failed with %d\n", status);
- goto out_hash;
- }
- + if (!CryptHashData(hash, (const BYTE*)pgroupname, (DWORD)strlen(pgroupname), 0)) {
- + status = GetLastError();
- + eprintf("CryptHashData() failed with %d\n", status);
- + goto out_hash;
- + }
- if (!CryptHashData(hash, (const BYTE*)name, (DWORD)strlen(name), 0)) {
- status = GetLastError();
- @@ -445,6 +467,15 @@ int nfs41_client_owner(
- goto out_hash;
- }
- +#if 1
- + (void)fprintf(stderr, "nfs41_client_owner: len=%d\nnfs41_client_owner: id='", owner->co_ownerid_len);
- + unsigned int i;
- + for (i=0 ; i < owner->co_ownerid_len ; i++) {
- + (void)fprintf(stderr, "%2.2x", (int)*(((char *)owner->co_ownerid)+i));
- + }
- + (void)fprintf(stderr, "'\n");
- +#endif
- +
- out_hash:
- CryptDestroyHash(hash);
- out_context:
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index c7bef5f..c0e21b2 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -67,7 +67,7 @@ typedef struct _nfs41_process_thread {
- uint32_t tid;
- } nfs41_process_thread;
- -static int map_current_user_to_ids(nfs41_idmapper *idmapper, uid_t *puid, gid_t *pgid)
- +int map_current_user_to_ids(nfs41_idmapper *idmapper, uid_t *puid, gid_t *pgid)
- {
- char username[UNLEN+1];
- char pgroupname[GNLEN+1];
multiuser experiment
Posted by Anonymous on Tue 23rd Apr 2024 11:02
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.