Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. validc.h
  5. Abstract:
  6. Strings of valid/invalid characters for canonicalization.
  7. --*/
  8. #ifndef _VALIDC_H_
  9. #define _VALIDC_H_
  10. //
  11. // Disallowed control characters (not including \0).
  12. //
  13. #define CTRL_CHARS_0 L"\001\002\003\004\005\006\007"
  14. #define CTRL_CHARS_1 L"\010\011\012\013\014\015\016\017"
  15. #define CTRL_CHARS_2 L"\020\021\022\023\024\025\026\027"
  16. #define CTRL_CHARS_3 L"\030\031\032\033\034\035\036\037"
  17. #define CTRL_CHARS_STR CTRL_CHARS_0 CTRL_CHARS_1 CTRL_CHARS_2 CTRL_CHARS_3
  18. //
  19. // Character subsets.
  20. //
  21. #define NON_COMPONENT_CHARS L"\\/:"
  22. #define ILLEGAL_CHARS_STR L"\"<>|"
  23. #define SPACE_STR L" "
  24. #define PATH_SEPARATORS L"\\/"
  25. //
  26. // Combinations of the above.
  27. //
  28. #define ILLEGAL_CHARS CTRL_CHARS_STR ILLEGAL_CHARS_STR
  29. #define ILLEGAL_NAME_CHARS_STR L"\"/\\:|<>?" CTRL_CHARS_STR
  30. #define STANDARD_ILLEGAL_CHARS ILLEGAL_NAME_CHARS_STR L"*"
  31. #define SERVER_ILLEGAL_CHARS STANDARD_ILLEGAL_CHARS SPACE_STR L"[]+;,"
  32. #define USERNAME_ILLEGAL_CHARS L"\"/:|<>?" CTRL_CHARS_STR
  33. //
  34. // Characters which may not appear in a canonicalized FAT filename are:
  35. // 0x00 - 0x1f " * + , / : ; < = > ? [ \ ] |
  36. //
  37. #define ILLEGAL_FAT_CHARS CTRL_CHARS_STR L"\"*+,/:;<=>?[\\]|"
  38. //
  39. // Characters which may not appear in a canonicalized HPFS filename are:
  40. // 0x00 - 0x1f " * / : < > ? \ |
  41. //
  42. #define ILLEGAL_HPFS_CHARS CTRL_CHARS_STR L"\"*/:<>?\\|"
  43. //
  44. // Checks if the token contains all valid characters
  45. //
  46. #define IS_VALID_TOKEN(_Str, _StrLen) \
  47. ((BOOL) (wcscspn((_Str), STANDARD_ILLEGAL_CHARS) == (_StrLen)))
  48. //
  49. // Checks if the server name contains all valid characters for the server name
  50. //
  51. #define IS_VALID_SERVER_TOKEN(_Str, _StrLen) \
  52. ((BOOL) (wcscspn((_Str), SERVER_ILLEGAL_CHARS) == (_StrLen)))
  53. //
  54. // Checks if the token contains all valid characters
  55. //
  56. #define IS_VALID_USERNAME_TOKEN(_Str, _StrLen) \
  57. ((BOOL) (wcscspn((_Str), USERNAME_ILLEGAL_CHARS) == (_StrLen)))
  58. //
  59. // A remote entry for every unique shared resource name (\\server\share)
  60. // of explicit connections.
  61. //
  62. typedef struct _UNC_NAME {
  63. DWORD TotalUseCount;
  64. DWORD UncNameLength;
  65. LPWSTR UncName[1];
  66. } UNC_NAME, *PUNC_NAME;
  67. //
  68. // A DAV use entry in the linked list of connections.
  69. //
  70. typedef struct _DAV_USE_ENTRY {
  71. struct _DAV_USE_ENTRY *Next;
  72. BOOL isPassport;
  73. PUNC_NAME Remote;
  74. LPWSTR Local;
  75. DWORD LocalLength;
  76. DWORD UseCount;
  77. HANDLE DavCreateFileHandle;
  78. LPWSTR TreeConnectStr;
  79. LPWSTR AuthUserName;
  80. DWORD AuthUserNameLength;
  81. } DAV_USE_ENTRY, *PDAV_USE_ENTRY;
  82. typedef struct _DAV_PER_USER_ENTRY {
  83. //
  84. // Pointer to linked list of user data.
  85. //
  86. PVOID List;
  87. //
  88. // Logon Id of user.
  89. //
  90. LUID LogonId;
  91. } DAV_PER_USER_ENTRY, *PDAV_PER_USER_ENTRY;
  92. typedef struct _DAV_USERS_OBJECT {
  93. //
  94. // Table of users.
  95. //
  96. PDAV_PER_USER_ENTRY Table;
  97. //
  98. // To serialize access to Table.
  99. //
  100. RTL_RESOURCE TableResource;
  101. //
  102. // Relocatable Table memory.
  103. //
  104. HANDLE TableMemory;
  105. //
  106. // Size of Table.
  107. //
  108. DWORD TableSize;
  109. } DAV_USERS_OBJECT, *PDAV_USERS_OBJECT;
  110. #define DAV_GROW_USER_COUNT 3
  111. //
  112. // The structure that contains a list of shares of a DAV server.
  113. //
  114. typedef struct _DAV_SERVER_SHARE_ENTRY {
  115. //
  116. // Name of the server.
  117. //
  118. PWCHAR ServerName;
  119. //
  120. // The list of structures containing the Dav shares.
  121. //
  122. PDAV_FILE_ATTRIBUTES DavShareList;
  123. //
  124. // Number of shares.
  125. //
  126. ULONG NumOfShares;
  127. //
  128. // The next entry.
  129. //
  130. LIST_ENTRY ServerShareEntry;
  131. //
  132. // The timer value used in the checking if we need to go to the server
  133. // again to get the list of shares.
  134. //
  135. time_t TimeValueInSec;
  136. //
  137. // This should be the last field.
  138. //
  139. WCHAR StrBuffer[1];
  140. } DAV_SERVER_SHARE_ENTRY, *PDAV_SERVER_SHARE_ENTRY;
  141. #define SERVER_SHARE_TABLE_SIZE 512
  142. extern LIST_ENTRY ServerShareTable[SERVER_SHARE_TABLE_SIZE];
  143. //
  144. // This critical section synchronizes access to the ServerHashTable.
  145. //
  146. extern CRITICAL_SECTION ServerShareTableLock;
  147. #endif // _VALIDC_H_