41 #define MAX_NUM_THREADS 128 45 static const char FILE_NETCONFIG[] =
"C:\\ReactOS\\System32\\drivers\\etc\\netconfig";
53 #ifndef STANDALONE_NFSD //make sure to define it in "sources" not here 126 printf(
"Shutting down..\n");
133 dprintf(1,
"writing downcall: xid=%lld opcode=%s status=%d " 139 dprintf(2,
"making a downcall: outbuf_len %ld\n\n", outbuf_len);
143 eprintf(
"IOCTL_NFS41_WRITE failed with %d xid=%lld opcode=%s\n",
155 #ifndef STANDALONE_NFSD 191 fprintf(
stderr,
"nfsd() failed to open file '%s'\n", config_path);
204 "--uid <non-zero value> --gid\n");
211 out->debug_level = 1;
242 fprintf(
stderr,
"Invalid (or missing) anonymous uid value of %d\n",
260 fprintf(
stdout,
"parse_cmdlineargs: debug_level %d ldap is %d\n",
261 out->debug_level,
out->ldap_enable);
267 char ipstringbuffer[46];
268 DWORD ipbufferlength = 46;
270 dprintf(1,
"getaddrinfo response flags: 0x%x\n",
ptr->ai_flags);
271 switch (
ptr->ai_family) {
274 dprintf(1,
"Family: AF_INET IPv4 address %s\n",
279 NULL, ipstringbuffer, &ipbufferlength))
282 dprintf(1,
"Family: AF_INET6 IPv6 address %s\n", ipstringbuffer);
285 default:
dprintf(1,
"Other %ld\n",
ptr->ai_family);
break;
287 dprintf(1,
"Canonical name: %s\n",
ptr->ai_canonname);
299 eprintf(
"getdomainname: GetNetworkParams returned %d\n",
status);
303 if (net_info ==
NULL) {
309 eprintf(
"getdomainname: GetNetworkParams returned %d\n",
status);
323 eprintf(
"getdomainname: getaddrinfo failed with %d\n",
status);
330 switch (
ptr->ai_family) {
349 dprintf(1,
"getdomainname: domainname %s %d\n",
361 eprintf(
"getdomainname: unable to get a domain name. " 362 "Set this machine's domain name:\n" 363 "System > ComputerName > Change > More > mydomain\n");
378 #ifdef STANDALONE_NFSD 414 dprintf(1,
"NFS41 driver started\n");
447 #pragma warning (push) 448 #pragma warning (disable : 4306) 450 #pragma warning (pop) 451 dprintf(1,
"debug mode. dumping memory leaks to stderr on exit.\n");
463 eprintf(
"id mapping initialization failed with %d\n",
status);
480 dprintf(1,
"starting nfs41 mini redirector\n");
484 eprintf(
"IOCTL_NFS41_START failed with %d\n",
489 #ifndef STANDALONE_NFSD 497 idmapper, 0, &tids[
i].
tid);
504 #ifndef STANDALONE_NFSD 511 dprintf(1,
"Parent waiting for children threads\n");
515 dprintf(1,
"Parent woke up!!!!\n");
522 #ifndef STANDALONE_NFSD char localdomain_name[NFS41_HOSTNAME_LEN]
void upcall_cancel(IN nfs41_upcall *upcall)
namespace GUID const ADDRINFOEXW * hints
static const char FILE_NETCONFIG[]
static bool_t check_for_files()
#define _CRTDBG_ALLOC_MEM_DF
#define ERROR_INTERNAL_ERROR
ACPI_SIZE strlen(const char *String)
static int getdomainname()
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
#define ERROR_BUFFER_OVERFLOW
int upcall_parse(IN unsigned char *buffer, IN uint32_t length, OUT nfs41_upcall *upcall)
struct _nfs41_process_thread nfs41_process_thread
DWORD WINAPI GetTickCount(VOID)
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
int upcall_handle(IN nfs41_upcall *upcall)
#define NFS41_USER_DEVICE_NAME_A
#define INVALID_HANDLE_VALUE
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
DWORD WINAPI GetLastError(VOID)
void eprintf(LPCSTR format,...)
int nfs41_idmap_name_to_ids(struct idmap_context *context, const char *username, uid_t *uid_out, gid_t *gid_out)
#define SERVICE_ALL_ACCESS
_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 _CrtSetReportFile(t, f)
void upcall_cleanup(IN nfs41_upcall *upcall)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
void set_debug_level(int level)
void nfs41_server_list_init()
_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)
#define NFS41_HOSTNAME_LEN
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
static unsigned int WINAPI thread_main(void *args)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
#define NFSD_VERSION_MISMATCH
static int map_user_to_ids(nfs41_idmapper *idmapper, uid_t *uid, gid_t *gid)
char DomainName[MAX_DOMAIN_NAME_LEN+4]
#define IOCTL_NFS41_START
VOID ServiceStart(DWORD argc, LPTSTR *argv)
#define _CRTDBG_LEAK_CHECK_DF
struct _nfsd_args nfsd_args
INT WSAAPI WSAGetLastError(VOID)
BOOL WINAPI QueryServiceStatus(SC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus)
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
#define _CRTDBG_MODE_FILE
#define memcpy(s1, s2, n)
BOOL WINAPI GetUserNameA(LPSTR lpszName, LPDWORD lpSize)
char HostName[MAX_HOSTNAME_LEN+4]
#define _CRTDBG_FILE_STDERR
_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)
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)
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
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
static bool_t parse_cmdlineargs(int argc, TCHAR *argv[], nfsd_args *out)
int CDECL _ttoi(const _TCHAR *str)
static void print_getaddrinfo(struct addrinfo *ptr)
#define SC_MANAGER_ALL_ACCESS
const char * opcode2string(DWORD opcode)
nfs41_updowncall_list upcall
#define IOCTL_NFS41_WRITE
int nfs41_idmap_create(struct idmap_context **context_out)
static SERVICE_STATUS status
#define _CrtSetDbgFlag(f)
#define WSAAddressToString
void nfs41_idmap_free(struct idmap_context *context)
#define _CrtSetReportMode(t, f)
BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)