pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


msnfs41client: backup for libtirpc work
Posted by Anonymous on Thu 26th Oct 2023 13:51
raw | new post

  1. diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
  2. index 36b6c4f..0694ed6 100644
  3. --- a/build.vc19/libtirpc/libtirpc.vcxproj
  4. +++ b/build.vc19/libtirpc/libtirpc.vcxproj
  5. @@ -87,7 +87,7 @@
  6.        </PrecompiledHeader>
  7.        <WarningLevel>Level3</WarningLevel>
  8.        <Optimization>Disabled</Optimization>
  9. -      <PreprocessorDefinitions>FD_SETSIZE=128;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  10. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  11.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  12.      </ClCompile>
  13.      <Link>
  14. @@ -103,7 +103,7 @@
  15.        </PrecompiledHeader>
  16.        <WarningLevel>Level3</WarningLevel>
  17.        <Optimization>Disabled</Optimization>
  18. -      <PreprocessorDefinitions>FD_SETSIZE=128;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  19. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  20.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  21.      </ClCompile>
  22.      <Link>
  23. @@ -121,7 +121,7 @@
  24.        <Optimization>MaxSpeed</Optimization>
  25.        <FunctionLevelLinking>true</FunctionLevelLinking>
  26.        <IntrinsicFunctions>true</IntrinsicFunctions>
  27. -      <PreprocessorDefinitions>FD_SETSIZE=128;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  28. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  29.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  30.      </ClCompile>
  31.      <Link>
  32. @@ -141,7 +141,7 @@
  33.        <Optimization>MaxSpeed</Optimization>
  34.        <FunctionLevelLinking>true</FunctionLevelLinking>
  35.        <IntrinsicFunctions>true</IntrinsicFunctions>
  36. -      <PreprocessorDefinitions>FD_SETSIZE=128;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  37. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  38.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  39.      </ClCompile>
  40.      <Link>
  41. diff --git a/daemon/acl.c b/daemon/acl.c
  42. index 1d1eac4..4297722 100644
  43. --- a/daemon/acl.c
  44. +++ b/daemon/acl.c
  45. @@ -223,6 +223,18 @@ static int map_name_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *sid_l
  46.              name = "roland_mainz";
  47.              dprintf(ACLLVL, "map_name_2_sid: remap 1616 --> roland_mainz\n");
  48.          }
  49. +        else if (!strcmp(name, "swulsch")) {
  50. +            name = "siegfried_wulsch";
  51. +            dprintf(ACLLVL, "map_name_2_sid: remap swulsch --> siegfried_wulsch\n");
  52. +        }
  53. +        else if (!strcmp(name, "197609")) {
  54. +            name = "siegfried_wulsch";
  55. +            dprintf(ACLLVL, "map_name_2_sid: remap 197609 --> siegfried_wulsch\n");
  56. +        }
  57. +        else if (!strcmp(name, "1818")) {
  58. +            name = "siegfried_wulsch";
  59. +            dprintf(ACLLVL, "map_name_2_sid: remap 1818 --> siegfried_wulsch\n");
  60. +        }
  61.      }
  62.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  63.  
  64. diff --git a/daemon/getattr.c b/daemon/getattr.c
  65. index 7c5f241..ee9f5e1 100644
  66. --- a/daemon/getattr.c
  67. +++ b/daemon/getattr.c
  68. @@ -80,6 +80,21 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  69.      nfs41_open_state *state = upcall->state_ref;
  70.      nfs41_file_info info = { 0 };
  71.  
  72. +#if 1
  73. +    if (((char *)state->session) == ((char *)0xdddddddddddddddd)) {
  74. +        eprintf("handle_getattr: Invalid session pointer 0xdddddddddddddddd\n");
  75. +        status = ERROR_INVALID_PARAMETER;
  76. +        goto out;
  77. +    }
  78. +
  79. +    EASSERT(state->file.fh.superblock != NULL);
  80. +    if (state->file.fh.superblock == NULL) {
  81. +        /* gisburn: fixme: maybe this should be |ERROR_INTERNAL_ERROR| ? */
  82. +        status = ERROR_INVALID_PARAMETER;
  83. +        goto out;
  84. +    }
  85. +#endif
  86. +
  87.      status = nfs41_cached_getattr(state->session, &state->file, &info);
  88.      if (status) {
  89.          eprintf("nfs41_cached_getattr() failed with %d\n", status);
  90. diff --git a/daemon/idmap.c b/daemon/idmap.c
  91. index 00af1fe..6947b6c 100644
  92. --- a/daemon/idmap.c
  93. +++ b/daemon/idmap.c
  94. @@ -133,7 +133,7 @@ static const struct config_option g_options[] = {
  95.      OPT_ATTR("ldap_attr_gidNumber", "gidNumber", ATTR_GID),
  96.  
  97.      /* caching configuration */
  98. -    OPT_INT("cache_ttl", "60", cache_ttl),
  99. +    OPT_INT("cache_ttl", "6000", cache_ttl),
  100.  };
  101.  
  102.  
  103. diff --git a/daemon/name_cache.c b/daemon/name_cache.c
  104. index 3f944fd..5bb6aee 100644
  105. --- a/daemon/name_cache.c
  106. +++ b/daemon/name_cache.c
  107. @@ -351,12 +351,24 @@ static void copy_attrs(
  108.      dst->type = src->type;
  109.      dst->numlinks = src->numlinks;
  110.      dst->mode = src->mode;
  111. -    EASSERT(src->owner != NULL);
  112. +    EASSERT(src->owner[0] != '\0');
  113. +    if (src->owner[0] != '\0') {
  114.          dst->owner = dst->owner_buf;
  115.          (void)strcpy(dst->owner, src->owner);
  116. -    EASSERT(src->owner_group != NULL);
  117. +    }
  118. +    else {
  119. +        /* this should only happen for newly created files7dirs */
  120. +        dst->owner = NULL;
  121. +    }
  122. +    EASSERT(src->owner_group[0] != '\0');
  123. +    if (src->owner_group[0] != '\0') {
  124.          dst->owner_group = dst->owner_group_buf;
  125.          (void)strcpy(dst->owner_group, src->owner_group);
  126. +    }
  127. +    else {
  128. +        /* this should only happen for newly created files7dirs */
  129. +        dst->owner_group = NULL;
  130. +    }
  131.      dst->fileid = src->fileid;
  132.      dst->hidden = src->hidden;
  133.      dst->system = src->system;
  134. @@ -369,8 +381,11 @@ static void copy_attrs(
  135.      dst->attrmask.arr[1] = FATTR4_WORD1_MODE
  136.          | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_TIME_ACCESS
  137.          | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_MODIFY
  138. -        | FATTR4_WORD1_SYSTEM
  139. -        | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
  140. +        | FATTR4_WORD1_SYSTEM;
  141. +    if (dst->owner)
  142. +        dst->attrmask.arr[1] |= FATTR4_WORD1_OWNER;
  143. +    if (dst->owner_group)
  144. +        dst->attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
  145.  }
  146.  
  147.  
  148. diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
  149. index 9bde0f0..6889a79 100644
  150. --- a/daemon/nfs41_xdr.c
  151. +++ b/daemon/nfs41_xdr.c
  152. @@ -1815,6 +1815,7 @@ static bool_t decode_file_attrs(
  153.              EASSERT(owner_len > 0);
  154.              EASSERT(owner_len < sizeof(info->owner_group_buf));
  155.              info->owner[owner_len] = '\0';
  156. +            EASSERT(info->owner[0] != '\0');
  157.          }
  158.          if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
  159.              if (info->owner_group == NULL)
  160. @@ -1830,6 +1831,7 @@ static bool_t decode_file_attrs(
  161.              EASSERT(owner_group_len > 0);
  162.              EASSERT(owner_group_len < sizeof(info->owner_group_buf));
  163.              info->owner_group[owner_group_len] = '\0';
  164. +            EASSERT(info->owner_group[0] != '\0');
  165.          }
  166.          if (attrs->attrmask.arr[1] & FATTR4_WORD1_SPACE_AVAIL) {
  167.              if (!xdr_u_hyper(xdr, &info->space_avail))
  168. diff --git a/daemon/open.c b/daemon/open.c
  169. index a9ffcb0..1f8bd54 100644
  170. --- a/daemon/open.c
  171. +++ b/daemon/open.c
  172. @@ -99,6 +99,24 @@ static void open_state_free(
  173.  void nfs41_open_state_ref(
  174.      IN nfs41_open_state *state)
  175.  {
  176. +#if 1
  177. +    /*
  178. +     * gisburn: fixme: sometimes this happens under high parallel
  179. +     * usage with multiple mounts - but why ?
  180. +     * 0:038> kp
  181. +     * Child-SP          RetAddr           Call Site
  182. +     * 0000006d`431fde10 00007ff7`32f7d905 nfsd!nfs41_open_state_ref(struct __nfs41_open_state * state = 0x00000000`00000000)+0x31
  183. +     * 0000006d`431fdf30 00007ff7`32f4d284 nfsd!upcall_parse(unsigned char * buffer = 0x0000006d`431fe180 "???", unsigned int length = 8, struct __nfs41_upcall * upcall = 0x0000006d`431ff1e0)+0x2e5
  184. +     * 0000006d`431fe0b0 00007ffc`1ca24c7c nfsd!thread_main(void * args = 0x00007ff7`32fb6080)+0x144
  185. +     * 0000006d`431ffe00 00007ffc`4d4b7344 ucrtbased!thread_start<unsigned int (void * parameter = 0x0000025d`a9c6def0)+0x9c
  186. +     * 0000006d`431ffe60 00007ffc`4efc26b1 KERNEL32!BaseThreadInitThunk+0x14
  187. +     * 0000006d`431ffe90 00000000`00000000 ntdll!RtlUserThreadStart+0x21
  188. +     */
  189. +    EASSERT(state != NULL);
  190. +    if (state == NULL)
  191. +        return;
  192. +#endif
  193. +
  194.      const LONG count = InterlockedIncrement(&state->ref_count);
  195.  
  196.      dprintf(2, "nfs41_open_state_ref(%s) count %d\n", state->path.path, count);
  197. @@ -669,12 +687,47 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  198.          gid_t map_gid = -1;
  199.          char *at_ch; /* pointer to '@' */
  200.  
  201. +#if 1
  202. +        /* this should only happen for newly created files/dirs */
  203. +        if (((info.attrmask.arr[1] & FATTR4_WORD1_OWNER) == 0) ||
  204. +            ((info.attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) == 0)) {
  205. +            bitmap4 og_attr_request = { 0 };
  206. +            nfs41_file_info og_info = { 0 };
  207. +            nfsacl41 acl = { 0 };
  208. +
  209. +            og_attr_request.count = 2;
  210. +            og_attr_request.arr[1] =
  211. +                FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
  212. +            og_info.owner = og_info.owner_buf;
  213. +            og_info.owner_group = og_info.owner_group_buf;
  214. +            status = nfs41_getattr(state->session, &state->file,
  215. +                &og_attr_request, &og_info);
  216. +            if (status) {
  217. +                eprintf("get_stat_data: nfs41_getattr('%s') "
  218. +                    "failed with %d\n",
  219. +                    state->path.path,
  220. +                    status);
  221. +                goto out_free_state;
  222. +            }
  223. +
  224. +            info.owner = info.owner_buf;
  225. +            (void)strcpy(info.owner, og_info.owner);
  226. +            info.attrmask.arr[1] |= FATTR4_WORD1_OWNER;
  227. +            info.owner_group = info.owner_group_buf;
  228. +            (void)strcpy(info.owner_group, og_info.owner_group);
  229. +            info.attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
  230. +        }
  231. +#endif
  232. +
  233.          EASSERT((info.attrmask.arr[1] & FATTR4_WORD1_OWNER) != 0);
  234.          EASSERT((info.attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) != 0);
  235.          EASSERT(info.owner != NULL);
  236.          EASSERT(info.owner_group != NULL);
  237.          EASSERT(info.owner == info.owner_buf);
  238.          EASSERT(info.owner_group == info.owner_group_buf);
  239. +        EASSERT(strlen(info.owner) > 0);
  240. +        EASSERT(strlen(info.owner_group) > 0);
  241. +
  242.          /* Make copies as we will modify  them */
  243.          (void)strcpy(owner, info.owner);
  244.          (void)strcpy(owner_group, info.owner_group);
  245. @@ -698,8 +751,9 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  246.          }
  247.          else {
  248.              args->owner_local_uid = NFS_USER_NOBODY_UID;
  249. -            eprintf("get_stat_data: "
  250. +            eprintf("get_stat_data('%s'): "
  251.                  "no username mapping for '%s', fake uid=%d\n",
  252. +                state->path.path,
  253.                  owner, args->owner_local_uid);
  254.          }
  255.  
  256. @@ -721,12 +775,14 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  257.          }
  258.          else {
  259.              args->owner_group_local_gid = NFS_GROUP_NOGROUP_GID;
  260. -            eprintf("get_stat_data: "
  261. +            eprintf("get_stat_data('%s'): "
  262.                  "no group mapping for '%s', fake gid=%d\n",
  263. +                state->path.path,
  264.                  owner_group, args->owner_group_local_gid);
  265.          }
  266.  
  267. -        dprintf(1, "handle_open: stat: owner=%u/'%s', owner_group=%u/'%s'\n",
  268. +        dprintf(1, "handle_open('%s'): stat: owner=%u/'%s', owner_group=%u/'%s'\n",
  269. +            state->path.path,
  270.              (unsigned int)args->owner_local_uid, owner,
  271.              (unsigned int)args->owner_group_local_gid, owner_group);
  272.  #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
  273. diff --git a/daemon/util.c b/daemon/util.c
  274. index 07aa2c6..c482624 100644
  275. --- a/daemon/util.c
  276. +++ b/daemon/util.c
  277. @@ -207,7 +207,9 @@ void nfs41_file_info_cpy(
  278.      IN const nfs41_file_info *src)
  279.  {
  280.      (void)memcpy(dest, src, sizeof(nfs41_file_info));
  281. +    if (src->owner != NULL)
  282.          dest->owner = dest->owner_buf;
  283. +    if (src->owner_group != NULL)
  284.          dest->owner_group = dest->owner_group_buf;
  285.  }
  286.  
  287. diff --git a/libtirpc/src/auth_time.c b/libtirpc/src/auth_time.c
  288. index ad8e521..7a5b3d0 100644
  289. --- a/libtirpc/src/auth_time.c
  290. +++ b/libtirpc/src/auth_time.c
  291. @@ -383,6 +383,18 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
  292.                         goto error;
  293.                 }
  294.                  
  295. +#if 1
  296. +                int myfd = _open_osfhandle(s, _O_BINARY);
  297. +                if (myfd < 0) {
  298. +                    closesocket(s);
  299. +                    /* _open_osfhandle may not set errno, and closesocket() may override it */
  300. +                    errno = ENOMEM;
  301. +                    goto error;
  302. +                }
  303. +                fprintf(stderr, "%s/%d: sock fd=%d\n", __FILE__, (int)__LINE__, myfd);
  304. +                s = _get_osfhandle(myfd);
  305. +#endif
  306. +
  307.                 /*
  308.                  * Now depending on whether or not we're talking to
  309.                  * UDP we set a timeout or not.
  310. diff --git a/libtirpc/src/rpc_generic.c b/libtirpc/src/rpc_generic.c
  311. index 42dca45..f947f77 100644
  312. --- a/libtirpc/src/rpc_generic.c
  313. +++ b/libtirpc/src/rpc_generic.c
  314. @@ -567,6 +567,17 @@ __rpc_nconf2fd(const struct netconfig *nconf)
  315.             si.si_af == AF_INET6) {
  316.                 int val = 1;
  317.  
  318. +#if 1
  319. +                int myfd = _open_osfhandle(fd, _O_BINARY);
  320. +                if (myfd < 0) {
  321. +                    closesocket(fd);
  322. +                    /* _open_osfhandle may not set errno, and closesocket() may override it */
  323. +                    errno = ENOMEM;
  324. +                    return INVALID_SOCKET;
  325. +                }
  326. +                fprintf(stderr, "%s/%d: sock fd=%d\n", __FILE__, (int)__LINE__, myfd);
  327. +                fd = _get_osfhandle(myfd);
  328. +#endif
  329.                 setsockopt(fd, SOL_IPV6, IPV6_V6ONLY, (const char *)&val, sizeof(val));
  330.         }
  331.         return fd;
  332. diff --git a/libtirpc/src/rpc_soc.c b/libtirpc/src/rpc_soc.c
  333. index 4b69810..3d08eb2 100644
  334. --- a/libtirpc/src/rpc_soc.c
  335. +++ b/libtirpc/src/rpc_soc.c
  336. @@ -553,6 +553,17 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
  337.                                 (void)closesocket(*sockp);
  338.                         goto done;
  339.                 }
  340. +#if 1
  341. +                int myfd = _open_osfhandle(*sockp, _O_BINARY);
  342. +                if (myfd < 0) {
  343. +                    closesocket(*sockp);
  344. +                    /* _open_osfhandle may not set errno, and closesocket() may override it */
  345. +                    errno = ENOMEM;
  346. +                    goto done;
  347. +                }
  348. +                fprintf(stderr, "%s/%d: sock fd=%d\n", __FILE__, (int)__LINE__, myfd);
  349. +                *sockp = _get_osfhandle(myfd);
  350. +#endif
  351.          }
  352.         svcaddr->buf = raddr;
  353.         svcaddr->len = sizeof(raddr);
  354. diff --git a/libtirpc/src/rpcb_clnt.c b/libtirpc/src/rpcb_clnt.c
  355. index b8c30c1..9eec261 100644
  356. --- a/libtirpc/src/rpcb_clnt.c
  357. +++ b/libtirpc/src/rpcb_clnt.c
  358. @@ -437,6 +437,18 @@ local_rpcb()
  359.         sock = socket(AF_UNIX, SOCK_STREAM, 0);
  360.         if (sock == INVALID_SOCKET)
  361.                 goto try_nconf;
  362. +#if 1
  363. +                int myfd = _open_osfhandle(sock, _O_BINARY);
  364. +                if (myfd < 0) {
  365. +                    closesocket(sock);
  366. +                    /* _open_osfhandle may not set errno, and closesocket() may override it */
  367. +                    errno = ENOMEM;
  368. +                    goto try_nconf;
  369. +                }
  370. +                fprintf(stderr, "%s/%d: sock fd=%d\n", __FILE__, (int)__LINE__, myfd);
  371. +                sock = _get_osfhandle(myfd);
  372. +#endif
  373. +
  374.         sun.sun_family = AF_UNIX;
  375.         strcpy(sun.sun_path, _PATH_RPCBINDSOCK);
  376.         nbuf.len = SUN_LEN(&sun);
  377. @@ -675,6 +687,17 @@ __rpcbind_is_up()
  378.         sock = socket(AF_UNIX, SOCK_STREAM, 0);
  379.         if (sock == INVALID_SOCKET)
  380.                 return (FALSE);
  381. +#if 1
  382. +                int myfd = _open_osfhandle(sock, _O_BINARY);
  383. +                if (myfd < 0) {
  384. +                    closesocket(sock);
  385. +                    /* _open_osfhandle may not set errno, and closesocket() may override it */
  386. +                    errno = ENOMEM;
  387. +                    return FALSE;
  388. +                }
  389. +                fprintf(stderr, "%s/%d: sock fd=%d\n", __FILE__, (int)__LINE__, myfd);
  390. +                sock = _get_osfhandle(myfd);
  391. +#endif
  392.         sun.sun_family = AF_UNIX;
  393.         strncpy(sun.sun_path, _PATH_RPCBINDSOCK, sizeof(sun.sun_path));
  394.  
  395. diff --git a/libtirpc/src/rtime.c b/libtirpc/src/rtime.c
  396. index f933ff6..fc71562 100644
  397. --- a/libtirpc/src/rtime.c
  398. +++ b/libtirpc/src/rtime.c
  399. @@ -85,6 +85,17 @@ rtime(addrp, timep, timeout)
  400.         if (s == INVALID_SOCKET) {
  401.                 return(-1);
  402.         }
  403. +#if 1
  404. +                int myfd = _open_osfhandle(s, _O_BINARY);
  405. +                if (myfd < 0) {
  406. +                    closesocket(s);
  407. +                    /* _open_osfhandle may not set errno, and closesocket() may override it */
  408. +                    errno = ENOMEM;
  409. +                    return -1;
  410. +                }
  411. +                fprintf(stderr, "%s/%d: sock fd=%d\n", __FILE__, (int)__LINE__, myfd);
  412. +                s = _get_osfhandle(myfd);
  413. +#endif
  414.         addrp->sin_family = AF_INET;
  415.  
  416.         /* TCP and UDP port are the same in this case */
  417. diff --git a/libtirpc/tirpc/wintirpc.h b/libtirpc/tirpc/wintirpc.h
  418. index a299835..2aef47b 100644
  419. --- a/libtirpc/tirpc/wintirpc.h
  420. +++ b/libtirpc/tirpc/wintirpc.h
  421. @@ -44,6 +44,8 @@
  422.  #include <windows.h>
  423.  #include <process.h>
  424.  #include <basetsd.h>
  425. +#include <fcntl.h>
  426. +#include <io.h>
  427.  
  428.  //#define snprintf _snprintf
  429.  //#define vsnprintf _vsnprintf
  430. @@ -66,7 +68,7 @@
  431.  /*
  432.   * Hash of Windows Socket Handle values
  433.   */
  434. -#define WINSOCK_HANDLE_HASH_SIZE       1024
  435. +#define WINSOCK_HANDLE_HASH_SIZE       (256*256*256)
  436.  #define WINSOCK_HANDLE_HASH(x) (((x) >> 2) % WINSOCK_HANDLE_HASH_SIZE)
  437.  
  438.  /*
  439. diff --git a/sys/nfs41_build_features.h b/sys/nfs41_build_features.h
  440. index 93ee7a9..d43334a 100644
  441. --- a/sys/nfs41_build_features.h
  442. +++ b/sys/nfs41_build_features.h
  443. @@ -32,19 +32,19 @@
  444.  /*
  445.   * NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES - return local uid/gid values
  446.   */
  447. -// #define NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES 1
  448. +#define NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES 1
  449.  
  450.  /*
  451.   * NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID - give NFS
  452.   * files which do not map to a local account a SID in the
  453.   * Unix_User+x/Unix_Group+x range
  454.   */
  455. -// #define NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID 1
  456. +#define NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID 1
  457.  
  458.  /*
  459.   * NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN - use Cygwin /usr/bin/getent
  460.   * as "name service"
  461.   */
  462. -// #define NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN 1
  463. +#define NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN 1
  464.  
  465.  #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */

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