pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


msnfs41client $ cp -p chmodtest chmodtest_cp2 # fails with "Function not implemented"
Posted by Anonymous on Wed 7th Feb 2024 14:33
raw | new post
modification of post by Anonymous (view diff)

  1. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  2. index 07c1dd5..a6e4f88 100644
  3. --- a/cygwin/devel/msnfs41client.bash
  4. +++ b/cygwin/devel/msnfs41client.bash
  5. @@ -140,7 +140,7 @@ function nfsclient_rundeamon
  6.  
  7.         typeset -a nfsd_args=(
  8.                 'nfsd_debug.exe'
  9. -               '-d' '0'
  10. +               '-d' '1'
  11.                 '--noldap'
  12.                 #'--numworkerthreads' '512'
  13.                 #'--gid' '1616' '--uid' '1616'
  14. diff --git a/daemon/acl.c b/daemon/acl.c
  15. index e4fb02e..d4f4c1a 100644
  16. --- a/daemon/acl.c
  17. +++ b/daemon/acl.c
  18. @@ -36,7 +36,7 @@
  19.  #include "sid.h"
  20.  
  21.  //#define DEBUG_ACLS
  22. -#define ACLLVL 2 /* dprintf level for acl logging */
  23. +#define ACLLVL 1 /* dprintf level for acl logging */
  24.  
  25.  static int parse_getacl(unsigned char *buffer, uint32_t length,
  26.                          nfs41_upcall *upcall)
  27. @@ -287,6 +287,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  28.      args->sec_desc_len = 0;
  29.      status = MakeSelfRelativeSD(&sec_desc, args->sec_desc, &args->sec_desc_len);
  30.      if (status) {
  31. +        dprintf(1, "handle_getacl: MakeSelfRelativeSD() failed.\n");
  32.          status = ERROR_INTERNAL_ERROR;
  33.          goto out;
  34.      }
  35. @@ -462,6 +463,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  36.      DWORD size = 0, tmp_size = 0;
  37.      SID_NAME_USE sid_type;
  38.      LPSTR tmp_buf = NULL, who = NULL;
  39. +    LPSTR sidstr = NULL;
  40.  
  41.      /* for ace mapping, we want to map owner's sid into "owner@"
  42.       * but for set_owner attribute we want to map owner into a user name
  43. @@ -492,6 +494,85 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  44.              return ERROR_SUCCESS;
  45.      }
  46.  
  47. +#ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  48. +    if (!ConvertSidToStringSidA(sid, &sidstr)) {
  49. +        status = GetLastError();
  50. +        eprintf("map_nfs4ace_who: ConvertSidToStringSidA() failed, "
  51. +            "error=%d\n", status);
  52. +        goto out;
  53. +    }
  54. +
  55. +    dprintf(ACLLVL, "map_nfs4ace_who: Looking up SID '%s'\n", sidstr);
  56. +
  57. +    /*
  58. +     * Handle special "Unix_User+<uid>"-SIDs
  59. +     */
  60. +    if (!strncmp(sidstr, UNIXUSERSID_PREFIX, strlen(UNIXUSERSID_PREFIX))) {
  61. +        const char *uidstr = sidstr+strlen(UNIXUSERSID_PREFIX);
  62. +        uid_t uid;
  63. +        char tmpwho[NFS4_OPAQUE_LIMIT+1];
  64. +
  65. +        uid = (uid_t)atol(uidstr);
  66. +        dprintf(ACLLVL, "map_nfs4ace_who: uidstr='%s', uid=%u\n",
  67. +            uidstr, (unsigned int)uid);
  68. +
  69. +        /* fixme! */
  70. +        extern nfs41_daemon_globals nfs41_dg;
  71. +
  72. +        status = nfs41_idmap_uid_to_name(nfs41_dg.idmapper, uid,
  73. +            tmpwho, sizeof(tmpwho));
  74. +        if (status) {
  75. +            dprintf(ACLLVL, "map_nfs4ace_who: "
  76. +                "nfs41_idmap_uid_to_name() failed, status=%d\n",
  77. +                status);
  78. +            goto out;
  79. +        }
  80. +
  81. +        (void)snprintf(who_out, NFS4_OPAQUE_LIMIT, "%s@%s", tmpwho, domain);
  82. +
  83. +        dprintf(ACLLVL, "map_nfs4ace_who: returning Unix_User+ who='%s'\n", who_out);
  84. +
  85. +        goto out;
  86. +    }
  87. +    else {
  88. +        dprintf(ACLLVL, "map_nfs4ace_who: Not an Unix_User+ SID\n");
  89. +    }
  90. +
  91. +    /*
  92. +     * Handle special "Unix_Group+<gid>"-SIDs
  93. +     */
  94. +    if (!strncmp(sidstr, UNIXGROUPSID_PREFIX, strlen(UNIXGROUPSID_PREFIX))) {
  95. +        const char *gidstr = sidstr+strlen(UNIXGROUPSID_PREFIX);
  96. +        gid_t gid;
  97. +        char tmpwho[NFS4_OPAQUE_LIMIT+1];
  98. +
  99. +        gid = (uid_t)atol(gidstr);
  100. +        dprintf(ACLLVL, "map_nfs4ace_who: gidstr='%s', gid=%u\n",
  101. +            gidstr, (unsigned int)gid);
  102. +
  103. +        /* fixme! */
  104. +        extern nfs41_daemon_globals nfs41_dg;
  105. +
  106. +        status = nfs41_idmap_gid_to_group(nfs41_dg.idmapper, gid,
  107. +            tmpwho, sizeof(tmpwho));
  108. +        if (status) {
  109. +            dprintf(ACLLVL, "map_nfs4ace_who: "
  110. +                "nfs41_idmap_gid_to_group() failed, status=%d\n",
  111. +                status);
  112. +            goto out;
  113. +        }
  114. +
  115. +        (void)snprintf(who_out, NFS4_OPAQUE_LIMIT, "%s@%s", tmpwho, domain);
  116. +
  117. +        dprintf(ACLLVL, "map_nfs4ace_who: returning Unix_Group+ who='%s'\n", who_out);
  118. +
  119. +        goto out;
  120. +    }
  121. +    else {
  122. +        dprintf(ACLLVL, "map_nfs4ace_who: Not an Unix_Group+ SID\n");
  123. +    }
  124. +#endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  125. +
  126.      status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
  127.          &tmp_size, &sid_type);
  128.      dprintf(ACLLVL, "map_nfs4ace_who: LookupAccountSid returned %d GetLastError "
  129. @@ -526,6 +607,8 @@ add_domain:
  130.      if (who) free(who);
  131.      status = ERROR_SUCCESS;
  132.  out:
  133. +    if (sidstr)
  134. +        LocalFree(sidstr);
  135.      return status;
  136.  out_free_who:
  137.      free(who);
  138. diff --git a/daemon/sid.h b/daemon/sid.h
  139. index e6d87c5..232e456 100644
  140. --- a/daemon/sid.h
  141. +++ b/daemon/sid.h
  142. @@ -27,6 +27,10 @@
  143.  #include "nfs41_build_features.h"
  144.  #include "nfs41_daemon.h"
  145.  
  146. +#define UNIXUSERSID_PREFIX  "S-1-22-1-"
  147. +#define UNIXGROUPSID_PREFIX "S-1-22-2-"
  148. +
  149. +
  150.  /* prototypes */
  151.  int create_unknownsid(WELL_KNOWN_SID_TYPE type, PSID *sid, DWORD *sid_len);
  152.  void sidcache_init(void);
  153. diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
  154. index b3cf06c..d496497 100644
  155. --- a/sys/nfs41_driver.c
  156. +++ b/sys/nfs41_driver.c
  157. @@ -2643,8 +2643,10 @@ NTSTATUS map_mount_errors(
  158.      case ERROR_BAD_NET_RESP:    return STATUS_UNEXPECTED_NETWORK_ERROR;
  159.      case ERROR_BAD_NET_NAME:    return STATUS_BAD_NETWORK_NAME;
  160.      case ERROR_BAD_NETPATH:     return STATUS_BAD_NETWORK_PATH;
  161. +    case ERROR_INTERNAL_ERROR:  return STATUS_INTERNAL_ERROR;
  162.      default:
  163. -        print_error("failed to map windows error %d to NTSTATUS; "
  164. +        print_error("map_mount_errors: "
  165. +            "failed to map windows ERROR_%d to NTSTATUS; "
  166.              "defaulting to STATUS_INSUFFICIENT_RESOURCES\n", status);
  167.          return STATUS_INSUFFICIENT_RESOURCES;
  168.      }
  169. @@ -3604,8 +3606,9 @@ NTSTATUS map_open_errors(
  170.      case ERROR_TOO_MANY_LINKS:          return STATUS_TOO_MANY_LINKS;
  171.      case ERROR_DIRECTORY:               return STATUS_FILE_IS_A_DIRECTORY;
  172.      case ERROR_BAD_FILE_TYPE:           return STATUS_NOT_A_DIRECTORY;
  173. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  174.      default:
  175. -        print_error("[ERROR] nfs41_Create: upcall returned %d returning "
  176. +        print_error("[ERROR] nfs41_Create: upcall returned ERROR_%d returning "
  177.              "STATUS_INSUFFICIENT_RESOURCES\n", status);
  178.      case ERROR_OUTOFMEMORY:             return STATUS_INSUFFICIENT_RESOURCES;
  179.      }
  180. @@ -4215,7 +4218,8 @@ NTSTATUS map_close_errors(
  181.      case ERROR_NOT_EMPTY:       return STATUS_DIRECTORY_NOT_EMPTY;
  182.      case ERROR_FILE_INVALID:    return STATUS_FILE_INVALID;
  183.      default:
  184. -        print_error("failed to map windows error %d to NTSTATUS; "
  185. +        print_error("map_close_errors: "
  186. +            "failed to map windows ERROR_%d to NTSTATUS; "
  187.              "defaulting to STATUS_INTERNAL_ERROR\n", status);
  188.      case ERROR_INTERNAL_ERROR:  return STATUS_INTERNAL_ERROR;
  189.      }
  190. @@ -4345,8 +4349,10 @@ NTSTATUS map_querydir_errors(
  191.      case ERROR_NO_MORE_FILES:       return STATUS_NO_MORE_FILES;
  192.      case ERROR_OUTOFMEMORY:         return STATUS_INSUFFICIENT_RESOURCES;
  193.      case ERROR_FILENAME_EXCED_RANGE: return STATUS_NAME_TOO_LONG;
  194. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  195.      default:
  196. -        print_error("failed to map windows error %d to NTSTATUS; "
  197. +        print_error("map_querydir_errors: "
  198. +            "failed to map windows ERROR_%d to NTSTATUS; "
  199.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  200.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  201.      }
  202. @@ -4489,8 +4495,10 @@ NTSTATUS map_volume_errors(
  203.      case ERROR_NETNAME_DELETED:     return STATUS_NETWORK_NAME_DELETED;
  204.      case ERROR_INVALID_PARAMETER:   return STATUS_INVALID_PARAMETER;
  205.      case ERROR_OUTOFMEMORY:         return STATUS_INSUFFICIENT_RESOURCES;
  206. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  207.      default:
  208. -        print_error("failed to map windows error %d to NTSTATUS; "
  209. +        print_error("map_volume_errors: "
  210. +            "failed to map windows ERROR_%d to NTSTATUS; "
  211.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  212.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  213.      }
  214. @@ -4769,8 +4777,10 @@ NTSTATUS map_setea_error(
  215.      case ERROR_INVALID_EA_HANDLE:       return STATUS_NONEXISTENT_EA_ENTRY;
  216.      case ERROR_NO_MORE_FILES:           return STATUS_NO_MORE_EAS;
  217.      case ERROR_EA_FILE_CORRUPT:         return STATUS_EA_CORRUPT_ERROR;
  218. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  219.      default:
  220. -        print_error("failed to map windows error %d to NTSTATUS; "
  221. +        print_error("map_setea_error: "
  222. +            "failed to map windows ERROR_%d to NTSTATUS; "
  223.              "defaulting to STATUS_INVALID_PARAMETER\n", error);
  224.      case ERROR_INVALID_PARAMETER:       return STATUS_INVALID_PARAMETER;
  225.      }
  226. @@ -5185,8 +5195,10 @@ NTSTATUS map_query_acl_error(
  227.      case ERROR_ACCESS_DENIED:       return STATUS_ACCESS_DENIED;
  228.      case ERROR_FILE_NOT_FOUND:      return STATUS_OBJECT_NAME_NOT_FOUND;
  229.      case ERROR_INVALID_PARAMETER:   return STATUS_INVALID_PARAMETER;
  230. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  231.      default:
  232. -        print_error("failed to map windows error %d to NTSTATUS; "
  233. +        print_error("map_query_acl_error: "
  234. +            "failed to map windows ERROR_%d to NTSTATUS; "
  235.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
  236.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  237.      }
  238. @@ -5449,8 +5461,10 @@ NTSTATUS map_queryfile_error(
  239.      case ERROR_ACCESS_DENIED:       return STATUS_ACCESS_DENIED;
  240.      case ERROR_NETNAME_DELETED:     return STATUS_NETWORK_NAME_DELETED;
  241.      case ERROR_INVALID_PARAMETER:   return STATUS_INVALID_PARAMETER;
  242. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  243.      default:
  244. -        print_error("failed to map windows error %d to NTSTATUS; "
  245. +        print_error("map_queryfile_error: "
  246. +            "failed to map windows ERROR_%d to NTSTATUS; "
  247.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
  248.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  249.      }
  250. @@ -5634,8 +5648,10 @@ NTSTATUS map_setfile_error(
  251.      case ERROR_NETWORK_ACCESS_DENIED:   return STATUS_NETWORK_ACCESS_DENIED;
  252.      case ERROR_NETNAME_DELETED:         return STATUS_NETWORK_NAME_DELETED;
  253.      case ERROR_BUFFER_OVERFLOW:         return STATUS_INSUFFICIENT_RESOURCES;
  254. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  255.      default:
  256. -        print_error("failed to map windows error %d to NTSTATUS; "
  257. +        print_error("map_setfile_error: "
  258. +            "failed to map windows ERROR_%d to NTSTATUS; "
  259.              "defaulting to STATUS_INVALID_PARAMETER\n", error);
  260.      case ERROR_INVALID_PARAMETER:       return STATUS_INVALID_PARAMETER;
  261.      }
  262. @@ -6022,8 +6038,10 @@ NTSTATUS map_readwrite_errors(
  263.      case ERROR_LOCK_VIOLATION:          return STATUS_FILE_LOCK_CONFLICT;
  264.      case ERROR_NETWORK_ACCESS_DENIED:   return STATUS_NETWORK_ACCESS_DENIED;
  265.      case ERROR_NETNAME_DELETED:         return STATUS_NETWORK_NAME_DELETED;
  266. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  267.      default:
  268. -        print_error("failed to map windows error %d to NTSTATUS; "
  269. +        print_error("map_readwrite_errors: "
  270. +            "failed to map windows ERROR_%d to NTSTATUS; "
  271.              "defaulting to STATUS_NET_WRITE_FAULT\n", status);
  272.      case ERROR_NET_WRITE_FAULT:         return STATUS_NET_WRITE_FAULT;
  273.      }
  274. @@ -6301,8 +6319,10 @@ NTSTATUS map_lock_errors(
  275.      /* if we return ERROR_INVALID_PARAMETER, Windows translates that to
  276.       * success!! */
  277.      case ERROR_INVALID_PARAMETER:   return STATUS_LOCK_NOT_GRANTED;
  278. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  279.      default:
  280. -        print_error("failed to map windows error %d to NTSTATUS; "
  281. +        print_error("map_lock_errors: "
  282. +            "failed to map windows ERROR_%d to NTSTATUS; "
  283.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  284.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  285.      }
  286. @@ -6521,8 +6541,10 @@ NTSTATUS map_symlink_errors(
  287.      case ERROR_INSUFFICIENT_BUFFER: return STATUS_BUFFER_TOO_SMALL;
  288.      case STATUS_BUFFER_TOO_SMALL:
  289.      case ERROR_BUFFER_OVERFLOW:     return STATUS_BUFFER_OVERFLOW;
  290. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  291.      default:
  292. -        print_error("failed to map windows error %d to NTSTATUS; "
  293. +        print_error("map_symlink_errors: "
  294. +            "failed to map windows ERROR_%d to NTSTATUS; "
  295.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  296.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  297.      }

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