1 | /*:VRX Main
|
---|
2 | */
|
---|
3 | /* Main
|
---|
4 | */
|
---|
5 | Main:
|
---|
6 | /* Process the arguments.
|
---|
7 | Get the parent window.
|
---|
8 | */
|
---|
9 | parse source . calledAs .
|
---|
10 | parent = ""
|
---|
11 | argCount = arg()
|
---|
12 | argOff = 0
|
---|
13 | if( calledAs \= "COMMAND" )then do
|
---|
14 | if argCount >= 1 then do
|
---|
15 | parent = arg(1)
|
---|
16 | argCount = argCount - 1
|
---|
17 | argOff = 1
|
---|
18 | end
|
---|
19 | end; else do
|
---|
20 | call VROptions 'ImplicitNames'
|
---|
21 | call VROptions 'NoEchoQuit'
|
---|
22 | end
|
---|
23 | InitArgs.0 = argCount
|
---|
24 | if( argCount > 0 )then do i = 1 to argCount
|
---|
25 | InitArgs.i = arg( i + argOff )
|
---|
26 | end
|
---|
27 | drop calledAs argCount argOff
|
---|
28 |
|
---|
29 | /* Load the windows
|
---|
30 | */
|
---|
31 | call VRInit
|
---|
32 | parse source . . spec
|
---|
33 | _VREPrimaryWindowPath = ,
|
---|
34 | VRParseFileName( spec, "dpn" ) || ".VRW"
|
---|
35 | _VREPrimaryWindow = ,
|
---|
36 | VRLoad( parent, _VREPrimaryWindowPath )
|
---|
37 | drop parent spec
|
---|
38 | if( _VREPrimaryWindow == "" )then do
|
---|
39 | call VRMessage "", "Cannot load window:" VRError(), ,
|
---|
40 | "Error!"
|
---|
41 | _VREReturnValue = 32000
|
---|
42 | signal _VRELeaveMain
|
---|
43 | end
|
---|
44 |
|
---|
45 | /* Process events
|
---|
46 | */
|
---|
47 | call Init
|
---|
48 | signal on halt
|
---|
49 | do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
|
---|
50 | _VREEvent = VREvent()
|
---|
51 | interpret _VREEvent
|
---|
52 | end
|
---|
53 | _VREHalt:
|
---|
54 | _VREReturnValue = Fini()
|
---|
55 | call VRDestroy _VREPrimaryWindow
|
---|
56 | _VRELeaveMain:
|
---|
57 | call VRFini
|
---|
58 | exit _VREReturnValue
|
---|
59 |
|
---|
60 | VRLoadSecondary:
|
---|
61 | __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
|
---|
62 | if __vrlsWait then do
|
---|
63 | call VRFlush
|
---|
64 | end
|
---|
65 | __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
|
---|
66 | if __vrlsHWnd = '' then signal __vrlsDone
|
---|
67 | if __vrlsWait \= 1 then signal __vrlsDone
|
---|
68 | call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
|
---|
69 | __vrlsTmp = __vrlsWindows.0
|
---|
70 | if( DataType(__vrlsTmp) \= 'NUM' ) then do
|
---|
71 | __vrlsTmp = 1
|
---|
72 | end
|
---|
73 | else do
|
---|
74 | __vrlsTmp = __vrlsTmp + 1
|
---|
75 | end
|
---|
76 | __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
|
---|
77 | __vrlsWindows.0 = __vrlsTmp
|
---|
78 | do while( VRIsValidObject( VRWindow() ) = 1 )
|
---|
79 | __vrlsEvent = VREvent()
|
---|
80 | interpret __vrlsEvent
|
---|
81 | end
|
---|
82 | __vrlsTmp = __vrlsWindows.0
|
---|
83 | __vrlsWindows.0 = __vrlsTmp - 1
|
---|
84 | call VRWindow __vrlsWindows.__vrlsTmp
|
---|
85 | __vrlsHWnd = ''
|
---|
86 | __vrlsDone:
|
---|
87 | return __vrlsHWnd
|
---|
88 |
|
---|
89 | /*:VRX __VXREXX____APPENDS__
|
---|
90 | */
|
---|
91 | __VXREXX____APPENDS__:
|
---|
92 | /*
|
---|
93 | #append U:\Develop\Samba\trunk\guitools\shared\usercredmem.vrs
|
---|
94 | #append U:\Develop\Samba\trunk\guitools\shared\cltinit.vrs
|
---|
95 | #append U:\Develop\Samba\trunk\guitools\shared\inittempdir.vrs
|
---|
96 | #append U:\Develop\Samba\trunk\guitools\shared\rxrpclib.vrs
|
---|
97 | #append U:\Develop\Samba\trunk\guitools\shared\masterpasswd.vrs
|
---|
98 | #append U:\Develop\Samba\trunk\guitools\shared\nlv.vrs
|
---|
99 | */
|
---|
100 | return
|
---|
101 | /*:VRX _ContainerInit
|
---|
102 | */
|
---|
103 | _ContainerInit:
|
---|
104 | Status.StatusFH = VRMethod( "CN_STATUS", "AddField", "Icon", "Status" )
|
---|
105 | Status.MessageFH = VRMethod( "CN_STATUS", "AddField", "String", "Message" )
|
---|
106 | return
|
---|
107 |
|
---|
108 | /*:VRX _INIRead
|
---|
109 | */
|
---|
110 | _INIRead:
|
---|
111 |
|
---|
112 | return
|
---|
113 |
|
---|
114 | /*:VRX _INIWrite
|
---|
115 | */
|
---|
116 | _INIWrite:
|
---|
117 |
|
---|
118 | return
|
---|
119 |
|
---|
120 | /*:VRX _IsValidLocalUser
|
---|
121 | */
|
---|
122 | _IsValidLocalUser:
|
---|
123 | LocalUser = arg(1)
|
---|
124 | UserMatch = 0
|
---|
125 | do I = 1 to username.0
|
---|
126 | if translate(username.I) = translate(LocalUser) then do
|
---|
127 | UserMatch = 1
|
---|
128 | LocalPasswd = password.I
|
---|
129 | leave
|
---|
130 | end
|
---|
131 | end
|
---|
132 | return UserMatch
|
---|
133 |
|
---|
134 | /*:VRX _LoadOtherFuncs
|
---|
135 | */
|
---|
136 | _LoadOtherFuncs:
|
---|
137 | IF options.!debug == 1 THEN say "_LoadotherFuncs() started"
|
---|
138 | IF options.!debug == 1 THEN ok = VRRedirectStdIO("ON")
|
---|
139 | ELSE ok = VRRedirectStdIO("OFF")
|
---|
140 |
|
---|
141 | /* what REXX script would be complete without this... */
|
---|
142 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
|
---|
143 | call SysLoadFuncs
|
---|
144 |
|
---|
145 |
|
---|
146 | call RxFuncAdd 'RxuInit', 'RXU', 'RxuInit'
|
---|
147 | call RxuInit
|
---|
148 |
|
---|
149 | call rxFuncAdd 'Crypt', 'RxCrypt', 'RxCrypt'
|
---|
150 | IF options.!debug == 1 THEN say "_LoadotherFuncs() done"
|
---|
151 | return
|
---|
152 |
|
---|
153 | /*:VRX _LogonLocal
|
---|
154 | */
|
---|
155 | _LogonLocal:
|
---|
156 | ErrorStatus = 0
|
---|
157 | IF options.!debug == 1 THEN say "_LogonLocal() started"
|
---|
158 | if \_IsValidLocalUser(Credentials.!Username) then do
|
---|
159 | ErrorStatus = 1
|
---|
160 | Msg.Type = "E"
|
---|
161 | Msg.Text = "Invalid local user - specify server to authenticate against!"
|
---|
162 | call _ShowMsg
|
---|
163 | end
|
---|
164 | else do
|
---|
165 | passtwo = Crypt(Credentials.!password , LocalPasswd )
|
---|
166 | if LocalPasswd <> passtwo then do
|
---|
167 | ErrorStatus = 1
|
---|
168 | Msg.Text = "Invalid local password!"
|
---|
169 | call _ShowMsg
|
---|
170 | end
|
---|
171 | else do
|
---|
172 | ok = VRSet("DT_WELCOME","Caption", Credentials.!Username" authenticated locally!")
|
---|
173 | StoreCreds = 1
|
---|
174 | end
|
---|
175 | end
|
---|
176 | if _ucChkObj() & StoreCreds then do
|
---|
177 | if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0
|
---|
178 | then UserCred = '--user='Credentials.!username'%'Credentials.!password
|
---|
179 | else UserCred = '--user='Credentials.!username'%%'Credentials.!password
|
---|
180 | ok = _ucSetUc()
|
---|
181 | end
|
---|
182 | else do
|
---|
183 | ErrorStatus = 1
|
---|
184 | Msg.Text = "Credentials not stored!"
|
---|
185 | call _ShowMsg
|
---|
186 | end
|
---|
187 | if ErrorStatus = 1 then do
|
---|
188 | Msg.Type = "E"
|
---|
189 | Msg.Text = "Errors during logon!"
|
---|
190 | call _ShowMsg
|
---|
191 | ok = VRSet("PB_Cancel","Visible", 1)
|
---|
192 | end
|
---|
193 | else ok = VRSet("TM_Quit","Enabled",1)
|
---|
194 | IF options.!debug == 1 THEN say "_LogonLocal() done"
|
---|
195 | return
|
---|
196 |
|
---|
197 | /*:VRX _LogonServer
|
---|
198 | */
|
---|
199 | _LogonServer:
|
---|
200 | IF options.!debug == 1 THEN say "_LogonServer() started"
|
---|
201 | ok = _rpcqueryuser(server, Credentials.!username, Credentials.!password,Credentials.!username)
|
---|
202 | LogonStatus = word(ok,1)
|
---|
203 |
|
---|
204 | if LogonStatus = "1" then Msg.Type ="I"
|
---|
205 | else Msg.Type ="E"
|
---|
206 | LogonWelcome = "Welcome" /* NLVGetMessage(x) */
|
---|
207 | ok = VRSet("DT_WELCOME","Caption", LogonWelcome' 'rpc.queryuser.FULL_NAME)
|
---|
208 |
|
---|
209 | ok = SysFileDelete(samba.!msg)
|
---|
210 | ErrorStatus = 0
|
---|
211 | address cmd 'evfscli.exe attach 'rpc.queryuser.DIR_DRIVE' >'samba.!msg
|
---|
212 | attach_rc = rc
|
---|
213 |
|
---|
214 | do until lines(samba.!msg) = 0
|
---|
215 | attachline = linein(samba.!msg)
|
---|
216 | rh = VRMethod( "CN_STATUS", "AddRecord")
|
---|
217 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, attachline)
|
---|
218 | call beautify attachline
|
---|
219 | end
|
---|
220 | ok = stream(samba.!msg,'c','close')
|
---|
221 |
|
---|
222 | /* \mountpoint ;workgroup=...;server=...;share=...;user=...;password=...;master=...;mastertype=...;memlen=...;logfile=...;loglevel=...;easupport=...) */
|
---|
223 |
|
---|
224 | parse var rpc.queryuser.PROFILE_PATH '\\'server'\'pshare'\'puser
|
---|
225 |
|
---|
226 | pshare = 'netlogon'
|
---|
227 |
|
---|
228 | /* EVFSCLI MOUNT type mountpoint resource {R|W} [F] */
|
---|
229 | say 'evfscli.exe mount SMBFS 'rpc.queryuser.DIR_DRIVE'\ WORKGROUP=;SERVER='server';share='pshare';user='Credentials.!username';password='Credentials.!password' W'
|
---|
230 | address cmd 'evfscli.exe mount SMBFS 'rpc.queryuser.DIR_DRIVE'\ WORKGROUP=;SERVER='server';share='pshare';user='Credentials.!username';password='Credentials.!password' W >'samba.!msg
|
---|
231 | mount_rc = rc
|
---|
232 | do until lines(samba.!msg) = 0
|
---|
233 | mountline = linein(samba.!msg)
|
---|
234 |
|
---|
235 | rh = VRMethod( "CN_STATUS", "AddRecord")
|
---|
236 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, mountline)
|
---|
237 |
|
---|
238 | call beautify mountline
|
---|
239 | end
|
---|
240 | ok = stream(samba.!msg,'c','close')
|
---|
241 |
|
---|
242 | rh = VRMethod( "CN_STATUS", "AddRecord")
|
---|
243 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, "Start logon script")
|
---|
244 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.StatusFH, "Application")
|
---|
245 |
|
---|
246 | ok = Value('OS','ECS','OS2ENVIRONMENT')
|
---|
247 | ok = Value("SERVER",Server,"OS2ENVIRONMENT")
|
---|
248 | ok = Value("USER",Credentials.!Username,"OS2ENVIRONMENT")
|
---|
249 | ok = Value("PASSWORD",Credentials.!password,"OS2ENVIRONMENT")
|
---|
250 |
|
---|
251 | address cmd rpc.queryuser.DIR_DRIVE'\'rpc.queryuser.LOGON_SCRIPT' >'samba.!msg
|
---|
252 |
|
---|
253 | do until lines(samba.!msg) = 0
|
---|
254 | mountline = linein(samba.!msg)
|
---|
255 | rh = VRMethod( "CN_STATUS", "AddRecord")
|
---|
256 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, mountline)
|
---|
257 | call beautify mountline
|
---|
258 | end
|
---|
259 | ok = stream(samba.!msg,'c','close')
|
---|
260 |
|
---|
261 | rh = VRMethod( "CN_STATUS", "AddRecord")
|
---|
262 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, "Logon script done.")
|
---|
263 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.StatusFH, "Application")
|
---|
264 |
|
---|
265 | say 'evfscli.exe detach 'rpc.queryuser.DIR_DRIVE
|
---|
266 | address cmd 'evfscli.exe detach 'rpc.queryuser.DIR_DRIVE' >'samba.!msg
|
---|
267 | do until lines(samba.!msg) = 0
|
---|
268 | mountline = linein(samba.!msg)
|
---|
269 | rh = VRMethod( "CN_STATUS", "AddRecord")
|
---|
270 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, mountline)
|
---|
271 | call beautify mountline
|
---|
272 | end
|
---|
273 | /* remove server and password from environment */
|
---|
274 | ok = Value("SERVER","","OS2ENVIRONMENT")
|
---|
275 | ok = value("PASSWORD","","OS2ENVIRONMENT")
|
---|
276 | ok = stream(samba.!msg,'c','close')
|
---|
277 | if ErrorStatus = 1 then do
|
---|
278 | Msg.Type = "E"
|
---|
279 | Msg.Text = "Errors during logon!"
|
---|
280 | call _ShowMsg
|
---|
281 | ok = VRSet("PB_Cancel","Visible", 1)
|
---|
282 | end
|
---|
283 | else ok = VRSet("TM_Quit","Enabled",1)
|
---|
284 | IF options.!debug == 1 THEN say "_LogonServer() done"
|
---|
285 | return
|
---|
286 |
|
---|
287 | beautify:
|
---|
288 | bLine = translate(arg(1))
|
---|
289 | select
|
---|
290 | when pos("DRIVE LETTER",bLine) > 0 & pos("HAS BEEN CREATED",bLine) > 0 then do
|
---|
291 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.StatusFH, icons.!drive)
|
---|
292 | end
|
---|
293 | when pos("RESOURCE HAS BEEN MOUNTED",bLine) > 0 then do
|
---|
294 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.StatusFH, icons.!folder_open)
|
---|
295 | end
|
---|
296 | when pos("DRIVE LETTER",bLine) > 0 & pos("HAS BEEN DELETED",bLine) > 0 then do
|
---|
297 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.StatusFH, icons.!drive_inactive)
|
---|
298 | end
|
---|
299 | when left(bLIne,3) = "EVC" | pos(" NOT ",bLine) > 0 | pos("ALREADY IN USE",bLine) > 0 then do
|
---|
300 | ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.StatusFH, "Error")
|
---|
301 | ErrorStatus = 1
|
---|
302 | end
|
---|
303 | otherwise nop /* ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.StatusFH, "Information") */
|
---|
304 | end
|
---|
305 | return
|
---|
306 |
|
---|
307 | /*:VRX _NLVSetup
|
---|
308 | */
|
---|
309 | _NLVSetup:
|
---|
310 |
|
---|
311 | return
|
---|
312 |
|
---|
313 | /*:VRX _ParseCommandLine
|
---|
314 | */
|
---|
315 | _ParseCommandLine:
|
---|
316 | IF options.!debug == 1 THEN SAY time()" _ParseCommandLine() started"
|
---|
317 | CmdLine = VRGet("Application","Commandline")
|
---|
318 | IF options.!debug == 1 THEN SAY ' original commandline ="'CmdLine'"'
|
---|
319 | upCmdLine = translate(CmdLine)
|
---|
320 |
|
---|
321 | UserPos = 0
|
---|
322 | UserPos = pos('--USER=',upCmdLine)
|
---|
323 |
|
---|
324 | if UserPos > 0 then do
|
---|
325 | IF options.!debug == 1 THEN SAY " --USER switch detected"
|
---|
326 | UserPasswd = translate(word(substr(CmdLine,UserPos+7,),1),'%','|')
|
---|
327 | parse var UserPasswd Credentials.!Username '%' Credentials.!password
|
---|
328 | end
|
---|
329 | else do
|
---|
330 | UserPos = pos('-U ',upCmdLine)
|
---|
331 | If UserPos > 0 then do
|
---|
332 | IF options.!debug == 1 THEN SAY " -U switch detected"
|
---|
333 | UserPasswd = translate(word(substr(CmdLine,UserPos+3,),1),'%','|')
|
---|
334 | parse var UserPasswd Credentials.!Username '%' Credentials.!password
|
---|
335 | end
|
---|
336 | end
|
---|
337 |
|
---|
338 | ServerPos = 0
|
---|
339 | ServerPos = pos('--SERVER=',upCmdLine)
|
---|
340 | Server = ""
|
---|
341 |
|
---|
342 | if ServerPos > 0 then do
|
---|
343 | IF options.!debug == 1 THEN SAY " --SERVER switch detected"
|
---|
344 | server = word(substr(CmdLine,ServerPos+9,),1)
|
---|
345 | end
|
---|
346 | else do
|
---|
347 | ServerPos = pos('-S ',upCmdLine)
|
---|
348 | If ServerPos > 0 then do
|
---|
349 | IF options.!debug == 1 THEN SAY " -S switch detected"
|
---|
350 | Server = word((substr(CmdLine,ServerPos+3,),1)
|
---|
351 | end
|
---|
352 | end
|
---|
353 |
|
---|
354 | if Credentials.!Username = "" then do
|
---|
355 | IF options.!debug == 1 THEN say ' Reading username from envvar USER'
|
---|
356 | Credentials.!Username = value("USER",,"OS2ENVIRONMENT")
|
---|
357 | end
|
---|
358 |
|
---|
359 | IF options.!debug == 1 THEN say ' Username ="'Credentials.!Username'"'
|
---|
360 | IF options.!debug == 1 THEN say ' Password ="'Credentials.!password'"'
|
---|
361 | IF options.!debug == 1 THEN say ' Server ="'Server'"'
|
---|
362 | IF options.!debug == 1 THEN SAY time()" _ParseCommandLine() done"
|
---|
363 | return
|
---|
364 |
|
---|
365 | /*:VRX _ShowMsg
|
---|
366 | */
|
---|
367 | _ShowMsg:
|
---|
368 | Buttons.1 = "OK" /* NLVGetMessage(2) */
|
---|
369 | Buttons.0 = 1
|
---|
370 | id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
|
---|
371 | return
|
---|
372 | /*:VRX _StemsInit
|
---|
373 | */
|
---|
374 | _StemsInit:
|
---|
375 | if options.!debug == 1 then say time()' _StemsInit started'
|
---|
376 |
|
---|
377 | if options.!debug == 1 then say ' initializing msg. '
|
---|
378 | msg.title = "Samba Logon"
|
---|
379 |
|
---|
380 | if options.!debug == 1 then say ' initializing credentials. '
|
---|
381 | credentials. =""
|
---|
382 | credentials.!username = ""
|
---|
383 | credentials.!password = ""
|
---|
384 |
|
---|
385 | if options.!debug == 1 then say ' initializing icons. '
|
---|
386 | icons.!bat = '#1:PMWP.DLL'
|
---|
387 | icons.!cmd = '#2:PMWP.DLL'
|
---|
388 | icons.!exe = '#3:PMWP.DLL'
|
---|
389 | icons.!template = '#10:PMWP.DLL'
|
---|
390 | icons.!drive = '#16:PMWP.DLL'
|
---|
391 | icons.!defaultfile = '#24:PMWP.DLL'
|
---|
392 | icons.!folder = '#26:PMWP.DLL'
|
---|
393 | icons.!folder_open = '#34:PMWP.DLL'
|
---|
394 | icons.!machine_awake = '#35:PMWP.DLL'
|
---|
395 | icons.!machine_sleeping = '#61:PMWP.DLL'
|
---|
396 | icons.!workgroup = '#62:PMWP.DLL'
|
---|
397 | icons.!pdc = '#63:PMWP.DLL'
|
---|
398 | icons.!active = '#64:PMWP.DLL'
|
---|
399 | icons.!passive = '#68:PMWP.DLL'
|
---|
400 | icons.!printer = '#65:PMWP.DLL'
|
---|
401 | icons.!drive_inactive = '#70:PMWP.DLL'
|
---|
402 |
|
---|
403 | if options.!debug == 1 then say time()' _StemsInit done'
|
---|
404 | return
|
---|
405 |
|
---|
406 | /*:VRX Fini
|
---|
407 | */
|
---|
408 | Fini:
|
---|
409 | window = VRWindow()
|
---|
410 | call VRSet window, "Visible", 0
|
---|
411 | drop window
|
---|
412 | return 0
|
---|
413 |
|
---|
414 | /*:VRX Halt
|
---|
415 | */
|
---|
416 | Halt:
|
---|
417 | signal _VREHalt
|
---|
418 | return
|
---|
419 |
|
---|
420 | /*:VRX Init
|
---|
421 | */
|
---|
422 | Init:
|
---|
423 | window = VRWindow()
|
---|
424 | call VRMethod window, "CenterWindow"
|
---|
425 | call VRSet window, "Visible", 1
|
---|
426 | call VRMethod window, "Activate"
|
---|
427 | drop window
|
---|
428 | return
|
---|
429 |
|
---|
430 | /*:VRX Main_Close
|
---|
431 | */
|
---|
432 | Main_Close:
|
---|
433 | call Quit
|
---|
434 | return
|
---|
435 |
|
---|
436 | /*:VRX Main_Create
|
---|
437 | */
|
---|
438 | Main_Create:
|
---|
439 | options.!debug = 1
|
---|
440 | call _LoadOtherFuncs
|
---|
441 |
|
---|
442 | call _INIRead
|
---|
443 | call NLVSetup
|
---|
444 | call _StemsInit
|
---|
445 |
|
---|
446 | call _InitTempDir
|
---|
447 | call _CltInit
|
---|
448 |
|
---|
449 | call _ContainerInit
|
---|
450 | call _NLVSetup
|
---|
451 |
|
---|
452 | ok = _ucInitObj()
|
---|
453 |
|
---|
454 | call _ParseCommandLine
|
---|
455 |
|
---|
456 | if Credentials.!user = "" | Credentials.!password = "" then do
|
---|
457 | window = VRLoadSecondary( "SW_LOGIN", "W" )
|
---|
458 | end
|
---|
459 |
|
---|
460 | IF options.!debug == 1 THEN say ' Username ="'Credentials.!Username'"'
|
---|
461 | IF options.!debug == 1 THEN say ' Password ="'Credentials.!password'"'
|
---|
462 | IF options.!debug == 1 THEN say ' Server ="'Server'"'
|
---|
463 |
|
---|
464 | StoreCreds = 0
|
---|
465 |
|
---|
466 | call _MasterPasswdRead
|
---|
467 |
|
---|
468 | if Server = ""
|
---|
469 | then call _LogonLocal /* Authenticate locally! */
|
---|
470 | else call _LogonServer /* Authenticate against specified server */
|
---|
471 |
|
---|
472 | return
|
---|
473 |
|
---|
474 | /*:VRX Main_Resize
|
---|
475 | */
|
---|
476 | Main_Resize:
|
---|
477 | ok = VRSet("CN_Status","Width", VRGet("Main", "WIdth")-144)
|
---|
478 | ok = VRSet("CN_Status","Height",VRGet("Main", "Height")-144-434)
|
---|
479 | return
|
---|
480 |
|
---|
481 | /*:VRX PB_Cancel_Click
|
---|
482 | */
|
---|
483 | PB_Cancel_Click:
|
---|
484 | call quit
|
---|
485 | return
|
---|
486 |
|
---|
487 | /*:VRX PB_LOGIN_CANCEL_Click
|
---|
488 | */
|
---|
489 | PB_LOGIN_CANCEL_Click:
|
---|
490 | call SW_LOGIN_Close
|
---|
491 | return 0
|
---|
492 |
|
---|
493 | /*:VRX PB_LOGIN_OK_Click
|
---|
494 | */
|
---|
495 | PB_LOGIN_OK_Click:
|
---|
496 | Credentials.!username = VRGet("EF_USER1","Value")
|
---|
497 | Credentials.!password = VRGet("EF_PASSWORD1","Value")
|
---|
498 | UserCred = '--user='Credentials.!username'%'Credentials.!password
|
---|
499 | call SW_LOGIN_Close
|
---|
500 | return
|
---|
501 |
|
---|
502 | /*:VRX PB_Logon_Click
|
---|
503 | */
|
---|
504 | PB_Logon_Click:
|
---|
505 | return
|
---|
506 |
|
---|
507 | /*:VRX PB_TEST1_Click
|
---|
508 | */
|
---|
509 | PB_TEST1_Click:
|
---|
510 |
|
---|
511 |
|
---|
512 | /* ok = _rpcquerygroupmem(server, Credentials.!username, Credentials.!password,'0x201') */
|
---|
513 | ok = _rpcqueryuser(server, Credentials.!username, Credentials.!password,Credentials.!username)
|
---|
514 |
|
---|
515 | if ok = 1 then do
|
---|
516 | ok = VRSetIni( "SmbLogon", c2x(server), c2x(Credentials.!username)'#'c2x(Credentials.!password), "SYSTEM" )
|
---|
517 | end
|
---|
518 | else do
|
---|
519 | ok = VRDelIni( "SmbLogon", c2x(server),"SYSTEM")
|
---|
520 | end
|
---|
521 |
|
---|
522 | /* ok = _rpcenumprinters(server, Credentials.!username, Credentials.!password) */
|
---|
523 | /* ok = _rpcenumdomusers(server, Credentials.!username, Credentials.!password) */
|
---|
524 | /* ok = _rpcsrvinfo(server, Credentials.!username, Credentials.!password) */
|
---|
525 | /* ok = _rpcnetsharegetinfo(server, Credentials.!username, Credentials.!password,'data') */
|
---|
526 | /* ok = _rpcnetshareenum(server, Credentials.!username, Credentials.!password) */
|
---|
527 | return
|
---|
528 |
|
---|
529 | /*:VRX PB_TEST2_Click
|
---|
530 | */
|
---|
531 | PB_TEST2_Click:
|
---|
532 | ucMem = '\SHAREMEM\INETXXX'
|
---|
533 | ok = _ucChkObj()
|
---|
534 | say ok
|
---|
535 | ok = _ucChkUc()
|
---|
536 | say ok
|
---|
537 | if ok = 1 then do
|
---|
538 | UserCred = _ucGetUc()
|
---|
539 | say UserCred
|
---|
540 | end
|
---|
541 | else do
|
---|
542 | ok = _ucSetUc()
|
---|
543 | say ok
|
---|
544 | end
|
---|
545 | UserCred = _ucGetUc()
|
---|
546 | say UserCred
|
---|
547 | /* ok = _ucDelUc()
|
---|
548 | ok = _ucChkUc()
|
---|
549 | say ok */
|
---|
550 |
|
---|
551 | return
|
---|
552 |
|
---|
553 | /*:VRX Quit
|
---|
554 | */
|
---|
555 | Quit:
|
---|
556 | call _SambaFinish
|
---|
557 | window = VRWindow()
|
---|
558 | call VRSet window, "Shutdown", 1
|
---|
559 | drop window
|
---|
560 | return
|
---|
561 |
|
---|
562 | /*:VRX SW_LOGIN_Close
|
---|
563 | */
|
---|
564 | SW_LOGIN_Close:
|
---|
565 | call SW_LOGIN_Fini
|
---|
566 | return
|
---|
567 |
|
---|
568 | /*:VRX SW_LOGIN_Create
|
---|
569 | */
|
---|
570 | SW_LOGIN_Create:
|
---|
571 | call SW_LOGIN_Init
|
---|
572 | CALL NLVSetText 'DT_USER1', 'Caption', 32
|
---|
573 | CALL NLVSetText 'DT_PASSWORD1', 'Caption', 33
|
---|
574 | CALL NLVSetText 'PB_LOGIN_OK', 'Caption', 2
|
---|
575 | CALL NLVSetText 'PB_LOGIN_CANCEL','Caption', 3
|
---|
576 |
|
---|
577 | ok = VRSet("EF_User1","Value", Credentials.!Username)
|
---|
578 | ok = VRSet("EF_PASSWORD1","Value",Credentials.!password)
|
---|
579 | if Credentials.!Username = "" then ok = VRMethod("EF_User1", "SetFocus" )
|
---|
580 | else ok = VRMethod("EF_PASSWORD1", "SetFocus" )
|
---|
581 | return
|
---|
582 |
|
---|
583 | /*:VRX SW_LOGIN_Fini
|
---|
584 | */
|
---|
585 | SW_LOGIN_Fini:
|
---|
586 | window = VRInfo( "Window" )
|
---|
587 | call VRDestroy window
|
---|
588 | drop window
|
---|
589 | return
|
---|
590 | /*:VRX SW_LOGIN_Init
|
---|
591 | */
|
---|
592 | SW_LOGIN_Init:
|
---|
593 | window = VRInfo( "Object" )
|
---|
594 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
---|
595 | call VRMethod window, "CenterWindow"
|
---|
596 | call VRSet window, "Visible", 1
|
---|
597 | call VRMethod window, "Activate"
|
---|
598 | end
|
---|
599 | drop window
|
---|
600 | return
|
---|
601 |
|
---|
602 | /*:VRX TM_Quit_Trigger
|
---|
603 | */
|
---|
604 | TM_Quit_Trigger:
|
---|
605 | ok = VRRedirectStdio("OFF")
|
---|
606 | call quit
|
---|
607 | return
|
---|
608 |
|
---|