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.

325 lines
11 KiB

  1. /********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1987-1990 **/
  4. /********************************************************************/
  5. #define INCL_NOCOMMON
  6. #include <os2.h>
  7. #include "netcmds.h"
  8. #include "nettext.h"
  9. /***
  10. * READ THIS READ THIS READ THIS
  11. *
  12. * If this file is changed, swtchtbl.h must be regenerated via the following
  13. * command:
  14. *
  15. * sed -n -f text.sed swtchtbl.c > swtchtbl.h
  16. *
  17. * This is just until there is a sed supported on NT
  18. *
  19. ***
  20. *
  21. * This list of valid switches for each command is made up of
  22. * ordered triples. The first in each triple is what is acceptable
  23. * from the command line. The second in the triple is
  24. * what the switch get TRANSLATED into! If the second is NULL,
  25. * no translation is performed. The translation is done by
  26. * ValidateSwitches(), which should be called as the first
  27. * condition in the grammar (for each token). The third value
  28. * in the triple specifies whether an arguement is allowed following
  29. * the switch. Values for the third element are NO_ARG, ARG_OPT,
  30. * and ARG_REQ.
  31. *
  32. * A small example:
  33. * static SWITCHTAB *foo_switches[] = {
  34. * "/BAR", "/BELL", ARG_REQ,
  35. * "/JACKIE", NULL, NO_ARG,
  36. * NULL, NULL, NO_ARG };
  37. *
  38. * user types: net foo /bar:12 /jackie
  39. *
  40. * After ValidateSwitches is called, the SwitchList will contain:
  41. * /BELL:12, and /JACKIE. Simple enough!
  42. *
  43. * This translation ability can be used for internationalization,
  44. * customization, and backwards compatibility.
  45. *
  46. * To prevent folding to upper case of the switch ARGUMENT (switches
  47. * are always folded), add the English language form to the no_fold
  48. * array. (The english form is the 2nd element in the truple if there
  49. * is a second element; o/w it is the first element.)
  50. */
  51. /* It should not be necessary to change this. Provided only for future. */
  52. SWITCHTAB no_switches[] = {
  53. NULL, NULL, NO_ARG };
  54. SWITCHTAB add_only_switches[] = {
  55. swtxt_SW_ADD, NULL, NO_ARG,
  56. NULL, NULL, NO_ARG };
  57. SWITCHTAB del_only_switches[] = {
  58. swtxt_SW_DELETE, NULL, NO_ARG,
  59. NULL, NULL, NO_ARG };
  60. SWITCHTAB domain_only_switches[] = {
  61. swtxt_SW_DOMAIN, NULL, ARG_REQ,
  62. NULL, NULL, NO_ARG };
  63. SWITCHTAB add_del_switches[] = {
  64. swtxt_SW_ADD, NULL, NO_ARG,
  65. swtxt_SW_DELETE, NULL, NO_ARG,
  66. NULL, NULL, NO_ARG };
  67. SWITCHTAB accounts_switches[] = {
  68. swtxt_SW_ACCOUNTS_FORCELOGOFF, NULL, ARG_REQ,
  69. swtxt_SW_ACCOUNTS_UNIQUEPW, NULL, ARG_REQ,
  70. swtxt_SW_ACCOUNTS_MINPWLEN, NULL, ARG_REQ,
  71. swtxt_SW_ACCOUNTS_MINPWAGE, NULL, ARG_REQ,
  72. swtxt_SW_ACCOUNTS_MAXPWAGE, NULL, ARG_REQ,
  73. swtxt_SW_ACCOUNTS_SYNCH, NULL, NO_ARG,
  74. swtxt_SW_DOMAIN, NULL, NO_ARG,
  75. swtxt_SW_ACCOUNTS_LOCKOUT_THRESHOLD,NULL, ARG_REQ,
  76. swtxt_SW_ACCOUNTS_LOCKOUT_DURATION, NULL, ARG_REQ,
  77. swtxt_SW_ACCOUNTS_LOCKOUT_WINDOW, NULL, ARG_REQ,
  78. NULL, NULL, NO_ARG };
  79. SWITCHTAB computer_switches[] = {
  80. swtxt_SW_ADD, NULL, NO_ARG,
  81. swtxt_SW_DELETE, NULL, NO_ARG,
  82. swtxt_SW_COMPUTER_JOIN, NULL, NO_ARG,
  83. swtxt_SW_COMPUTER_LEAVE,NULL, NO_ARG,
  84. NULL, NULL, NO_ARG };
  85. SWITCHTAB config_wksta_switches[] = {
  86. swtxt_SW_WKSTA_CHARWAIT, NULL, ARG_REQ,
  87. swtxt_SW_WKSTA_CHARTIME, NULL, ARG_REQ,
  88. swtxt_SW_WKSTA_CHARCOUNT, NULL, ARG_REQ,
  89. NULL, NULL, NO_ARG };
  90. SWITCHTAB config_server_switches[] = {
  91. swtxt_SW_SRV_SRVCOMMENT, NULL, ARG_REQ,
  92. swtxt_SW_SRV_AUTODISCONNECT, NULL, ARG_REQ,
  93. swtxt_SW_SRV_SRVHIDDEN, NULL, ARG_OPT,
  94. NULL, NULL, NO_ARG };
  95. SWITCHTAB file_switches[] = {
  96. TEXT("/CLOSE"), NULL, NO_ARG,
  97. NULL, NULL, NO_ARG };
  98. SWITCHTAB help_switches[] = {
  99. swtxt_SW_OPTIONS, NULL, NO_ARG,
  100. NULL, NULL, NO_ARG };
  101. SWITCHTAB print_switches[] = {
  102. swtxt_SW_DELETE, NULL, NO_ARG,
  103. swtxt_SW_PRINT_HOLD, NULL, NO_ARG,
  104. swtxt_SW_PRINT_RELEASE, NULL, NO_ARG,
  105. NULL, NULL, NO_ARG };
  106. SWITCHTAB send_switches[] = {
  107. swtxt_SW_MESSAGE_BROADCAST, NULL, NO_ARG,
  108. swtxt_SW_DOMAIN, NULL, ARG_OPT,
  109. TEXT("/USERS"), NULL, NO_ARG,
  110. NULL, NULL, NO_ARG };
  111. SWITCHTAB share_switches[] = {
  112. swtxt_SW_DELETE, NULL, NO_ARG,
  113. swtxt_SW_REMARK, NULL, ARG_REQ,
  114. swtxt_SW_GRANT, NULL, ARG_REQ,
  115. swtxt_SW_SHARE_UNLIMITED, NULL, NO_ARG,
  116. swtxt_SW_SHARE_USERS, NULL, ARG_REQ,
  117. swtxt_SW_CACHE, NULL, ARG_OPT,
  118. NULL, NULL, NO_ARG };
  119. SWITCHTAB start_alerter_switches[] = {
  120. swtxt_SW_ALERTER_SIZALERTBUF, NULL, ARG_REQ,
  121. NULL, NULL, NO_ARG };
  122. SWITCHTAB start_netlogon_switches[] = {
  123. swtxt_SW_NETLOGON_CENTRALIZED, NULL, ARG_REQ,
  124. swtxt_SW_NETLOGON_PULSE, NULL, ARG_REQ,
  125. swtxt_SW_NETLOGON_RANDOMIZE, NULL, ARG_REQ,
  126. swtxt_SW_NETLOGON_SYNCHRONIZE, NULL, ARG_OPT,
  127. swtxt_SW_NETLOGON_SCRIPTS, NULL, ARG_REQ,
  128. NULL, NULL, NO_ARG };
  129. /* Switches swallowed by netcmd. Not static, used in start.c */
  130. SWITCHTAB start_netlogon_ignore_switches[] = {
  131. swtxt_SW_NETLOGON_CENTRALIZED, NULL, ARG_REQ,
  132. NULL, NULL, NO_ARG };
  133. SWITCHTAB start_repl_switches[] = {
  134. swtxt_SW_REPL_REPL, NULL, ARG_OPT,
  135. swtxt_SW_REPL_EXPPATH, NULL, ARG_REQ,
  136. swtxt_SW_REPL_EXPLIST, NULL, ARG_REQ,
  137. swtxt_SW_REPL_IMPPATH, NULL, ARG_REQ,
  138. swtxt_SW_REPL_IMPLIST, NULL, ARG_REQ,
  139. swtxt_SW_REPL_TRYUSER, NULL, ARG_OPT,
  140. swtxt_SW_REPL_LOGON, NULL, ARG_REQ,
  141. swtxt_SW_REPL_PASSWD, NULL, ARG_REQ,
  142. swtxt_SW_REPL_SYNCH, NULL, ARG_REQ,
  143. swtxt_SW_REPL_PULSE, NULL, ARG_REQ,
  144. swtxt_SW_REPL_GUARD, NULL, ARG_REQ,
  145. swtxt_SW_REPL_RANDOM, NULL, ARG_REQ,
  146. NULL, NULL, NO_ARG };
  147. /* start_rdr_switches MANIFEST! used three places */
  148. #define WORKSTATION_SWITCHES_TWO /* first half of switches */ \
  149. swtxt_SW_WKSTA_CHARCOUNT, NULL, ARG_REQ, \
  150. swtxt_SW_WKSTA_CHARTIME, NULL, ARG_REQ, \
  151. swtxt_SW_WKSTA_CHARWAIT, NULL, ARG_REQ, \
  152. swtxt_SW_WKSTA_COMPUTERNAME, NULL, ARG_REQ, \
  153. swtxt_SW_WKSTA_KEEPCONN, NULL, ARG_REQ, \
  154. swtxt_SW_WKSTA_KEEPSEARCH, NULL, ARG_REQ, \
  155. swtxt_SW_WKSTA_LOGONSERVER, NULL, ARG_REQ, \
  156. swtxt_SW_WKSTA_MAILSLOTS, NULL, ARG_REQ, \
  157. swtxt_SW_WKSTA_NUMCHARBUF, NULL, ARG_REQ, \
  158. swtxt_SW_WKSTA_NUMDGRAMBUF, NULL, ARG_REQ, \
  159. swtxt_SW_WKSTA_NUMWORKBUF, NULL, ARG_REQ, \
  160. swtxt_SW_WKSTA_OTHDOMAINS, NULL, ARG_OPT, \
  161. swtxt_SW_WKSTA_PRIMARYDOMAIN, NULL, ARG_REQ, \
  162. swtxt_SW_WKSTA_SIZCHARBUF, NULL, ARG_REQ, \
  163. swtxt_SW_WKSTA_SIZWORKBUF, NULL, ARG_REQ, \
  164. swtxt_SW_WKSTA_WRKHEURISTICS, NULL, ARG_REQ, \
  165. swtxt_SW_WKSTA_WRKNETS, NULL, ARG_REQ, \
  166. swtxt_SW_WKSTA_NUMSERVICES, NULL, ARG_REQ, \
  167. swtxt_SW_WKSTA_WRKSERVICES, NULL, ARG_REQ
  168. /* WORKSTATION_SWITCHES_THREE are the switches that are different
  169. * between MS-DOS and OS/2
  170. */
  171. #define WORKSTATION_SWITCHES_THREE /* second half of switches */ \
  172. swtxt_SW_WKSTA_MAXERRORLOG, NULL, ARG_REQ, \
  173. swtxt_SW_WKSTA_MAXWRKCACHE, NULL, ARG_REQ, \
  174. swtxt_SW_WKSTA_NUMALERTS, NULL, ARG_REQ, \
  175. swtxt_SW_WKSTA_PRINTBUFTIME, NULL, ARG_REQ, \
  176. swtxt_SW_WKSTA_SESSTIMEOUT, NULL, ARG_REQ, \
  177. swtxt_SW_WKSTA_SIZERROR, NULL, ARG_REQ
  178. /* start_rdr_switches not static! used in start.c */
  179. SWITCHTAB start_rdr_switches[] = {
  180. // WORKSTATION_SWITCHES_ONE, (no longer used)
  181. WORKSTATION_SWITCHES_TWO,
  182. WORKSTATION_SWITCHES_THREE,
  183. NULL, NULL, NO_ARG };
  184. SWITCHTAB start_rdr_ignore_switches[] = {
  185. swtxt_SW_WKSTA_LOGONSERVER, NULL, ARG_REQ,
  186. NULL, NULL, NO_ARG };
  187. SWITCHTAB start_msg_switches[] = {
  188. // WORKSTATION_SWITCHES_ONE, (no longer used)
  189. WORKSTATION_SWITCHES_TWO,
  190. WORKSTATION_SWITCHES_THREE,
  191. TEXT("/SIZMESSBUF"), NULL, ARG_REQ,
  192. TEXT("/MBI"), TEXT("/SIZMESSBUF"), ARG_REQ,
  193. TEXT("/LOGFILE"), NULL, ARG_REQ,
  194. #ifdef DOS3
  195. TEXT("/NMSG"), TEXT("/NUMMSGNAMES"), ARG_REQ,
  196. TEXT("/NUMMSGNAMES"), NULL, ARG_REQ,
  197. #endif
  198. NULL, NULL, NO_ARG };
  199. SWITCHTAB start_srv_switches[] = {
  200. swtxt_SW_SRV_MAXSESSOPENS, NULL, ARG_REQ,
  201. swtxt_SW_SRV_MAXUSERS, NULL, ARG_REQ,
  202. swtxt_SW_SRV_NUMBIGBUF, NULL, ARG_REQ,
  203. swtxt_SW_SRV_NUMREQBUF, NULL, ARG_REQ,
  204. swtxt_SW_SRV_SIZREQBUF, NULL, ARG_REQ,
  205. swtxt_SW_SRV_SRVANNDELTA, NULL, ARG_REQ,
  206. swtxt_SW_SRV_SRVANNOUNCE, NULL, ARG_REQ,
  207. swtxt_SW_SRV_AUTODISCONNECT, NULL, ARG_REQ,
  208. swtxt_SW_SRV_SRVCOMMENT, NULL, ARG_REQ,
  209. swtxt_SW_SRV_DEBUG, NULL, ARG_REQ,
  210. NULL, NULL, NO_ARG };
  211. SWITCHTAB start_ups_switches[] = {
  212. swtxt_SW_UPS_BATTERYTIME, NULL, ARG_REQ,
  213. swtxt_SW_UPS_CMDFILE, NULL, ARG_REQ,
  214. swtxt_SW_UPS_DEVICENAME, NULL, ARG_REQ,
  215. swtxt_SW_UPS_MESSDELAY, NULL, ARG_REQ,
  216. swtxt_SW_UPS_MESSTIME, NULL, ARG_REQ,
  217. swtxt_SW_UPS_RECHARGE, NULL, ARG_REQ,
  218. swtxt_SW_UPS_SIGNALS, NULL, ARG_REQ,
  219. swtxt_SW_UPS_VOLTLEVELS, NULL, ARG_REQ,
  220. NULL, NULL, NO_ARG };
  221. SWITCHTAB stats_switches[] = {
  222. swtxt_SW_STATS_CLEAR, NULL, NO_ARG,
  223. NULL, NULL, NO_ARG };
  224. SWITCHTAB use_switches[] = {
  225. swtxt_SW_USE_USER, NULL, ARG_REQ,
  226. swtxt_SW_USE_PERSISTENT, NULL, ARG_REQ,
  227. swtxt_SW_USE_HOME, NULL, NO_ARG,
  228. swtxt_SW_USE_SMARTCARD, NULL, NO_ARG,
  229. swtxt_SW_USE_SAVECRED, NULL, NO_ARG,
  230. swtxt_SW_DELETE, NULL, NO_ARG,
  231. NULL, NULL, NO_ARG };
  232. SWITCHTAB user_switches[] = {
  233. swtxt_SW_ADD, NULL, NO_ARG,
  234. swtxt_SW_DELETE, NULL, NO_ARG,
  235. swtxt_SW_DOMAIN, NULL, NO_ARG,
  236. swtxt_SW_COMMENT, NULL, ARG_REQ,
  237. swtxt_SW_REMARK, swtxt_SW_COMMENT, ARG_REQ,
  238. swtxt_SW_COMMENT, NULL, ARG_REQ,
  239. swtxt_SW_NETWARE, NULL, ARG_OPT,
  240. swtxt_SW_RANDOM, NULL, ARG_OPT,
  241. swtxt_SW_USER_ACTIVE, NULL, ARG_OPT,
  242. swtxt_SW_USER_COUNTRYCODE, NULL, ARG_REQ,
  243. swtxt_SW_USER_EXPIRES, NULL, ARG_REQ,
  244. swtxt_SW_USER_ENABLESCRIPT, NULL, ARG_REQ,
  245. swtxt_SW_USER_FULLNAME, NULL, ARG_REQ,
  246. swtxt_SW_USER_HOMEDIR, NULL, ARG_REQ,
  247. swtxt_SW_USER_PARMS, NULL, ARG_REQ,
  248. swtxt_SW_USER_PASSWORDREQ, NULL, ARG_REQ,
  249. swtxt_SW_USER_PASSWORDCHG, NULL, ARG_REQ,
  250. swtxt_SW_USER_SCRIPTPATH, NULL, ARG_REQ,
  251. swtxt_SW_USER_TIMES, NULL, ARG_REQ,
  252. swtxt_SW_USER_USERCOMMENT, NULL, ARG_REQ,
  253. swtxt_SW_USER_WORKSTATIONS, NULL, ARG_REQ,
  254. swtxt_SW_USER_PROFILEPATH, NULL, ARG_REQ,
  255. NULL, NULL, NO_ARG };
  256. SWITCHTAB group_switches[] = {
  257. swtxt_SW_ADD, NULL, NO_ARG,
  258. swtxt_SW_DELETE, NULL, NO_ARG,
  259. swtxt_SW_DOMAIN, NULL, NO_ARG,
  260. swtxt_SW_COMMENT, NULL, ARG_REQ,
  261. swtxt_SW_REMARK, swtxt_SW_COMMENT, ARG_REQ,
  262. NULL, NULL, NO_ARG };
  263. SWITCHTAB ntalias_switches[] = {
  264. swtxt_SW_ADD, NULL, NO_ARG,
  265. swtxt_SW_DELETE, NULL, NO_ARG,
  266. swtxt_SW_DOMAIN, NULL, NO_ARG,
  267. NULL, NULL, NO_ARG };
  268. SWITCHTAB time_switches[] = {
  269. swtxt_SW_DOMAIN, NULL, ARG_OPT,
  270. swtxt_SW_TIME_SET, NULL, NO_ARG,
  271. swtxt_SW_RTSDOMAIN, NULL, ARG_OPT,
  272. swtxt_SW_SETSNTP, NULL, ARG_OPT,
  273. swtxt_SW_QUERYSNTP, NULL, NO_ARG,
  274. NULL, NULL, NO_ARG };
  275. SWITCHTAB who_switches[] = {
  276. swtxt_SW_DOMAIN, NULL, ARG_OPT,
  277. NULL, NULL, NO_ARG };
  278. SWITCHTAB view_switches[] = {
  279. swtxt_SW_DOMAIN, NULL, ARG_OPT,
  280. swtxt_SW_NETWORK, NULL, ARG_OPT,
  281. swtxt_SW_CACHE, NULL, NO_ARG,
  282. NULL, NULL, NO_ARG };