Changeset 1020 for trunk/guitools/sscc


Ignore:
Timestamp:
May 12, 2017, 4:03:38 PM (8 years ago)
Author:
Herwig Bauernfeind
Message:

GUITools: SSCC: Clean up password mess

Location:
trunk/guitools/sscc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/guitools/sscc/sscc.vrp

    r1019 r1020  
    44MacroPath: VRM:U:\Develop\Samba\trunk\guitools\sscc
    55EXEPath:
    6 RunParameters:
     6RunParameters: /install
    77RunDirectory: U:\Develop\Samba\trunk\guitools\sscc
    88VRXWindow: __VREMainWindow,1,2867,4577,5767,8000
    9 VRXWindow: __VRESectionListWindow,1,3156,14791,10431,4686
     9VRXWindow: __VRESectionListWindow,1,1482,13924,10431,4686
    1010VRXWindow: __VREToolsWindow,0,4011,10744,6992,1669
    1111VRXWindow: __VREWindListWindow,1,2072,13539,4710,3150
  • trunk/guitools/sscc/sscc.vrx

    r1019 r1020  
    9595#append ..\shared\inittempdir.vrs
    9696#append ..\shared\sambainit.vrs
     97#append ..\shared\masterpasswd.vrs
    9798*/
    9899return
     
    525526return
    526527
    527 /*:VRX         _MasterPasswdCreate
    528 */
    529 _MasterPasswdCreate:
    530     call lineout samba.!masterpasswd, '# Created by 'VRParseFileName(OurINI,'N')' Ver. 'word(VRGet("Main","Hinttext"),2)
    531     call lineout samba.!masterpasswd, '# syntax:'
    532     call lineout samba.!masterpasswd, '# username:passwd:UID:GID:login-class:chg pw x sec:deact x sec:GECOS:home:shell'
    533     call lineout samba.!masterpasswd, 'root:*:0:512::0:0:root:/nonexistent:/usr/sbin/nologin'
    534     call lineout samba.!masterpasswd, 'guest:*:65534:65534::0:0:guest:/nonexistent:/usr/sbin/nologin'
    535     ok = stream(samba.!masterpasswd,'c','close')
    536 return
    537 
    538 /*:VRX         _MasterPasswdFindUser
    539 */
    540 _MasterPasswdFindUser: procedure expose username.
    541     IF options.!debug == 1 THEN say '_MasterpasswdFindUser("'arg(1)'") started'
    542     FindUser = arg(1)
    543     Idx = 0
    544     do I = 1 to username.0
    545         if translate(username.I) = translate(FindUser) then do
    546             Idx = I
    547             leave
    548         end
    549     end
    550     IF options.!debug == 1 THEN say '_MasterpasswdFindUser("'FindUser'") done, returning 'Idx
    551 return idx
    552 /*:VRX         _MasterPasswdRead
    553 */
    554 _MasterPasswdRead:
    555     IF options.!debug == 1 THEN say '_MasterpasswdRead() started'
    556     /* Read complete master.passwd */
    557     I = 0
    558 
    559     do until lines(samba.!masterpasswd) = 0
    560         userline = strip(linein(samba.!masterpasswd))
    561    
    562         /* Skip comments */
    563         if left(userline,1) = "#" then iterate
    564         if left(userline,1) = ";" then iterate 
    565 
    566         /* parse fields into stem variables */
    567         I = I + 1
    568         parse var userline username.I':'password.I':'uid.I':'gid.I':'LoginClass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
    569 
    570         Status.I =""   
    571         do J = 1 to I - 1
    572             if translate(Username.J) = translate(Username.I) then do
    573                 status.I = "DUPLICATE"
    574                 leave
    575             end
    576         end
    577     end
    578     ok = stream(samba.!masterpasswd,'c','close')
    579     drop userline
    580 
    581     /* set "stem roots" properly */
    582     username.0  = I
    583     password.0  = I
    584     uid.0       = I
    585     gid.0       = I
    586     loginclass.0= I
    587     pwchange.0  = I
    588     deact.0     = I
    589     gecos.0     = I
    590     home.0      = I
    591     shell.0     = I
    592 
    593     /* also smbpasswd stems */
    594     lmhash. = ''
    595     nthash. = ''
    596     flags.  = ''
    597     lct.    = ''
    598     lmhash.0 = I
    599     nthash.0 = I
    600     flags.0  = I
    601     lct.0    = I
    602 
    603     /* smbusermap stem */
    604     MapTo. = ''
    605     MapTo.0 = I
    606 
    607     /* our private stem */
    608     status.0 = I
    609     IF options.!debug == 1 THEN say '_MasterpasswdRead() done, read 'username.0' users'
    610 return
    611 
    612 /*:VRX         _MasterPasswdWrite
    613 */
    614 _MasterpasswdWrite:
    615     IF options.!debug == 1 THEN say "_MasterpasswdWrite() started"
    616     newmasterpasswd = TempDir'master.passwd'
    617 
    618     ok = SysFileDelete(newmasterpasswd)
    619 
    620     call lineout newmasterpasswd, '# Created by 'VRParseFileName(OurINI,'N')' Ver. 'word(VRGet("Main","Hinttext"),2)
    621     call lineout newmasterpasswd, '# syntax:'
    622     call lineout newmasterpasswd, '# username:passwd:UID:GID:login-class:chg pw x sec:deact x sec:GECOS:home:shell'
    623 
    624     do I = 1 to username.0
    625         select
    626             when Status.I = "DUPLICATE" & settings.!FixErrors = 1 then iterate
    627             when Status.I = "UID MISMATCH" then do
    628                 call lineout newmasterpasswd, username.I':'password.I':'word(uid.I,1)':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
    629             end
    630             when Status.I = "UNIX MISSING" & settings.!FixErrors then do
    631                 call lineout newmasterpasswd, username.I':'password.I':'uid.I':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
    632             end
    633             otherwise call lineout newmasterpasswd, username.I':'password.I':'uid.I':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
    634         end
    635     end
    636     ok = stream(newmasterpasswd,'c','close')
    637     ok = VRCopyFile( samba.!masterpasswd, samba.!masterpasswd'.bak' )
    638     ok = VRCopyFile( newmasterpasswd, samba.!masterpasswd )
    639     ok = SysFileDelete(newmasterpasswd)
    640     IF options.!debug == 1 THEN say "_MasterpasswdWrite() done"
    641 return
    642 
    643528/*:VRX         _MsgYesNo
    644529*/
     
    660545/*:VRX         _MyIniEnum
    661546*/
    662 _MyIniEnum: procedure expose sections. Voc. Val.
     547_MyIniEnum: procedure expose sections. Voc. Val. options.
     548    call _debugLog "_MyIniEnum() started."
    663549    CurSection = arg(1)
    664550    do I = 1 to sections.0
     
    676562        end
    677563    end
     564    call _debugLog "_MyIniEnum() done."
    678565return
    679566
    680567/*:VRX         _MyIniEnumSections
    681568*/
    682 _MyIniEnumSections: procedure expose sections.
    683     say '_MyIniEnumSections() started'
     569_MyIniEnumSections: procedure expose sections. options.
     570    call _DebugLog '_MyIniEnumSections() started'
    684571    smbconf = arg(1)
    685572    sections. = ""
     
    714601    sections.I.0 = J
    715602    ok = stream(smbconf,'c','close')
    716     say '_MyIniEnumSections() done.'
     603    call _DebugLog '_MyIniEnumSections() done.'
    717604return
    718605
     
    896783/*:VRX         _SambaRootPWCheck
    897784*/
    898 _SambaRootPWCheck:
     785_SambaRootPWCheck:
     786    call _debugLog "_SambaRootPWCheck() started "
    899787    if VRGet("EF_RootPassword","Value") ="" then do
    900788        Msg.type  = "E"
    901789        Msg.Text  = NLVGetMessage(57, "root")
    902790        call _ShowMsg
     791        call _debugLog "_SambaRootPWCheck() done, RC = 0 "
    903792        return 0
    904793    end
     
    907796        Msg.Text  = NLVGetMessage(58,"root")
    908797        call _ShowMsg
     798        call _debugLog "_SambaRootPWCheck() done, RC = 0 "
    909799        return 0
    910800    end
     
    914804        Msg.Text  = NLVGetMessage(59, "root")
    915805        call _ShowMsg
     806        call _debugLog "_SambaRootPWCheck() done, RC = 0 "
    916807        return 0
    917808    end
     809    call _debugLog "_SambaRootPWCheck() done, RC = 1 "
    918810return 1
    919811
     
    921813*/
    922814_SambaRootPWSet:
    923     IF options.!debug == 1 THEN say "_SambaRootPWSet() started"
    924 
     815    call _DebugLog "_SambaRootPWSet() started"
    925816    /* Write root password to a temp file */
    926817    pwdfile = TempDir'newpwd'
     
    928819    call lineout pwdfile, VRGet("EF_RootPassword","value")
    929820    ok = stream(pwdfile,"c","close")
    930 
    931821    /* update Master.passwd and (s)pwd.db */
    932822    call _MasterPasswdRead
    933823    nx = _MasterPasswdFindUser("root")
    934 
    935824    call rxFuncAdd "Crypt", "RxCrypt", "RxCrypt"
    936 
    937825    itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    938826    salt   = ""
     
    956844    /* Remove the temp password file */
    957845    ok = SysFileDelete(pwdfile)
    958 
    959 
    960846
    961847    /* Deal with swat */
     
    973859        else call _SambaShowMsg */
    974860    end
    975     IF options.!debug == 1 THEN say "_SambaRootPWSet() done"
     861    call _DebugLog THEN say "_SambaRootPWSet() done"
    976862return
    977863/*:VRX         _SambaShowError
     
    14421328*/
    14431329_SmbConfDefault_ShareDrives:
     1330    call _debugLog "_SmbConfDefault_ShareDrives() started."
    14441331    DriveList = SysDriveMap('C:','Local')
    14451332
    14461333    do I = 1 to words(DriveList)
    14471334        CurDrive = word(DriveList,I)
    1448 say CurDrive
     1335        say "  CurDrive="Curdrive
    14491336        Filesys = SysFilesystemType(Curdrive)
    14501337        DriveInfo=SysDriveInfo(CurDrive)
     
    14741361    end
    14751362    ok = stream(smbconf, 'c','close') 
     1363    call _debugLog "_SmbConfDefault_ShareDrives() done."
    14761364return
    14771365
     
    30312919*/
    30322920PB_Install_Default_Click:
     2921    ok = VRREdirectStdIO("ON")
    30332922    if VRGet("EF_Workgroup_Initial","Value") = "" then return
    30342923
     
    30482937        call _SambaRootPWSet
    30492938    end
     2939
    30502940    call _SambaGuestCreate
    30512941
Note: See TracChangeset for help on using the changeset viewer.