ReactOS  0.4.12-dev-18-gf469aca
nfs41_daemon.c
Go to the documentation of this file.
1 /* NFSv4.1 client for Windows
2  * Copyright 2012 The Regents of the University of Michigan
3  *
4  * Olga Kornievskaia <aglo@umich.edu>
5  * Casey Bodley <cbodley@umich.edu>
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * without any warranty; without even the implied warranty of merchantability
14  * or fitness for a particular purpose. See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  */
21 
22 #include <windows.h>
23 #include <process.h>
24 #include <tchar.h>
25 #include <stdio.h>
26 #ifdef __REACTOS__
27 #include <strsafe.h>
28 #endif
29 
30 #include <devioctl.h>
31 #include <lmcons.h> /* UNLEN for GetUserName() */
32 #include <iphlpapi.h> /* for GetNetworkParam() */
33 #include "nfs41_driver.h" /* for NFS41_USER_DEVICE_NAME_A */
34 #include "nfs41_np.h" /* for NFS41NP_SHARED_MEMORY */
35 
36 #include "idmap.h"
37 #include "daemon_debug.h"
38 #include "upcall.h"
39 #include "util.h"
40 
41 #define MAX_NUM_THREADS 128
43 
44 #ifndef __REACTOS__
45 static const char FILE_NETCONFIG[] = "C:\\ReactOS\\System32\\drivers\\etc\\netconfig";
46 #endif
47 
48 /* Globals */
50 int default_uid = 666;
51 int default_gid = 777;
52 
53 #ifndef STANDALONE_NFSD //make sure to define it in "sources" not here
54 #include "service.h"
56 #endif
57 typedef struct _nfs41_process_thread {
61 
62 static int map_user_to_ids(nfs41_idmapper *idmapper, uid_t *uid, gid_t *gid)
63 {
64  char username[UNLEN + 1];
65  DWORD len = UNLEN + 1;
66  int status = NO_ERROR;
67 
68  if (!GetUserNameA(username, &len)) {
69  status = GetLastError();
70  eprintf("GetUserName() failed with %d\n", status);
71  goto out;
72  }
73  dprintf(1, "map_user_to_ids: mapping user %s\n", username);
74 
75  if (nfs41_idmap_name_to_ids(idmapper, username, uid, gid)) {
76  /* instead of failing for auth_sys, fall back to 'nobody' uid/gid */
77  *uid = default_uid;
78  *gid = default_gid;
79  }
80 out:
81  return status;
82 }
83 
84 static unsigned int WINAPI thread_main(void *args)
85 {
86  nfs41_idmapper *idmapper = (nfs41_idmapper*)args;
87  DWORD status = 0;
88  HANDLE pipe;
89  // buffer used to process upcall, assumed to be fixed size.
90  // if we ever need to handle non-cached IO, need to make it dynamic
91  unsigned char outbuf[UPCALL_BUF_SIZE], inbuf[UPCALL_BUF_SIZE];
92  DWORD inbuf_len = UPCALL_BUF_SIZE, outbuf_len;
94 
97  0, NULL);
98  if (pipe == INVALID_HANDLE_VALUE)
99  {
100  eprintf("Unable to open upcall pipe %d\n", GetLastError());
101  return GetLastError();
102  }
103 
104  while(1) {
105  status = DeviceIoControl(pipe, IOCTL_NFS41_READ, NULL, 0,
106  outbuf, UPCALL_BUF_SIZE, (LPDWORD)&outbuf_len, NULL);
107  if (!status) {
108  eprintf("IOCTL_NFS41_READ failed %d\n", GetLastError());
109  continue;
110  }
111 
112  status = upcall_parse(outbuf, (uint32_t)outbuf_len, &upcall);
113  if (status) {
114  upcall.status = status;
115  goto write_downcall;
116  }
117 
118  /* map username to uid/gid */
119  status = map_user_to_ids(idmapper, &upcall.uid, &upcall.gid);
120  if (status) {
121  upcall.status = status;
122  goto write_downcall;
123  }
124 
125  if (upcall.opcode == NFS41_SHUTDOWN) {
126  printf("Shutting down..\n");
127  exit(0);
128  }
129 
130  status = upcall_handle(&upcall);
131 
132 write_downcall:
133  dprintf(1, "writing downcall: xid=%lld opcode=%s status=%d "
134  "get_last_error=%d\n", upcall.xid, opcode2string(upcall.opcode),
135  upcall.status, upcall.last_error);
136 
137  upcall_marshall(&upcall, inbuf, (uint32_t)inbuf_len, (uint32_t*)&outbuf_len);
138 
139  dprintf(2, "making a downcall: outbuf_len %ld\n\n", outbuf_len);
140  status = DeviceIoControl(pipe, IOCTL_NFS41_WRITE,
141  inbuf, inbuf_len, NULL, 0, (LPDWORD)&outbuf_len, NULL);
142  if (!status) {
143  eprintf("IOCTL_NFS41_WRITE failed with %d xid=%lld opcode=%s\n",
144  GetLastError(), upcall.xid, opcode2string(upcall.opcode));
145  upcall_cancel(&upcall);
146  }
147  if (upcall.status != NFSD_VERSION_MISMATCH)
148  upcall_cleanup(&upcall);
149  }
150  CloseHandle(pipe);
151 
152  return GetLastError();
153 }
154 
155 #ifndef STANDALONE_NFSD
157 {
158  if (stop_event)
159  SetEvent(stop_event);
160 }
161 #endif
162 
163 typedef struct _nfsd_args {
166 } nfsd_args;
167 
169 {
170  FILE *fd;
171 #ifdef __REACTOS__
172  char config_path[MAX_PATH];
173 
174  if (GetSystemDirectoryA(config_path, ARRAYSIZE(config_path)))
175  {
176  StringCchCatA(config_path, ARRAYSIZE(config_path), "\\drivers\\etc\\netconfig");
177  }
178  else
179  {
180  StringCchCopyA(config_path, ARRAYSIZE(config_path), "C:\\ReactOS\\system32\\drivers\\etc\\netconfig");
181  }
182 
183  fd = fopen(config_path, "r");
184 #else
185 
186  fd = fopen(FILE_NETCONFIG, "r");
187 #endif
188  if (fd == NULL) {
189 #ifdef __REACTOS__
190  fprintf(stderr,"nfsd() failed to open file '%s'\n", config_path);
191 #else
192  fprintf(stderr,"nfsd() failed to open file '%s'\n", FILE_NETCONFIG);
193 #endif
194  return FALSE;
195  }
196  fclose(fd);
197  return TRUE;
198 }
199 
200 static void PrintUsage()
201 {
202  fprintf(stderr, "Usage: nfsd.exe -d <debug_level> --noldap "
203  "--uid <non-zero value> --gid\n");
204 }
206 {
207  int i;
208 
209  /* set defaults. */
210  out->debug_level = 1;
211  out->ldap_enable = TRUE;
212 
213  /* parse command line */
214  for (i = 1; i < argc; i++) {
215  if (argv[i][0] == TEXT('-')) {
216  if (_tcscmp(argv[i], TEXT("-h")) == 0) { /* help */
217  PrintUsage();
218  return FALSE;
219  }
220  else if (_tcscmp(argv[i], TEXT("-d")) == 0) { /* debug level */
221  ++i;
222  if (i >= argc) {
223  fprintf(stderr, "Missing debug level value\n");
224  PrintUsage();
225  return FALSE;
226  }
227  out->debug_level = _ttoi(argv[i]);
228  }
229  else if (_tcscmp(argv[i], TEXT("--noldap")) == 0) { /* no LDAP */
230  out->ldap_enable = FALSE;
231  }
232  else if (_tcscmp(argv[i], TEXT("--uid")) == 0) { /* no LDAP, setting default uid */
233  ++i;
234  if (i >= argc) {
235  fprintf(stderr, "Missing uid value\n");
236  PrintUsage();
237  return FALSE;
238  }
239  default_uid = _ttoi(argv[i]);
240  if (!default_uid) {
241  fprintf(stderr, "Invalid (or missing) anonymous uid value of %d\n",
242  default_uid);
243  return FALSE;
244  }
245  }
246  else if (_tcscmp(argv[i], TEXT("--gid")) == 0) { /* no LDAP, setting default gid */
247  ++i;
248  if (i >= argc) {
249  fprintf(stderr, "Missing gid value\n");
250  PrintUsage();
251  return FALSE;
252  }
253  default_gid = _ttoi(argv[i]);
254  }
255  else
256  fprintf(stderr, "Unrecognized option '%s', disregarding.\n", argv[i]);
257  }
258  }
259  fprintf(stdout, "parse_cmdlineargs: debug_level %d ldap is %d\n",
260  out->debug_level, out->ldap_enable);
261  return TRUE;
262 }
263 
264 static void print_getaddrinfo(struct addrinfo *ptr)
265 {
266  char ipstringbuffer[46];
267  DWORD ipbufferlength = 46;
268 
269  dprintf(1, "getaddrinfo response flags: 0x%x\n", ptr->ai_flags);
270  switch (ptr->ai_family) {
271  case AF_UNSPEC: dprintf(1, "Family: Unspecified\n"); break;
272  case AF_INET:
273  dprintf(1, "Family: AF_INET IPv4 address %s\n",
274  inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr));
275  break;
276  case AF_INET6:
278  NULL, ipstringbuffer, &ipbufferlength))
279  dprintf(1, "WSAAddressToString failed with %u\n", WSAGetLastError());
280  else
281  dprintf(1, "Family: AF_INET6 IPv6 address %s\n", ipstringbuffer);
282  break;
283  case AF_NETBIOS: dprintf(1, "AF_NETBIOS (NetBIOS)\n"); break;
284  default: dprintf(1, "Other %ld\n", ptr->ai_family); break;
285  }
286  dprintf(1, "Canonical name: %s\n", ptr->ai_canonname);
287 }
288 
289 static int getdomainname()
290 {
291  int status = 0;
292  PFIXED_INFO net_info = NULL;
293  DWORD size = 0;
294  BOOLEAN flag = FALSE;
295 
296  status = GetNetworkParams(net_info, &size);
297  if (status != ERROR_BUFFER_OVERFLOW) {
298  eprintf("getdomainname: GetNetworkParams returned %d\n", status);
299  goto out;
300  }
301  net_info = calloc(1, size);
302  if (net_info == NULL) {
303  status = GetLastError();
304  goto out;
305  }
306  status = GetNetworkParams(net_info, &size);
307  if (status) {
308  eprintf("getdomainname: GetNetworkParams returned %d\n", status);
309  goto out_free;
310  }
311 
312  if (net_info->DomainName[0] == '\0') {
313  struct addrinfo *result = NULL, *ptr = NULL, hints = { 0 };
314  char hostname[NI_MAXHOST], servInfo[NI_MAXSERV];
315 
316  hints.ai_socktype = SOCK_STREAM;
317  hints.ai_protocol = IPPROTO_TCP;
318 
319  status = getaddrinfo(net_info->HostName, NULL, &hints, &result);
320  if (status) {
321  status = WSAGetLastError();
322  eprintf("getdomainname: getaddrinfo failed with %d\n", status);
323  goto out_free;
324  }
325 
326  for (ptr=result; ptr != NULL; ptr=ptr->ai_next) {
327  print_getaddrinfo(ptr);
328 
329  switch (ptr->ai_family) {
330  case AF_INET6:
331  case AF_INET:
332  status = getnameinfo((struct sockaddr *)ptr->ai_addr,
333  (socklen_t)ptr->ai_addrlen, hostname, NI_MAXHOST,
334  servInfo, NI_MAXSERV, NI_NAMEREQD);
335  if (status)
336  dprintf(1, "getnameinfo failed %d\n", WSAGetLastError());
337  else {
338  size_t i, len = strlen(hostname);
339  char *p = hostname;
340  dprintf(1, "getdomainname: hostname %s %d\n", hostname, len);
341  for (i = 0; i < len; i++)
342  if (p[i] == '.')
343  break;
344  if (i == len)
345  break;
346  flag = TRUE;
347  memcpy(localdomain_name, &hostname[i+1], len-i);
348  dprintf(1, "getdomainname: domainname %s %d\n",
350  goto out_loop;
351  }
352  break;
353  default:
354  break;
355  }
356  }
357 out_loop:
358  if (!flag) {
359  status = ERROR_INTERNAL_ERROR;
360  eprintf("getdomainname: unable to get a domain name. "
361  "Set this machine's domain name:\n"
362  "System > ComputerName > Change > More > mydomain\n");
363  }
364  freeaddrinfo(result);
365  } else {
366  dprintf(1, "domain name is %s\n", net_info->DomainName);
367  memcpy(localdomain_name, net_info->DomainName,
368  strlen(net_info->DomainName));
369  localdomain_name[strlen(net_info->DomainName)] = '\0';
370  }
371 out_free:
372  free(net_info);
373 out:
374  return status;
375 }
376 
377 #ifdef STANDALONE_NFSD
378 void __cdecl _tmain(int argc, TCHAR *argv[])
379 #else
381 #endif
382 {
383  DWORD status = 0, len;
384  // handle to our drivers
385  HANDLE pipe;
387  nfs41_idmapper *idmapper = NULL;
388  int i;
389  nfsd_args cmd_args;
390 
391  if (!check_for_files())
392  exit(0);
393  if (!parse_cmdlineargs(argc, argv, &cmd_args))
394  exit(0);
395  set_debug_level(cmd_args.debug_level);
396  open_log_files();
397 
398 #ifdef __REACTOS__
399  /* Start the kernel part */
400  {
402  if (hSvcMan)
403  {
404  HANDLE hSvc = OpenService(hSvcMan, "nfs41_driver", SERVICE_ALL_ACCESS);
405  if (hSvc)
406  {
407  SERVICE_STATUS SvcSt;
408  QueryServiceStatus(hSvc, &SvcSt);
409  if (SvcSt.dwCurrentState != SERVICE_RUNNING)
410  {
411  if (StartService(hSvc, 0, NULL))
412  {
413  dprintf(1, "NFS41 driver started\n");
414  }
415  else
416  {
417  eprintf("Driver failed to start: %d\n", GetLastError());
418  }
419  }
420  else
421  {
422  eprintf("Driver in state: %x\n", SvcSt.dwCurrentState);
423  }
424 
425  CloseServiceHandle(hSvc);
426  }
427  else
428  {
429  eprintf("Failed to open service: %d\n", GetLastError());
430  }
431 
432  CloseServiceHandle(hSvcMan);
433  }
434  else
435  {
436  eprintf("Failed to open service manager: %d\n", GetLastError());
437  }
438  }
439 #endif
440 
441 #ifdef _DEBUG
442  /* dump memory leaks to stderr on exit; this requires the debug heap,
443  /* available only when built in debug mode under visual studio -cbodley */
446 #pragma warning (push)
447 #pragma warning (disable : 4306) /* conversion from 'int' to '_HFILE' of greater size */
449 #pragma warning (pop)
450  dprintf(1, "debug mode. dumping memory leaks to stderr on exit.\n");
451 #endif
452  /* acquire and store in global memory current dns domain name.
453  * needed for acls */
454  if (getdomainname())
455  exit(0);
456 
458 
459  if (cmd_args.ldap_enable) {
460  status = nfs41_idmap_create(&idmapper);
461  if (status) {
462  eprintf("id mapping initialization failed with %d\n", status);
463  goto out_logs;
464  }
465  }
466 
468  dprintf(1, "NFS41 Daemon starting: version %d\n", NFS41D_VERSION);
469 
472  0, NULL);
473  if (pipe == INVALID_HANDLE_VALUE)
474  {
475  eprintf("Unable to open upcall pipe %d\n", GetLastError());
476  goto out_idmap;
477  }
478 
479  dprintf(1, "starting nfs41 mini redirector\n");
480  status = DeviceIoControl(pipe, IOCTL_NFS41_START,
481  &NFS41D_VERSION, sizeof(DWORD), NULL, 0, (LPDWORD)&len, NULL);
482  if (!status) {
483  eprintf("IOCTL_NFS41_START failed with %d\n",
484  GetLastError());
485  goto out_pipe;
486  }
487 
488 #ifndef STANDALONE_NFSD
489  stop_event = CreateEvent(NULL, TRUE, FALSE, NULL);
490  if (stop_event == NULL)
491  goto out_pipe;
492 #endif
493 
494  for (i = 0; i < MAX_NUM_THREADS; i++) {
496  idmapper, 0, &tids[i].tid);
497  if (tids[i].handle == INVALID_HANDLE_VALUE) {
498  status = GetLastError();
499  eprintf("_beginthreadex failed %d\n", status);
500  goto out_pipe;
501  }
502  }
503 #ifndef STANDALONE_NFSD
504  // report the status to the service control manager.
506  goto out_pipe;
507  WaitForSingleObject(stop_event, INFINITE);
508 #else
509  //This can be changed to waiting on an array of handles and using waitformultipleobjects
510  dprintf(1, "Parent waiting for children threads\n");
511  for (i = 0; i < MAX_NUM_THREADS; i++)
513 #endif
514  dprintf(1, "Parent woke up!!!!\n");
515 
516 out_pipe:
517  CloseHandle(pipe);
518 out_idmap:
519  if (idmapper) nfs41_idmap_free(idmapper);
520 out_logs:
521 #ifndef STANDALONE_NFSD
522  close_log_files();
523 #endif
524  return;
525 }
char localdomain_name[NFS41_HOSTNAME_LEN]
Definition: nfs41_daemon.c:49
#define CreateEvent
Definition: winbase.h:3562
#define StartService
Definition: winsvc.h:585
void upcall_cancel(IN nfs41_upcall *upcall)
Definition: upcall.c:189
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
static int argc
Definition: ServiceArgs.c:12
static const char FILE_NETCONFIG[]
Definition: nfs41_daemon.c:45
#define NI_NAMEREQD
Definition: ws2def.h:355
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
uint32_t status
Definition: upcall.h:196
#define freeaddrinfo
Definition: wspiapi.h:46
static bool_t check_for_files()
Definition: nfs41_daemon.c:168
DWORD dwCurrentState
Definition: winsvc.h:100
#define _CRTDBG_ALLOC_MEM_DF
Definition: crtdbg.h:55
#define _CRT_WARN
Definition: crtdbg.h:27
uid_t uid
Definition: upcall.h:200
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
#define __cdecl
Definition: accygwin.h:79
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int32_t bool_t
Definition: types.h:101
static int getdomainname()
Definition: nfs41_daemon.c:289
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
int default_uid
Definition: nfs41_daemon.c:50
int upcall_parse(IN unsigned char *buffer, IN uint32_t length, OUT nfs41_upcall *upcall)
Definition: upcall.c:75
#define free
Definition: debug_ros.c:5
struct _nfs41_process_thread nfs41_process_thread
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2282
int upcall_handle(IN nfs41_upcall *upcall)
Definition: upcall.c:138
#define NFS41_USER_DEVICE_NAME_A
Definition: nfs41_driver.h:28
bool_t ldap_enable
Definition: nfs41_daemon.c:164
uint64_t xid
Definition: upcall.h:194
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
void eprintf(LPCSTR format,...)
Definition: daemon_debug.c:86
static int fd
Definition: io.c:51
int nfs41_idmap_name_to_ids(struct idmap_context *context, const char *username, uid_t *uid_out, gid_t *gid_out)
Definition: idmap.c:887
#define SERVICE_ALL_ACCESS
Definition: winsvc.h:62
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
#define AF_NETBIOS
Definition: winsock.h:363
#define NO_ERROR
Definition: dderror.h:5
Definition: match.c:390
long uid_t
Definition: various.h:8
#define _CrtSetReportFile(t, f)
Definition: crtdbg.h:184
#define OpenService
Definition: winsvc.h:576
int default_gid
Definition: nfs41_daemon.c:51
static char ** argv
Definition: ServiceArgs.c:11
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FILE_SHARE_READ
Definition: compat.h:125
FILE * stdout
void upcall_cleanup(IN nfs41_upcall *upcall)
Definition: upcall.c:197
char * hostname
Definition: ftp.c:88
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE stop_event
Definition: nfs41_daemon.c:55
void set_debug_level(int level)
Definition: daemon_debug.c:35
GLenum GLclampf GLint i
Definition: glfuncs.h:14
void nfs41_server_list_init()
Definition: nfs41_server.c:48
UINT gid_t
Definition: types.h:89
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
STRSAFEAPI StringCchCatA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:320
#define NFS41_HOSTNAME_LEN
Definition: nfs41_const.h:48
#define dprintf
Definition: regdump.c:33
#define GENERIC_WRITE
Definition: nt_native.h:90
#define SERVICE_RUNNING
Definition: winsvc.h:24
static PVOID ptr
Definition: dispmode.c:27
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
static unsigned int WINAPI thread_main(void *args)
Definition: nfs41_daemon.c:84
VOID ServiceStop()
Definition: nfs41_daemon.c:156
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:576
#define NFSD_VERSION_MISMATCH
Definition: upcall.h:28
unsigned char BOOLEAN
DWORD NFS41D_VERSION
Definition: nfs41_daemon.c:42
smooth NULL
Definition: ftsmooth.c:416
#define AF_INET6
Definition: winsock.h:369
static int map_user_to_ids(nfs41_idmapper *idmapper, uid_t *uid, gid_t *gid)
Definition: nfs41_daemon.c:62
char DomainName[MAX_DOMAIN_NAME_LEN+4]
Definition: iptypes.h:82
static void PrintUsage()
Definition: nfs41_daemon.c:200
void close_log_files()
Definition: daemon_debug.c:59
#define AF_UNSPEC
Definition: winsock.h:344
#define OPEN_EXISTING
Definition: compat.h:426
#define IOCTL_NFS41_START
Definition: nfs41_driver.h:43
char * ai_canonname
Definition: ws2def.h:670
#define inet_ntoa(addr)
Definition: inet.h:100
VOID ServiceStart(DWORD argc, LPTSTR *argv)
Definition: nfs41_daemon.c:380
static WCHAR username[]
Definition: url.c:32
#define _CRTDBG_LEAK_CHECK_DF
Definition: crtdbg.h:60
char TCHAR
Definition: xmlstorage.h:189
#define OpenSCManager
Definition: winsvc.h:575
struct _nfsd_args nfsd_args
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
GLsizeiptr size
Definition: glext.h:5919
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean flag
Definition: glfuncs.h:72
#define NI_MAXSERV
Definition: ws2def.h:360
#define MAX_PATH
Definition: compat.h:26
static FILE * out
Definition: regtests2xml.c:44
PVOID HANDLE
Definition: typedefs.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
int socklen_t
Definition: tcp.c:35
BOOL WINAPI QueryServiceStatus(SC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:2787
#define _tmain
Definition: tchar.h:497
#define NI_MAXHOST
Definition: ws2def.h:359
uchar inbuf[M_BLOCK]
Definition: unzcrash.c:40
#define _CRTDBG_MODE_FILE
Definition: crtdbg.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
BOOL WINAPI GetUserNameA(LPSTR lpszName, LPDWORD lpSize)
Definition: misc.c:246
char HostName[MAX_HOSTNAME_LEN+4]
Definition: iptypes.h:81
#define _CRTDBG_FILE_STDERR
Definition: crtdbg.h:40
#define GENERIC_READ
Definition: compat.h:124
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define WINAPI
Definition: msvc.h:20
void upcall_marshall(IN nfs41_upcall *upcall, OUT unsigned char *buffer, IN uint32_t length, OUT uint32_t *length_out)
Definition: upcall.c:157
gid_t gid
Definition: upcall.h:201
uint32_t opcode
Definition: upcall.h:195
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
#define TEXT(s)
Definition: k32.h:26
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
Definition: fatprocs.h:904
#define UNLEN
Definition: sspi.c:28
static bool_t parse_cmdlineargs(int argc, TCHAR *argv[], nfsd_args *out)
Definition: nfs41_daemon.c:205
#define UPCALL_BUF_SIZE
Definition: nfs41_const.h:42
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
#define getnameinfo
Definition: wspiapi.h:45
static void print_getaddrinfo(struct addrinfo *ptr)
Definition: nfs41_daemon.c:264
uint32_t last_error
Definition: upcall.h:197
UINT32 uint32_t
Definition: types.h:75
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
const char * opcode2string(DWORD opcode)
Definition: daemon_debug.c:280
#define IOCTL_NFS41_READ
Definition: nfs41_driver.h:48
nfs41_updowncall_list upcall
Definition: nfs41_driver.c:273
#define calloc
Definition: rosglue.h:14
#define IOCTL_NFS41_WRITE
Definition: nfs41_driver.h:49
uint32_t * LPDWORD
Definition: typedefs.h:57
FILE * stderr
#define AF_INET
Definition: tcpip.h:117
void open_log_files()
Definition: daemon_debug.c:40
int nfs41_idmap_create(struct idmap_context **context_out)
Definition: idmap.c:803
size_t ai_addrlen
Definition: ws2def.h:669
#define SOCK_STREAM
Definition: tcpip.h:118
void exit(int exitcode)
Definition: _exit.c:33
GLfloat GLfloat p
Definition: glext.h:8902
int ai_flags
Definition: ws2def.h:665
#define INFINITE
Definition: serial.h:102
GLuint64EXT * result
Definition: glext.h:11304
static SERVICE_STATUS status
Definition: service.c:31
#define _CrtSetDbgFlag(f)
Definition: crtdbg.h:192
#define WSAAddressToString
Definition: winsock2.h:2443
void nfs41_idmap_free(struct idmap_context *context)
Definition: idmap.c:865
struct sockaddr * ai_addr
Definition: ws2def.h:671
#define _CrtSetReportMode(t, f)
Definition: crtdbg.h:183
#define printf
Definition: config.h:203
BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
Definition: service.c:240
uchar outbuf[M_BLOCK_OUT]
Definition: unzcrash.c:41
#define MAX_NUM_THREADS
Definition: nfs41_daemon.c:41
#define getaddrinfo
Definition: wspiapi.h:44
Definition: ps.c:97
int ai_family
Definition: ws2def.h:666