- From 8619b9b6e25d5cfb44196b62566d1e33ec52d461 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 18 Apr 2024 19:27:19 +0200
- Subject: [PATCH 1/2] daemon: |nfs41_session_set_lease()| fails with user
- impersonation
- |CreateEventA()| in |nfs41_session_set_lease()| fails with user
- impersonation with an access denied error, as it tries to create
- an event object with a name already created by another impersonated
- user.
- The fix is simply to remove the object name.
- Reported-by: Martin Wege <martin.l.wege@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41_session.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
- diff --git a/daemon/nfs41_session.c b/daemon/nfs41_session.c
- index 6f4654d..98a2ccb 100644
- --- a/daemon/nfs41_session.c
- +++ b/daemon/nfs41_session.c
- @@ -409,10 +409,10 @@ int nfs41_session_set_lease(
- session->lease_time = lease_time;
- session->renew.cancel_event = CreateEventA(NULL, TRUE, FALSE,
- - "renew.cancel_event");
- + NULL);
- if (!valid_handle(session->renew.cancel_event)) {
- status = GetLastError();
- - eprintf("nfs41_session_set_lease: CreateEventA() failed %d\n",
- + eprintf("nfs41_session_set_lease: CreateEventA() failed, status=%d\n",
- status);
- goto out;
- }
- --
- 2.43.0
- From f59c2cc252451bc7346a7869ec0aa09b464d5e34 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 18 Apr 2024 20:01:21 +0200
- Subject: [PATCH 2/2] daemon: |logprintf()| should print thread user name
- |logprintf()| should print thread user name, so we can see
- for whom the thread is doing a request.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/daemon_debug.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index b1cb396..83f8612 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -23,6 +23,7 @@
- #include <windows.h>
- #include <stdio.h>
- #include <sddl.h>
- +#include <lmcons.h>
- #include "daemon_debug.h"
- #include "from_kernel.h"
- @@ -87,17 +88,24 @@ void dprintf_out(LPCSTR format, ...)
- void logprintf(LPCSTR format, ...)
- {
- SYSTEMTIME stime;
- + char username[UNLEN+1];
- + DWORD username_len = sizeof(username);
- GetLocalTime(&stime);
- + if (!GetUserNameA(username, &username_len)) {
- + (void)strcpy(username, "<unknown>");
- + }
- +
- va_list args;
- va_start(args, format);
- (void)fprintf(dlog_file,
- "# LOG: ts=%04d-%02d-%02d_%02d:%02d:%02d:%04d"
- - " thr=%04x msg=",
- + " thr=%04x user='%s' msg=",
- (int)stime.wYear, (int)stime.wMonth, (int)stime.wDay,
- (int)stime.wHour, (int)stime.wMinute, (int)stime.wSecond,
- (int)stime.wMilliseconds,
- - (int)GetCurrentThreadId());
- + (int)GetCurrentThreadId(),
- + username);
- (void)vfprintf(dlog_file, format, args);
- (void)fflush(dlog_file);
- va_end(args);
- --
- 2.43.0
msnfs41client: Patches for imperrsonation+misc, 2024-04-18
Posted by Anonymous on Thu 18th Apr 2024 19:23
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.