Changeset 660


Ignore:
Timestamp:
Nov 10, 2011, 9:32:23 AM (14 years ago)
Author:
Herwig Bauernfeind
Message:

GUI-Tools: EVFSGUI 2.5.x: Support WINS, store credentials

Location:
trunk/guitools
Files:
1 added
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/guitools/evfsgui/changes

    r653 r660  
    44- Support server based logon scripts (requires REXX rpc library,
    55  partly done) (works in a separate utility right now)
    6 - TDB auch bei 3.5 CLUT kaputt
    76- eigenes Icon fr ADMIN$
    87- _AddSharesDisplay verwendet kein file2stem
     8- session user/password
    99
    1010Known problems:
     
    1616 
    1717Version 2.5.x 2011-??-??
    18 + Added: Create/maintain LMHosts automagically (speeds up connecting!!!)
     18+ Added: Optionally store credentials in memory until next reboot
     19+ Added: Properly verify all manually entered IP addresses
     20+ Added: Connection speedup: Allow configuration of name resolve order
     21+ Added: Connection speedup: Allow configuration of WINS server
     22+ Added: Connection speedup: Optionally create/maintain LMHosts automagically
    1923+ Added: Enhanced, faster browsing code (major code refactoring)
    2024+ Added: Allow refreshing a single machine in the network neighbourhood
  • trunk/guitools/evfsgui/evfsgui.vrp

    r652 r660  
    1010VRXWindow: __VREMainWindow,1,1951,2361,891,7841
    1111VRXWindow: __VREFileListWindow,1,2987,5155,2665,3358
    12 VRXWindow: __VRESectionListWindow,1,3830,10841,8082,3324
     12VRXWindow: __VRESectionListWindow,1,3903,10744,8082,4505
    1313VRXWindow: __VREToolsWindow,0,2987,8528,6486,1669
    14 VRXWindow: __VREWindListWindow,1,1168,10841,2650,3150
     14VRXWindow: __VREWindListWindow,1,193,10841,3686,3150
    1515UserFile: 1
    1616UserWindow: Main,1
    1717UserWindow: SW_LOGIN,1
     18UserWindow: SW_SETTINGS,1
     19UserWindow: SW_SMBTREE,1
     20UserWindow: SW_DIALOG,1
  • trunk/guitools/evfsgui/evfsgui.vrx

    r652 r660  
    9797#append U:\Develop\Samba\trunk\guitools\shared\smbtree.vrs
    9898#append U:\Develop\Samba\trunk\guitools\shared\textini.vrs
     99#append U:\Develop\Samba\trunk\guitools\shared\usercredmem.vrs
    99100*/
    100101return
     
    782783    if \VRFileExists( samba.!smbconf ) then call _CreateSmbConf
    783784
     785    say _ucInitObj()
     786
     787    options.!storecreds = _ucChkObj()
     788
    784789    IF STREAM( settings.!ini, 'C', 'QUERY EXISTS') == '' THEN DO
    785790        /* First start */
     
    919924    end
    920925
     926    /* Look for usable credentials */
     927    if options.!storecreds = 1 & _ucChkUc() then do
     928        UserCred = _ucGetUc()
     929        parse var UserCred '--user='Credentials.!username'%'Credentials.!password
     930        ok = VRSet("EF_USER",    "Value",Credentials.!username)
     931        ok = VRSet("EF_PASSWORD","Value",Credentials.!password)
     932    end
     933
    921934    /* SambaInit.VRS needs these 2 */
    922935    ShowHidden = advanced.!special
     
    9911004    IF options.!debug == 1 THEN SAY time()' '||"SaveSettings done"
    9921005RETURN
     1006
     1007/*:VRX         _isValidIPAddress
     1008*/
     1009_isValidIPAddress: procedure
     1010   ipaddr = arg(1)
     1011   d. = ''
     1012   d.0 = 4
     1013   fail = 0
     1014   parse var ipaddr d.1 '.' d.2 '.' d.3 '.' d.4
     1015   do I = 1 to 4
     1016       if datatype(d.I) = 'NUM' then do
     1017           if d.I < 0 | d.I > 255 then fail = 1
     1018       end
     1019       else fail = 1
     1020       if fail = 1 then leave
     1021   end
     1022return(\fail)
    9931023
    9941024/*:VRX         _LMHostsRead
     
    10641094*/
    10651095_LoadOtherFuncs:
    1066     CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
    1067     CALL SysLoadFuncs
     1096    call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
     1097    call SysLoadFuncs
     1098
     1099    call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
     1100    call IniLoadFuncs
    10681101
    10691102    call RxFuncAdd 'PRLoadFuncs',  'PR1UTIL', 'PRLoadFuncs'
    10701103    call PRLoadFuncs
     1104
     1105    call RxFuncAdd 'RxuInit','Rxu','RxuInit'
     1106    call RxuInit
    10711107return
    10721108
     
    13171353return
    13181354
     1355/*:VRX         _SmbConfCreateShadowCopy
     1356*/
     1357_SmbConfCreateShadowCopy:
     1358    /* we create a complete version of smb.conf in temporary directory for reading purposes */
     1359    /* as we can only determine a default value from this complete version of the file */
     1360    /* however it is not desirable to always have a complete copy normally */
     1361    ok = SysFileDelete(samba.!shadowsmbconf)
     1362    say         samba.!testparmexe' -v -s 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
     1363    address cmd samba.!testparmexe' -v -s 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
     1364return
     1365
    13191366/*:VRX         _SMBpdrInstalled
    13201367*/
     
    13501397    options.!editmode   = 0
    13511398    options.!delay      = 0
     1399    options.!storecreds = 0
    13521400
    13531401    IF options.!debug == 1 THEN SAY '  initializing vfs. '
     
    13681416    advanced.!cachetimeout  = '10'
    13691417    advanced.!cachelistings = '32'
     1418
     1419    advanced.!smbconfchanged = 0
    13701420
    13711421    /* Obsolete */
     
    14701520        then UserCred = '--user='Credentials.!username'%'Credentials.!password
    14711521        else UserCred = '--user='Credentials.!username'%%'Credentials.!password
     1522
     1523    if options.!storecreds = 1 & \(UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' | UserCred = '-N') then do
     1524        ok = _ucSetUc()
     1525        call beep 2400, 10
     1526    end
     1527    else call beep 200, 20
    14721528return
    14731529
     
    16281684        CALL VRSet 'MENU_CONTEXT_DETACH',     'Visible', 1
    16291685        CALL VRSet 'MENU_CONTEXT_OPEN',       'Visible', 1
    1630         CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 1
     1686/*      CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 1 */
    16311687        CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
    1632         CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 1
     1688/*      CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 1 */
    16331689       
    16341690    END
     
    16371693        CALL VRSet 'MENU_CONTEXT_DETACH',     'Visible', 0
    16381694        CALL VRSet 'MENU_CONTEXT_OPEN',       'Visible', 0
    1639         CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 0
     1695/*      CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 0 */
    16401696        CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
    1641         CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 0
    1642        
     1697/*      CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 0 */
    16431698    END
    16441699   
     
    21292184*/
    21302185EF_PASSWORD_Change:
     2186    Now = VRGet("EF_PASSWORD","value")
     2187    if Now = "" | Now = LastPassword then return
     2188    ok = SysSleep(1)
     2189    LastPassword = Now
     2190    if Now <> VRGet("EF_PASSWORD","value") then return
    21312191    call _UserCredUpdate
    21322192return
     
    21452205
    21462206    /* Do nothing for incomplete IP addresses */
    2147     if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" & length(VRGet("EF_SERVER","value")) < 7 then return
     2207    if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" then do /* got an IP address */
     2208        if \_IsValidIPAddress(VRGet("EF_SERVER","value")) then return /* it is invalid or incomplete */
     2209    end
    21482210
    21492211    machine = VRGet("EF_SERVER","value")   
     
    21982260*/
    21992261EF_USER_Change:
     2262    Now = VRGet("EF_USER","value")
     2263    if Now = "" | Now = LastUser then return
     2264    ok = SysSleep(1)
     2265    LastUser = Now
     2266    if Now <> VRGet("EF_USER","value") then return
    22002267    call _UserCredUpdate
     2268return
     2269
     2270/*:VRX         EF_WINS_SERVER_Change
     2271*/
     2272EF_WINS_SERVER_Change:
     2273    advanced.!smbconfchanged = 1
    22012274return
    22022275
     
    24072480    options.!debug    = 1
    24082481    IF options.!debug == 1 THEN do
    2409         ok = VRREdirectStdIO("ON")
     2482        ok = VRRedirectStdIO("ON")
    24102483        say time()' Main_Create started'
    24112484    end
    2412     else ok = VRREdirectStdIO("OFF")
     2485    else ok = VRRedirectStdIO("OFF")
    24132486
    24142487    call _LoadOtherFuncs
     
    30483121*/
    30493122Menu_Help_Extended_Click:
    3050     call PB_HELP_Click
     3123    ok = VRMethod( "Main", "InvokeHelp" )
    30513124return
    30523125
     
    30613134Menu_Selected_Default_Workgroup_Click:
    30623135    workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
     3136    /* FIXME: switch over to REXXIni calls */
    30633137    ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
    30643138return
     
    36363710    ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
    36373711    ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
     3712    options.!storecreds = VRGet("CB_STORECREDS1","Set")
    36383713    credentials.!entered = 1
    36393714
     
    38313906
    38323907    /* Note: CB_LOGGING has its own event tied to the click */
    3833 
     3908    options.!storecreds   = VRGet("CB_STORECREDS", "Set" )
    38343909    options.!debug        = VRGet("CB_DEBUG",      "Set" )
    38353910
     
    38673942        call _LMHostsUpdate
    38683943    end
     3944    if advanced.!smbconfchanged = 1 then do
     3945        name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
     3946        handle = IniOpen('global', samba.!smbconf)
     3947        call IniSet 'name resolve order', name_resolve_order, handle
     3948        /* FIXME: Throw an error in this case */
     3949        if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
     3950        call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
     3951        call IniSave handle
     3952        call IniClose handle
     3953        advanced.!smbconfchanged = 0
     3954        ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
     3955    end
    38693956return
    38703957
     
    40054092/*:VRX         PB_SMBTREE_REFRESH_Click
    40064093*/
    4007 PB_SMBTREE_REFRESH_Click: PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir
     4094PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
    40084095    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click started"
    40094096
     
    40964183
    40974184    ok = VRSet("MENU_CONTEXT_OPEN",    "Visible",  0)
    4098     ok = VRSet("MENU_CONTEXT_SEP1",    "Visible",  0)
     4185/*  ok = VRSet("MENU_CONTEXT_SEP1",    "Visible",  0) */
    40994186    ok = VRSet("MENU_CONTEXT_DETACH",  "Visible",  0)
    41004187    ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible",  0)
     
    41264213    IF options.!debug == 1 THEN SAY time()' '||"Refresh done"
    41274214RETURN 0
     4215
     4216/*:VRX         SPIN_NRO1_Change
     4217*/
     4218SPIN_NRO1_Change:
     4219    advanced.!smbconfchanged = 1
     4220return
     4221
     4222/*:VRX         SPIN_NRO2_Change
     4223*/
     4224SPIN_NRO2_Change:
     4225    advanced.!smbconfchanged = 1
     4226return
     4227
     4228/*:VRX         SPIN_NRO3_Change
     4229*/
     4230SPIN_NRO3_Change:
     4231    advanced.!smbconfchanged = 1
     4232return
     4233
     4234/*:VRX         SPIN_NRO4_Change
     4235*/
     4236SPIN_NRO4_Change:
     4237    advanced.!smbconfchanged = 1
     4238return
    41284239
    41294240/*:VRX         SPLIT_Main_Move
     
    43854496*/
    43864497SW_LOGIN_Create:
    4387     call SW_LOGIN_Init
    4388     CALL NLVSetText 'DT_USER1',      "Caption", 25
    4389     CALL NLVSetText 'DT_PASSWORD1',  "Caption", 26
     4498    call SW_LOGIN_Init
     4499    CALL NLVSetText 'DT_USER1',       "Caption", 25
     4500    CALL NLVSetText 'DT_PASSWORD1',   "Caption", 26
     4501    CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
    43904502    CALL NLVSetText 'PB_LOGIN_OK',    "Caption", 2
    43914503    CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
     4504
    43924505    /* ok = VRSet("Pict_Login","PicturePath", SMBObj.icon) */
    43934506    ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
    43944507    ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
     4508    ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
    43954509return
    43964510
     
    46094723    call NLVSetText "CB_BROADCAST",      "Caption", 74
    46104724    call NLVSetText "CB_MINIICONS",      "Caption", 70
     4725    call NLVSetText "CB_STORECREDS",     "Caption", 135
    46114726
    46124727    /* Buttons */
     
    46254740*/
    46264741SW_SETTINGS_Init_Content:
     4742    ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
     4743
    46274744    if advanced.!browseauth  \= ""  then ok = VRSet("CB_BROWSEAUTH", "Set",   advanced.!browseauth)
    46284745    if advanced.!browseimme  \= ""  then ok = VRSet("CB_BROWSEIMME", "Set",   advanced.!browseimme)
     
    46344751    call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
    46354752    if options.!debug        \= ""  then ok = VRSet("CB_debug",      "Set",   options.!debug)
     4753    if options.!storecreds   \= ""  then ok = VRSet("CB_STORECREDS", "Set",   options.!storecreds)
    46364754
    46374755    if advanced.!miniicons   \= ""  then ok = VRSet("CB_MINIICONS",  "Set",   advanced.!miniicons)
     
    46404758    if advanced.!logfile     \= ""  then ok = VRSet("EF_LOGFILE",    "Value", advanced.!logfile)
    46414759    if advanced.!loglevel    \= "0" then ok = VRSet("SPIN_LOGLEVEL", "Value", advanced.!loglevel)
     4760
     4761    call _SmbConfCreateShadowCopy
     4762
     4763    wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
     4764
     4765    if wins_support = "YES" then do /* we are a WINS server ourself */
     4766        ok = VRSet("DT_WINS_SERVER","Enabled", 0)
     4767        ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
     4768        ok = VRSet("EF_WINS_SERVER","Value", "")
     4769        ok = VRSet("EF_WINS_SERVER","Enabled", 0)
     4770    end
     4771    else do
     4772        ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
     4773    end
     4774
     4775    name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
     4776
     4777    do I = 1 to words(name_resolve_order)
     4778        ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
     4779    end
     4780
     4781    advanced.!smbconfchanged = 0   
    46424782return
    46434783
  • trunk/guitools/evfsgui/rc/lang/evfsi_de.mkm

    r653 r660  
    144144EVG0133I: LMHosts verwalten
    145145EVG0134I: TRAC Wiki Notation anfgen
     146EVG0135I: Anmeldeinformationen speichern
  • trunk/guitools/evfsgui/rc/lang/evfsi_en.mkm

    r653 r660  
    144144EVG0133I: Manage LMHosts
    145145EVG0134I: Add TRAC Wiki markup
     146EVG0135I: Store credentials until next reboot
  • trunk/guitools/evfsgui/rc/lang/evfsi_fr.mkm

    r653 r660  
    150150EVG0133I: G‚rer le fichier LMHosts
    151151EVG0134I: Ajouter TRAC Wiki balisage
     152EVG0135I: R‚f‚rences magasin jusqu'au prochain red‚marrage
  • trunk/guitools/evfsgui/rc/lang/evfsi_it.mkm

    r653 r660  
    148148EVG0133I: Gestire il file LMHosts
    149149EVG0134I: Aggiungi TRAC Wiki markup
     150EVG0135I: Credenziali di memorizzare fino al riavvio successivo
  • trunk/guitools/shared/cltinit.vrs

    r638 r660  
    124124    IF options.!debug == 1 THEN say '  Samba smb.conf = "'samba.!smbconf'"'
    125125
     126    /* complete shadow copy of smb.conf in temporary directory - should always be created on the fly */
     127    /* before reading from it */
     128    samba.!shadowsmbconf = TempDir||'smb.conf'
     129
     130    /* lmhosts */
     131    samba.!lmhosts = ETC'\samba\lmhosts'
     132    if \VRFileExists(samba.!lmhosts) then call _ErrorDataFileNotFound samba.!lmhosts' is not present.'
     133    IF options.!debug == 1 THEN say '  Samba lmhosts  = "'samba.!lmhosts'"'
     134
     135    /* FIXME: Needs to be changed for Samba 3.3+ */
    126136    /* upcase table files - several utilities need these */
    127137    if (\VRFileExists(samba.!bin'\lib\upcase.dat')) |,
  • trunk/guitools/shared/smbtree.vrs

    r643 r660  
    172172        ok = VRSet("TM_RefreshTreeDisplay","Delay", 1000)
    173173        ok = VRSet("CN_smbtree","Enabled", 1)
     174        if DoLMHosts = 1 then do
     175            call _LMHostsRead
     176            call _LMHostsUpdate
     177        end
    174178        ok = VRSet("CN_smbtree", "Painting", 0 )
    175179        ok = VRSet("CN_smbtree", "Painting", 1 )
     
    510514return IPStr'|'MAC'|'Roles
    511515
     516
     517
    512518/*:VRX         file2stem
    513519*/
     
    515521    msgfile = arg(1)
    516522    msgstem = arg(2)
     523    delmsgfile = translate(arg(3))
    517524    if right(msgstem,1) <> '.' then msgstem = msgstem'.'
    518525    say '  file2stem("'msgfile'","'msgstem'")'
     
    533540    interpret dyn
    534541    ok = stream(msgfile,'c','close')
    535     ok = SysFileDelete(msgfile)
     542    if delMsgFile <> "NODEL" then ok = SysFileDelete(msgfile)
    536543    drop msgfile msgstem
    537544return stemcount
Note: See TracChangeset for help on using the changeset viewer.