Changeset 859


Ignore:
Timestamp:
Apr 18, 2014, 9:26:53 AM (11 years ago)
Author:
Herwig Bauernfeind
Message:

SSCC 1.1.0: Fixed #234 and updated GUI

Location:
branches/guitools-1.0/install
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/guitools-1.0/install/readme.sscc

    r577 r859  
    1 SSCC Simple Samba Configuration Center Version 1.0.1
     1SSCC Simple Samba Configuration Center Version 1.0.2
    22====================================================
    33
     
    4444  loss of all comments (and all errors in smb.conf, which is not that bad
    4545  after all)
     46 
     47NOTE: Versions prior to 1.0.2 trash the smb.conf of a Samba Server 3.3.x!
    4648
    4749Author:
  • branches/guitools-1.0/install/sscc.RC

    r333 r859  
    66bitmap 7 up.bmp
    77bitmap 8 down.bmp
    8 bitmap 9 netlabs.bmp
     8bitmap 9 bww.bmp
  • branches/guitools-1.0/install/sscc.vrp

    r580 r859  
    11VX-REXX OS/2 V2.14 Build B3
    22VRX: sscc.VRX
     3VXOFile: VROBJEX
    34MacroPath: VRM:U:\Develop\Samba\guitools-1.0\install
    45EXEPath:
    5 RunParameters: /Install
    6 RunDirectory: E:\Dev\REXX\VXREXX\Projects\Samba\install
    7 VRXWindow: __VREMainWindow,1,1987,5059,891,7263
    8 VRXWindow: __VRESectionListWindow,1,3071,10551,8974,4890
    9 VRXWindow: __VREToolsWindow,1,1590,337,6489,1659
    10 VRXWindow: __VREWindListWindow,1,458,12190,2650,3150
     6RunParameters: /install
     7RunDirectory: D:\samba
     8VRXWindow: __VREMainWindow,1,2180,3710,903,8000
     9VRXWindow: __VRESectionListWindow,1,3481,15080,8648,7299
     10VRXWindow: __VREToolsWindow,1,3324,9877,5477,1659
     11VRXWindow: __VREWindListWindow,1,927,11997,3577,3336
    1112UserFile: 1
    1213UserWindow: Main,1
  • branches/guitools-1.0/install/sscc.vrx

    r580 r859  
    475475*/
    476476_LoadOtherFuncs:
    477     if options.!Debug then ok = VRREdirectStdIO("ON")
    478                       else ok = VRREdirectStdIO("OFF")
     477    if options.!Debug = 1
     478        then ok = VRREdirectStdIO("ON")
     479        else ok = VRREdirectStdIO("OFF")
    479480
    480481    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
     
    499500*/
    500501_MasterPasswdCreate:
    501     call lineout samba.!masterpasswd, '# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2)
     502    call lineout samba.!masterpasswd, '# Created by 'VRParseFileName(OurINI,'N')' Ver. 'word(VRGet("Main","Hinttext"),2)
    502503    call lineout samba.!masterpasswd, '# syntax:'
    503504    call lineout samba.!masterpasswd, '# username:passwd:UID:GID:login-class:chg pw x sec:deact x sec:GECOS:home:shell'
    504     call lineout samba.!masterpasswd, 'root:*:0:513::0:0:root:/nonexistent:/usr/sbin/nologin'
     505    call lineout samba.!masterpasswd, 'root:*:0:512::0:0:root:/nonexistent:/usr/sbin/nologin'
    505506    call lineout samba.!masterpasswd, 'guest:*:65534:65534::0:0:guest:/nonexistent:/usr/sbin/nologin'
    506507    ok = stream(samba.!masterpasswd,'c','close')
     508return
     509
     510/*:VRX         _MasterPasswdFindUser
     511*/
     512_MasterPasswdFindUser: procedure expose username.
     513    IF options.!debug == 1 THEN say '_MasterpasswdFindUser("'arg(1)'") started'
     514    FindUser = arg(1)
     515    Idx = 0
     516    do I = 1 to username.0
     517        if translate(username.I) = translate(FindUser) then do
     518            Idx = I
     519            leave
     520        end
     521    end
     522    IF options.!debug == 1 THEN say '_MasterpasswdFindUser("'FindUser'") done, returning 'Idx
     523return idx
     524/*:VRX         _MasterPasswdRead
     525*/
     526_MasterPasswdRead:
     527    IF options.!debug == 1 THEN say '_MasterpasswdRead() started'
     528    /* Read complete master.passwd */
     529    I = 0
     530
     531    do until lines(samba.!masterpasswd) = 0
     532        userline = strip(linein(samba.!masterpasswd))
     533   
     534        /* Skip comments */
     535        if left(userline,1) = "#" then iterate
     536        if left(userline,1) = ";" then iterate 
     537
     538        /* parse fields into stem variables */
     539        I = I + 1
     540        parse var userline username.I':'password.I':'uid.I':'gid.I':'LoginClass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
     541
     542        Status.I =""   
     543        do J = 1 to I - 1
     544            if translate(Username.J) = translate(Username.I) then do
     545                status.I = "DUPLICATE"
     546                leave
     547            end
     548        end
     549    end
     550    ok = stream(samba.!masterpasswd,'c','close')
     551    drop userline
     552
     553    /* set "stem roots" properly */
     554    username.0  = I
     555    password.0  = I
     556    uid.0       = I
     557    gid.0       = I
     558    loginclass.0= I
     559    pwchange.0  = I
     560    deact.0     = I
     561    gecos.0     = I
     562    home.0      = I
     563    shell.0     = I
     564
     565    /* also smbpasswd stems */
     566    lmhash. = ''
     567    nthash. = ''
     568    flags.  = ''
     569    lct.    = ''
     570    lmhash.0 = I
     571    nthash.0 = I
     572    flags.0  = I
     573    lct.0    = I
     574
     575    /* smbusermap stem */
     576    MapTo. = ''
     577    MapTo.0 = I
     578
     579    /* our private stem */
     580    status.0 = I
     581    IF options.!debug == 1 THEN say '_MasterpasswdRead() done, read 'username.0' users'
     582return
     583
     584/*:VRX         _MasterPasswdWrite
     585*/
     586_MasterpasswdWrite:
     587    IF options.!debug == 1 THEN say "_MasterpasswdWrite() started"
     588    newmasterpasswd = TempDir'master.passwd'
     589
     590    ok = SysFileDelete(newmasterpasswd)
     591
     592    call lineout newmasterpasswd, '# Created by 'VRParseFileName(OurINI,'N')' Ver. 'word(VRGet("Main","Hinttext"),2)
     593    call lineout newmasterpasswd, '# syntax:'
     594    call lineout newmasterpasswd, '# username:passwd:UID:GID:login-class:chg pw x sec:deact x sec:GECOS:home:shell'
     595
     596    do I = 1 to username.0
     597        select
     598            when Status.I = "DUPLICATE" & settings.!FixErrors = 1 then iterate
     599            when Status.I = "UID MISMATCH" then do
     600                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
     601            end
     602            when Status.I = "UNIX MISSING" & settings.!FixErrors then do
     603                call lineout newmasterpasswd, username.I':'password.I':'uid.I':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
     604            end
     605            otherwise call lineout newmasterpasswd, username.I':'password.I':'uid.I':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
     606        end
     607    end
     608    ok = stream(newmasterpasswd,'c','close')
     609    ok = VRCopyFile( samba.!masterpasswd, samba.!masterpasswd'.bak' )
     610    ok = VRCopyFile( newmasterpasswd, samba.!masterpasswd )
     611    ok = SysFileDelete(newmasterpasswd)
     612    IF options.!debug == 1 THEN say "_MasterpasswdWrite() done"
    507613return
    508614
     
    750856*/
    751857_SambaGuestCreate:
    752     say samba.!smbpasswdexe' -a guest -n'
    753     address cmd samba.!smbpasswdexe' -a guest -n -D 0 2>'samba.!error' 1>'samba.!message
    754     smbpasswdrc = rc
    755     if RC = 0 then call _SambaShowMsg
     858    IF options.!debug == 1 THEN say "_SambaGuestCreate() started"
     859    IF options.!debug == 1 THEN say '  'samba.!smbpasswdexe' -a guest -n'
     860    samba.!smbpasswdexe' -a guest -n -D 0 2>'samba.!error' 1>'samba.!message
     861
     862    if rc = 0 then call _SambaShowMsg
    756863              else call _SambaShowError
     864
     865    IF options.!debug == 1 THEN say "_SambaGuestCreate() done"
    757866return
    758867
     
    784893*/
    785894_SambaRootPWSet:
    786 /*  ok VRREdirectStdIO("ON") */
     895    IF options.!debug == 1 THEN say "_SambaRootPWSet() started"
     896
     897    /* Write root password to a temp file */
    787898    pwdfile = TempDir'newpwd'
    788899    call lineout pwdfile, VRGet("EF_RootPassword","value")
    789900    call lineout pwdfile, VRGet("EF_RootPassword","value")
    790901    ok = stream(pwdfile,"c","close")
    791     say samba.!smbpasswdexe' -a root -s <'pwdfile
    792     address cmd samba.!smbpasswdexe' -a root -s -D 0 <'pwdfile' 2>'samba.!error' 1>'samba.!message
    793     smbpasswdrc = rc
    794     if RC = 0 then call _SambaShowMsg
     902
     903    /* update Master.passwd and (s)pwd.db */
     904    call _MasterPasswdRead
     905    nx = _MasterPasswdFindUser("root")
     906
     907    call rxFuncAdd "Crypt", "RxCrypt", "RxCrypt"
     908
     909    itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
     910    salt   = ""
     911    do i = 1 to 8
     912        salt = salt || substr( itoa64, random( 0, 63 ) + 1, 1 )
     913    end
     914    password.nx = Crypt(VRGet("EF_RootPassword","Value"), salt )
     915
     916    /* we need this otherwise _MasterPasswdWrite does not work */
     917    settings.!FixErrors = 1
     918    call _MasterPasswdWrite
     919    call _PasswordDbRewrite
     920
     921    /* Create the root account */
     922    IF options.!debug == 1 THEN say '  'samba.!smbpasswdexe' -a root -s <'pwdfile
     923    samba.!smbpasswdexe' -a root -s -D 0 <'pwdfile' 2>'samba.!error' 1>'samba.!message
     924
     925    if rc = 0 then call _SambaShowMsg
    795926              else call _SambaShowError
    796927
     928    /* Remove the temp password file */
    797929    ok = SysFileDelete(pwdfile)
     930
     931
     932
     933    /* Deal with swat */
     934    /* We could use rxcrypt.dll however htpasswd.exe (at least in theory) is more flexible regarding encryption */
    798935    if swatauth then do
    799936        /* we always remove the old swat */
    800         say '  'samba.!htpasswdexe' -D "'swatusers'" 'Username.CurUserNr
     937        say '  'samba.!htpasswdexe' -D "'swatusers'" root'
    801938        address cmd samba.!htpasswdexe' -D "'swatusers'" root' /* ' 2>'samba.!error' 1>'samba.!msg
    802939        if rc <> 0 then call _SambaShowError; else call _SambaShowMsg  */             
     
    808945        else call _SambaShowMsg */
    809946    end
    810 return
    811 
     947    IF options.!debug == 1 THEN say "_SambaRootPWSet() done"
     948return
    812949/*:VRX         _SambaShowError
    813950*/
     
    817954        I = I + 1
    818955        smberr.I = linein(samba.!error)
     956        say I':err:'smberr.I
    819957    end
    820958    ok = stream(Samba.!error,"c","close")
     
    835973        I = I + 1
    836974        smbmsg.I = linein(samba.!message)
     975        say I':msg:'smbmsg.I
    837976    end
    838977    ok = stream(Samba.!message,"c","close")
     
    9701109return
    9711110
     1111/*:VRX         _Smb35Init
     1112*/
     1113_Smb35Init:
     1114    IF options.!debug == 1 THEN say '_Smb35Init() started'
     1115    say '1 -> 'samba.!smbpasswdexe' -a dummyuser -n -D 10'
     1116    address cmd samba.!smbpasswdexe' -a dummyuser -n -D 10'
     1117    say '2 -> 'samba.!smbpasswdexe' -x dummyuser -D 10'
     1118    address cmd samba.!smbpasswdexe' -x dummyuser -D 10'
     1119    say '3 -> 'samba.!pdbeditexe' --policies-reset -d=3'
     1120    address cmd samba.!pdbeditexe' --policies-reset -d=3'
     1121    say 'X -> ----------------------'
     1122    IF options.!debug == 1 THEN say '_Smb35Init() done'
     1123return
     1124
    9721125/*:VRX         _SmbConfBackup
    9731126*/
     
    9851138        ok = VRCopyFile(smbconf,src)
    9861139    end
    987     'pause'
    988     say src' 'stream(src,'c','query size')
    989     'pause'
    9901140    trg = smbconf
    991     say trg
    9921141    ok = SysFileDelete(smbconf)
    9931142    call lineout trg, '# Samba config file created using SSCC ver. 'word(VRGet("Main","Hinttext"),2)
     
    10981247    end
    10991248
    1100     call lineout smbconf, Indent||'dos charset = IBM-850'
    1101     call lineout smbconf, Indent||'display charset = IBM-850'
    1102     call lineout smbconf, Indent||'unix charset = IBM-850'
     1249    if SysQueryProcessCodePage() = "850" then do
     1250        call lineout smbconf, Indent||'dos charset = IBM-850'
     1251        call lineout smbconf, Indent||'display charset = IBM-850'
     1252        call lineout smbconf, Indent||'unix charset = IBM-850'
     1253    end
     1254    else do
     1255        call lineout smbconf, Indent||'dos charset = IBM-850'
     1256        call lineout smbconf, Indent||'display charset = SYSTEM'
     1257        call lineout smbconf, Indent||'unix charset = SYSTEM'
     1258    end
    11031259
    11041260    CurCP = SysQueryProcessCodePage()
     
    11111267        call lineout smbconf, Indent||'passdb backend = tdbsam'
    11121268    end
     1269    call lineout smbconf, Indent||'log level = 2'
     1270    call lineout smbconf, Indent||'log file = '||ETC||'\samba\log\log.smbd.%U.%M'
    11131271    call lineout smbconf, Indent||'null passwords = Yes'
    11141272    call lineout smbconf, Indent||'guest account = guest'
    11151273    call lineout smbconf, Indent||'security = user'
    1116     call lineout smbconf, Indent||'log level = 2'
    1117     call lineout smbconf, Indent||'log file = '||ETC||'\samba\log\log.smbd.%U.%M'
    11181274    call lineout smbconf, Indent||'load printers = No'
    11191275    call lineout smbconf, Indent||'time server = Yes'
     
    16741830    ok = VRSet("About","Caption", NLVGetMessage(31))
    16751831    ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2))
    1676     SambaTeam.0 = 8
    1677     SambaTeam.1 = 'Paul Smedley'
    1678     SambaTeam.2 = 'Yuri Dario'
    1679     SambaTeam.3 = 'Herwig Bauernfeind'
    1680     SambaTeam.4 = 'Silvan Scherrer'
    1681     SambaTeam.5 = 'Alex Taylor'
    1682     SambaTeam.6 = 'Nikolay Kolosov'
    1683     SambaTeam.7 = 'All the Samba people'
    1684     SambaTeam.8 = 'All the netlabs people'
     1832    SambaTeam.0 = 9
     1833    SambaTeam.1 = 'Silvan Scherrer'
     1834    SambaTeam.2 = 'Herwig Bauernfeind'
     1835    SambaTeam.3 = 'Vitali Pelenyov'
     1836    SambaTeam.4 = 'Paul Smedley'
     1837    SambaTeam.5 = 'Yuri Dario'
     1838    SambaTeam.6 = 'Alex Taylor'
     1839    SambaTeam.7 = 'Nikolay Kolosov'
     1840    SambaTeam.8 = 'All the Samba people'
     1841    SambaTeam.9 = 'All the netlabs people'
    16851842    ok = VRSet("About","Font", VRGet("GB_Help2","Font"))
    16861843    ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
     
    21052262*/
    21062263GB_Global_1_Create:
    2107     call GB_Global_1_Init   
     2264    call GB_Global_1_Init
     2265    SysCP = SysQueryProcessCodePage()
     2266    ok = VRMethod( "EF_unix_charset",    "AddString", "IBM-"SysCP, 2)
     2267    ok = VRMethod( "EF_display_charset", "AddString", "IBM-"SysCP, 2)
     2268    if pos("IBM-"SysCP, VRGet( "EF_dos_charset","InitialList")) = 0 then do
     2269        ok = VRMethod( "EF_dos_charset", "AddString", "IBM-"SysCP, 2)
     2270    end
    21082271return
    21092272
     
    22572420*/
    22582421Main_Create:
    2259     options.!debug = 0
     2422    ok = VRREdirectStdIO("ON")
     2423    options.!debug = 1
    22602424
    22612425    call _LoadOtherFuncs
     
    22882452    ok = VRSet("GB_SmbConfTree","Top",    FWidth)
    22892453    ok = VRSet("GB_SmbConfTree","Left",   FWidth-24)
    2290     ok = VRSet("GB_SmbConfTree","Height", VRGet("Main", "Height") -1350)
     2454    ok = VRSet("GB_SmbConfTree","Height", VRGet("Main", "Height") -1400)
    22912455
    22922456    ok = VRset("GB_SmbConfTree3","Top",     FWidth)
     
    23582522
    23592523    if MButton.bTop < 1300 & MButton.bLeft < 1300 then do
    2360         MButton.bTop = 4842
     2524        MButton.bTop = 4802
    23612525        MButton.bLeft = 3758
    23622526        MButton.bWidth = 1241
     
    23682532    ok = VRSet("PB_Reload", "Width",  MButton.bWidth)
    23692533
    2370     ok = VRSet("PB_Save", "Top",    MButton.bTop)
    2371     ok = VRSet("PB_Save", "Left",   MButton.bLeft+1*FWidth+MButton.bWidth)
     2534    ok = VRSet("PB_Save", "Top",      MButton.bTop)
     2535    ok = VRSet("PB_Save", "Left",     MButton.bLeft+1*FWidth+MButton.bWidth)
    23722536    ok = VRSet("PB_Reload", "Width",  MButton.bWidth)
    23732537
     
    26972861return
    26982862
     2863/*:VRX         PB_1_Click
     2864*/
     2865PB_1_Click:
     2866    ok = VRREdirectStdIO("ON")
     2867    Buttons.1 = NLVGetMessage(2)
     2868    Buttons.2 = NLVGetMessage(3)
     2869    Buttons.0 = 2
     2870    command = 'd:\samba\smbpasswd.exe'
     2871    id = VRPrompt( VRWindow(), "Console", "command", "Console", "Buttons.", buttons.1, buttons.2 )
     2872    if id = 2 then return
     2873    say command
     2874    address cmd command
     2875    /* samba.!netexe' rpc 'command' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg */
     2876    /* if RC <> 0 then call _SambaShowError; else call _SambaShowMsg */
     2877return
     2878
    26992879/*:VRX         PB_AboutOK_Click
    27002880*/
     
    27582938
    27592939    call _SmbConfCreateDefault
     2940    /* call _Smb35Init */
    27602941    ok = SysFileTree(smbconf,exist.,'FO')
    27612942    SmbConfExists = exist.0
    27622943    call _SmbConfBackup
    27632944    call _SmbConfTreeReset
     2945
    27642946    if \VRGet("CB_NoRoot","Set") then do
    27652947        call _SambaRootPWSet
Note: See TracChangeset for help on using the changeset viewer.