pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for imperrsonation+misc, 2024-04-18
Posted by Anonymous on Thu 18th Apr 2024 19:23
raw | new post

  1. From 8619b9b6e25d5cfb44196b62566d1e33ec52d461 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Thu, 18 Apr 2024 19:27:19 +0200
  4. Subject: [PATCH 1/2] daemon: |nfs41_session_set_lease()| fails with user
  5.  impersonation
  6.  
  7. |CreateEventA()| in |nfs41_session_set_lease()| fails with user
  8. impersonation with an access denied error, as it tries to create
  9. an event object with a name already created by another impersonated
  10. user.
  11.  
  12. The fix is simply to remove the object name.
  13.  
  14. Reported-by: Martin Wege <martin.l.wege@gmail.com>
  15. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  16. ---
  17. daemon/nfs41_session.c | 4 ++--
  18.  1 file changed, 2 insertions(+), 2 deletions(-)
  19.  
  20. diff --git a/daemon/nfs41_session.c b/daemon/nfs41_session.c
  21. index 6f4654d..98a2ccb 100644
  22. --- a/daemon/nfs41_session.c
  23. +++ b/daemon/nfs41_session.c
  24. @@ -409,10 +409,10 @@ int nfs41_session_set_lease(
  25.  
  26.      session->lease_time = lease_time;
  27.      session->renew.cancel_event = CreateEventA(NULL, TRUE, FALSE,
  28. -        "renew.cancel_event");
  29. +        NULL);
  30.      if (!valid_handle(session->renew.cancel_event)) {
  31.          status = GetLastError();
  32. -        eprintf("nfs41_session_set_lease: CreateEventA() failed %d\n",
  33. +        eprintf("nfs41_session_set_lease: CreateEventA() failed, status=%d\n",
  34.              status);
  35.          goto out;
  36.      }
  37. --
  38. 2.43.0
  39.  
  40. From f59c2cc252451bc7346a7869ec0aa09b464d5e34 Mon Sep 17 00:00:00 2001
  41. From: Roland Mainz <roland.mainz@nrubsig.org>
  42. Date: Thu, 18 Apr 2024 20:01:21 +0200
  43. Subject: [PATCH 2/2] daemon: |logprintf()| should print thread user name
  44.  
  45. |logprintf()| should print thread user name, so we can see
  46. for whom the thread is doing a request.
  47.  
  48. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  49. ---
  50. daemon/daemon_debug.c | 12 ++++++++++--
  51.  1 file changed, 10 insertions(+), 2 deletions(-)
  52.  
  53. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  54. index b1cb396..83f8612 100644
  55. --- a/daemon/daemon_debug.c
  56. +++ b/daemon/daemon_debug.c
  57. @@ -23,6 +23,7 @@
  58.  #include <windows.h>
  59.  #include <stdio.h>
  60.  #include <sddl.h>
  61. +#include <lmcons.h>
  62.  
  63.  #include "daemon_debug.h"
  64.  #include "from_kernel.h"
  65. @@ -87,17 +88,24 @@ void dprintf_out(LPCSTR format, ...)
  66.  void logprintf(LPCSTR format, ...)
  67.  {
  68.      SYSTEMTIME stime;
  69. +    char username[UNLEN+1];
  70. +    DWORD username_len = sizeof(username);
  71.  
  72.      GetLocalTime(&stime);
  73. +    if (!GetUserNameA(username, &username_len)) {
  74. +        (void)strcpy(username, "<unknown>");
  75. +    }
  76. +
  77.      va_list args;
  78.      va_start(args, format);
  79.      (void)fprintf(dlog_file,
  80.          "# LOG: ts=%04d-%02d-%02d_%02d:%02d:%02d:%04d"
  81. -        " thr=%04x msg=",
  82. +        " thr=%04x user='%s' msg=",
  83.          (int)stime.wYear, (int)stime.wMonth, (int)stime.wDay,
  84.          (int)stime.wHour, (int)stime.wMinute, (int)stime.wSecond,
  85.          (int)stime.wMilliseconds,
  86. -        (int)GetCurrentThreadId());
  87. +        (int)GetCurrentThreadId(),
  88. +        username);
  89.      (void)vfprintf(dlog_file, format, args);
  90.      (void)fflush(dlog_file);
  91.      va_end(args);
  92. --
  93. 2.43.0

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at