Changeset 726 for trunk/guitools/smblogon
- Timestamp:
- Nov 9, 2012, 5:35:17 PM (8 years ago)
- Location:
- trunk/guitools/smblogon
- Files:
-
- 13 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/guitools/smblogon/smblogon.VRP
r724 r726 7 7 VRXWindow: __VREMainWindow,1,1963,2264,891,8000 8 8 VRXWindow: __VRESectionListWindow,1,3047,11804,7432,7480 9 VRXWindow: __VREToolsWindow,1,1975,530,648 6,16699 VRXWindow: __VREToolsWindow,1,1975,530,6489,1659 10 10 VRXWindow: __VREWindListWindow,1,397,11804,2650,3150 11 11 UserFile: 1 -
trunk/guitools/smblogon/smblogon.VRX
r724 r726 96 96 #append U:\Develop\Samba\trunk\guitools\shared\rxrpclib.vrs 97 97 #append U:\Develop\Samba\trunk\guitools\shared\masterpasswd.vrs 98 #append U:\Develop\Samba\trunk\guitools\shared\nlv.vrs 98 99 */ 99 100 return … … 103 104 Status.StatusFH = VRMethod( "CN_STATUS", "AddField", "Icon", "Status" ) 104 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 105 118 return 106 119 … … 138 151 return 139 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 140 313 /*:VRX _ParseCommandLine 141 314 */ … … 197 370 id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 ) 198 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 199 406 /*:VRX Fini 200 407 */ … … 230 437 */ 231 438 Main_Create: 232 options.!debug = 0 233 439 options.!debug = 1 234 440 call _LoadOtherFuncs 441 442 call _INIRead 443 call NLVSetup 444 call _StemsInit 235 445 236 446 call _InitTempDir … … 238 448 239 449 call _ContainerInit 240 241 Credentials. ="" 450 call _NLVSetup 451 242 452 ok = _ucInitObj() 243 453 … … 256 466 call _MasterPasswdRead 257 467 258 if Server = "" then do /* NO Server specified - authenticate locally! */ 259 if \_IsValidLocalUser(Credentials.!Username) then do 260 say "Invalid local user - specify server to authenticate against!" 261 end 262 else do 263 passtwo = Crypt(Credentials.!password , LocalPasswd ) 264 if LocalPasswd <> passtwo then do 265 say "Invalid local password!" 266 end 267 else do 268 ok = VRSet("DT_WELCOME","Caption", Credentials.!Username" authenticated locally!") 269 StoreCreds = 1 270 end 271 end 272 if _ucChkObj() & StoreCreds then do 273 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0 274 then UserCred = '--user='Credentials.!username'%'Credentials.!password 275 else UserCred = '--user='Credentials.!username'%%'Credentials.!password 276 ok = _ucSetUc() 277 end 278 else say "Credentials not stored!" 279 end 280 else do /* Authenticate against specified server */ 281 call PB_Logon_Click 282 end 283 ok = VRSet("TM_Quit","Enabled",1) 468 if Server = "" 469 then call _LogonLocal /* Authenticate locally! */ 470 else call _LogonServer /* Authenticate against specified server */ 471 284 472 return 285 473 … … 315 503 */ 316 504 PB_Logon_Click: 317 ok = _rpcqueryuser(server, Credentials.!username, Credentials.!password,Credentials.!username)318 LogonStatus = word(ok,1)319 320 if LogonStatus = "1" then Msg.Type ="I"321 else Msg.Type ="E"322 LogonWelcome = "Welcome" /* NLVGetMessage(x) */323 ok = VRSet("DT_WELCOME","Caption", LogonWelcome' 'rpc.queryuser.FULL_NAME)324 325 ok = SysFileDelete(samba.!msg)326 address cmd 'evfscli.exe attach 'rpc.queryuser.DIR_DRIVE' >'samba.!msg327 attach_rc = rc328 329 do until lines(samba.!msg) = 0330 attachline = linein(samba.!msg)331 rh = VRMethod( "CN_STATUS", "AddRecord")332 ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, attachline)333 end334 ok = stream(samba.!msg,'c','close')335 336 /* \mountpoint ;workgroup=...;server=...;share=...;user=...;password=...;master=...;mastertype=...;memlen=...;logfile=...;loglevel=...;easupport=...) */337 338 parse var rpc.queryuser.PROFILE_PATH '\\'server'\'pshare'\'puser339 340 pshare = 'netlogon'341 342 /* EVFSCLI MOUNT type mountpoint resource {R|W} [F] */343 say 'evfscli.exe mount SMBFS 'rpc.queryuser.DIR_DRIVE'\ WORKGROUP=;SERVER='server';share='pshare';user='Credentials.!username';password='Credentials.!password' W'344 address cmd 'evfscli.exe mount SMBFS 'rpc.queryuser.DIR_DRIVE'\ WORKGROUP=;SERVER='server';share='pshare';user='Credentials.!username';password='Credentials.!password' W >'samba.!msg345 mount_rc = rc346 do until lines(samba.!msg) = 0347 mountline = linein(samba.!msg)348 rh = VRMethod( "CN_STATUS", "AddRecord")349 ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, mountline)350 end351 ok = stream(samba.!msg,'c','close')352 353 rh = VRMethod( "CN_STATUS", "AddRecord")354 ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, "Start logon script")355 356 ok = Value('OS','ECS','OS2ENVIRONMENT')357 ok = Value("SERVER",Server,"OS2ENVIRONMENT")358 ok = Value("USER",Credentials.!Username,"OS2ENVIRONMENT")359 ok = Value("PASSWORD",Credentials.!password,"OS2ENVIRONMENT")360 361 address cmd rpc.queryuser.DIR_DRIVE'\'rpc.queryuser.LOGON_SCRIPT' >'samba.!msg362 363 do until lines(samba.!msg) = 0364 mountline = linein(samba.!msg)365 rh = VRMethod( "CN_STATUS", "AddRecord")366 ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, mountline)367 end368 ok = stream(samba.!msg,'c','close')369 370 rh = VRMethod( "CN_STATUS", "AddRecord")371 ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, "Logon script done.")372 373 say 'evfscli.exe detach 'rpc.queryuser.DIR_DRIVE374 address cmd 'evfscli.exe detach 'rpc.queryuser.DIR_DRIVE' >'samba.!msg375 do until lines(samba.!msg) = 0376 mountline = linein(samba.!msg)377 rh = VRMethod( "CN_STATUS", "AddRecord")378 ok = VRMethod( "CN_STATUS", "SetFieldData", rh, Status.MessageFH, mountline)379 end380 /* remove server and password from environment */381 ok = Value("SERVER","","OS2ENVIRONMENT")382 ok = value("PASSWORD","","OS2ENVIRONMENT")383 ok = stream(samba.!msg,'c','close')384 505 return 385 506 … … 449 570 SW_LOGIN_Create: 450 571 call SW_LOGIN_Init 451 /* CALL NLVSetText 'DT_USER1', 'Caption', 25 452 CALL NLVSetText 'DT_PASSWORD1', 'Caption', 26572 CALL NLVSetText 'DT_USER1', 'Caption', 32 573 CALL NLVSetText 'DT_PASSWORD1', 'Caption', 33 453 574 CALL NLVSetText 'PB_LOGIN_OK', 'Caption', 2 454 CALL NLVSetText 'PB_LOGIN_CANCEL','Caption', 3 */575 CALL NLVSetText 'PB_LOGIN_CANCEL','Caption', 3 455 576 456 577 ok = VRSet("EF_User1","Value", Credentials.!Username) 457 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" ) 458 581 return 459 582
Note: See TracChangeset
for help on using the changeset viewer.