Changeset 566 for branches/guitools-2.0/shared/smbtree.vrs
- Timestamp:
- Mar 6, 2011, 11:48:47 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/guitools-2.0/shared/smbtree.vrs
r558 r566 232 232 stat = stream(smbmachine.I,'c','open read') 233 233 if stat = "READY:" then do /* we found a readable output file */ 234 OneWorkGroupOnly = 0 234 235 /* Machine = VRParseFilename(smbmachine.I,'E') */ 235 236 Machine = substr(smbmachine.I,pos('.',smbmachine.I)+1) … … 303 304 end 304 305 line = linein(smbmachine.I) 305 /* Reading workgroup and master - eventually both empty */306 /* Reading FIRST workgroup and master - eventually both empty */ 306 307 line = linein(smbmachine.I) 308 309 /* Multiple workgroups? */ 310 if lines(smbmachine.I) = 0 then OneWorkGroupOnly = 1 311 else OneWorkGroupOnly = 0 312 say " OneWorkGroupOnly = "OneWorkGroupOnly 313 307 314 parse var line '09'x workgroup master 308 315 master = strip(master) 309 316 310 /* we use this to set the workgroup for manually added servers */311 if workgroup <> "" then do317 /* we use this to set the workgroup for manually added servers - if there is ONLY ONE workgroup */ 318 if workgroup <> "" & OneWorkGroupOnly = 1 then do 312 319 wgh = _GetMachinehandle(workgroup) 313 if wgh = "" then do /* This machine appears to be in a new workgroup - add it as well */ 320 if wgh = "" then do /* The machine appears to be in a new workgroup - add it as well */ 321 /* NOTE: This should be obsolete now because the list of available 322 workgroups should always have been updated before we get here */ 314 323 wgh = VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL") 315 324 ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup) … … 319 328 end 320 329 /* we only do this for machines with empty parent (=workgroup) handle */ 321 /* this might not be good enough yet - verifictaion required */ 330 /* IF there is only one workgroup */ 331 if wgh <> "" & VRMethod('CN_smbtree', 'GetRecordAttr', smbtree.!machine, 'Parent') = "" then do 332 ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Parent', wgh) 333 end 334 end 335 else do /* There are multiple workgroups, we need additional */ 336 /* measures tofind out which is our workgroup */ 337 say ' 'samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL' 338 address cmd samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL' 339 infoline = linein(samba.!msg) 340 if word(infoline,1) = "creating" then do /* upcase tables are missing */ 341 say "Missing upcase tables detected!" 342 infoline = linein(samba.!msg) 343 infoline = linein(samba.!msg) 344 end 345 IF options.!debug == 1 THEN say ' Response = "'Infoline'"' 346 ok = stream(samba.!msg,'c','close') 347 ok = SysFileDelete(samba.!msg) 348 349 parse var infoline "Domain=["WorkGroup"] "Rest 350 wgh = _GetMachinehandle(workgroup) 322 351 if wgh <> "" & VRMethod('CN_smbtree', 'GetRecordAttr', smbtree.!machine, 'Parent') = "" then do 323 352 ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Parent', wgh) … … 360 389 if match = 0 then rh.I = "" /* return an empty handle, if there was no match */ 361 390 return rh.I 391 392 /*:VRX _RefreshWorkgroups 393 */ 394 _RefreshWorkgroups: 395 say time()' _RefreshWorkgroups() started' 396 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N' 397 if BroadCast = 1 then BroadCast = '-b'; else BroadCast = '' 398 399 say samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg 400 address cmd samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg 401 402 if BroadCast = '-b' then BroadCast = 1; else BroadCast = 0 403 if UserCred = '-N' then UserCred = '' 404 405 drop wgline. 406 407 sl = 0 408 409 do until lines(samba.!msg) = 0 410 sl = sl + 1 411 wgline.sl = linein(samba.!msg) 412 end 413 wgline.0 = sl 414 ok = stream(samba.!msg,'c','close') 415 ok = SysFileDelete(samba.!msg) 416 417 do sl = 1 to wgline.0 418 if pos("RECEIVING",translate(wgline.sl)) > 0 | pos("TDB(",translate(wgline.sl)) > 0 then do 419 iterate /* We ignore errors here */ 420 end 421 workgroup = wgline.sl 422 wgh = _GetMachinehandle(workgroup) 423 if wgh = "" then do /* A new workgroup was found -- add it */ 424 wgh = VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL") 425 ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup) 426 ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "Collapsed", 0) 427 ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1) 428 ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|") 429 end 430 end 431 say time()' _RefreshWorkgroups() done' 432 return 433
Note:
See TracChangeset
for help on using the changeset viewer.