ReactOS  0.4.15-dev-976-g0f66c66
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) {
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 
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);
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));
146  }
147  if (upcall.status != NFSD_VERSION_MISMATCH)
149  }
150  CloseHandle(pipe);
151 
152  return GetLastError();
153 }
154 
155 #ifndef STANDALONE_NFSD
157 {
158  if (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  eprintf("GetSystemDirectoryA failed with error %ld\n", GetLastError());
181  return FALSE;
182  }
183 
184  fd = fopen(config_path, "r");
185 #else
186 
187  fd = fopen(FILE_NETCONFIG, "r");
188 #endif
189  if (fd == NULL) {
190 #ifdef __REACTOS__
191  fprintf(stderr,"nfsd() failed to open file '%s'\n", config_path);
192 #else
193  fprintf(stderr,"nfsd() failed to open file '%s'\n", FILE_NETCONFIG);
194 #endif
195  return FALSE;
196  }
197  fclose(fd);
198  return TRUE;
199 }
200 
201 static void PrintUsage()
202 {
203  fprintf(stderr, "Usage: nfsd.exe -d <debug_level> --noldap "
204  "--uid <non-zero value> --gid\n");
205 }
207 {
208  int i;
209 
210  /* set defaults. */
211  out->debug_level = 1;
212  out->ldap_enable = TRUE;
213 
214  /* parse command line */
215  for (i = 1; i < argc; i++) {
216  if (argv[i][0] == TEXT('-')) {
217  if (_tcscmp(argv[i], TEXT("-h")) == 0) { /* help */
218  PrintUsage();
219  return FALSE;
220  }
221  else if (_tcscmp(argv[i], TEXT("-d")) == 0) { /* debug level */
222  ++i;
223  if (i >= argc) {
224  fprintf(stderr, "Missing debug level value\n");
225  PrintUsage();
226  return FALSE;
227  }
228  out->debug_level = _ttoi(argv[i]);
229  }
230  else if (_tcscmp(argv[i], TEXT("--noldap")) == 0) { /* no LDAP */
231  out->ldap_enable = FALSE;
232  }
233  else if (_tcscmp(argv[i], TEXT("--uid")) == 0) { /* no LDAP, setting default uid */
234  ++i;
235  if (i >= argc) {
236  fprintf(stderr, "Missing uid value\n");
237  PrintUsage();
238  return FALSE;
239  }
240  default_uid = _ttoi(argv[i]);
241  if (!default_uid) {
242  fprintf(stderr, "Invalid (or missing) anonymous uid value of %d\n",
243  default_uid);
244  return FALSE;
245  }
246  }
247  else if (_tcscmp(argv[i], TEXT("--gid")) == 0) { /* no LDAP, setting default gid */
248  ++i;
249  if (i >= argc) {
250  fprintf(stderr, "Missing gid value\n");
251  PrintUsage();
252  return FALSE;
253  }
254  default_gid = _ttoi(argv[i]);
255  }
256  else
257  fprintf(stderr, "Unrecognized option '%s', disregarding.\n", argv[i]);
258  }
259  }
260  fprintf(stdout, "parse_cmdlineargs: debug_level %d ldap is %d\n",
261  out->debug_level, out->ldap_enable);
262  return TRUE;
263 }
264 
265 static void print_getaddrinfo(struct addrinfo *ptr)
266 {
267  char ipstringbuffer[46];
268  DWORD ipbufferlength = 46;
269 
270  dprintf(1, "getaddrinfo response flags: 0x%x\n", ptr->ai_flags);
271  switch (ptr->ai_family) {
272  case AF_UNSPEC: dprintf(1, "Family: Unspecified\n"); break;
273  case AF_INET:
274  dprintf(1, "Family: AF_INET IPv4 address %s\n",
275  inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr));
276  break;
277  case AF_INET6:
278  if (WSAAddressToString((LPSOCKADDR)ptr->ai_addr, (DWORD)ptr->ai_addrlen,
279  NULL, ipstringbuffer, &ipbufferlength))
280  dprintf(1, "WSAAddressToString failed with %u\n", WSAGetLastError());
281  else
282  dprintf(1, "Family: AF_INET6 IPv6 address %s\n", ipstringbuffer);
283  break;
284  case AF_NETBIOS: dprintf(1, "AF_NETBIOS (NetBIOS)\n"); break;
285  default: dprintf(1, "Other %ld\n", ptr->ai_family); break;
286  }
287  dprintf(1, "Canonical name: %s\n", ptr->ai_canonname);
288 }
289 
290 static int getdomainname()
291 {
292  int status = 0;
293  PFIXED_INFO net_info = NULL;
294  DWORD size = 0;
295  BOOLEAN flag = FALSE;
296 
297  status = GetNetworkParams(net_info, &size);
298  if (status != ERROR_BUFFER_OVERFLOW) {
299  eprintf("getdomainname: GetNetworkParams returned %d\n", status);
300  goto out;
301  }
302  net_info = calloc(1, size);
303  if (net_info == NULL) {
304  status = GetLastError();
305  goto out;
306  }
307  status = GetNetworkParams(net_info, &size);
308  if (status) {
309  eprintf("getdomainname: GetNetworkParams returned %d\n", status);
310  goto out_free;
311  }
312 
313  if (net_info->DomainName[0] == '\0') {
314  struct addrinfo *result = NULL, *ptr = NULL, hints = { 0 };
315  char hostname[NI_MAXHOST], servInfo[NI_MAXSERV];
316 
317  hints.ai_socktype = SOCK_STREAM;
318  hints.ai_protocol = IPPROTO_TCP;
319 
320  status = getaddrinfo(net_info->HostName, NULL, &hints, &result);
321  if (status) {
323  eprintf("getdomainname: getaddrinfo failed with %d\n", status);
324  goto out_free;
325  }
326 
327  for (ptr=result; ptr != NULL; ptr=ptr->ai_next) {
329 
330  switch (ptr->ai_family) {
331  case AF_INET6:
332  case AF_INET:
333  status = getnameinfo((struct sockaddr *)ptr->ai_addr,
334  (socklen_t)ptr->ai_addrlen, hostname, NI_MAXHOST,
335  servInfo, NI_MAXSERV, NI_NAMEREQD);
336  if (status)
337  dprintf(1, "getnameinfo failed %d\n", WSAGetLastError());
338  else {
339  size_t i, len = strlen(hostname);
340  char *p = hostname;
341  dprintf(1, "getdomainname: hostname %s %d\n", hostname, len);
342  for (i = 0; i < len; i++)
343  if (p[i] == '.')
344  break;
345  if (i == len)
346  break;
347  flag = TRUE;
349  dprintf(1, "getdomainname: domainname %s %d\n",
351  goto out_loop;
352  }
353  break;
354  default:
355  break;
356  }
357  }
358 out_loop:
359  if (!flag) {
361  eprintf("getdomainname: unable to get a domain name. "
362  "Set this machine's domain name:\n"
363  "System > ComputerName > Change > More > mydomain\n");
364  }
366  } else {
367  dprintf(1, "domain name is %s\n", net_info->DomainName);
368  memcpy(localdomain_name, net_info->DomainName,
369  strlen(net_info->DomainName));
370  localdomain_name[strlen(net_info->DomainName)] = '\0';
371  }
372 out_free:
373  free(net_info);
374 out:
375  return status;
376 }
377 
378 #ifdef STANDALONE_NFSD
379 void __cdecl _tmain(int argc, TCHAR *argv[])
380 #else
382 #endif
383 {
384  DWORD status = 0, len;
385  // handle to our drivers
386  HANDLE pipe;
388  nfs41_idmapper *idmapper = NULL;
389  int i;
390  nfsd_args cmd_args;
391 
392  if (!check_for_files())
393  exit(0);
394  if (!parse_cmdlineargs(argc, argv, &cmd_args))
395  exit(0);
396  set_debug_level(cmd_args.debug_level);
397  open_log_files();
398 
399 #ifdef __REACTOS__
400  /* Start the kernel part */
401  {
403  if (hSvcMan)
404  {
405  HANDLE hSvc = OpenService(hSvcMan, "nfs41_driver", SERVICE_ALL_ACCESS);
406  if (hSvc)
407  {
408  SERVICE_STATUS SvcSt;
409  QueryServiceStatus(hSvc, &SvcSt);
410  if (SvcSt.dwCurrentState != SERVICE_RUNNING)
411  {
412  if (StartService(hSvc, 0, NULL))
413  {
414  dprintf(1, "NFS41 driver started\n");
415  }
416  else
417  {
418  eprintf("Driver failed to start: %d\n", GetLastError());
419  }
420  }
421  else
422  {
423  eprintf("Driver in state: %x\n", SvcSt.dwCurrentState);
424  }
425 
426  CloseServiceHandle(hSvc);
427  }
428  else
429  {
430  eprintf("Failed to open service: %d\n", GetLastError());
431  }
432 
433  CloseServiceHandle(hSvcMan);
434  }
435  else
436  {
437  eprintf("Failed to open service manager: %d\n", GetLastError());
438  }
439  }
440 #endif
441 
442 #ifdef _DEBUG
443  /* dump memory leaks to stderr on exit; this requires the debug heap,
444  /* available only when built in debug mode under visual studio -cbodley */
447 #pragma warning (push)
448 #pragma warning (disable : 4306) /* conversion from 'int' to '_HFILE' of greater size */
450 #pragma warning (pop)
451  dprintf(1, "debug mode. dumping memory leaks to stderr on exit.\n");
452 #endif
453  /* acquire and store in global memory current dns domain name.
454  * needed for acls */
455  if (getdomainname())
456  exit(0);
457 
459 
460  if (cmd_args.ldap_enable) {
461  status = nfs41_idmap_create(&idmapper);
462  if (status) {
463  eprintf("id mapping initialization failed with %d\n", status);
464  goto out_logs;
465  }
466  }
467 
469  dprintf(1, "NFS41 Daemon starting: version %d\n", NFS41D_VERSION);
470 
473  0, NULL);
474  if (pipe == INVALID_HANDLE_VALUE)
475  {
476  eprintf("Unable to open upcall pipe %d\n", GetLastError());
477  goto out_idmap;
478  }
479 
480  dprintf(1, "starting nfs41 mini redirector\n");
482  &NFS41D_VERSION, sizeof(DWORD), NULL, 0, (LPDWORD)&len, NULL);
483  if (!status) {
484  eprintf("IOCTL_NFS41_START failed with %d\n",
485  GetLastError());
486  goto out_pipe;
487  }
488 
489 #ifndef STANDALONE_NFSD
491  if (stop_event == NULL)
492  goto out_pipe;
493 #endif
494 
495  for (i = 0; i < MAX_NUM_THREADS; i++) {
497  idmapper, 0, &tids[i].tid);
498  if (tids[i].handle == INVALID_HANDLE_VALUE) {
499  status = GetLastError();
500  eprintf("_beginthreadex failed %d\n", status);
501  goto out_pipe;
502  }
503  }
504 #ifndef STANDALONE_NFSD
505  // report the status to the service control manager.
507  goto out_pipe;
509 #else
510  //This can be changed to waiting on an array of handles and using waitformultipleobjects
511  dprintf(1, "Parent waiting for children threads\n");
512  for (i = 0; i < MAX_NUM_THREADS; i++)
514 #endif
515  dprintf(1, "Parent woke up!!!!\n");
516 
517 out_pipe:
518  CloseHandle(pipe);
519 out_idmap:
520  if (idmapper) nfs41_idmap_free(idmapper);
521 out_logs:
522 #ifndef STANDALONE_NFSD
523  close_log_files();
524 #endif
525  return;
526 }
char localdomain_name[NFS41_HOSTNAME_LEN]
Definition: nfs41_daemon.c:49
#define CreateEvent
Definition: winbase.h:3588
#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 CloseHandle
Definition: compat.h:487
#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
#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:290
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define TRUE
Definition: types.h:120
#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
static int inbuf
Definition: adnsresfilter.c:73
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
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
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
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:889
#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 argv
Definition: mplay32.c:18
#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:247
#define OpenService
Definition: winsvc.h:576
int default_gid
Definition: nfs41_daemon.c:51
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FILE_SHARE_READ
Definition: compat.h:136
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
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void nfs41_server_list_init()
Definition: nfs41_server.c:48
#define FALSE
Definition: types.h:117
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:577
#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:201
void close_log_files()
Definition: daemon_debug.c:59
#define AF_UNSPEC
Definition: winsock.h:344
#define OPEN_EXISTING
Definition: compat.h:523
#define IOCTL_NFS41_START
Definition: nfs41_driver.h:43
#define inet_ntoa(addr)
Definition: inet.h:100
VOID ServiceStart(DWORD argc, LPTSTR *argv)
Definition: nfs41_daemon.c:381
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
#define NI_MAXSERV
Definition: ws2def.h:360
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
static FILE * out
Definition: regtests2xml.c:44
PVOID HANDLE
Definition: typedefs.h:73
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:2788
#define _tmain
Definition: tchar.h:497
#define NI_MAXHOST
Definition: ws2def.h:359
GLsizei GLenum const GLvoid GLsizei GLenum 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 flag
Definition: glfuncs.h:52
#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:135
_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)
void upcall_marshall(IN nfs41_upcall *upcall, OUT unsigned char *buffer, IN uint32_t length, OUT uint32_t *length_out)
Definition: upcall.c:157
#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:913
#define UNLEN
Definition: sspi.c:28
static bool_t parse_cmdlineargs(int argc, TCHAR *argv[], nfsd_args *out)
Definition: nfs41_daemon.c:206
#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:265
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:59
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:805
#define SOCK_STREAM
Definition: tcpip.h:118
void exit(int exitcode)
Definition: _exit.c:33
GLfloat GLfloat p
Definition: glext.h:8902
#define INFINITE
Definition: serial.h:102
GLuint64EXT * result
Definition: glext.h:11304
static SERVICE_STATUS status
Definition: service.c:31
static TfClientId tid
#define _CrtSetDbgFlag(f)
Definition: crtdbg.h:253
#define WSAAddressToString
Definition: winsock2.h:2443
void nfs41_idmap_free(struct idmap_context *context)
Definition: idmap.c:867
#define _CrtSetReportMode(t, f)
Definition: crtdbg.h:246
#define printf
Definition: config.h:203
BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
Definition: service.c:240
#define MAX_NUM_THREADS
Definition: nfs41_daemon.c:41
#define getaddrinfo
Definition: wspiapi.h:44
Definition: ps.c:97