| [303] | 1 | /*:VRX         Main
 | 
|---|
 | 2 | */
 | 
|---|
 | 3 | /*  Main
 | 
|---|
 | 4 | */
 | 
|---|
 | 5 | Main:
 | 
|---|
 | 6 | /*  Process the arguments.
 | 
|---|
 | 7 |     Get the parent window.
 | 
|---|
 | 8 | */
 | 
|---|
 | 9 |     parse source . calledAs .
 | 
|---|
 | 10 |     parent = ""
 | 
|---|
 | 11 |     argCount = arg()
 | 
|---|
 | 12 |     argOff = 0
 | 
|---|
 | 13 |     if( calledAs \= "COMMAND" )then do
 | 
|---|
 | 14 |         if argCount >= 1 then do
 | 
|---|
 | 15 |             parent = arg(1)
 | 
|---|
 | 16 |             argCount = argCount - 1
 | 
|---|
 | 17 |             argOff = 1
 | 
|---|
 | 18 |         end
 | 
|---|
 | 19 |     end; else do
 | 
|---|
 | 20 |         call VROptions 'ImplicitNames'
 | 
|---|
 | 21 |         call VROptions 'NoEchoQuit'
 | 
|---|
 | 22 |     end
 | 
|---|
 | 23 |     InitArgs.0 = argCount
 | 
|---|
 | 24 |     if( argCount > 0 )then do i = 1 to argCount
 | 
|---|
 | 25 |         InitArgs.i = arg( i + argOff )
 | 
|---|
 | 26 |     end
 | 
|---|
 | 27 |     drop calledAs argCount argOff
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 | /*  Load the windows
 | 
|---|
 | 30 | */
 | 
|---|
 | 31 |     call VRInit
 | 
|---|
 | 32 |     parse source . . spec
 | 
|---|
 | 33 |     _VREPrimaryWindowPath = ,
 | 
|---|
 | 34 |         VRParseFileName( spec, "dpn" ) || ".VRW"
 | 
|---|
 | 35 |     _VREPrimaryWindow = ,
 | 
|---|
 | 36 |         VRLoad( parent, _VREPrimaryWindowPath )
 | 
|---|
 | 37 |     drop parent spec
 | 
|---|
 | 38 |     if( _VREPrimaryWindow == "" )then do
 | 
|---|
 | 39 |         call VRMessage "", "Cannot load window:" VRError(), ,
 | 
|---|
 | 40 |             "Error!"
 | 
|---|
 | 41 |         _VREReturnValue = 32000
 | 
|---|
 | 42 |         signal _VRELeaveMain
 | 
|---|
 | 43 |     end
 | 
|---|
 | 44 | 
 | 
|---|
 | 45 | /*  Process events
 | 
|---|
 | 46 | */
 | 
|---|
 | 47 |     call Init
 | 
|---|
 | 48 |     signal on halt
 | 
|---|
 | 49 |     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
 | 
|---|
 | 50 |         _VREEvent = VREvent()
 | 
|---|
 | 51 |         interpret _VREEvent
 | 
|---|
 | 52 |     end
 | 
|---|
 | 53 | _VREHalt:
 | 
|---|
 | 54 |     _VREReturnValue = Fini()
 | 
|---|
 | 55 |     call VRDestroy _VREPrimaryWindow
 | 
|---|
 | 56 | _VRELeaveMain:
 | 
|---|
 | 57 |     call VRFini
 | 
|---|
 | 58 | exit _VREReturnValue
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 | VRLoadSecondary:
 | 
|---|
 | 61 |     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
 | 
|---|
 | 62 |     if __vrlsWait then do
 | 
|---|
 | 63 |         call VRFlush
 | 
|---|
 | 64 |     end
 | 
|---|
 | 65 |     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
 | 
|---|
 | 66 |     if __vrlsHWnd = '' then signal __vrlsDone
 | 
|---|
 | 67 |     if __vrlsWait \= 1 then signal __vrlsDone
 | 
|---|
 | 68 |     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
 | 
|---|
 | 69 |     __vrlsTmp = __vrlsWindows.0
 | 
|---|
 | 70 |     if( DataType(__vrlsTmp) \= 'NUM' ) then do
 | 
|---|
 | 71 |         __vrlsTmp = 1
 | 
|---|
 | 72 |     end
 | 
|---|
 | 73 |     else do
 | 
|---|
 | 74 |         __vrlsTmp = __vrlsTmp + 1
 | 
|---|
 | 75 |     end
 | 
|---|
 | 76 |     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
 | 
|---|
 | 77 |     __vrlsWindows.0 = __vrlsTmp
 | 
|---|
 | 78 |     do while( VRIsValidObject( VRWindow() ) = 1 )
 | 
|---|
 | 79 |         __vrlsEvent = VREvent()
 | 
|---|
 | 80 |         interpret __vrlsEvent
 | 
|---|
 | 81 |     end
 | 
|---|
 | 82 |     __vrlsTmp = __vrlsWindows.0
 | 
|---|
 | 83 |     __vrlsWindows.0 = __vrlsTmp - 1
 | 
|---|
 | 84 |     call VRWindow __vrlsWindows.__vrlsTmp 
 | 
|---|
 | 85 |     __vrlsHWnd = ''
 | 
|---|
 | 86 | __vrlsDone:
 | 
|---|
 | 87 | return __vrlsHWnd
 | 
|---|
 | 88 | 
 | 
|---|
 | 89 | /*:VRX         __VXREXX____APPENDS__
 | 
|---|
 | 90 | */
 | 
|---|
 | 91 | __VXREXX____APPENDS__:
 | 
|---|
 | 92 | /*
 | 
|---|
 | 93 | #append U:\Develop\Samba\guitools-1.0\shared\inittempdir.vrs
 | 
|---|
 | 94 | #append U:\Develop\Samba\guitools-1.0\shared\sambainit.vrs
 | 
|---|
| [451] | 95 | #append U:\Develop\Samba\guitools-2.0\shared\nlv.vrs
 | 
|---|
| [303] | 96 | #append U:\Develop\Samba\guitools-1.0\shared\swat.vrs
 | 
|---|
 | 97 | */
 | 
|---|
 | 98 | return
 | 
|---|
 | 99 | /*:VRX         _ActiveGroup
 | 
|---|
 | 100 | */
 | 
|---|
 | 101 | _ActiveGroup: 
 | 
|---|
 | 102 |     ActiveGroup = translate(arg(1))
 | 
|---|
 | 103 |     ActiveGroupObj = VRGet("GB_"ActiveGroup, "Self")
 | 
|---|
 | 104 |     ok = VRset(ActiveGroupObj, "Visible", 1)
 | 
|---|
 | 105 | return
 | 
|---|
 | 106 | 
 | 
|---|
 | 107 | /*:VRX         _bs2fs
 | 
|---|
 | 108 | */
 | 
|---|
 | 109 | _bs2fs: procedure
 | 
|---|
 | 110 |     string = arg(1)
 | 
|---|
 | 111 | return translate(string,'/','\')
 | 
|---|
 | 112 | 
 | 
|---|
 | 113 | /*:VRX         _CfgPageSetupSize
 | 
|---|
 | 114 | */
 | 
|---|
 | 115 | _CfgPageSetupSize: 
 | 
|---|
| [333] | 116 |     if arg(1) = "GB_Global" 
 | 
|---|
 | 117 |         then ok = VRset(arg(1), "Top", 0)
 | 
|---|
 | 118 |         else ok = VRset(arg(1), "Top", Fwidth)
 | 
|---|
 | 119 | 
 | 
|---|
 | 120 |     ok = VRset(arg(1), "Left",VRGet("GB_SmbConfTree","Width") + 60)
 | 
|---|
 | 121 | 
 | 
|---|
 | 122 |     if arg(1) = "GB_Global" 
 | 
|---|
 | 123 |         then ok = VRset(arg(1), "Height",VRGet("GB_SmbConfTree","height")+FWidth)
 | 
|---|
 | 124 |         else ok = VRset(arg(1), "Height",VRGet("GB_SmbConfTree","height"))
 | 
|---|
 | 125 | 
 | 
|---|
 | 126 |     ok = VRset(arg(1), "Width", VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2)
 | 
|---|
| [303] | 127 | return
 | 
|---|
 | 128 | 
 | 
|---|
 | 129 | /*:VRX         _ChooseDir
 | 
|---|
 | 130 | */
 | 
|---|
 | 131 | _ChooseDir: 
 | 
|---|
 | 132 |     Invoked = VRInfo("Object")
 | 
|---|
 | 133 |     InitDir = VRGet("EF_"||substr(VRGet(Invoked, "name"),5),"Value")
 | 
|---|
 | 134 |     if pos('\\',InitDir) > 0 then do
 | 
|---|
 | 135 |         Msg.Text = NLVGetMessage(63,InitDir)
 | 
|---|
 | 136 |         Msg.Type = "E"
 | 
|---|
 | 137 |         call _ShowMsg
 | 
|---|
 | 138 |         return
 | 
|---|
 | 139 |     end
 | 
|---|
 | 140 |     VarPos = pos('%', InitDir)
 | 
|---|
 | 141 |     if VarPos > 0 then do
 | 
|---|
 | 142 |         VarChar = substr(InitDir,VarPos,2)
 | 
|---|
 | 143 |         InitDir = left(InitDir,VarPos-1)
 | 
|---|
 | 144 |         say VarChar
 | 
|---|
 | 145 |     end
 | 
|---|
 | 146 |     NewPath = _dirDialog('Choose path for 'VRGet("DT_Shares","Caption"),_fs2bs(InitDir))
 | 
|---|
 | 147 |     if NewPath = "" then return
 | 
|---|
 | 148 |     if VarPos > 0 then NewPath = NewPath'\'VarChar
 | 
|---|
 | 149 |     ok = VRset("EF_"||substr(VRGet(Invoked, "name"),5),"value",NewPath)
 | 
|---|
 | 150 | return
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 | /*:VRX         _CreateVocObject
 | 
|---|
 | 153 | */
 | 
|---|
 | 154 | _CreateVocObject: 
 | 
|---|
 | 155 |     IF options.!debug == 1 THEN say "_CreateVocObject() started" 
 | 
|---|
 | 156 |     If VRIsValidObject(VocObjType"_"upVoc ) then Success = 1
 | 
|---|
 | 157 |     else do
 | 
|---|
 | 158 |         /* Creative descriptive text */
 | 
|---|
 | 159 |         Objs = Objs + 1
 | 
|---|
 | 160 |         Voc.V = translate(left(Voc.V,1))||substr(Voc.V,2)
 | 
|---|
 | 161 |         CreatedObjs.Objs = VRCreate(ActiveGroupObj, "DescriptiveText", "Name", "DT_"upVoc, 'Caption', Voc.V, "Top", ObjYPos+50 , "Left", 120+72, "Visible", 1, "AutoSize", 1)
 | 
|---|
 | 162 |         select
 | 
|---|
 | 163 |             when pos("\\",Val.V) > 0 then nop
 | 
|---|
 | 164 |             when pos(" dir",Voc.V) > 0 then ok = VRSet(CreatedObjs.Objs, "Forecolor", "Black")
 | 
|---|
 | 165 |             when pos("file",Voc.V) > 0 then ok = VRSet(CreatedObjs.Objs, "Forecolor", "Black")
 | 
|---|
 | 166 |             when pos("path",Voc.V) > 0 then ok = VRSet(CreatedObjs.Objs, "Forecolor", "Black")
 | 
|---|
 | 167 |             otherwise nop /* do not beautify */
 | 
|---|
 | 168 |         end
 | 
|---|
 | 169 | 
 | 
|---|
 | 170 |         DT_Handle = CreatedObjs.Objs
 | 
|---|
 | 171 |         /* The CB or EF */
 | 
|---|
 | 172 |         Objs = Objs + 1
 | 
|---|
 | 173 |         select 
 | 
|---|
 | 174 |             when VocObjType = "CB" then do
 | 
|---|
 | 175 |                 CreatedObjs.Objs = VRCreate(ActiveGroupObj, "Checkbox",   "Name", VocObjType"_"upVoc, "Top", ObjYPos+30, "AutoSize", 1)
 | 
|---|
 | 176 |                 ok = VRSet(VocObjType"_"upVoc, "Click", "call _ShareObject_Changed")
 | 
|---|
 | 177 |             end
 | 
|---|
 | 178 |             otherwise do
 | 
|---|
 | 179 |                 CreatedObjs.Objs = VRCreate(ActiveGroupObj, "EntryField", "Name", VocObjType"_"upVoc, "Top", ObjYPos   , "Width", 2800, "Height", "253")
 | 
|---|
 | 180 |                 ok = VRSet(VocObjType"_"upVoc, "Change", "call _ShareObject_Changed")
 | 
|---|
 | 181 |             end
 | 
|---|
 | 182 |         end
 | 
|---|
 | 183 |         Success = (CreatedObjs.OBjs <> "")
 | 
|---|
 | 184 |         if Success then do /* SUccess */
 | 
|---|
 | 185 |             ok = VRSet(VocObjType"_"upVoc, "Left", max(1500, 120*2+VRGet(DT_handle,"Width")))
 | 
|---|
 | 186 |             if VocObjType = "EF" & upCurSection ="GLOBAL" then do
 | 
|---|
 | 187 |                 OWidth = 2800-max(0,VRGet(VocObjType"_"upVoc, "Left")-1500)
 | 
|---|
 | 188 |                 if datatype(Val.V) = "NUM" then OWidth = length(Val.V)*90+200
 | 
|---|
 | 189 |                                            else OWidth = length(Val.V)*90+440
 | 
|---|
 | 190 |                 if Val.V = "" then OWidth = 1500
 | 
|---|
 | 191 |                 ok = VRSet(VocObjType"_"upVoc, "Width", OWidth)
 | 
|---|
 | 192 |                 if (pos("_DIRECTORY",upVoc) > 0 | pos("_PATH",upVoc) > 0) & pos("MODE",upVoc) = 0 & pos("MASK",upVoc) = 0 then do
 | 
|---|
 | 193 |                     Objs = Objs + 1
 | 
|---|
 | 194 |                     CreatedObjs.Objs = VRCreate(ActiveGroupObj, "ImagePushButton",   "Name", "IPB_"upVoc, "Top", ObjYPos+30, "AutoSize", 0 , "PicturePath", "#2;#3", "Left", VRGet(VocObjType"_"upVoc,"Left")+VRGet(VocObjType"_"upVoc,"Width")+72)
 | 
|---|
 | 195 |                     ok = VRSet("IPB_"upVoc, "Click", "call _ChooseDir")
 | 
|---|
 | 196 |                     ok = VRSet("IPB_"upVoc,"Width" ,VRMethod( "Screen", "PixelsToTwips", 20 ))
 | 
|---|
 | 197 |                     ok = VRSet("IPB_"upVoc,"Height",VRMethod( "Screen", "PixelsToTwips", 20 ))
 | 
|---|
 | 198 |                 end
 | 
|---|
 | 199 |             end
 | 
|---|
 | 200 |             
 | 
|---|
 | 201 |          /* ok = VRSet(VocObjType"_"upVoc, "BackColor", "Red") */
 | 
|---|
 | 202 |             ok = VRSet(VocObjType"_"upVoc, "Visible", 1)
 | 
|---|
 | 203 |             CreatedObjs.0 = Objs
 | 
|---|
 | 204 |             ObjYPos= ObjYPos + ObjDelta
 | 
|---|
 | 205 |         end
 | 
|---|
 | 206 |         else do
 | 
|---|
 | 207 |             say "Failed to Create "||VocObjType"_"upVoc||' in 'ActiveGroupObj
 | 
|---|
 | 208 |         end
 | 
|---|
 | 209 |     end
 | 
|---|
 | 210 |     IF options.!debug == 1 THEN say '  Object: "'VocObjType'_'upVoc'" Value: "'Val.V'" Handle:"'CreatedObjs.Objs'"'
 | 
|---|
 | 211 |     IF options.!debug == 1 THEN say "_CreateVocObject() done"
 | 
|---|
 | 212 | return Success
 | 
|---|
 | 213 | /*:VRX         _dirdialog
 | 
|---|
 | 214 | */
 | 
|---|
 | 215 | _DirDialog: procedure
 | 
|---|
 | 216 |     Title   = arg(1)
 | 
|---|
 | 217 |     InitDir = arg(2)
 | 
|---|
 | 218 |     RC = RxFuncQuery("DRCtrlPickDirectory")
 | 
|---|
 | 219 |     if RC = 0 then do /* use DrCtrl if available */
 | 
|---|
 | 220 |         MyDir=DRCtrlPickDirectory(InitDir, Title)
 | 
|---|
 | 221 |     end
 | 
|---|
 | 222 |     else do
 | 
|---|
 | 223 |         MyDir = VRFileDialog(VRWindow,Title, 'o', InitDir||'\dummy')
 | 
|---|
 | 224 |         if MyDir <> '' then MyDir = strip(filespec('D',MyDir)||Filespec('P',MyDir),'T','\')
 | 
|---|
 | 225 |     end
 | 
|---|
 | 226 | return MyDir
 | 
|---|
 | 227 | /*:VRX         _FindIBMLANPath
 | 
|---|
 | 228 | */
 | 
|---|
 | 229 | _FindIBMLANPath: 
 | 
|---|
 | 230 |     say '_FindIBMLANPath() started.'
 | 
|---|
 | 231 |     ibmlanini  = SysBootDrive()'\IBMLAN\IBMLAN.INI'
 | 
|---|
 | 232 |     ibmlaniniexists = VRFileExists(ibmlanini)
 | 
|---|
 | 233 |     say '  Does "'ibmlanini'" exist? 'ibmlaniniexists' (1=Yes, 0=No)'
 | 
|---|
 | 234 | 
 | 
|---|
 | 235 |     lsshareini = SysBootDrive()'\IBMLAN\LSSHARE.INI'
 | 
|---|
 | 236 |     lsshareiniexists = VRFileExists(lsshareini)
 | 
|---|
 | 237 |     say '  Does "'lsshareini'" exist? 'lsshareiniexists' (1=Yes, 0=No)'
 | 
|---|
 | 238 |     say '_FindIBMLANPath() done.'
 | 
|---|
 | 239 | return
 | 
|---|
 | 240 | 
 | 
|---|
 | 241 | /*:VRX         _fs2bs
 | 
|---|
 | 242 | */
 | 
|---|
 | 243 | _fs2bs: procedure
 | 
|---|
 | 244 |     string = arg(1)
 | 
|---|
 | 245 | return translate(string,'\','/')
 | 
|---|
 | 246 | 
 | 
|---|
 | 247 | /*:VRX         _GroupCreate
 | 
|---|
 | 248 | */
 | 
|---|
 | 249 | _GroupCreate: 
 | 
|---|
 | 250 |     /* Create kLIBC group file */
 | 
|---|
 | 251 |     ok = SysFileDelete(samba.!group)
 | 
|---|
 | 252 |     call lineout samba.!group, '# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2) 
 | 
|---|
 | 253 |     call lineout samba.!group, '# syntax:'
 | 
|---|
 | 254 |     call lineout samba.!group, '# groupname:password:GID:user[,user,...,]'
 | 
|---|
 | 255 |     call lineout samba.!group, 'admin:*:512:root,'
 | 
|---|
 | 256 |     call lineout samba.!group, 'users:*:513:'
 | 
|---|
 | 257 |     call lineout samba.!group, 'guests:*:514:'
 | 
|---|
 | 258 |     call lineout samba.!group, 'machines:*:515:'
 | 
|---|
 | 259 |     call lineout samba.!group, 'dc:*:516:'
 | 
|---|
 | 260 |     call lineout samba.!group, 'certadmin:*:517:'
 | 
|---|
 | 261 |     call lineout samba.!group, 'schemeadmin:*:518:'
 | 
|---|
 | 262 |     call lineout samba.!group, 'entadmin:*:519:'
 | 
|---|
 | 263 |     call lineout samba.!group, 'poladmin:*:520:'
 | 
|---|
 | 264 |     ok = stream(samba.!group,'c','close')
 | 
|---|
 | 265 | return
 | 
|---|
 | 266 | /*:VRX         _GUIInit
 | 
|---|
 | 267 | */
 | 
|---|
 | 268 | _GUIInit: 
 | 
|---|
 | 269 |     if datatype(Top) = 'NUM' then do
 | 
|---|
 | 270 |         ok = VRset("Main","Top",Top)
 | 
|---|
 | 271 |         ok = VRset("Main","Left",Left)
 | 
|---|
 | 272 |         ok = VRset("Main","Width",Width)
 | 
|---|
 | 273 |         ok = VRset("Main","Height",Height)
 | 
|---|
 | 274 |     end
 | 
|---|
 | 275 |     else ok = VRset("Main","Width", 9250)
 | 
|---|
 | 276 | 
 | 
|---|
| [333] | 277 |     settings.!curfcolor = VRGetIni('PM_Default_Colors', 'ActiveTitleText', 'User', 'NoClose')
 | 
|---|
 | 278 |     settings.!curbcolor = VRGetIni('PM_Default_Colors', 'ActiveTitleTextBgnd', 'User')
 | 
|---|
 | 279 | 
 | 
|---|
 | 280 |     ok = VRSet("DT_SmbConfTree","BACKCOLOR", settings.!curbcolor )
 | 
|---|
 | 281 |     ok = VRSet("DT_SmbConfTree","FORECOLOR", settings.!curfcolor )
 | 
|---|
 | 282 | 
 | 
|---|
| [303] | 283 |     ok = VRSet("EF_Binaries_Version","value",samba.!version)
 | 
|---|
 | 284 |     ok = VRSet("EF_Binaries_Path","value",samba.!bin)
 | 
|---|
 | 285 |     ok = VRSet("EF_Scripts_Path","value",samba.!tools)
 | 
|---|
 | 286 |     ok = VRSet("EF_UnixRoot_Path","value",UnixRoot)
 | 
|---|
 | 287 |     ok = VRSet("EF_ETC_Path","value",ETC)
 | 
|---|
| [333] | 288 |     ok = VRSet("CN_SmbConf","Caption", smbconf)
 | 
|---|
| [303] | 289 |     ok = VRSet("IPB_ChooseDir","Width" ,VRMethod( "Screen", "PixelsToTwips", 20 ))
 | 
|---|
 | 290 |     ok = VRSet("IPB_ChooseDir","Height",VRMethod( "Screen", "PixelsToTwips", 20 ))
 | 
|---|
 | 291 |     ok = VRSet("IPB_NewItem","Width" ,VRMethod( "Screen", "PixelsToTwips", 20 ))
 | 
|---|
 | 292 |     ok = VRSet("IPB_NewItem","Height",VRMethod( "Screen", "PixelsToTwips", 20 ))
 | 
|---|
 | 293 | 
 | 
|---|
 | 294 |     ok = VRSet("Menu_File_Import_IBMPeer", "Enabled", lsshareiniexists * ibmlaniniexists )
 | 
|---|
 | 295 | 
 | 
|---|
| [344] | 296 |     ok = VRSet("Menu_Options_MiniIcons","Checked", \advanced.!bigicons)
 | 
|---|
 | 297 |     ok = VRset("CN_smbconf","MiniIcons", \advanced.!bigicons)
 | 
|---|
 | 298 | 
 | 
|---|
| [303] | 299 |     if _ChkTempFreeSpace() < 262144 then do
 | 
|---|
 | 300 |         Msg.Type = "W"
 | 
|---|
 | 301 |         Msg.Text = NLVGetMessage(116, TempDir)
 | 
|---|
 | 302 |         call _ShowMsg
 | 
|---|
 | 303 |     end
 | 
|---|
 | 304 | 
 | 
|---|
 | 305 |     ok = VRSet("Menu_File_PrintCap","Enabled", \IsCupsPrintcap)
 | 
|---|
 | 306 |     if \IsCupsPrintcap then call _PrintCapCreate
 | 
|---|
 | 307 | 
 | 
|---|
 | 308 |     if SmbConfExists then call _SmbConfLoad
 | 
|---|
 | 309 |                      else ok = VRSet("TM_Installer","Enabled", 1)
 | 
|---|
 | 310 | return
 | 
|---|
 | 311 | 
 | 
|---|
 | 312 | /*:VRX         _GUIInitNLV
 | 
|---|
 | 313 | */
 | 
|---|
 | 314 | _GUIInitNLV: 
 | 
|---|
| [333] | 315 |     say '_GUIInitNLV started'
 | 
|---|
| [303] | 316 |     CALL NLVSetup
 | 
|---|
 | 317 |     CALL NLVSetText 'Main', 'Caption', 1
 | 
|---|
 | 318 |     Msg.Title = VRGet("Main", "Caption")
 | 
|---|
 | 319 | 
 | 
|---|
 | 320 |     CALL NLVSetText 'PB_Reload',        'Caption',   11
 | 
|---|
 | 321 |     CALL NLVSetText 'PB_Reload',        'Hinttext', 111
 | 
|---|
| [569] | 322 |     CALL NLVSetText 'PB_Save',        'Caption',   12
 | 
|---|
 | 323 |     CALL NLVSetText 'PB_Save',        'Hinttext', 112
 | 
|---|
| [303] | 324 |     CALL NLVSetText 'PB_Undo',          'Caption',    9
 | 
|---|
 | 325 |     CALL NLVSetText 'PB_Undo',          'Hinttext', 109
 | 
|---|
 | 326 |     CALL NLVSetText 'PB_Cancel',        'Caption',   10
 | 
|---|
 | 327 |     CALL NLVSetText 'PB_Cancel',        'Hinttext', 110
 | 
|---|
 | 328 |     CALL NLVSetText 'PB_Help',          'Caption',    4
 | 
|---|
 | 329 |     CALL NLVSetText 'PB_Help',          'Hinttext', 104
 | 
|---|
 | 330 |     CALL NLVSetText 'PB_Add_Voc_OK',    'Caption',    2
 | 
|---|
 | 331 |     CALL NLVSetText 'PB_Add_Voc_OK',    'Hinttext', 102
 | 
|---|
 | 332 |     CALL NLVSetText 'PB_Add_Voc_Cancel','Caption',    3 
 | 
|---|
 | 333 |     CALL NLVSetText 'PB_Add_Voc_Cancel','Hinttext', 103 
 | 
|---|
 | 334 |     CALL NLVSetText 'Menu_File',        'Caption',   21
 | 
|---|
 | 335 |     CALL NLVSetText 'Menu_Options',     'Caption',   22
 | 
|---|
 | 336 |     CALL NLVSetText 'Menu_Help',        'Caption',   23
 | 
|---|
 | 337 | 
 | 
|---|
 | 338 |     CALL NLVSetText 'Menu_File_Import_IBMPeer', 'Caption',  24
 | 
|---|
 | 339 |     CALL NLVSetText 'Menu_File_Reset',          'Caption',  25
 | 
|---|
 | 340 |     CALL NLVSetText 'Menu_File_Debug',          'Caption',  26
 | 
|---|
 | 341 |     CALL NLVSetText 'Menu_File_ImportHosts',    'Caption',  36
 | 
|---|
 | 342 |     CALL NLVSetText 'Menu_File_PrintCap',       'Caption',  37
 | 
|---|
 | 343 |     CALL NLVSetText 'Menu_File_SmbUpdate',      'Caption',  44
 | 
|---|
 | 344 |     CALL NLVSetText 'Menu_File_Exit',           'Caption',  27
 | 
|---|
 | 345 | 
 | 
|---|
 | 346 |     CALL NLVSetText 'Menu_Options_SimpleMode',   'Caption', 28
 | 
|---|
 | 347 |     CALL NLVSetText 'Menu_Options_ExportMode',   'Caption', 29
 | 
|---|
| [344] | 348 |     CALL NLVSetText 'Menu_Options_MiniIcons',    'Caption', 74
 | 
|---|
| [303] | 349 |     CALL NLVSetText 'Menu_Help_smbconf',         'Caption', 30
 | 
|---|
 | 350 |     CALL NLVSetText 'Menu_Help_About',           'Caption', 31
 | 
|---|
 | 351 |     CALL NLVSetText 'Menu_Action',               'Caption', 32
 | 
|---|
 | 352 |     CALL NLVSetText 'Menu_Action_AddHomes',      'Caption', 33
 | 
|---|
 | 353 |     CALL NLVSetText 'Menu_Action_AddNetlogon',   'Caption', 34
 | 
|---|
 | 354 |     CALL NLVSetText 'Menu_Action_AddProfiles',   'Caption', 35
 | 
|---|
 | 355 |     CALL NLVSetText 'Menu_Action_AddProfiles',   'Caption', 35
 | 
|---|
 | 356 |     CALL NLVSetText 'Menu_Action_EraseTransient','Caption', 47
 | 
|---|
 | 357 | 
 | 
|---|
 | 358 |     CALL NLVSetText 'Menu_ShareContext_AddPrinter',   'Caption', 40
 | 
|---|
 | 359 |     CALL NLVSetText 'Menu_ShareContext_Add',          'Caption', 41
 | 
|---|
 | 360 |     CALL NLVSetText 'Menu_ShareContext_RemovePrinter','Caption', 42
 | 
|---|
 | 361 |     CALL NLVSetText 'Menu_ShareContext_Remove',       'Caption', 43
 | 
|---|
 | 362 |     CALL NLVSetText 'Menu_ShareContext_RenamePrinter','Caption', 48
 | 
|---|
 | 363 |     CALL NLVSetText 'Menu_ShareContext_Rename',       'Caption', 49
 | 
|---|
 | 364 | 
 | 
|---|
 | 365 |     CALL NLVSetText 'DT_Help',                        'Caption', 80
 | 
|---|
 | 366 |     CALL NLVSetText 'DT_Heading',                     'Caption', 81
 | 
|---|
 | 367 |     CALL NLVSetText 'DT_Binaries_Version',            'Caption', 82
 | 
|---|
 | 368 |     CALL NLVSetText 'DT_Binaries_Path',               'Caption', 83
 | 
|---|
 | 369 |     CALL NLVSetText 'DT_Scripts_Path',                'Caption', 84
 | 
|---|
| [333] | 370 | /*  CALL NLVSetText 'DT_SmbConfTree',                 'Caption', 73 */
 | 
|---|
 | 371 | say NLVGetMessage(73)
 | 
|---|
 | 372 |     ok = VRSet("DT_SmbConfTree","Caption", NLVGetMessage(73))
 | 
|---|
| [303] | 373 |     Drive = NLVGetMessage(38)
 | 
|---|
| [333] | 374 |     say '_GUIInitNLV done'
 | 
|---|
| [303] | 375 | return
 | 
|---|
 | 376 | 
 | 
|---|
 | 377 | /*:VRX         _INIRead
 | 
|---|
 | 378 | */
 | 
|---|
 | 379 | _INIRead: 
 | 
|---|
 | 380 |     IF options.!debug == 1 THEN say '_INIRead() started'
 | 
|---|
 | 381 |     OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SSCC.INI',,'\')
 | 
|---|
 | 382 |     ok = SysFileTree(OurINI, INIFound.,'FO')
 | 
|---|
 | 383 |     if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
 | 
|---|
 | 384 |     say 'OurINI  ='OurINI
 | 
|---|
 | 385 | 
 | 
|---|
 | 386 |     Top   = VRGetIni( "Pos", "Top",    OurINI , 'NoClose')
 | 
|---|
 | 387 |     Left  = VRGetIni( "Pos", "Left",   OurINI , 'NoClose')
 | 
|---|
 | 388 |     Width = VRGetIni( "Pos", "Width",  OurINI , 'NoClose')
 | 
|---|
 | 389 |     Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
 | 
|---|
 | 390 | 
 | 
|---|
 | 391 |     options.!debug = VRGetIni( "Options", "Debug", OurINI, 'NoClose')
 | 
|---|
 | 392 |     if options.!debug = "" then options.!debug = 0
 | 
|---|
 | 393 | 
 | 
|---|
 | 394 |     ok = VRSet("Menu_File_Debug","Checked",options.!Debug)
 | 
|---|
 | 395 |     if options.!Debug then ok = VRREdirectStdIO("ON")
 | 
|---|
 | 396 |                       else ok = VRREdirectStdIO("OFF")
 | 
|---|
 | 397 | 
 | 
|---|
| [344] | 398 |     options.!builddir = VRGetIni( "Options", "BuildDir", OurINI, 'NoClose')
 | 
|---|
| [303] | 399 |     if options.!builddir = "" then options.!builddir = ""
 | 
|---|
 | 400 | 
 | 
|---|
| [344] | 401 |     advanced.!bigicons = VRGetIni( "Options", "BigIcons", OurINI)
 | 
|---|
| [451] | 402 |     if advanced.!bigicons = "" then advanced.!bigicons = 1
 | 
|---|
| [344] | 403 | 
 | 
|---|
| [303] | 404 |     /* Initialize several variables */
 | 
|---|
 | 405 |     indent = '09'x
 | 
|---|
 | 406 |     ManageDaemons = 1
 | 
|---|
 | 407 | 
 | 
|---|
 | 408 |     /* these were formerly defined in smb.conf */
 | 
|---|
 | 409 |     CreatedObjs.0 = 0
 | 
|---|
 | 410 |     ChangeList    = ""
 | 
|---|
 | 411 |     ValueChanged  = 0
 | 
|---|
 | 412 |     CurSection    = ""
 | 
|---|
 | 413 |     CreatedObjs.0 = 0
 | 
|---|
 | 414 |     ActiveGroup   = "Global"
 | 
|---|
 | 415 | 
 | 
|---|
 | 416 |     InstallMode = 0 /* Normally 0 for configure mode, /Install switch overrides this */
 | 
|---|
 | 417 |     UseTDBSam = 0   /* only for installermode */
 | 
|---|
 | 418 |     CreatePDC = 0   /* only for installermode */
 | 
|---|
| [333] | 419 | 
 | 
|---|
 | 420 |     FWidth = 32
 | 
|---|
 | 421 | 
 | 
|---|
| [451] | 422 |     IF options.!debug == 1 THEN say '_INIRead() done'
 | 
|---|
| [303] | 423 | return
 | 
|---|
 | 424 | 
 | 
|---|
 | 425 | /*:VRX         _INIWrite
 | 
|---|
 | 426 | */
 | 
|---|
 | 427 | _INIWrite: 
 | 
|---|
 | 428 |     ok = VRSetIni( "Pos",     "Top",      VRGet("Main","Top"),         OurINI, 'NoClose')
 | 
|---|
 | 429 |     ok = VRSetIni( "Pos",     "Left",     VRGet("Main","Left"),        OurINI, 'NoClose')
 | 
|---|
 | 430 |     ok = VRSetIni( "Pos",     "Width",    VRGet("Main","Width"),       OurINI, 'NoClose')    
 | 
|---|
 | 431 |     ok = VRSetIni( "Pos",     "Height",   VRGet("Main","Height"),      OurINI, 'NoClose')
 | 
|---|
 | 432 |     ok = VRSetIni( "Options", "BuildDir", options.!builddir,           OurINI, 'NoClose')
 | 
|---|
| [344] | 433 |     ok = VRSetIni( "Options", "Debug",    options.!debug,              OurINI, 'NoClose')
 | 
|---|
 | 434 |     ok = VRSetIni( "Options", "BigIcons", \VRGet("Menu_Options_MiniIcons","Checked"),OurINI)
 | 
|---|
| [303] | 435 | return
 | 
|---|
 | 436 | 
 | 
|---|
 | 437 | /*:VRX         _InstallerMode
 | 
|---|
 | 438 | */
 | 
|---|
 | 439 | _InstallerMode: 
 | 
|---|
 | 440 |     ok = VRSet("Main", "Visible", 1)
 | 
|---|
 | 441 |     window = VRLoadSecondary( "Installer", "W" )
 | 
|---|
 | 442 |     ok = VRSet("Main", "Visible", 1)
 | 
|---|
 | 443 | return
 | 
|---|
 | 444 | 
 | 
|---|
 | 445 | /*:VRX         _LMHostsImport
 | 
|---|
 | 446 | */
 | 
|---|
 | 447 | _LMHostsImport: 
 | 
|---|
 | 448 |     hosts = ETC'\hosts'
 | 
|---|
 | 449 |     lmhosts = ETC'\samba\lmhosts'
 | 
|---|
 | 450 |     
 | 
|---|
 | 451 |     ok = SysFileDelete(lmhosts)
 | 
|---|
 | 452 | 
 | 
|---|
 | 453 |     call lineout lmhosts,'# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time()
 | 
|---|
 | 454 |     call lineout lmhosts,'# Syntax:'
 | 
|---|
 | 455 |     call lineout lmhosts,'# IP-address NetBIOS-name'
 | 
|---|
 | 456 | 
 | 
|---|
 | 457 |     do until lines(hosts) = 0
 | 
|---|
 | 458 |         hostsline = linein(hosts)
 | 
|---|
 | 459 |         parse var hostsline IP FQDN Alias
 | 
|---|
 | 460 |         parse var FQDN hostname'.'domain
 | 
|---|
| [344] | 461 |         if IP <> '127.0.0.1' then do
 | 
|---|
 | 462 |             say left(IP, 25)||hostname
 | 
|---|
 | 463 |             call lineout lmhosts, left(IP, 25)||hostname
 | 
|---|
 | 464 |         end
 | 
|---|
| [303] | 465 |     end
 | 
|---|
 | 466 | 
 | 
|---|
 | 467 |     ok = stream(hosts,'c','close')
 | 
|---|
 | 468 |     ok = stream(lmhosts,'c','close')
 | 
|---|
 | 469 |     Msg.Text = NLVGetMessage(50, lmhosts)
 | 
|---|
 | 470 |     msg.Type = 'I'
 | 
|---|
 | 471 |     call _ShowMsg
 | 
|---|
 | 472 | return
 | 
|---|
 | 473 | 
 | 
|---|
 | 474 | /*:VRX         _LoadOtherFuncs
 | 
|---|
 | 475 | */
 | 
|---|
 | 476 | _LoadOtherFuncs: 
 | 
|---|
| [859] | 477 |     if options.!Debug = 1 
 | 
|---|
 | 478 |         then ok = VRREdirectStdIO("ON")
 | 
|---|
 | 479 |         else ok = VRREdirectStdIO("OFF")
 | 
|---|
| [303] | 480 | 
 | 
|---|
 | 481 |     call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
 | 
|---|
 | 482 |     call SysLoadFuncs
 | 
|---|
 | 483 | 
 | 
|---|
 | 484 |     call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
 | 
|---|
 | 485 |     call IniLoadFuncs
 | 
|---|
 | 486 | 
 | 
|---|
 | 487 |     call RxFuncAdd 'PRLoadFuncs',  'PR1UTIL', 'PRLoadFuncs'
 | 
|---|
 | 488 |     call PRLoadFuncs
 | 
|---|
 | 489 | 
 | 
|---|
 | 490 |     /* Deal with DRCtrlxxx */
 | 
|---|
 | 491 |     RC = RxFuncQuery("DRCtrlPickDirectory")
 | 
|---|
 | 492 |     if RC = 1 then do /* DRCtrlXXX not already registered */
 | 
|---|
 | 493 |         /* Load DRCtrl functions */
 | 
|---|
 | 494 |         ok = RxFuncAdd('DRCtrlLoadFuncs', 'drctl017', 'DRCtrlLoadFuncs')
 | 
|---|
 | 495 |         if ok = 0 then CALL DRCtrlLoadFuncs
 | 
|---|
 | 496 |     end
 | 
|---|
 | 497 | return
 | 
|---|
 | 498 | 
 | 
|---|
 | 499 | /*:VRX         _MasterPasswdCreate
 | 
|---|
 | 500 | */
 | 
|---|
 | 501 | _MasterPasswdCreate: 
 | 
|---|
| [859] | 502 |     call lineout samba.!masterpasswd, '# Created by 'VRParseFileName(OurINI,'N')' Ver. 'word(VRGet("Main","Hinttext"),2) 
 | 
|---|
| [303] | 503 |     call lineout samba.!masterpasswd, '# syntax:'
 | 
|---|
 | 504 |     call lineout samba.!masterpasswd, '# username:passwd:UID:GID:login-class:chg pw x sec:deact x sec:GECOS:home:shell'
 | 
|---|
| [859] | 505 |     call lineout samba.!masterpasswd, 'root:*:0:512::0:0:root:/nonexistent:/usr/sbin/nologin'
 | 
|---|
| [303] | 506 |     call lineout samba.!masterpasswd, 'guest:*:65534:65534::0:0:guest:/nonexistent:/usr/sbin/nologin'
 | 
|---|
 | 507 |     ok = stream(samba.!masterpasswd,'c','close')
 | 
|---|
 | 508 | return
 | 
|---|
 | 509 | 
 | 
|---|
| [859] | 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
 | 
|---|
 | 523 | return 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'
 | 
|---|
 | 582 | return
 | 
|---|
 | 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"
 | 
|---|
 | 613 | return
 | 
|---|
 | 614 | 
 | 
|---|
| [303] | 615 | /*:VRX         _MsgYesNo
 | 
|---|
 | 616 | */
 | 
|---|
 | 617 | _MsgYesNo: 
 | 
|---|
 | 618 |     IF options.!debug == 1 THEN say '_MsgYesNo() started'    
 | 
|---|
 | 619 |     IF options.!debug == 1 THEN say '  Msgbox:"'Msg.Text'"'
 | 
|---|
 | 620 |     buttons.0 = 2
 | 
|---|
 | 621 |     buttons.1 = NLVGetMessage('6')
 | 
|---|
 | 622 |     buttons.2 = NLVGetMessage('7')
 | 
|---|
 | 623 |     default = 2
 | 
|---|
 | 624 |     buttons.default = buttons.2
 | 
|---|
 | 625 |     esc = 2
 | 
|---|
 | 626 |     buttons.esc = buttons.2
 | 
|---|
 | 627 |     RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc )
 | 
|---|
 | 628 |     IF options.!debug == 1 THEN say '  Answer: 'RC' ( 1 = Yes, 2 = No)'
 | 
|---|
 | 629 |     IF options.!debug == 1 THEN say '_MsgYesNo() done'    
 | 
|---|
 | 630 | return RC
 | 
|---|
 | 631 | 
 | 
|---|
 | 632 | /*:VRX         _MyIniEnum
 | 
|---|
 | 633 | */
 | 
|---|
 | 634 | _MyIniEnum: procedure expose sections. Voc. Val.
 | 
|---|
 | 635 |     CurSection = arg(1)
 | 
|---|
 | 636 |     do I = 1 to sections.0
 | 
|---|
 | 637 |         say I':'sections.I
 | 
|---|
 | 638 |         if sections.I = Cursection then leave
 | 
|---|
 | 639 |     end
 | 
|---|
 | 640 |     if I <= sections.0 then do
 | 
|---|
 | 641 |         say 'sections.'I'.0='sections.I.0
 | 
|---|
 | 642 |         Voc.0 = sections.I.0
 | 
|---|
 | 643 |         Val.0 = sections.I.0
 | 
|---|
 | 644 |         do J = 1 to Voc.0
 | 
|---|
 | 645 |             parse var sections.I.J Voc.J'='Val.J
 | 
|---|
 | 646 |             Voc.J = strip(Voc.J)
 | 
|---|
 | 647 |             Val.J = strip(Val.J)
 | 
|---|
 | 648 |         end
 | 
|---|
 | 649 |     end
 | 
|---|
 | 650 | return
 | 
|---|
 | 651 | 
 | 
|---|
 | 652 | /*:VRX         _MyIniEnumSections
 | 
|---|
 | 653 | */
 | 
|---|
 | 654 | _MyIniEnumSections: procedure expose sections.
 | 
|---|
 | 655 |     say '_MyIniEnumSections() started'
 | 
|---|
 | 656 |     smbconf = arg(1)
 | 
|---|
 | 657 |     sections. = ""
 | 
|---|
 | 658 |     I = 0
 | 
|---|
 | 659 |     J = 0
 | 
|---|
 | 660 |     do until lines(smbconf) = 0
 | 
|---|
 | 661 |         smbconfline = strip(translate(linein(smbconf),' ','09'x))
 | 
|---|
 | 662 |         select
 | 
|---|
 | 663 |             when left(smbconfline,1) =' ' then nop /* empty line */
 | 
|---|
 | 664 |             when left(smbconfline,1) =';' then nop /* Comment */
 | 
|---|
 | 665 |             when left(smbconfline,1) ='#' then nop /* Comment */
 | 
|---|
 | 666 |             when left(smbconfline,1) ='[' then do  /* Section */
 | 
|---|
 | 667 |                 sections.I.0 = J
 | 
|---|
 | 668 |                 I = I + 1
 | 
|---|
 | 669 |                 J = 0
 | 
|---|
 | 670 |                 parse var smbconfline '['CurSection']'
 | 
|---|
 | 671 |                 sections.I = CurSection
 | 
|---|
 | 672 |                 say '  'CurSection
 | 
|---|
 | 673 |             end
 | 
|---|
 | 674 |             otherwise do /* Option */
 | 
|---|
 | 675 |                 parse var smbconfline option'='value
 | 
|---|
 | 676 |                 J = J + 1
 | 
|---|
 | 677 |                 sections.I.J = smbconfline
 | 
|---|
 | 678 |                option = translate(strip(option),'_!?',' :$')
 | 
|---|
 | 679 |                value  = strip(value)
 | 
|---|
 | 680 |                OptStr = CurSection'.'option'="'Value'"'
 | 
|---|
 | 681 |                /* say OptStr */
 | 
|---|
 | 682 |             end
 | 
|---|
 | 683 |         end
 | 
|---|
 | 684 |     end
 | 
|---|
 | 685 |     sections.0 = I
 | 
|---|
 | 686 |     sections.I.0 = J
 | 
|---|
 | 687 |     ok = stream(smbconf,'c','close')
 | 
|---|
 | 688 |     say '_MyIniEnumSections() done.'
 | 
|---|
 | 689 | return
 | 
|---|
 | 690 | 
 | 
|---|
 | 691 | /*:VRX         _NLVSetup
 | 
|---|
 | 692 | */
 | 
|---|
 | 693 | _NLVSetup: 
 | 
|---|
 | 694 |     call NLVSetup
 | 
|---|
 | 695 | RETURN
 | 
|---|
 | 696 | /*:VRX         _ParseCommandLine
 | 
|---|
 | 697 | */
 | 
|---|
 | 698 | _ParseCommandLine: 
 | 
|---|
 | 699 |     IF options.!debug == 1 THEN SAY "_ParseCommandLine() started"
 | 
|---|
 | 700 |     CmdLine = VRGet("Application","Commandline")
 | 
|---|
 | 701 |     IF options.!debug == 1 THEN SAY '  original commandline ="'CmdLine'"'
 | 
|---|
 | 702 |     upCmdLine = translate(CmdLine)
 | 
|---|
 | 703 | 
 | 
|---|
 | 704 |     InstPos = pos('/INSTALL',upCmdLine)
 | 
|---|
 | 705 | 
 | 
|---|
 | 706 |     if InstPos > 0 then do
 | 
|---|
 | 707 |         IF options.!debug == 1 THEN SAY "  /install switch detected"
 | 
|---|
 | 708 |         InstallMode = 1
 | 
|---|
 | 709 |     end
 | 
|---|
 | 710 |     IF options.!debug == 1 THEN SAY "_ParseCommandLine() done"
 | 
|---|
 | 711 | return
 | 
|---|
 | 712 | 
 | 
|---|
 | 713 | /*:VRX         _PrintCapCreate
 | 
|---|
 | 714 | */
 | 
|---|
 | 715 | _PrintCapCreate: 
 | 
|---|
 | 716 |     ok = SysFileDelete(samba.!printcap)
 | 
|---|
 | 717 |     ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.') 
 | 
|---|
 | 718 |     call lineout samba.!printcap, '# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time()
 | 
|---|
 | 719 |     call lineout samba.!printcap, '# syntax:'
 | 
|---|
 | 720 |     call lineout samba.!printcap, '# Printerqueue|printername'
 | 
|---|
 | 721 |     do I = 1 to printers.0
 | 
|---|
 | 722 |         queue = printers.I
 | 
|---|
 | 723 |         name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';')
 | 
|---|
 | 724 |         call lineout samba.!printcap, queue'|'name
 | 
|---|
 | 725 |     end
 | 
|---|
 | 726 |     ok = stream(samba.!printcap,'c','close')
 | 
|---|
 | 727 | return
 | 
|---|
 | 728 | 
 | 
|---|
 | 729 | /*:VRX         _SambaCheckComponents
 | 
|---|
 | 730 | */
 | 
|---|
 | 731 | _SambaCheckComponents: 
 | 
|---|
 | 732 |     IF options.!debug == 1 THEN say '_SambaCheckComponents() started'
 | 
|---|
 | 733 | 
 | 
|---|
 | 734 |     /* set deprecated variables */ 
 | 
|---|
 | 735 |     smbconf = samba.!smbconf
 | 
|---|
 | 736 |     printcap = samba.!printcap
 | 
|---|
 | 737 | 
 | 
|---|
 | 738 |     /* detect presence of several components and act accordingly */
 | 
|---|
 | 739 |     SmbConfExists = VRFileExists(samba.!smbconf)
 | 
|---|
 | 740 |     IF options.!debug == 1 THEN say '  Does "'smbconf'" exist? 'SmbConfExists' (1=Yes, 0=No)'
 | 
|---|
 | 741 | 
 | 
|---|
 | 742 |     IsCupsPrintcap = 0
 | 
|---|
 | 743 |     if VRFileExists(samba.!printcap) then do
 | 
|---|
 | 744 |         printcapline = translate(linein(samba.!printcap))
 | 
|---|
 | 745 |         if pos("CUPS",printcapline) > 0 then IsCupsPrintcap = 1
 | 
|---|
 | 746 |         ok = stream(samba.!printcap,'c','close')
 | 
|---|
 | 747 |     end
 | 
|---|
 | 748 |     IF options.!debug == 1 THEN say '  Is printcap from CUPS? 'IsCupsPrintcap' (1=Yes, 0=No)'
 | 
|---|
 | 749 | 
 | 
|---|
 | 750 |     if \VRFileExists(samba.!smbcmd) then do
 | 
|---|
 | 751 |         Msg.Title = NLVGetMessage('1')
 | 
|---|
 | 752 |         Msg.Type = "E"
 | 
|---|
 | 753 |         Msg.Text = NLVGetMessage(53, samba.!smbcmd)' - 'NLVGetMessage(55)
 | 
|---|
 | 754 |         call _ShowMsg
 | 
|---|
 | 755 |         ManageDaemons = 0
 | 
|---|
 | 756 |     end
 | 
|---|
 | 757 |     IF options.!debug == 1 THEN say '  Is "'samba.!smbcmd'" present, able to manage daemons = 'ManageDaemons' (1=Yes, 0=No)'
 | 
|---|
 | 758 | 
 | 
|---|
 | 759 |     if \VRFileExists(samba.!testparmexe) then do    
 | 
|---|
 | 760 |         Msg.Title = NLVGetMessage('1')
 | 
|---|
 | 761 |         Msg.Text  = NLVGetMessage(53,samba.!testparmexe)' - 'NLVGetMessage(54)
 | 
|---|
 | 762 |         Msg.Type  = "E"
 | 
|---|
 | 763 |         call _ShowMsg
 | 
|---|
 | 764 |         call Quit
 | 
|---|
 | 765 |     end
 | 
|---|
 | 766 |     IF options.!debug == 1 THEN say '  Is "'samba.!testparmexe'" present, continuing.'
 | 
|---|
 | 767 | 
 | 
|---|
 | 768 |     if \VRFileExists(samba.!smbpasswdexe) then do    
 | 
|---|
 | 769 |         Msg.Title = NLVGetMessage('1')
 | 
|---|
 | 770 |         Msg.Text  = NLVGetMessage(53,samba.!smbpasswdexe)' - 'NLVGetMessage(54)
 | 
|---|
 | 771 |         Msg.Type  = "E"
 | 
|---|
 | 772 |         call _ShowMsg
 | 
|---|
 | 773 |         call Quit
 | 
|---|
 | 774 |     end
 | 
|---|
 | 775 |     IF options.!debug == 1 THEN say '  Is "'samba.!smbpasswdexe'" is present, continuing.'
 | 
|---|
 | 776 | 
 | 
|---|
 | 777 |     if SmbConfExists then do
 | 
|---|
 | 778 |         call _SmbConfBackup
 | 
|---|
 | 779 |         if InstallMode then do
 | 
|---|
| [451] | 780 |             window = VRLoadSecondary( "RemoveConfig", "W" )
 | 
|---|
| [303] | 781 |         end
 | 
|---|
 | 782 |     end
 | 
|---|
 | 783 | 
 | 
|---|
 | 784 |     if \VRFileExists(swatusers) & swatauth = 1 & InstallMode = 0 then do
 | 
|---|
 | 785 |         Msg.Text = NLVGetMessage(115, swatusers)
 | 
|---|
 | 786 |         Msg.Type = "W"
 | 
|---|
 | 787 |         call _ShowMsg
 | 
|---|
 | 788 |     end
 | 
|---|
 | 789 |     IF options.!debug == 1 THEN say '  Does "'samba.!smbconf'" still exist? 'SmbConfExists' (1=Yes, 0=No)'
 | 
|---|
 | 790 |     IF options.!debug == 1 THEN say '  Running in InstallMode = 'InstallMode' (1=Yes, 0=No)'
 | 
|---|
 | 791 | 
 | 
|---|
 | 792 |     IF options.!debug == 1 THEN say '_SambaCheckComponents() done'
 | 
|---|
 | 793 | return
 | 
|---|
| [451] | 794 | 
 | 
|---|
 | 795 | 
 | 
|---|
 | 796 | /*          Msg.Text = NLVGetMessage(56, samba.!smbconf)
 | 
|---|
 | 797 |             Msg.Type = "Q"
 | 
|---|
 | 798 |             ok = _MsgYesNo()
 | 
|---|
 | 799 |             if ok = 1 then do
 | 
|---|
 | 800 |                 ok = SysFileDelete(samba.!smbconf)
 | 
|---|
 | 801 |                 SmbConfExists = 0
 | 
|---|
 | 802 |                 Msg.Text = "Also reinitialize backend?" /* NLVGetMessage(56, samba.!smbconf) */
 | 
|---|
 | 803 |                 Msg.Type = "Q"
 | 
|---|
 | 804 |                 ok = _MsgYesNo()
 | 
|---|
 | 805 |                 if ok = 1 then do
 | 
|---|
 | 806 |                     ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS')
 | 
|---|
 | 807 |                     do I = 1 to xdb.0
 | 
|---|
 | 808 |                         ok = SysFileDelete(xdb.I)
 | 
|---|
 | 809 |                         if ok <> 0 then do
 | 
|---|
 | 810 |                             Msg.Text = "Error "ok" deleting "xdb.I"!"
 | 
|---|
 | 811 |                             Msg.Type = "W"
 | 
|---|
 | 812 |                             call _ShowMsg
 | 
|---|
 | 813 |                         end
 | 
|---|
 | 814 |                     end
 | 
|---|
 | 815 |                 end
 | 
|---|
 | 816 |             end
 | 
|---|
 | 817 |             else InstallMode = 0
 | 
|---|
 | 818 |  */
 | 
|---|
| [303] | 819 | /*:VRX         _SambaGroupMapInst
 | 
|---|
 | 820 | */
 | 
|---|
 | 821 | _SambaGroupMapInst:
 | 
|---|
 | 822 |     IF options.!debug == 1 THEN SAY "_SambaGroupMapInst() started" 
 | 
|---|
 | 823 |     /* These group mappings are obligatory */
 | 
|---|
 | 824 |     IF options.!debug == 1 THEN SAY  "  Mapping Required domain groups"
 | 
|---|
 | 825 |     address cmd samba.!netexe' groupmap add rid=512 ntgroup="Domain Admins"                unixgroup="admin"       type=domain   comment="Domain Administrators"'
 | 
|---|
 | 826 |     address cmd samba.!netexe' groupmap add rid=513 ntgroup="Domain Users"                 unixgroup="users"       type=domain   comment="Domain Users"'
 | 
|---|
 | 827 |     address cmd samba.!netexe' groupmap add rid=514 ntgroup="Domain Guests"                unixgroup="guests"      type=domain   comment="Domain Guests"'
 | 
|---|
 | 828 | 
 | 
|---|
 | 829 |     /* These group mappings are optional */
 | 
|---|
 | 830 |     IF options.!debug == 1 THEN SAY "  Mapping Optional domain groups"
 | 
|---|
 | 831 |     address cmd samba.!netexe' groupmap add rid=515 ntgroup="Domain Computers"             unixgroup="machines"    type=domain   comment="Domain Computers"'
 | 
|---|
 | 832 |     address cmd samba.!netexe' groupmap add rid=516 ntgroup="Domain Controllers"           unixgroup="dc"          type=domain   comment="Domain Controllers"'
 | 
|---|
 | 833 |     address cmd samba.!netexe' groupmap add rid=517 ntgroup="Domain Certificate Admins"    unixgroup="certadmin"   type=domain   comment="Domain Certificate Administrators"' 
 | 
|---|
 | 834 |     address cmd samba.!netexe' groupmap add rid=518 ntgroup="Domain Schema Admins"         unixgroup="schemeadmin" type=domain   comment="Domain Schema Administrators"'      
 | 
|---|
 | 835 |     address cmd samba.!netexe' groupmap add rid=519 ntgroup="Domain Enterprise Admins"     unixgroup="entadmin"    type=domain   comment="Domain Enterprise Administrators"'  
 | 
|---|
 | 836 |     address cmd samba.!netexe' groupmap add rid=520 ntgroup="Domain Policy Admins"         unixgroup="poladmin"    type=domain   comment="Domain Policy Administrators"'      
 | 
|---|
 | 837 | 
 | 
|---|
 | 838 |     /* The following ones are unsupported at the moment - use at your own risk */
 | 
|---|
 | 839 |     /*
 | 
|---|
 | 840 |     IF options.!debug == 1 THEN SAY say "  Mapping Builtin groups"
 | 
|---|
 | 841 |     address cmd samba.!netexe' groupmap add rid=544 ntgroup="Builtin Admins"               unixgroup="ntadmin"   type=builtin
 | 
|---|
 | 842 |     address cmd samba.!netexe' groupmap add rid=545 ntgroup="Builtin Users"                unixgroup="ntusers"   type=builtin
 | 
|---|
 | 843 |     address cmd samba.!netexe' groupmap add rid=546 ntgroup="Builtin Guests"               unixgroup="ntguests"  type=builtin
 | 
|---|
 | 844 |     address cmd samba.!netexe' groupmap add rid=547 ntgroup="Builtin Power Users"          unixgroup="" type=builtin 
 | 
|---|
 | 845 |     address cmd samba.!netexe' groupmap add rid=548 ntgroup="Builtin Account Operators"    unixgroup="" type=builtin 
 | 
|---|
 | 846 |     address cmd samba.!netexe' groupmap add rid=549 ntgroup="Builtin System Operators"     unixgroup="operator" type=builtin 
 | 
|---|
 | 847 |     address cmd samba.!netexe' groupmap add rid=550 ntgroup="Builtin Print Operators"      unixgroup="lp" type=builtin 
 | 
|---|
 | 848 |     address cmd samba.!netexe' groupmap add rid=551 ntgroup="Builtin Backup Operators"     unixgroup="backup" type=builtin 
 | 
|---|
 | 849 |     address cmd samba.!netexe' groupmap add rid=552 ntgroup="Builtin Replicator"           unixgroup="" type=builtin 
 | 
|---|
 | 850 |     address cmd samba.!netexe' groupmap add rid=553 ntgroup="Builtin RAS Servers"          unixgroup="" type=builtin 
 | 
|---|
 | 851 |     */
 | 
|---|
 | 852 |     IF options.!debug == 1 THEN SAY "_SambaGroupMapInst() done" 
 | 
|---|
 | 853 | return
 | 
|---|
 | 854 | 
 | 
|---|
 | 855 | /*:VRX         _SambaGuestCreate
 | 
|---|
 | 856 | */
 | 
|---|
 | 857 | _SambaGuestCreate: 
 | 
|---|
| [859] | 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
 | 
|---|
| [303] | 863 |               else call _SambaShowError
 | 
|---|
| [859] | 864 | 
 | 
|---|
 | 865 |     IF options.!debug == 1 THEN say "_SambaGuestCreate() done"
 | 
|---|
| [303] | 866 | return
 | 
|---|
 | 867 | 
 | 
|---|
 | 868 | /*:VRX         _SambaRootPWCheck
 | 
|---|
 | 869 | */
 | 
|---|
 | 870 | _SambaRootPWCheck: 
 | 
|---|
 | 871 |     if VRGet("EF_RootPassword","Value") ="" then do
 | 
|---|
 | 872 |         Msg.type  = "E"
 | 
|---|
 | 873 |         Msg.Text  = NLVGetMessage(57, "root")
 | 
|---|
 | 874 |         call _ShowMsg
 | 
|---|
 | 875 |         return 0
 | 
|---|
 | 876 |     end
 | 
|---|
 | 877 |     if VRGet("EF_RootPassword_repeat","Value") ="" then do
 | 
|---|
 | 878 |         Msg.type  = "E"
 | 
|---|
 | 879 |         Msg.Text  = NLVGetMessage(58,"root")
 | 
|---|
 | 880 |         call _ShowMsg
 | 
|---|
 | 881 |         return 0
 | 
|---|
 | 882 |     end
 | 
|---|
 | 883 | 
 | 
|---|
 | 884 |     if VRGet("EF_RootPassword","Value") <> VRGet("EF_RootPassword_repeat","Value") then do
 | 
|---|
 | 885 |         Msg.type  = "E"
 | 
|---|
 | 886 |         Msg.Text  = NLVGetMessage(59, "root")
 | 
|---|
 | 887 |         call _ShowMsg
 | 
|---|
 | 888 |         return 0
 | 
|---|
 | 889 |     end
 | 
|---|
 | 890 | return 1
 | 
|---|
 | 891 | 
 | 
|---|
 | 892 | /*:VRX         _SambaRootPWSet
 | 
|---|
 | 893 | */
 | 
|---|
 | 894 | _SambaRootPWSet: 
 | 
|---|
| [859] | 895 |     IF options.!debug == 1 THEN say "_SambaRootPWSet() started"
 | 
|---|
 | 896 | 
 | 
|---|
 | 897 |     /* Write root password to a temp file */
 | 
|---|
| [303] | 898 |     pwdfile = TempDir'newpwd'
 | 
|---|
 | 899 |     call lineout pwdfile, VRGet("EF_RootPassword","value")
 | 
|---|
 | 900 |     call lineout pwdfile, VRGet("EF_RootPassword","value")
 | 
|---|
 | 901 |     ok = stream(pwdfile,"c","close")
 | 
|---|
| [859] | 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
 | 
|---|
| [303] | 926 |               else call _SambaShowError
 | 
|---|
 | 927 | 
 | 
|---|
| [859] | 928 |     /* Remove the temp password file */
 | 
|---|
| [303] | 929 |     ok = SysFileDelete(pwdfile)
 | 
|---|
| [859] | 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 */
 | 
|---|
| [303] | 935 |     if swatauth then do
 | 
|---|
 | 936 |         /* we always remove the old swat */
 | 
|---|
| [859] | 937 |         say '  'samba.!htpasswdexe' -D "'swatusers'" root'
 | 
|---|
| [303] | 938 |         address cmd samba.!htpasswdexe' -D "'swatusers'" root' /* ' 2>'samba.!error' 1>'samba.!msg
 | 
|---|
 | 939 |         if rc <> 0 then call _SambaShowError; else call _SambaShowMsg  */             
 | 
|---|
 | 940 | 
 | 
|---|
 | 941 |         if VRFileExists(swatusers) then cFlag = ""; else cFlag="c"
 | 
|---|
 | 942 |         say '  'samba.!htpasswdexe' -b'cFLag' "'swatusers'" root **********'
 | 
|---|
 | 943 |         address cmd samba.!htpasswdexe' -b'cFlag' "'swatusers'" root 'VRGet("EF_RootPassword","value") /* ' 2>'samba.!error' 1>'samba.!msg
 | 
|---|
 | 944 |         if rc <> 0 then call _SambaShowError
 | 
|---|
 | 945 |         else call _SambaShowMsg */
 | 
|---|
 | 946 |     end
 | 
|---|
| [859] | 947 |     IF options.!debug == 1 THEN say "_SambaRootPWSet() done"
 | 
|---|
| [303] | 948 | return
 | 
|---|
 | 949 | /*:VRX         _SambaShowError
 | 
|---|
 | 950 | */
 | 
|---|
 | 951 | _SambaShowError: procedure expose samba. settings. options.
 | 
|---|
 | 952 |     I = 0
 | 
|---|
 | 953 |     do while lines(samba.!error) <> 0
 | 
|---|
 | 954 |         I = I + 1
 | 
|---|
 | 955 |         smberr.I = linein(samba.!error)
 | 
|---|
| [859] | 956 |         say I':err:'smberr.I
 | 
|---|
| [303] | 957 |     end
 | 
|---|
 | 958 |     ok = stream(Samba.!error,"c","close")
 | 
|---|
 | 959 |     ok = SysFileDelete(Samba.!error)
 | 
|---|
 | 960 |     smberr.0 = I
 | 
|---|
 | 961 |     /* we did not get any error text */
 | 
|---|
 | 962 |     if smberr.0 = 0 then return
 | 
|---|
 | 963 |     Buttons.1 = "OK"
 | 
|---|
 | 964 |     Buttons.0 = 1
 | 
|---|
 | 965 |     id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
 | 
|---|
 | 966 | return
 | 
|---|
 | 967 | 
 | 
|---|
 | 968 | /*:VRX         _SambaShowMsg
 | 
|---|
 | 969 | */
 | 
|---|
 | 970 | _SambaShowMsg: procedure expose samba. settings. options.
 | 
|---|
 | 971 |     I = 0
 | 
|---|
 | 972 |     do while lines(samba.!message) <> 0
 | 
|---|
 | 973 |         I = I + 1
 | 
|---|
 | 974 |         smbmsg.I = linein(samba.!message)
 | 
|---|
| [859] | 975 |         say I':msg:'smbmsg.I
 | 
|---|
| [303] | 976 |     end
 | 
|---|
 | 977 |     ok = stream(Samba.!message,"c","close")
 | 
|---|
 | 978 |     ok = SysFileDelete(Samba.!message)
 | 
|---|
 | 979 |     smbmsg.0 = I
 | 
|---|
 | 980 |     /* we did not get any message */
 | 
|---|
 | 981 |     if smbmsg.0 = 0 then return
 | 
|---|
 | 982 |     Buttons.1 = "OK"
 | 
|---|
 | 983 |     Buttons.0 = 1
 | 
|---|
 | 984 |     id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
 | 
|---|
 | 985 | return
 | 
|---|
| [451] | 986 | /*:VRX         _SambaUserCreate
 | 
|---|
 | 987 | */
 | 
|---|
 | 988 | _SambaUserCreate: 
 | 
|---|
 | 989 |     eCSUser = value("USER",,"OS2ENVIRONMENT")
 | 
|---|
 | 990 |     if translate(eCSUser) <> "root" & translate(eCSUser) <> "guest" then do
 | 
|---|
 | 991 |         Msg.Text = NLVGetMessage(75, eCSUser)
 | 
|---|
 | 992 |         Msg.Type = "I"
 | 
|---|
 | 993 |         call _ShowMsg
 | 
|---|
 | 994 |     end
 | 
|---|
 | 995 | return
 | 
|---|
 | 996 | 
 | 
|---|
| [303] | 997 | /*:VRX         _SambaVersion
 | 
|---|
 | 998 | */
 | 
|---|
 | 999 | _SambaVersion: 
 | 
|---|
 | 1000 |     say "_SambaVersion() started"
 | 
|---|
 | 1001 |     address cmd samba.!smbd' -V >'samba.!msg
 | 
|---|
 | 1002 |     samba.!version = linein(samba.!msg)
 | 
|---|
 | 1003 |     say "  Samba "samba.!version
 | 
|---|
 | 1004 |     ok = stream(samba.!msg,"c","close")
 | 
|---|
 | 1005 |     say "_SambaVersion() done"
 | 
|---|
 | 1006 | return
 | 
|---|
 | 1007 | 
 | 
|---|
 | 1008 | /*:VRX         _SaveChanges
 | 
|---|
 | 1009 | */
 | 
|---|
 | 1010 | _SaveChanges: 
 | 
|---|
 | 1011 |     say '_SaveChanges() started for ['CurSection']'
 | 
|---|
 | 1012 | 
 | 
|---|
 | 1013 |     do I = 1 to words(ChangeList)
 | 
|---|
 | 1014 |         ChangeObj = word(ChangeList,I)
 | 
|---|
 | 1015 |         say "Changed object: "ChangeObj
 | 
|---|
 | 1016 | 
 | 
|---|
 | 1017 |         parse var ChangeObj ChangeObjType '_' ChangeVoc
 | 
|---|
 | 1018 | 
 | 
|---|
 | 1019 |         ChangeVoc = translate(ChangeVoc, ' ', '_')
 | 
|---|
 | 1020 |         say "Changed voc: "ChangeVoc
 | 
|---|
 | 1021 |         VocIdx = VRGet(ChangeObj,'Userdata')
 | 
|---|
 | 1022 |         if ChangeObjType = "EF" then do
 | 
|---|
 | 1023 | 
 | 
|---|
 | 1024 |             NewVal = VRGet(ChangeObj, 'Value')
 | 
|---|
 | 1025 |             parse var sections.CurSIdx.VocIdx OldVoc'='OldVal
 | 
|---|
 | 1026 |             OldVoc = strip(oldVoc)
 | 
|---|
 | 1027 |             sections.CurSIdx.VocIdx = OldVoc' = 'NewVal
 | 
|---|
 | 1028 | 
 | 
|---|
 | 1029 |             if VRGet(ChangeObj, 'Value') <> "" then do
 | 
|---|
 | 1030 |                 select
 | 
|---|
 | 1031 |                     when pos("\\", VRGet(ChangeObj, 'Value')) > 0 then ok = IniSet(ChangeVoc, VRGet(ChangeObj, 'Value'), CurSection, samba.!smbconf)
 | 
|---|
 | 1032 |                     when pos(" dir",   ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf)
 | 
|---|
 | 1033 |                     when pos("file",   ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf)
 | 
|---|
 | 1034 |                     when pos("path",   ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf)
 | 
|---|
 | 1035 | /*                  when pos("command",ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf) */
 | 
|---|
 | 1036 | /*                  when pos("script", ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf) */
 | 
|---|
 | 1037 |                     otherwise ok = IniSet(ChangeVoc, VRGet(ChangeObj, 'Value'), CurSection, samba.!smbconf)
 | 
|---|
 | 1038 |                 end
 | 
|---|
 | 1039 |                 say "INISet ok = "ok
 | 
|---|
 | 1040 |             end
 | 
|---|
 | 1041 |             else do
 | 
|---|
 | 1042 |                 ok = IniDel( ChangeVoc, CurSection, samba.!smbconf )
 | 
|---|
 | 1043 |                 say "INIDel ok = "ok
 | 
|---|
 | 1044 |                 if ok = "" then ok = 0
 | 
|---|
 | 1045 |             end
 | 
|---|
 | 1046 |         end
 | 
|---|
 | 1047 |         if ChangeObjType = "CB" then do
 | 
|---|
 | 1048 |             If VRGet(ChangeObj, 'Set') then BoolVal = "Yes"; else BoolVal = "No"
 | 
|---|
 | 1049 | 
 | 
|---|
 | 1050 |             parse var sections.CurSIdx.VocIdx OldVoc'='OldVal
 | 
|---|
 | 1051 |             OldVoc = strip(oldVoc)
 | 
|---|
 | 1052 |             sections.CurSIdx.VocIdx = OldVoc' = 'BoolVal
 | 
|---|
 | 1053 | 
 | 
|---|
 | 1054 |             ok = IniSet(ChangeVoc, BoolVal, CurSection, samba.!smbconf)
 | 
|---|
 | 1055 |             say "INISet ok = "ok" (Bool)"
 | 
|---|
 | 1056 |         end
 | 
|---|
 | 1057 |     end
 | 
|---|
 | 1058 | 
 | 
|---|
 | 1059 |     if ok = 0 then do
 | 
|---|
 | 1060 |         Msg.Type = "I"
 | 
|---|
 | 1061 |         Msg.Text = NLVGetMessage(51)
 | 
|---|
 | 1062 |     end
 | 
|---|
 | 1063 |     else do
 | 
|---|
 | 1064 |         Msg.Type = "E"
 | 
|---|
 | 1065 |         Msg.Text = NLVGetMessage(52)
 | 
|---|
 | 1066 |     end
 | 
|---|
 | 1067 |     call _ShowMsg
 | 
|---|
 | 1068 | 
 | 
|---|
 | 1069 |     call TM_Value_Trigger
 | 
|---|
 | 1070 |     
 | 
|---|
 | 1071 |     say '_SaveChanges() done' 
 | 
|---|
 | 1072 | return
 | 
|---|
 | 1073 | /*:VRX         _ShareObject_Changed
 | 
|---|
 | 1074 | */
 | 
|---|
 | 1075 | _ShareObject_Changed: 
 | 
|---|
 | 1076 |     say "_ShareObject_Changed() started"
 | 
|---|
 | 1077 |     ValueChanged = 1
 | 
|---|
 | 1078 |     if pos(VRGet(VRInfo("OBject"),"Name"), ChangeList) = 0 then Changelist = ChangeList' 'VRGet(VRInfo("OBject"),"Name")
 | 
|---|
| [569] | 1079 |     ok = VRSet("PB_Save", "Enabled", 1)
 | 
|---|
| [303] | 1080 |     say "  ValueChanged = "ValueChanged
 | 
|---|
 | 1081 |     say Changelist
 | 
|---|
 | 1082 |     say "_ShareObject_Changed() done"
 | 
|---|
 | 1083 | return
 | 
|---|
 | 1084 | 
 | 
|---|
 | 1085 | /*:VRX         _SharesReset
 | 
|---|
 | 1086 | */
 | 
|---|
 | 1087 | _SharesReset: 
 | 
|---|
 | 1088 |     say '_SharesReset started'
 | 
|---|
 | 1089 |     ok = VRset("EF_path", "Value","")
 | 
|---|
 | 1090 |     ok = VRFlush( , "EF_path" ) 
 | 
|---|
 | 1091 |     ok = VRset("CB_Browseable", "Set", 1)
 | 
|---|
 | 1092 |     ok = VRFlush( , "CB_Browseable" ) 
 | 
|---|
 | 1093 |     ok = VRset("CB_Read_Only",  "Set", 0)
 | 
|---|
 | 1094 |     ok = VRFlush( , "CB_Read_Only") 
 | 
|---|
 | 1095 |     ok = VRset("CB_Guest_OK",   "Set", 0)
 | 
|---|
 | 1096 |     ok = VRFlush( , "CB_Guest_OK" ) 
 | 
|---|
 | 1097 |     do I = 1 to CreatedObjs.0
 | 
|---|
 | 1098 |         ok = VRDestroy(CreatedObjs.I)      
 | 
|---|
 | 1099 |     end
 | 
|---|
 | 1100 |     say '_SharesReset done'
 | 
|---|
 | 1101 | return
 | 
|---|
 | 1102 | 
 | 
|---|
 | 1103 | /*:VRX         _ShowMsg
 | 
|---|
 | 1104 | */
 | 
|---|
 | 1105 | _ShowMsg: 
 | 
|---|
 | 1106 |     Buttons.1 = "OK"
 | 
|---|
 | 1107 |     Buttons.0 = 1
 | 
|---|
 | 1108 |     id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
 | 
|---|
 | 1109 | return
 | 
|---|
 | 1110 | 
 | 
|---|
| [859] | 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'
 | 
|---|
 | 1123 | return
 | 
|---|
 | 1124 | 
 | 
|---|
| [303] | 1125 | /*:VRX         _SmbConfBackup
 | 
|---|
 | 1126 | */
 | 
|---|
 | 1127 | _SmbConfBackup: 
 | 
|---|
 | 1128 |     ok = VRCopyFile( SmbConf, SmbConf"-backup" )
 | 
|---|
 | 1129 | return
 | 
|---|
 | 1130 | 
 | 
|---|
 | 1131 | /*:VRX         _SmbConfCommitChanges
 | 
|---|
 | 1132 | */
 | 
|---|
| [580] | 1133 | _SmbConfCommitChanges:
 | 
|---|
 | 1134 |     IF options.!debug == 1 THEN say '_SmbConfCommitChanges() started'    
 | 
|---|
 | 1135 |  
 | 
|---|
| [303] | 1136 |     src = TempDir'smb.conf'
 | 
|---|
| [580] | 1137 |     if stream(src,'c','query size') = 0 then do
 | 
|---|
 | 1138 |         ok = VRCopyFile(smbconf,src)
 | 
|---|
 | 1139 |     end
 | 
|---|
| [303] | 1140 |     trg = smbconf
 | 
|---|
 | 1141 |     ok = SysFileDelete(smbconf)
 | 
|---|
 | 1142 |     call lineout trg, '# Samba config file created using SSCC ver. 'word(VRGet("Main","Hinttext"),2)
 | 
|---|
 | 1143 |     call lineout trg, '# from 'value("USER",,'OS2ENVIRONMENT')'@'value("HOSTNAME",,'OS2ENVIRONMENT')
 | 
|---|
 | 1144 |     call lineout trg, '# Date: 'date()' 'time()
 | 
|---|
| [490] | 1145 |     lct = 0
 | 
|---|
| [303] | 1146 |     do until lines(src) = 0
 | 
|---|
 | 1147 |         smbline = linein(src)
 | 
|---|
| [569] | 1148 |         if pos("idmap uid",smbline) > 0 then iterate
 | 
|---|
 | 1149 |         if pos("idmap gid",smbline) > 0 then iterate
 | 
|---|
| [303] | 1150 |         if pos("winbind separator",smbline) > 0 then iterate
 | 
|---|
| [569] | 1151 |         if pos("copy ",smbline) > 0 then iterate
 | 
|---|
| [303] | 1152 |         call lineout trg, smbline
 | 
|---|
| [490] | 1153 |         lct = lct + 1
 | 
|---|
| [303] | 1154 |     end
 | 
|---|
| [490] | 1155 |     say "Lines saved "lct
 | 
|---|
| [303] | 1156 |     ok = stream(trg,'c','close')
 | 
|---|
 | 1157 |     ok = stream(src,'c','close')
 | 
|---|
 | 1158 |     ok = SysFileDelete(src)
 | 
|---|
| [580] | 1159 |     IF options.!debug == 1 THEN say '_SmbConfCommitChanges() done'    
 | 
|---|
| [303] | 1160 | return
 | 
|---|
 | 1161 | 
 | 
|---|
 | 1162 | /*:VRX         _SmbConfCreateDefault
 | 
|---|
 | 1163 | */
 | 
|---|
 | 1164 | _SmbConfCreateDefault: 
 | 
|---|
 | 1165 |     ok = SysFileDelete(smbconf)
 | 
|---|
 | 1166 |     
 | 
|---|
 | 1167 |     /* Create a basic smb.conf */
 | 
|---|
 | 1168 |     call _SmbConfDefault_Global    
 | 
|---|
 | 1169 |     call _SmbConfDefault_Scripts
 | 
|---|
 | 1170 |     if CreatePDC then do
 | 
|---|
 | 1171 |         call _SmbConfDefault_NetLogon
 | 
|---|
 | 1172 |         call _SmbConfDefault_Profiles
 | 
|---|
 | 1173 |     end
 | 
|---|
 | 1174 |     call _SmbConfDefault_Homes
 | 
|---|
 | 1175 |     call _SmbConfDefault_SharePrinters
 | 
|---|
 | 1176 |     call _SmbConfDefault_ShareDrives
 | 
|---|
 | 1177 |     ok = stream(smbconf,'c','close')
 | 
|---|
 | 1178 | return
 | 
|---|
 | 1179 | 
 | 
|---|
 | 1180 | /*:VRX         _SmbConfCreateDefault_OldInstall
 | 
|---|
 | 1181 | */
 | 
|---|
 | 1182 | _SmbConfCreateDefault_OldInstall: 
 | 
|---|
 | 1183 |     DriveList = SysDriveMap('C:','Local')
 | 
|---|
 | 1184 |     ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.') 
 | 
|---|
 | 1185 |     ok = VRSet("EF_NetBIOS_Name","Value", Value("HOSTNAME",,"OS2ENVIRONMENT"))
 | 
|---|
 | 1186 | 
 | 
|---|
 | 1187 |     DrivesOH.0 = 0
 | 
|---|
 | 1188 |     do I = 1 to words(DriveList)
 | 
|---|
 | 1189 |         CurDrive = word(DriveList,I)
 | 
|---|
 | 1190 |         Filesys = SysFilesystemType(Curdrive)
 | 
|---|
 | 1191 |         DriveInfo=SysDriveInfo(CurDrive)
 | 
|---|
 | 1192 |         parse var DriveInfo DrvLet CurFree CurSize CurLabel
 | 
|---|
 | 1193 |         curlabel = strip(Curlabel)
 | 
|---|
 | 1194 |         CurFree = word(Driveinfo,2)
 | 
|---|
 | 1195 |         CurSize = word(Driveinfo,3)
 | 
|---|
 | 1196 |         if Curlabel = "" then Curlabel = '?'
 | 
|---|
 | 1197 | 
 | 
|---|
 | 1198 |         if datatype(CurSize) = 'NUM' then do       
 | 
|---|
 | 1199 |             CurSize = CurSize/(1024*1024)
 | 
|---|
 | 1200 |             CurFree = CurFree/(1024*1024)
 | 
|---|
 | 1201 | 
 | 
|---|
 | 1202 |             CurSize = format(CurSize,,0)'MB'
 | 
|---|
 | 1203 |             CurFree = format(CurFree,,0)'MB'
 | 
|---|
 | 1204 |         end
 | 
|---|
 | 1205 |         else do
 | 
|---|
 | 1206 |             CurSize = '?'
 | 
|---|
 | 1207 |             CurFree = '?'
 | 
|---|
 | 1208 |         end
 | 
|---|
 | 1209 | 
 | 
|---|
 | 1210 | /*      DrivesOH.I = VRCreate( "GB_Drives", "CheckBox", "Name", "CB_"left(CurDrive,1), "Top", 120, "Left", 1325+(I-1)*420, "Visible", 1, "Caption", CurDrive, "AutoSize", 1, "set", 1, "Userdata", FileSys, "HintText", CurDrive' ('Curlabel', 'FileSys') size: 'CurSize', free: 'CurFree)  */
 | 
|---|
 | 1211 |         Shares.!drives.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,,left(CurDrive,1) ,"#4")
 | 
|---|
 | 1212 |         if FileSys = '' | FileSys = 'CDFS' then do
 | 
|---|
 | 1213 | /*          ok = VRSet(DrivesOH.I, "ForeColor", "Red") */
 | 
|---|
 | 1214 |         end
 | 
|---|
 | 1215 | /*      if CurDrive = SysBootDrive() then ok = VRSet(DrivesOH.I, "Set", 0)
 | 
|---|
 | 1216 |         if CurDrive = translate(left(samba.!bin,2)) then ok = VRSet(DrivesOH.I, "Set", 0) */
 | 
|---|
 | 1217 |     end
 | 
|---|
 | 1218 |     DrivesOH.0 = I-1
 | 
|---|
 | 1219 | 
 | 
|---|
 | 1220 |     PrintersOH.0 = 0
 | 
|---|
 | 1221 |     Colum = 1325
 | 
|---|
 | 1222 |     dx = 0
 | 
|---|
 | 1223 |     do I = 1 to printers.0
 | 
|---|
 | 1224 |         queue = printers.I
 | 
|---|
 | 1225 |         name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';')
 | 
|---|
 | 1226 | /*      PrintersOH.I = VRCreate( "GB_printers", "CheckBox", "Name", "CB_"queue, "Top", 120+(I-1-dx)*250, "Left", Colum, "Visible", 1, "Caption", Name, "AutoSize", 1, "set", 1, "UserData", Queue)     */
 | 
|---|
 | 1227 |         Shares.!printers.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,,queue,"#6")
 | 
|---|
 | 1228 |         if I = 6 then do
 | 
|---|
 | 1229 |             Colum = 4000
 | 
|---|
 | 1230 |             dx = 6
 | 
|---|
 | 1231 |         end
 | 
|---|
 | 1232 |     end
 | 
|---|
 | 1233 |     PrintersOH.0 = I-1
 | 
|---|
 | 1234 | return
 | 
|---|
 | 1235 | 
 | 
|---|
 | 1236 | /*:VRX         _SmbConfDefault_Global
 | 
|---|
 | 1237 | */
 | 
|---|
 | 1238 | _SmbConfDefault_Global: 
 | 
|---|
 | 1239 |     Migrate = (arg(1) = 1)
 | 
|---|
 | 1240 |     if \Migrate then do /* when migrating these 4 lines are there already */
 | 
|---|
 | 1241 |         section       = '[global]'
 | 
|---|
 | 1242 |         call lineout smbconf, section 
 | 
|---|
| [574] | 1243 |         call lineout smbconf, Indent||'workgroup = 'VRGet("EF_Workgroup_Initial","value")
 | 
|---|
| [303] | 1244 |         call lineout smbconf, Indent||'netbios name = 'value('HOSTNAME',,'OS2ENVIRONMENT')
 | 
|---|
 | 1245 |         call lineout smbconf, Indent||'server string = %h Samba Server for eCS (OS/2)'
 | 
|---|
 | 1246 |         call lineout smbconf, Indent||'comment = Samba Server for eCS (OS/2)'
 | 
|---|
 | 1247 |     end
 | 
|---|
| [344] | 1248 | 
 | 
|---|
| [859] | 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
 | 
|---|
| [344] | 1259 | 
 | 
|---|
| [303] | 1260 |     CurCP = SysQueryProcessCodePage() 
 | 
|---|
 | 1261 |     if CurCP <> "850" then do
 | 
|---|
| [344] | 1262 |         Msg.Text = NLVGetMessage(117)
 | 
|---|
 | 1263 |         Msg.Type = "W"
 | 
|---|
 | 1264 |         call _ShowMsg
 | 
|---|
| [303] | 1265 |     end
 | 
|---|
 | 1266 |     if UseTDBsam = 1 then do
 | 
|---|
 | 1267 |         call lineout smbconf, Indent||'passdb backend = tdbsam'
 | 
|---|
 | 1268 |     end
 | 
|---|
| [859] | 1269 |     call lineout smbconf, Indent||'log level = 2'
 | 
|---|
 | 1270 |     call lineout smbconf, Indent||'log file = '||ETC||'\samba\log\log.smbd.%U.%M'
 | 
|---|
| [303] | 1271 |     call lineout smbconf, Indent||'null passwords = Yes'
 | 
|---|
 | 1272 |     call lineout smbconf, Indent||'guest account = guest'
 | 
|---|
 | 1273 |     call lineout smbconf, Indent||'security = user'
 | 
|---|
 | 1274 |     call lineout smbconf, Indent||'load printers = No'
 | 
|---|
 | 1275 |     call lineout smbconf, Indent||'time server = Yes'
 | 
|---|
 | 1276 |     call lineout smbconf, Indent||'lock directory = '||ETC||'\samba\lock'
 | 
|---|
 | 1277 |     /* This EA makes the testparm warning about browsing go away.
 | 
|---|
 | 1278 |        Note: The EA is NOT marked critical as it should be, 
 | 
|---|
 | 1279 |              neverthelesse this fix works */
 | 
|---|
 | 1280 |     ok = SysPutEA(ETC||'\samba\lock',"MODE", "FEFF0400ED410000"x)
 | 
|---|
 | 1281 |     call lineout smbconf, Indent||'ea support = Yes'
 | 
|---|
 | 1282 |     call lineout smbconf, Indent||'store dos attributes = Yes'
 | 
|---|
 | 1283 |     call lineout smbconf, Indent||'lm announce = Yes'
 | 
|---|
 | 1284 |     call lineout smbconf, Indent||'wins support = Yes'
 | 
|---|
| [408] | 1285 |     call lineout smbconf, Indent||'wide links = No'
 | 
|---|
| [303] | 1286 |     ok = SysFileTree(samba.!printcap,exist.,'FO')
 | 
|---|
 | 1287 |     if exist.0 = 1 then do
 | 
|---|
 | 1288 |         call lineout smbconf, Indent||'printcap name = 'samba.!printcap
 | 
|---|
 | 1289 |     end
 | 
|---|
 | 1290 |     samba.!smbusermap = ETC||'\samba\private\smbusermap'
 | 
|---|
 | 1291 |     call lineout smbconf, Indent||'username map = 'samba.!smbusermap
 | 
|---|
 | 1292 |     if \VRFileExists(samba.!smbusermap) then call _SmbUserMapCreate
 | 
|---|
 | 1293 |     if CreatePDC then do
 | 
|---|
 | 1294 |         call lineout smbconf, Indent||'local master = Yes'
 | 
|---|
 | 1295 |         call lineout smbconf, Indent||'preferred master = Yes'
 | 
|---|
 | 1296 |         call lineout smbconf, Indent||'domain master = Yes'
 | 
|---|
 | 1297 |         call lineout smbconf, Indent||'os level = 65'
 | 
|---|
 | 1298 |         call lineout smbconf, ';'Indent||'domain groups ='
 | 
|---|
 | 1299 |         call lineout smbconf, ';'Indent||'domain admin group = '
 | 
|---|
 | 1300 |         call lineout smbconf, Indent||'domain admin users = root'
 | 
|---|
 | 1301 |         call lineout smbconf, Indent||'domain logons = Yes'
 | 
|---|
 | 1302 |         call lineout smbconf, Indent||'logon home = \\%L\Profiles\%U'
 | 
|---|
 | 1303 |         call lineout smbconf, Indent||'logon path = \\%L\Profiles\%U'
 | 
|---|
 | 1304 |         call lineout smbconf, Indent||'logon drive = z:'
 | 
|---|
 | 1305 |         call lineout smbconf, Indent||'logon script = %U.cmd'
 | 
|---|
 | 1306 |     end
 | 
|---|
 | 1307 |     else do
 | 
|---|
 | 1308 |         call lineout smbconf, Indent||'create mask = 0777'
 | 
|---|
 | 1309 |     end 
 | 
|---|
 | 1310 |     ok = stream(smbconf, 'c','close')  
 | 
|---|
 | 1311 | return
 | 
|---|
 | 1312 | /*:VRX         _SmbConfDefault_Homes
 | 
|---|
 | 1313 | */
 | 
|---|
 | 1314 | _SmbConfDefault_Homes: 
 | 
|---|
 | 1315 |     /* Create Homes section */
 | 
|---|
 | 1316 |     call lineout smbconf, '[HOMES]'
 | 
|---|
 | 1317 |     call lineout smbconf, Indent||"comment = Home directory"
 | 
|---|
 | 1318 |     smbhome = samba.!bin'\homes'
 | 
|---|
 | 1319 |     Home = strip(value('Home',,'OS2ENVIRONMENT'),'T','\')
 | 
|---|
 | 1320 |     if Home <> '' then do
 | 
|---|
 | 1321 |         User = value('USER',,'OS2ENVIRONMENT')
 | 
|---|
 | 1322 |         if User <> '' then do
 | 
|---|
 | 1323 |             if translate(User) = translate(Filespec('N',Home)) | translate(Filespec('N',Home)) = "DEFAULT"  then smbHome = strip(filespec('D',Home)||filespec('P',Home),'T','\')
 | 
|---|
 | 1324 |         end
 | 
|---|
 | 1325 |     end
 | 
|---|
 | 1326 |     ok = SysMkDir(smbhome)
 | 
|---|
 | 1327 |     call lineout smbconf, Indent||"path = "_bs2fs(smbhome)'/%u'
 | 
|---|
 | 1328 |     call lineout smbconf, Indent||"read only = No"
 | 
|---|
 | 1329 |     call lineout smbconf, Indent||"browseable = No"
 | 
|---|
 | 1330 |     call lineout smbconf, Indent
 | 
|---|
 | 1331 |     ok = stream(smbconf, 'c','close')
 | 
|---|
 | 1332 | return
 | 
|---|
 | 1333 | 
 | 
|---|
 | 1334 | /*:VRX         _SmbConfDefault_Netlogon
 | 
|---|
 | 1335 | */
 | 
|---|
 | 1336 | _SmbConfDefault_Netlogon: 
 | 
|---|
 | 1337 |     /* Create Netlogon section */
 | 
|---|
 | 1338 |     call lineout smbconf, '[NETLOGON]'
 | 
|---|
 | 1339 |     call lineout smbconf, Indent||"comment = Netlogon service"
 | 
|---|
 | 1340 |     smbnetlogon = samba.!bin'\netlogon'
 | 
|---|
 | 1341 |     ok = SysMkDir(smbnetlogon)
 | 
|---|
 | 1342 |     call lineout smbconf, Indent||"path = "_bs2fs(smbnetlogon)
 | 
|---|
 | 1343 |     call lineout smbconf, Indent||"read only = Yes"
 | 
|---|
 | 1344 |     call lineout smbconf, Indent||"browseable = Yes"
 | 
|---|
 | 1345 |     call lineout smbconf, Indent||"share modes = No"
 | 
|---|
 | 1346 |     call lineout smbconf, Indent
 | 
|---|
 | 1347 |     ok = stream(smbconf, 'c','close')
 | 
|---|
 | 1348 | return
 | 
|---|
 | 1349 | 
 | 
|---|
 | 1350 | /*:VRX         _SmbConfDefault_Profiles
 | 
|---|
 | 1351 | */
 | 
|---|
 | 1352 | _SmbConfDefault_Profiles: 
 | 
|---|
 | 1353 |     /* Create profiles section */
 | 
|---|
 | 1354 |     call lineout smbconf, '[profiles]'
 | 
|---|
 | 1355 |     call lineout smbconf, Indent||"comment = profiles"
 | 
|---|
 | 1356 |     smbprofiles = samba.!bin'\profiles'
 | 
|---|
 | 1357 |     ok = SysMkDir(smbprofiles)
 | 
|---|
 | 1358 |     call lineout smbconf, Indent||"path = "_bs2fs(smbprofiles)
 | 
|---|
 | 1359 |     call lineout smbconf, Indent||"profile acls = Yes"
 | 
|---|
 | 1360 |     call lineout smbconf, Indent||"read only = No"
 | 
|---|
 | 1361 |     call lineout smbconf, Indent||"browseable = Yes"
 | 
|---|
 | 1362 |     call lineout smbconf, Indent||"create mask = 0777"
 | 
|---|
 | 1363 |     call lineout smbconf, Indent||"directory mask = 0777"
 | 
|---|
 | 1364 |     call lineout smbconf, Indent
 | 
|---|
 | 1365 |     ok = stream(smbconf, 'c','close')
 | 
|---|
 | 1366 | return
 | 
|---|
 | 1367 | 
 | 
|---|
 | 1368 | /*:VRX         _SmbConfDefault_Scripts
 | 
|---|
 | 1369 | */
 | 
|---|
 | 1370 | _SmbConfDefault_Scripts: 
 | 
|---|
 | 1371 |     smbtools = samba.!bin
 | 
|---|
 | 1372 | 
 | 
|---|
 | 1373 |     /* user scripts */
 | 
|---|
 | 1374 |     call lineout smbconf, ';'||Indent||'user scripts'
 | 
|---|
 | 1375 |     call lineout smbconf, Indent||'add user script          = '||smbtools||'\usermod.cmd -a "%u"'
 | 
|---|
 | 1376 |     call lineout smbconf, Indent||'delete user script       = '||smbtools||'\usermod.cmd -x "%u"'
 | 
|---|
 | 1377 |     call lineout smbconf, Indent||'rename user script       = '||smbtools||'\usermod.cmd -r "%uold" "%unew"'
 | 
|---|
 | 1378 |     call lineout smbconf, Indent||'add machine script       = '||smbtools||'\usermod.cmd -a "%u"'
 | 
|---|
 | 1379 |     call lineout smbconf, Indent||'set primary group script = '||smbtools||'\usermod.cmd -p "%u" "%g"'
 | 
|---|
 | 1380 | 
 | 
|---|
 | 1381 |     /* group scripts */
 | 
|---|
 | 1382 |     call lineout smbconf, ';'||Indent||'group scripts'
 | 
|---|
 | 1383 |     call lineout smbconf, Indent||'add group script              = '||smbtools||'\groupmod.cmd -a "%g"'
 | 
|---|
 | 1384 |     call lineout smbconf, Indent||'delete group script           = '||smbtools||'\groupmod.cmd -x "%g"'
 | 
|---|
 | 1385 |     call lineout smbconf, Indent||'add user to group script      = '||smbtools||'\groupmod.cmd -j "%g" "%u"'
 | 
|---|
 | 1386 |     call lineout smbconf, Indent||'delete user from group script = '||smbtools||'\groupmod.cmd -l "%g" "%u"'
 | 
|---|
 | 1387 | 
 | 
|---|
 | 1388 |     /* share scripts */
 | 
|---|
 | 1389 |     call lineout smbconf, ';'||Indent||'share scripts'
 | 
|---|
 | 1390 |     call lineout smbconf, Indent||'add share command = '||smbtools||'\addshare.cmd'
 | 
|---|
 | 1391 |     call lineout smbconf, Indent||'change share command = '||smbtools||'\changeshare.cmd'
 | 
|---|
 | 1392 |     call lineout smbconf, Indent||'delete share command = '||smbtools||'\delshare.cmd'
 | 
|---|
 | 1393 | 
 | 
|---|
 | 1394 |     /* other scripts */
 | 
|---|
 | 1395 |     call lineout smbconf, ';'||Indent||'other scripts'
 | 
|---|
 | 1396 |     call lineout smbconf, Indent||'enumports command = '||smbtools||'\enumports.cmd'
 | 
|---|
 | 1397 |     call lineout smbconf, Indent
 | 
|---|
 | 1398 |     call lineout smbconf
 | 
|---|
 | 1399 |     ok = stream(smbconf, 'c','close')  
 | 
|---|
 | 1400 | return
 | 
|---|
 | 1401 | 
 | 
|---|
 | 1402 | /*:VRX         _SmbConfDefault_ShareDrives
 | 
|---|
 | 1403 | */
 | 
|---|
 | 1404 | _SmbConfDefault_ShareDrives: 
 | 
|---|
 | 1405 |     DriveList = SysDriveMap('C:','Local')
 | 
|---|
 | 1406 | 
 | 
|---|
 | 1407 |     do I = 1 to words(DriveList)
 | 
|---|
 | 1408 |         CurDrive = word(DriveList,I)
 | 
|---|
 | 1409 | say CurDrive
 | 
|---|
 | 1410 |         Filesys = SysFilesystemType(Curdrive)
 | 
|---|
 | 1411 |         DriveInfo=SysDriveInfo(CurDrive)
 | 
|---|
 | 1412 |         parse var DriveInfo DrvLet CurFree CurSize CurLabel
 | 
|---|
 | 1413 | 
 | 
|---|
 | 1414 |         if FileSys = '' | FileSys = 'CDFS' then do
 | 
|---|
 | 1415 |             read_write = 'read only = Yes'
 | 
|---|
 | 1416 |         end
 | 
|---|
 | 1417 |         else do
 | 
|---|
 | 1418 |             read_write = 'read only = No'
 | 
|---|
 | 1419 |         end
 | 
|---|
 | 1420 |         if FileSys = '' then FileSys = 'CDFS'
 | 
|---|
 | 1421 |     
 | 
|---|
 | 1422 |         section    = '['left(curdrive,1)']'
 | 
|---|
 | 1423 |         comment    = 'comment = 'Drive' 'CurDrive' ('FileSys')'
 | 
|---|
 | 1424 |         path       = 'path = 'Curdrive'/'
 | 
|---|
 | 1425 |         guest_ok = 'guest ok = Yes'
 | 
|---|
 | 1426 |         hide_files = 'hide files = /*. SF/root/'
 | 
|---|
 | 1427 |    
 | 
|---|
 | 1428 |         call lineout smbconf, section
 | 
|---|
 | 1429 |         call lineout smbconf, Indent||comment   
 | 
|---|
 | 1430 |         call lineout smbconf, Indent||path      
 | 
|---|
 | 1431 |         call lineout smbconf, Indent||read_write
 | 
|---|
 | 1432 |         call lineout smbconf, Indent||guest_ok
 | 
|---|
 | 1433 |         call lineout smbconf, Indent||hide_files
 | 
|---|
 | 1434 |         call lineout smbconf, Indent    
 | 
|---|
 | 1435 |     end
 | 
|---|
 | 1436 |     ok = stream(smbconf, 'c','close')  
 | 
|---|
 | 1437 | return
 | 
|---|
 | 1438 | 
 | 
|---|
 | 1439 | /*      browsable  = 'browsable = Yes'
 | 
|---|
 | 1440 |         printable  = 'printable = No'
 | 
|---|
 | 1441 |         public     = 'public = Yes'
 | 
|---|
 | 1442 |         call lineout smbconf, Indent||browsable 
 | 
|---|
 | 1443 |         call lineout smbconf, Indent||printable 
 | 
|---|
 | 1444 |         call lineout smbconf, Indent||public    */
 | 
|---|
 | 1445 | /*:VRX         _SmbConfDefault_SharePrinters
 | 
|---|
 | 1446 | */
 | 
|---|
 | 1447 | _SmbConfDefault_SharePrinters: 
 | 
|---|
 | 1448 |     ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.') 
 | 
|---|
 | 1449 | 
 | 
|---|
 | 1450 |     do I = 1 to printers.0
 | 
|---|
 | 1451 |         queue = printers.I
 | 
|---|
 | 1452 |         name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';')
 | 
|---|
 | 1453 | 
 | 
|---|
 | 1454 | /*      call lineout samba.!printcap, queue'|'name */
 | 
|---|
 | 1455 | 
 | 
|---|
 | 1456 |         section       = '['queue']'
 | 
|---|
 | 1457 |         path          = 'path = 'ETC'\samba\spool\'queue
 | 
|---|
 | 1458 |         ok = SysMkDir(ETC'\samba\spool\'queue)
 | 
|---|
 | 1459 |         comment       = 'comment = 'name
 | 
|---|
 | 1460 |         create_mask   = 'create mask = 0700'
 | 
|---|
 | 1461 |         guest_ok = 'guest ok = Yes'
 | 
|---|
 | 1462 |         
 | 
|---|
 | 1463 |         printable     = 'printable = Yes'
 | 
|---|
 | 1464 |         print_command = 'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"'
 | 
|---|
 | 1465 |         printer_name  = 'printer name = 'queue
 | 
|---|
 | 1466 | 
 | 
|---|
 | 1467 |         call lineout smbconf, section
 | 
|---|
 | 1468 |         call lineout smbconf, Indent||comment   
 | 
|---|
 | 1469 |         call lineout smbconf, Indent||path      
 | 
|---|
 | 1470 |         call lineout smbconf, Indent||create_mask
 | 
|---|
 | 1471 |         call lineout smbconf, Indent||printable 
 | 
|---|
 | 1472 |         call lineout smbconf, Indent||print_command
 | 
|---|
 | 1473 |         call lineout smbconf, Indent||printer_name
 | 
|---|
 | 1474 |         call lineout smbconf, Indent||guest_ok
 | 
|---|
 | 1475 | 
 | 
|---|
 | 1476 |         call lineout smbconf, Indent  
 | 
|---|
 | 1477 |     
 | 
|---|
 | 1478 |     end
 | 
|---|
 | 1479 |     ok = stream(smbconf, 'c','close')  
 | 
|---|
 | 1480 |     ok = stream(samba.!printcap,'c','close')
 | 
|---|
 | 1481 | return
 | 
|---|
 | 1482 | 
 | 
|---|
 | 1483 | /*  browsable     = 'browsable = Yes'
 | 
|---|
 | 1484 |     call lineout smbconf, Indent||browsable */
 | 
|---|
 | 1485 | /*:VRX         _SmbConfLoad
 | 
|---|
 | 1486 | */
 | 
|---|
 | 1487 | _SmbConfLoad: 
 | 
|---|
 | 1488 |     IF options.!debug == 1 THEN say '_SmbConfLoad() started'
 | 
|---|
 | 1489 |     IF options.!debug == 1 THEN say '  Loading "'samba.!smbconf'" ('stream(samba.!smbconf,'c','query size')' bytes)'
 | 
|---|
 | 1490 | 
 | 
|---|
 | 1491 | /*  ok = IniEnumSections(sections., samba.!smbconf) */
 | 
|---|
 | 1492 | 
 | 
|---|
 | 1493 |     section. = ""
 | 
|---|
 | 1494 |     sections.0 = 0
 | 
|---|
 | 1495 |     call _MyIniEnumSections(samba.!smbconf)
 | 
|---|
 | 1496 | 
 | 
|---|
 | 1497 |     special = 'global printers netlogon print$ homes profiles'
 | 
|---|
 | 1498 |     Specialstatus.0 = sections.0
 | 
|---|
 | 1499 |     PrintStatus.0 = sections.0
 | 
|---|
 | 1500 |     sectionhandles.0 = sections.0
 | 
|---|
 | 1501 |     recordhandle.0 = sections.0
 | 
|---|
 | 1502 | 
 | 
|---|
 | 1503 |     do I = 1 to sections.0
 | 
|---|
 | 1504 |         IF options.!debug == 1 THEN say '  ['sections.I'] section loaded'
 | 
|---|
 | 1505 |         if wordpos(translate(sections.I),translate(special)) > 0 Then SpecialStatus.I = 1
 | 
|---|
 | 1506 |                                            Else SpecialStatus.I = 0
 | 
|---|
 | 1507 |         PrintRes = IniGet("Printable", sections.I, samba.!smbconf)
 | 
|---|
 | 1508 |         if Translate(PrintRes) = "YES" | Translate(PrintRes) = "TRUE" then PrintStatus.I = 1
 | 
|---|
 | 1509 |                                                                       else PrintStatus.I = 0
 | 
|---|
 | 1510 | 
 | 
|---|
 | 1511 |         IF options.!debug == 1 THEN say '  ['sections.I'] status (special:'SpecialStatus.I', print:'Printstatus.I')'
 | 
|---|
 | 1512 |         if Printstatus.I = 1 & SpecialStatus.I = 0 then do /* printer share */
 | 
|---|
 | 1513 |             recordhandle.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,,sections.I,"#65:PMWP.DLL")
 | 
|---|
 | 1514 |             ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"ReadOnly", 1)
 | 
|---|
 | 1515 |             IF options.!debug == 1 THEN say '  ['sections.I'] added to shared printer tree'
 | 
|---|
 | 1516 |         end
 | 
|---|
 | 1517 |         if Printstatus.I = 0 & SpecialStatus.I = 0 then do /* directory share */
 | 
|---|
 | 1518 |             recordhandle.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,,    sections.I,"#64:PMWP.DLL")
 | 
|---|
 | 1519 |             ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"ReadOnly", 1)
 | 
|---|
 | 1520 |             IF options.!debug == 1 THEN say '  ['sections.I'] added to shared folder tree'
 | 
|---|
 | 1521 |         end
 | 
|---|
 | 1522 |         if translate(sections.I) = 'PROFILES' then do
 | 
|---|
 | 1523 |             recordhandle.I = smbconf.!profiles
 | 
|---|
 | 1524 |             ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1)
 | 
|---|
 | 1525 |         end
 | 
|---|
 | 1526 |         if translate(sections.I) = 'NETLOGON' then do
 | 
|---|
 | 1527 |             recordhandle.I = smbconf.!netlogon
 | 
|---|
 | 1528 |             ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1)
 | 
|---|
 | 1529 |         end
 | 
|---|
 | 1530 |         if translate(sections.I) = 'HOMES' then do
 | 
|---|
 | 1531 |             recordhandle.I = smbconf.!homes
 | 
|---|
 | 1532 |             ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1)
 | 
|---|
 | 1533 |         end
 | 
|---|
 | 1534 |         if translate(sections.I) = 'GLOBAL' then recordhandle.I = smbconf.!global   
 | 
|---|
 | 1535 |     end 
 | 
|---|
 | 1536 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!root, "Collapsed", 0 )
 | 
|---|
 | 1537 |     IF options.!debug == 1 THEN say '_SmbConfLoad() done'
 | 
|---|
 | 1538 | return
 | 
|---|
 | 1539 | 
 | 
|---|
 | 1540 | 
 | 
|---|
 | 1541 | /*    if VRGet("DT_AlreadySmbConf","Visible") then do
 | 
|---|
 | 1542 |         smbline = strip(translate(linein(smbconf),' ','09'x))
 | 
|---|
 | 1543 | 
 | 
|---|
 | 1544 |         do while translate(left(smbline,8)) <> "[GLOBAL]"
 | 
|---|
 | 1545 |             smbline = strip(translate(linein(smbconf),' ','09'x))
 | 
|---|
 | 1546 |         end
 | 
|---|
 | 1547 | 
 | 
|---|
 | 1548 |         do until left(smbline,1) = '['
 | 
|---|
 | 1549 |             smbline = strip(translate(linein(smbconf),' ','09'x))
 | 
|---|
 | 1550 |             parse var smbline voc '=' val
 | 
|---|
 | 1551 |             voc = strip(voc)
 | 
|---|
 | 1552 |             val = strip(val)
 | 
|---|
 | 1553 |             if translate(voc) = "WORKGROUP" then do
 | 
|---|
 | 1554 |                 ok = VRset("EF_WorkGroup", "Value", val)
 | 
|---|
 | 1555 |                 ok = VRSet("EF_WorkGroup", "BackColor", "(255,255,180)")
 | 
|---|
 | 1556 |             end
 | 
|---|
 | 1557 |             if translate(voc) = "NETBIOS NAME" then do
 | 
|---|
 | 1558 |                 ok = VRset("EF_NetBIOS_Name", "Value", val)
 | 
|---|
 | 1559 |                 ok = VRSet("EF_NetBIOS_Name", "BackColor", "(255,255,180)")
 | 
|---|
 | 1560 |             end
 | 
|---|
 | 1561 |             if translate(voc) = "SERVER STRING" then do
 | 
|---|
 | 1562 |                 ok = VRset("EF_Server_String", "Value", val)
 | 
|---|
 | 1563 |                 ok = VRSet("EF_server_string", "BackColor", "(255,255,180)")
 | 
|---|
 | 1564 |             end
 | 
|---|
 | 1565 | 
 | 
|---|
 | 1566 |         end
 | 
|---|
 | 1567 |         ok = stream(smbconf, 'c','close')
 | 
|---|
 | 1568 |     end */
 | 
|---|
 | 1569 | 
 | 
|---|
 | 1570 | /*:VRX         _SmbConfMigratePeer
 | 
|---|
 | 1571 | */
 | 
|---|
 | 1572 | _SmbConfMigratePeer: 
 | 
|---|
 | 1573 |     Ok = SysFileDelete(smbconf)
 | 
|---|
 | 1574 |     /* Migrate Peer To Samba */
 | 
|---|
 | 1575 | 
 | 
|---|
 | 1576 |     /* IBMLAN.INI part */
 | 
|---|
 | 1577 |     ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
 | 
|---|
 | 1578 | 
 | 
|---|
 | 1579 |     do while translate(left(ibmlanline,11)) <> "[REQUESTER]"
 | 
|---|
 | 1580 |         ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
 | 
|---|
 | 1581 |     end
 | 
|---|
 | 1582 | 
 | 
|---|
 | 1583 |     call lineout smbconf, '[global]'
 | 
|---|
 | 1584 |     do until left(ibmlanline,1) = '['
 | 
|---|
 | 1585 |         ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
 | 
|---|
 | 1586 |         parse var ibmlanline voc '=' val
 | 
|---|
 | 1587 |         voc = strip(voc)
 | 
|---|
 | 1588 |         val = strip(val)
 | 
|---|
 | 1589 |         if translate(voc) = "DOMAIN" then do
 | 
|---|
 | 1590 |             call lineout smbconf, Indent||'workgroup = 'val
 | 
|---|
 | 1591 |         end
 | 
|---|
 | 1592 |         if translate(voc) = "COMPUTERNAME" then do
 | 
|---|
 | 1593 |             call lineout smbconf, Indent||'netbios name = 'val
 | 
|---|
 | 1594 |         end
 | 
|---|
 | 1595 |     end
 | 
|---|
 | 1596 |     do while translate(left(ibmlanline,6)) <> '[PEER]'
 | 
|---|
 | 1597 |         ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
 | 
|---|
 | 1598 |     end
 | 
|---|
 | 1599 |     do until left(ibmlanline,1) = '[' | lines(ibmlanini) = 0
 | 
|---|
 | 1600 |         ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
 | 
|---|
 | 1601 |         parse var ibmlanline voc '=' val
 | 
|---|
 | 1602 |         voc = strip(voc)
 | 
|---|
 | 1603 |         val = strip(val)
 | 
|---|
 | 1604 |         if translate(voc) = "SRVCOMMENT" then do
 | 
|---|
 | 1605 |             call lineout smbconf, Indent||'server string = 'val
 | 
|---|
 | 1606 |             call lineout smbconf, Indent||'comment = 'val
 | 
|---|
 | 1607 |         end
 | 
|---|
 | 1608 |     end
 | 
|---|
 | 1609 |     call _SmbConfDefault_Global 1 /* 1 = migration mode */
 | 
|---|
 | 1610 | 
 | 
|---|
 | 1611 |     call _SmbConfDefault_Scripts
 | 
|---|
 | 1612 |     if CreatePDC then do
 | 
|---|
 | 1613 |         call _SmbConfDefault_NetLogon
 | 
|---|
 | 1614 |         call _SmbConfDefault_Profiles
 | 
|---|
 | 1615 |     end
 | 
|---|
 | 1616 |     call _SmbConfDefault_Homes
 | 
|---|
 | 1617 | 
 | 
|---|
 | 1618 |     /* LSSHARE.INI part */
 | 
|---|
 | 1619 | 
 | 
|---|
 | 1620 |     ok = SysINI(lsshareini,"ALL:","Shares." )
 | 
|---|
 | 1621 |     SharePath.0 = shares.0
 | 
|---|
 | 1622 |     Comment.0 = shares.0
 | 
|---|
 | 1623 |     Type.0 = shares.0
 | 
|---|
 | 1624 | 
 | 
|---|
 | 1625 |     ok = VRMethod( "Application", "ListPrinters", "printer." ) 
 | 
|---|
 | 1626 | 
 | 
|---|
 | 1627 |     do I = 1 to shares.0
 | 
|---|
 | 1628 |         call lineout smbconf, '['Shares.I']'
 | 
|---|
 | 1629 |         sharepath.I = SysINI(lsshareini, shares.I, 'Path')
 | 
|---|
 | 1630 |         Type.I = c2d(left(SysINI(lsshareini, shares.I, 'Type'),1))
 | 
|---|
 | 1631 |         if Type.I = '1' then do /* We migrate a printer */
 | 
|---|
 | 1632 |             do J = 1 to printer.0
 | 
|---|
 | 1633 |                 parse var printer.J PrinterName';'PrinterQueue';'PrinterDriver
 | 
|---|
 | 1634 |                 if PrinterQueue = Sharepath.I then leave
 | 
|---|
 | 1635 |             end
 | 
|---|
 | 1636 |             call lineout smbconf, Indent||'path = '_bs2fs(ETC'\samba\spool\'printerqueue)
 | 
|---|
 | 1637 |             ok = SysMkDir(ETC'\samba\spool\'printerqueue)
 | 
|---|
 | 1638 |             call lineout smbconf, Indent||'comment = 'Printername
 | 
|---|
 | 1639 |             call lineout smbconf, Indent||'create mask = 0700'
 | 
|---|
 | 1640 |             call lineout smbconf, Indent||'printer name = 'printerqueue
 | 
|---|
 | 1641 |             call lineout smbconf, Indent||'printing = os2'
 | 
|---|
 | 1642 |             call lineout smbconf, Indent||'printable = Yes'
 | 
|---|
 | 1643 |             call lineout smbconf, Indent||'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"'
 | 
|---|
 | 1644 |             call lineout smbconf, Indent||'browseable = Yes'
 | 
|---|
 | 1645 |             call lineout smbconf, Indent||'guest ok = Yes'
 | 
|---|
 | 1646 |             call lineout smbconf, Indent||'read only = No'
 | 
|---|
 | 1647 |         end
 | 
|---|
 | 1648 |         else do /* we migrate a folder */
 | 
|---|
 | 1649 |             Comment.I = SysINI(lsshareini, shares.I, 'Remark')
 | 
|---|
 | 1650 |             call lineout smbconf, Indent||'comment = 'Comment.I
 | 
|---|
 | 1651 |             call lineout smbconf, Indent||'path = 'translate(Sharepath.I,'/','\')
 | 
|---|
 | 1652 |             call lineout smbconf, Indent||'read only = No'
 | 
|---|
 | 1653 |             call lineout smbconf, Indent||'browseable = Yes'
 | 
|---|
 | 1654 |             call lineout smbconf, Indent||'hide files = /*. SF/root/'
 | 
|---|
 | 1655 |         end
 | 
|---|
 | 1656 |         call lineout smbconf, " "
 | 
|---|
 | 1657 |     end
 | 
|---|
 | 1658 |     ok = stream(smbconf,'c','close')
 | 
|---|
 | 1659 | return
 | 
|---|
 | 1660 | 
 | 
|---|
 | 1661 | /*:VRX         _SmbConfRestore
 | 
|---|
 | 1662 | */
 | 
|---|
 | 1663 | _SmbConfRestore: 
 | 
|---|
 | 1664 |     ok = VRCopyFile( SmbConf"-backup", SmbConf)
 | 
|---|
 | 1665 | return
 | 
|---|
 | 1666 | 
 | 
|---|
 | 1667 | /*:VRX         _SmbConfShareRemove
 | 
|---|
 | 1668 | */
 | 
|---|
 | 1669 | _SmbConfShareRemove: 
 | 
|---|
 | 1670 |     Aborted = 0
 | 
|---|
 | 1671 |     ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "SelectedHandle." ) 
 | 
|---|
 | 1672 |     if Selectedhandle.0 = 0 then return
 | 
|---|
 | 1673 |     Msg.Title = NLVGetMessage(67)
 | 
|---|
 | 1674 |     do I = 1 to sections.0
 | 
|---|
 | 1675 |         if recordhandle.I = SelectedHandle.1 then do
 | 
|---|
 | 1676 |             if recordhandle.I = smbconf.!homes | recordhandle.I = smbconf.!global then do
 | 
|---|
 | 1677 |                 Msg.Text = NLVGetMessage(61, Sections.I)
 | 
|---|
 | 1678 |                 Msg.Type = 'E'
 | 
|---|
 | 1679 |                 call _ShowMsg
 | 
|---|
 | 1680 |                 Aborted = 1
 | 
|---|
 | 1681 |                 return
 | 
|---|
 | 1682 |             end
 | 
|---|
 | 1683 | 
 | 
|---|
 | 1684 |             Msg.Text = NLVGetMessage(62, Sections.I)
 | 
|---|
 | 1685 |             Msg.Type = "Q"
 | 
|---|
 | 1686 |             ok = _MsgYesNo()
 | 
|---|
 | 1687 |             if ok = 2 then return
 | 
|---|
 | 1688 | 
 | 
|---|
 | 1689 |             NewSmbConf = TempDir'smb.conf'
 | 
|---|
 | 1690 |             ok = SysFileDelete(NewSmbConf)
 | 
|---|
 | 1691 |             smbline = strip(linein(smbconf))
 | 
|---|
 | 1692 |             do while left(translate(smbline),length(sections.I)+2) <> translate('['sections.I']')
 | 
|---|
 | 1693 |                 call lineout NewSmbConf, smbline
 | 
|---|
 | 1694 |                 smbline = strip(linein(smbconf))
 | 
|---|
 | 1695 |             end
 | 
|---|
 | 1696 |             smbline = strip(linein(smbconf))
 | 
|---|
 | 1697 |             do while left(translate(smbline),1) <> '[' & lines(smbconf) <> 0
 | 
|---|
 | 1698 |                 smbline = strip(linein(smbconf))
 | 
|---|
 | 1699 |             end
 | 
|---|
 | 1700 |             do until lines(smbconf) = 0
 | 
|---|
 | 1701 |                 call lineout NewSmbConf, smbline
 | 
|---|
 | 1702 |                 smbline = strip(linein(smbconf))
 | 
|---|
 | 1703 |             end
 | 
|---|
 | 1704 |             call lineout NewSmbConf, smbline
 | 
|---|
 | 1705 |             ok = stream(smbconf, 'c', 'close')
 | 
|---|
 | 1706 |             ok = stream(Newsmbconf, 'c', 'close')
 | 
|---|
 | 1707 |             ok = VRCopyFile( NewSmbConf, smbconf )
 | 
|---|
 | 1708 |         end
 | 
|---|
 | 1709 |     end
 | 
|---|
 | 1710 |     call _SmbConfTreeReset
 | 
|---|
 | 1711 | 
 | 
|---|
 | 1712 |     if _SambaRunning() then do
 | 
|---|
 | 1713 |         Msg.Text = NLVGetMessage(69)
 | 
|---|
 | 1714 |         Msg.Type = 'I'
 | 
|---|
 | 1715 |         call _ShowMsg
 | 
|---|
 | 1716 |     end
 | 
|---|
 | 1717 | return
 | 
|---|
 | 1718 | 
 | 
|---|
 | 1719 | /*:VRX         _SmbConfShareRename
 | 
|---|
 | 1720 | */
 | 
|---|
 | 1721 | _SmbConfShareRename: 
 | 
|---|
 | 1722 |     Aborted = 0
 | 
|---|
 | 1723 |     ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "SelectedHandle." ) 
 | 
|---|
 | 1724 |     if Selectedhandle.0 = 0 then return
 | 
|---|
 | 1725 | 
 | 
|---|
 | 1726 |     do I = 1 to sections.0
 | 
|---|
 | 1727 |         if recordhandle.I = SelectedHandle.1 then do
 | 
|---|
 | 1728 |             if recordhandle.I = smbconf.!homes | recordhandle.I = smbconf.!global then do
 | 
|---|
 | 1729 |                 Msg.Text = NLVGetMessage(66, Sections.I)
 | 
|---|
 | 1730 |                 Msg.Type = 'E'
 | 
|---|
 | 1731 |                 call _ShowMsg
 | 
|---|
 | 1732 |                 Aborted = 1
 | 
|---|
 | 1733 |                 return
 | 
|---|
 | 1734 |             end
 | 
|---|
 | 1735 |             Buttons.1 = NLVGetMessage(2)
 | 
|---|
 | 1736 |             Buttons.2 = NLVGetMessage(3)
 | 
|---|
 | 1737 |             Buttons.0 = 2
 | 
|---|
 | 1738 |             NewShareName = Sections.I
 | 
|---|
 | 1739 |             id = VRPrompt( VRWindow(), NLVGetMessage(66), "NewShareName", NLVGetMessage(68), "Buttons.", buttons.1, buttons.2 )
 | 
|---|
 | 1740 |             if ID = 2 | NewShareName = "" then return
 | 
|---|
 | 1741 |         
 | 
|---|
 | 1742 |             NewSmbConf = TempDir'smb.conf'
 | 
|---|
 | 1743 |             ok = SysFileDelete(NewSmbConf)
 | 
|---|
 | 1744 |             smbline = strip(linein(smbconf))
 | 
|---|
 | 1745 |             do while left(translate(smbline),length(sections.I)+2) <> translate('['sections.I']')
 | 
|---|
 | 1746 |                 call lineout NewSmbConf, smbline
 | 
|---|
 | 1747 |                 smbline = strip(linein(smbconf))
 | 
|---|
 | 1748 |             end
 | 
|---|
 | 1749 |             call lineout NewSmbConf, '['NewShareName']'
 | 
|---|
 | 1750 |             smbline = strip(linein(smbconf))
 | 
|---|
 | 1751 |             do until lines(smbconf) = 0
 | 
|---|
 | 1752 |                 call lineout NewSmbConf, smbline
 | 
|---|
 | 1753 |                 smbline = strip(linein(smbconf))
 | 
|---|
 | 1754 |             end
 | 
|---|
 | 1755 |             call lineout NewSmbConf, smbline
 | 
|---|
 | 1756 |             ok = stream(smbconf, 'c', 'close')
 | 
|---|
 | 1757 |             ok = stream(Newsmbconf, 'c', 'close')
 | 
|---|
 | 1758 |             ok = VRCopyFile( NewSmbConf, smbconf )
 | 
|---|
 | 1759 |         end
 | 
|---|
 | 1760 |     end
 | 
|---|
 | 1761 |     call _SmbConfTreeReset
 | 
|---|
 | 1762 | 
 | 
|---|
 | 1763 |     if _SambaRunning() then do
 | 
|---|
 | 1764 |         Msg.Text = NLVGetMessage(69)
 | 
|---|
 | 1765 |         Msg.Type = 'I'
 | 
|---|
 | 1766 |         call _ShowMsg
 | 
|---|
 | 1767 |     end
 | 
|---|
 | 1768 | return
 | 
|---|
 | 1769 | 
 | 
|---|
 | 1770 | /*:VRX         _SmbConfTreeInit
 | 
|---|
 | 1771 | */
 | 
|---|
 | 1772 | _SmbConfTreeInit: 
 | 
|---|
 | 1773 |     IF options.!debug == 1 THEN say '_SmbConfTreeInit() started.'
 | 
|---|
 | 1774 |     call _CfgPageSetupSize "GB_Help"
 | 
|---|
 | 1775 |     call _CfgPageSetupSize "GB_Global"
 | 
|---|
 | 1776 |     call _CfgPageSetupSize "GB_Shares"
 | 
|---|
 | 1777 |     IF options.!debug == 1 THEN say '  Page setup done.'
 | 
|---|
 | 1778 | 
 | 
|---|
 | 1779 |     ok = VRMethod("CN_smbconf", "RemoveRecord", "ALL")
 | 
|---|
 | 1780 |     smbconf.!root     = VRMethod( "CN_smbconf", "AddRecord",,, "smb.conf","#33:PMWP.DLL")
 | 
|---|
 | 1781 |     smbconf.!global   = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Global","#33:PMWP.DLL")
 | 
|---|
 | 1782 |     smbconf.!homes    = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Homes","#33:PMWP.DLL")
 | 
|---|
 | 1783 |     smbconf.!netlogon = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Netlogon","#33:PMWP.DLL")
 | 
|---|
 | 1784 |     smbconf.!profiles = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Profiles","#33:PMWP.DLL")
 | 
|---|
 | 1785 |     smbconf.!printers = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, NLVGetMessage(45),"#93:PMWP.DLL")
 | 
|---|
 | 1786 |     smbconf.!dirs     = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, NLVGetMessage(46),"#27:PMWP.DLL")
 | 
|---|
 | 1787 |     IF options.!debug == 1 THEN say '  smb.conf sections created.'
 | 
|---|
 | 1788 | 
 | 
|---|
 | 1789 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!netlogon, "Visible", 0 , "ReadOnly", 1)
 | 
|---|
 | 1790 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!profiles, "Visible", 0 , "ReadOnly", 1)
 | 
|---|
 | 1791 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!homes,    "Visible", 0 , "ReadOnly", 1)
 | 
|---|
 | 1792 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!root,     "Collapsed",1, "ReadOnly", 1 )
 | 
|---|
 | 1793 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!global,   "ReadOnly", 1)
 | 
|---|
 | 1794 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "ReadOnly", 1)
 | 
|---|
 | 1795 |     ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs,     "ReadOnly", 1)
 | 
|---|
 | 1796 | 
 | 
|---|
 | 1797 |     IF options.!debug == 1 THEN say '  visibility set.'
 | 
|---|
 | 1798 |     IF options.!debug == 1 THEN say '_SmbConfTreeInit() done.'
 | 
|---|
 | 1799 | return
 | 
|---|
 | 1800 | 
 | 
|---|
 | 1801 | /*:VRX         _SmbConfTreeReset
 | 
|---|
 | 1802 | */
 | 
|---|
 | 1803 | _SmbConfTreeReset: 
 | 
|---|
 | 1804 |     call _SharesReset
 | 
|---|
 | 1805 |     ok = VRMethod( "CN_SmbConf", "RemoveRecord", smbconf.!root ) 
 | 
|---|
 | 1806 |     call _SmbConfTreeInit
 | 
|---|
 | 1807 |     call _GUIInit
 | 
|---|
 | 1808 | return
 | 
|---|
 | 1809 | 
 | 
|---|
 | 1810 | /*:VRX         _SmbUserMapCreate
 | 
|---|
 | 1811 | */
 | 
|---|
 | 1812 | _SmbUserMapCreate: 
 | 
|---|
 | 1813 |     call lineout samba.!smbusermap, '# Created by SSCC version 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time()
 | 
|---|
 | 1814 |     call lineout samba.!smbusermap, '# syntax:'
 | 
|---|
 | 1815 |     call lineout samba.!smbusermap, '# Samba username = Windows username'
 | 
|---|
 | 1816 |     call lineout samba.!smbusermap, 'root = Administrator'
 | 
|---|
 | 1817 |     ok = stream(samba.!smbusermap,'c','close')
 | 
|---|
 | 1818 | return
 | 
|---|
 | 1819 | 
 | 
|---|
 | 1820 | /*:VRX         About_Close
 | 
|---|
 | 1821 | */
 | 
|---|
 | 1822 | About_Close: 
 | 
|---|
 | 1823 |     call About_Fini
 | 
|---|
 | 1824 | return
 | 
|---|
 | 1825 | 
 | 
|---|
 | 1826 | /*:VRX         About_Create
 | 
|---|
 | 1827 | */
 | 
|---|
 | 1828 | About_Create: 
 | 
|---|
 | 1829 |     call About_Init
 | 
|---|
 | 1830 |     ok = VRSet("About","Caption", NLVGetMessage(31))
 | 
|---|
 | 1831 |     ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2))
 | 
|---|
| [859] | 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'
 | 
|---|
| [303] | 1842 |     ok = VRSet("About","Font", VRGet("GB_Help2","Font"))
 | 
|---|
 | 1843 |     ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
 | 
|---|
 | 1844 |     ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(72))
 | 
|---|
 | 1845 |     ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
 | 
|---|
 | 1846 | return
 | 
|---|
 | 1847 | 
 | 
|---|
 | 1848 | /*:VRX         About_Fini
 | 
|---|
 | 1849 | */
 | 
|---|
 | 1850 | About_Fini: 
 | 
|---|
 | 1851 |     window = VRInfo( "Window" )
 | 
|---|
 | 1852 |     call VRDestroy window
 | 
|---|
 | 1853 |     drop window
 | 
|---|
 | 1854 | return
 | 
|---|
 | 1855 | /*:VRX         About_Init
 | 
|---|
 | 1856 | */
 | 
|---|
 | 1857 | About_Init: 
 | 
|---|
 | 1858 |     window = VRInfo( "Object" )
 | 
|---|
 | 1859 |     if( \VRIsChildOf( window, "Notebook" ) ) then do
 | 
|---|
 | 1860 |         call VRMethod window, "CenterWindow"
 | 
|---|
 | 1861 |         call VRSet window, "Visible", 1
 | 
|---|
 | 1862 |         call VRMethod window, "Activate"
 | 
|---|
 | 1863 |     end
 | 
|---|
 | 1864 |     drop window
 | 
|---|
 | 1865 | return
 | 
|---|
 | 1866 | 
 | 
|---|
 | 1867 | /*:VRX         CB_Browseable_Click
 | 
|---|
 | 1868 | */
 | 
|---|
 | 1869 | CB_Browseable_Click: 
 | 
|---|
 | 1870 |     call _ShareObject_Changed
 | 
|---|
 | 1871 | return
 | 
|---|
 | 1872 | 
 | 
|---|
 | 1873 | /*:VRX         CB_EA_Support_Click
 | 
|---|
 | 1874 | */
 | 
|---|
 | 1875 | CB_EA_Support_Click: 
 | 
|---|
 | 1876 |     call _ShareObject_Changed
 | 
|---|
 | 1877 | return
 | 
|---|
 | 1878 | 
 | 
|---|
 | 1879 | /*:VRX         CB_Guest_OK_Click
 | 
|---|
 | 1880 | */
 | 
|---|
 | 1881 | CB_Guest_OK_Click: 
 | 
|---|
 | 1882 |     call _ShareObject_Changed
 | 
|---|
 | 1883 | return
 | 
|---|
 | 1884 | 
 | 
|---|
 | 1885 | /*:VRX         CB_LM_Announce_Click
 | 
|---|
 | 1886 | */
 | 
|---|
 | 1887 | CB_LM_Announce_Click: 
 | 
|---|
 | 1888 |     call _ShareObject_Changed
 | 
|---|
 | 1889 | return
 | 
|---|
 | 1890 | 
 | 
|---|
 | 1891 | /*:VRX         CB_Null_passwords_Click
 | 
|---|
 | 1892 | */
 | 
|---|
 | 1893 | CB_Null_passwords_Click: 
 | 
|---|
 | 1894 |     call _ShareObject_Changed
 | 
|---|
 | 1895 | return
 | 
|---|
 | 1896 | 
 | 
|---|
 | 1897 | /*:VRX         CB_Read_Only_Click
 | 
|---|
 | 1898 | */
 | 
|---|
 | 1899 | CB_Read_Only_Click: 
 | 
|---|
 | 1900 |     call _ShareObject_Changed
 | 
|---|
 | 1901 | return
 | 
|---|
 | 1902 | 
 | 
|---|
| [451] | 1903 | /*:VRX         CB_RemoveSmbConf_Click
 | 
|---|
 | 1904 | */
 | 
|---|
 | 1905 | CB_RemoveSmbConf_Click: 
 | 
|---|
 | 1906 |     ok = VRSet("CB_RemoveBackend", "Enabled", VRGet("CB_RemoveSmbConf","set"))
 | 
|---|
 | 1907 |     if VRGet("CB_RemoveBackend", "Enabled") = 0 then ok = VRSet("CB_RemoveBackend", "Set", 0)
 | 
|---|
 | 1908 | return
 | 
|---|
 | 1909 | 
 | 
|---|
| [303] | 1910 | /*:VRX         CB_Store_DOS_attributes_Click
 | 
|---|
 | 1911 | */
 | 
|---|
 | 1912 | CB_Store_DOS_attributes_Click: 
 | 
|---|
 | 1913 |     call _ShareObject_Changed
 | 
|---|
 | 1914 | return
 | 
|---|
 | 1915 | 
 | 
|---|
 | 1916 | /*:VRX         CB_Time_Server_Click
 | 
|---|
 | 1917 | */
 | 
|---|
 | 1918 | CB_Time_Server_Click: 
 | 
|---|
 | 1919 |     call _ShareObject_Changed
 | 
|---|
 | 1920 | return
 | 
|---|
 | 1921 | 
 | 
|---|
 | 1922 | /*:VRX         CB_WINS_Support_Click
 | 
|---|
 | 1923 | */
 | 
|---|
 | 1924 | CB_WINS_Support_Click: 
 | 
|---|
 | 1925 |     call _ShareObject_Changed
 | 
|---|
 | 1926 | return
 | 
|---|
 | 1927 | 
 | 
|---|
 | 1928 | /*:VRX         CN_smbconf_Click
 | 
|---|
 | 1929 | */
 | 
|---|
 | 1930 | CN_smbconf_Click: 
 | 
|---|
 | 1931 |     IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() started'
 | 
|---|
 | 1932 |     IF options.!debug == 1 THEN SAY '  Using 'smbconf' ('stream(smbconf,'c','query size')' bytes)'
 | 
|---|
 | 1933 |     if ValueChanged then do
 | 
|---|
 | 1934 |         if CurSection <> "" then do
 | 
|---|
 | 1935 |             Msg.Title = NLVGetMessage('1')
 | 
|---|
 | 1936 |             Msg.Text  = NLVGetMessage(60, CurSection)
 | 
|---|
 | 1937 |             ok = _MsgYesNo()
 | 
|---|
 | 1938 |             if ok = 1 then call _SaveChanges
 | 
|---|
 | 1939 |             CurSection = ""
 | 
|---|
 | 1940 |         end
 | 
|---|
 | 1941 |     end
 | 
|---|
 | 1942 | 
 | 
|---|
 | 1943 |     Ok = VRset("Main", "Painting", 0)
 | 
|---|
 | 1944 |     ok = VRset("GB_Help",      "Visible", 0)
 | 
|---|
 | 1945 |     ok = VRset("GB_Global",    "Visible", 0)
 | 
|---|
 | 1946 |     ok = VRset("GB_Shares",    "Visible", 0)
 | 
|---|
 | 1947 | 
 | 
|---|
 | 1948 |     ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "Prophandle." )
 | 
|---|
 | 1949 |     if PropHandle.0 = 0 then do
 | 
|---|
 | 1950 |         IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() aborted, no handle'
 | 
|---|
| [451] | 1951 |         Ok = VRset("Main", "Painting", 1)
 | 
|---|
| [303] | 1952 |         return
 | 
|---|
 | 1953 |     end
 | 
|---|
 | 1954 |     ParentHandle = VRMethod("CN_smbconf","GetRecordAttr", Prophandle.1,"Parent")
 | 
|---|
 | 1955 | 
 | 
|---|
 | 1956 |     if Prophandle.1 = smbconf.!root          then ok = VRset("GB_Help",      "Visible", 1)
 | 
|---|
 | 1957 |     if Prophandle.1 = smbconf.!global   | Parenthandle = smbconf.!global   then call _ActiveGroup "Global"
 | 
|---|
 | 1958 |     if Prophandle.1 = smbconf.!homes    | Parenthandle = smbconf.!homes    then call _ActiveGroup "Shares"
 | 
|---|
 | 1959 |     if Prophandle.1 = smbconf.!netlogon | Parenthandle = smbconf.!netlogon then call _ActiveGroup "Shares"
 | 
|---|
 | 1960 |     if Prophandle.1 = smbconf.!profiles | Parenthandle = smbconf.!profiles then call _ActiveGroup "Shares"
 | 
|---|
 | 1961 |     if Prophandle.1 = smbconf.!dirs     then call _ActiveGroup "Help"
 | 
|---|
 | 1962 |     if Prophandle.1 = smbconf.!printers then call _ActiveGroup "Help"
 | 
|---|
 | 1963 |     if Parenthandle = smbconf.!dirs     then call _ActiveGroup "Shares"
 | 
|---|
 | 1964 |     if Parenthandle = smbconf.!printers then call _ActiveGroup "Shares"
 | 
|---|
 | 1965 | 
 | 
|---|
 | 1966 |     call _SharesReset
 | 
|---|
 | 1967 |     Ok = VRset("Main", "Painting", 1)
 | 
|---|
 | 1968 | 
 | 
|---|
 | 1969 |     ok = VRSet("TM_Value", "Enabled", 1)
 | 
|---|
 | 1970 |     if Prophandle.1 = smbconf.!root | Prophandle.1 = smbconf.!dirs | Prophandle.1 = smbconf.!printers then do
 | 
|---|
 | 1971 |         IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() aborted, got parent handle'
 | 
|---|
| [451] | 1972 |         Ok = VRset("Main", "Painting", 1)
 | 
|---|
| [303] | 1973 |         return
 | 
|---|
 | 1974 |     end
 | 
|---|
 | 1975 |     IF options.!debug == 1 THEN SAY '  Got child handle, start populating now'
 | 
|---|
 | 1976 |     ObjYPos = 1280+361+72-120
 | 
|---|
 | 1977 |     ObjXPos = 1325+72
 | 
|---|
 | 1978 |     ObjDelta= 380
 | 
|---|
 | 1979 |     CreatedObjs.0 = 0
 | 
|---|
 | 1980 |     Objs = 0
 | 
|---|
 | 1981 | 
 | 
|---|
 | 1982 |     Page = 1 /* for global */
 | 
|---|
 | 1983 | 
 | 
|---|
 | 1984 |     do I = 1 to sections.0
 | 
|---|
 | 1985 |         if Prophandle.1 <> recordhandle.I then iterate
 | 
|---|
 | 1986 | 
 | 
|---|
 | 1987 |         Ok = VRset("Main", "Painting", 0)
 | 
|---|
 | 1988 |         CurSection = sections.I
 | 
|---|
 | 1989 |         CurSIdx = I
 | 
|---|
 | 1990 |         upCurSection = translate(CurSection)
 | 
|---|
 | 1991 |         IF options.!debug == 1 THEN SAY '  Section ['sections.I']'
 | 
|---|
 | 1992 | 
 | 
|---|
 | 1993 |         if upCurSection = 'GLOBAL' then do
 | 
|---|
 | 1994 |             ObjYPos = 1605+-120+361+361+361+361+361+361
 | 
|---|
 | 1995 |             ObjXPos = 1325
 | 
|---|
 | 1996 |             ObjDelta = 320
 | 
|---|
| [451] | 1997 |             if Page = 1 then do
 | 
|---|
 | 1998 |                 if \VRIsValidObject("GB_"ActiveGroup"_1") then do
 | 
|---|
 | 1999 |                         ActiveGroupObj = VRCreate("GB_Global", "Window", "Name", "GL_GLOBAL_"Page, "Height", 1500, "Width", 1500, "Visible", 0, "Font", "9.WarpSans")
 | 
|---|
 | 2000 |                         IF options.!debug == 1 THEN say '  Neues Fenster VRCreate = 'ok
 | 
|---|
 | 2001 |                         ok = VRLoad( "GB_Global", VRWindowPath(), "GL_GLOBAL_"Page )
 | 
|---|
 | 2002 |                         IF options.!debug == 1 THEN say '  VRLoad = 'ok
 | 
|---|
 | 2003 |                         ok = VRMethod("GB_Global", "InsertPage", "GL_GLOBAL_"Page, "+"Page)
 | 
|---|
 | 2004 |                         IF options.!debug == 1 THEN  say '  InsertPage = 'ok
 | 
|---|
 | 2005 | 
 | 
|---|
 | 2006 | /*                    ok = VRset("Main", "Painting", 1)
 | 
|---|
 | 2007 |                     Msg.Text = NLVGetMessage(114)
 | 
|---|
 | 2008 |                     Msg.Type = "I"
 | 
|---|
 | 2009 |                     call _ShowMsg
 | 
|---|
 | 2010 |                     return */
 | 
|---|
 | 2011 |                 end
 | 
|---|
 | 2012 |                 ActiveGroupObj = VRGet("GB_"ActiveGroup"_1", "Self")
 | 
|---|
 | 2013 |             end
 | 
|---|
| [303] | 2014 |         end
 | 
|---|
 | 2015 |         else do
 | 
|---|
| [451] | 2016 |             if \VRIsValidObject("GB_"ActiveGroup) then do
 | 
|---|
 | 2017 |                 ok = VRset("Main", "Painting", 1)
 | 
|---|
 | 2018 |                 Msg.Text = NLVGetMessage(114)
 | 
|---|
 | 2019 |                 Msg.Type = "I"
 | 
|---|
 | 2020 |                 call _ShowMsg
 | 
|---|
 | 2021 |                 return
 | 
|---|
 | 2022 |             end
 | 
|---|
| [303] | 2023 |             ActiveGroupObj = "GB_"ActiveGroup
 | 
|---|
 | 2024 |             ok = VRSet("DT_"ActiveGroup,"Caption",sections.I)
 | 
|---|
 | 2025 |         end            
 | 
|---|
 | 2026 |         say "CurSection="CurSection
 | 
|---|
 | 2027 |         say "smbconf="smbconf
 | 
|---|
 | 2028 | 
 | 
|---|
 | 2029 |      /* ok = IniEnum("Voc", hdl) */ /* Old command: Fill the Voc stem with vocabulary */
 | 
|---|
 | 2030 | 
 | 
|---|
 | 2031 |         call _MyIniEnum(CurSection)
 | 
|---|
 | 2032 | 
 | 
|---|
 | 2033 |         if upCurSection <> 'GLOBAL' then do
 | 
|---|
 | 2034 |             ok = VRSet("CB_Read_Only", "set", 1)
 | 
|---|
 | 2035 |         end
 | 
|---|
 | 2036 |         do V = 1 to Voc.0  /* loop for every vocabulary */
 | 
|---|
 | 2037 |             ValueChanged = 0
 | 
|---|
 | 2038 |             ChangeList = ""
 | 
|---|
 | 2039 | 
 | 
|---|
 | 2040 |          /* get value for this vocabulary */                
 | 
|---|
 | 2041 |            Val.V = IniGet(Voc.V, CurSection, samba.!smbconf) /* this is currently done by _MyIniEnum (which is probably not good) */
 | 
|---|
 | 2042 |             select
 | 
|---|
 | 2043 |                 when pos("\\",Val.V) > 0 then nop
 | 
|---|
 | 2044 |                 when pos(" dir",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
 | 
|---|
 | 2045 |                 when pos("file",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
 | 
|---|
 | 2046 |                 when pos("path",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
 | 
|---|
 | 2047 |                 when pos("username map",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
 | 
|---|
 | 2048 |                 otherwise nop /* do not beautify */
 | 
|---|
 | 2049 |             end
 | 
|---|
 | 2050 | 
 | 
|---|
 | 2051 |             IF options.!debug == 1 THEN say '  Process: "'Voc.V'" = "'Val.V'"'
 | 
|---|
 | 2052 | 
 | 
|---|
 | 2053 |             /* Proper format to ease checking and object creation */
 | 
|---|
 | 2054 |             upVal = translate(Val.V)
 | 
|---|
 | 2055 |             upVoc = translate(translate(Voc.V,'_',' '))
 | 
|---|
 | 2056 | 
 | 
|---|
 | 2057 |             if upVal = 'YES'| upVal = 'NO'
 | 
|---|
 | 2058 |                 then VocObjType = 'CB'
 | 
|---|
 | 2059 |                 else VocObjType = 'EF'
 | 
|---|
 | 2060 | 
 | 
|---|
 | 2061 |             /* Non configurable items */
 | 
|---|
 | 2062 |             if upVoc = "PRINTABLE" then iterate
 | 
|---|
 | 2063 |             if pos('SCRIPT', upVoc)  > 0 then iterate
 | 
|---|
 | 2064 |             if pos('COMMAND', upVoc)  > 0 then iterate
 | 
|---|
 | 2065 | 
 | 
|---|
 | 2066 |             if upVoc = "COMMENT" then do
 | 
|---|
 | 2067 |                 CurPage = Page
 | 
|---|
 | 2068 |                 CurActiveGroupObj = ActiveGroupObj
 | 
|---|
 | 2069 |                 if Page <> 1 then ActiveGroupObj = VRGet("GB_"ActiveGroup"_1", "Self")
 | 
|---|
 | 2070 |                 OldObjYPos = ObjYPos
 | 
|---|
 | 2071 |                 if upCurSection = "GLOBAL" then ObjYPos = 860-120
 | 
|---|
 | 2072 |                                            else ObjYPos = 860+361+72
 | 
|---|
 | 2073 |                 if _CreateVocObject() then do
 | 
|---|
 | 2074 |                     ok = VRSet(VocObjType"_"upVoc, 'Value', Val.V)
 | 
|---|
 | 2075 |                     ok = VRFlush( , VocObjType"_"upVoc ) 
 | 
|---|
 | 2076 |                 end
 | 
|---|
 | 2077 |                 ActiveGroupObj = CurActiveGroupObj
 | 
|---|
 | 2078 |                 Page = CurPage
 | 
|---|
 | 2079 |                 ObjYPos = OldObjYPos
 | 
|---|
 | 2080 |             end
 | 
|---|
 | 2081 |             else do /* Normalfall */
 | 
|---|
 | 2082 |                 if _CreateVocObject() then do
 | 
|---|
 | 2083 |                     if upVal = "YES" | upVal = "NO" then do
 | 
|---|
 | 2084 |                         ok = VRset(VocObjType"_"upVoc,"Set", (upVal="YES"))
 | 
|---|
 | 2085 |                         ok = VRFlush( , VocObjType"_"upVoc ) 
 | 
|---|
 | 2086 |                     end
 | 
|---|
 | 2087 |                     else do
 | 
|---|
 | 2088 |                         ok = VRSet(VocObjType"_"upVoc, 'Value', Val.V)
 | 
|---|
 | 2089 |                         ok = VRFlush( , VocObjType"_"upVoc )
 | 
|---|
 | 2090 |                         if translate(VocObjType"_"upVoc) = VocObjType"_PRINTER_NAME" then do
 | 
|---|
 | 2091 |                             ok = VRSet(VocObjType"_"upVoc, 'ReadOnly', 1)
 | 
|---|
 | 2092 |                             ok = VRSet(VocObjType"_"upVoc, 'BackColor', 'PaleGray')
 | 
|---|
 | 2093 |                         end
 | 
|---|
 | 2094 |                     end
 | 
|---|
 | 2095 |                 end   
 | 
|---|
 | 2096 |                 nop
 | 
|---|
 | 2097 |             end
 | 
|---|
 | 2098 |             ok = VRSet(VocObjType"_"upVoc, 'Userdata', V)
 | 
|---|
 | 2099 | 
 | 
|---|
 | 2100 |             if upCurSection = 'GLOBAL' then do
 | 
|---|
 | 2101 |                 if upVoc = "WINBIND_SEPARATOR" then do /* Workaround for Samba Ticket #57 */
 | 
|---|
 | 2102 |                     ok = VRset("DT_WINBIND_SEPARATOR","Visible","0")
 | 
|---|
 | 2103 |                     ok = VRset("EF_WINBIND_SEPARATOR","Value","|")
 | 
|---|
 | 2104 |                     ok = VRFlush( , "EF_WINBIND_SEPARATOR" )
 | 
|---|
 | 2105 |                     ok = VRset("EF_WINBIND_SEPARATOR","Visible",0)
 | 
|---|
 | 2106 |                     ObjYPos = ObjYPos - ObjDelta
 | 
|---|
 | 2107 |                 end
 | 
|---|
 | 2108 | 
 | 
|---|
 | 2109 |                 if ObjYPos > VRGet("GB_Global","Height") - 1200 then do
 | 
|---|
 | 2110 |                     /* Ok = VRset("Main", "Painting", 1) */
 | 
|---|
 | 2111 |                     Page = Page + 1
 | 
|---|
 | 2112 |                     if Page = 2 then do
 | 
|---|
 | 2113 |                         Ok = VRset("Main", "Painting", 1)
 | 
|---|
 | 2114 |                         ok = VRSet("Main", 'Pointer', 'Wait' )
 | 
|---|
 | 2115 |                         Ok = VRset("Main", "Painting", 0)
 | 
|---|
 | 2116 |                     end
 | 
|---|
 | 2117 |                     if \VRIsValidOBject("GL_GLOBAL_"Page) then do
 | 
|---|
 | 2118 |                         ActiveGroupObj = VRCreate("GB_Global", "Window", "Name", "GL_GLOBAL_"Page, "Height", 1500, "Width", 1500, "Visible", 0, "Font", "9.WarpSans")
 | 
|---|
 | 2119 |                         IF options.!debug == 1 THEN say '  Neues Fenster VRCreate = 'ok
 | 
|---|
 | 2120 |                         ok = VRLoad( "GB_Global", VRWindowPath(), "GL_GLOBAL_"Page )
 | 
|---|
 | 2121 |                         IF options.!debug == 1 THEN say '  VRLoad = 'ok
 | 
|---|
 | 2122 |                         ok = VRMethod("GB_Global", "InsertPage", "GL_GLOBAL_"Page, "+"Page)
 | 
|---|
 | 2123 |                         IF options.!debug == 1 THEN  say '  InsertPage = 'ok
 | 
|---|
 | 2124 |                     end
 | 
|---|
 | 2125 |                     else do
 | 
|---|
 | 2126 |                         ActiveGroupObj = VRGet("GL_GLOBAL_"Page, "Self")
 | 
|---|
 | 2127 |                     end
 | 
|---|
 | 2128 |                     ObjYPos = 0
 | 
|---|
 | 2129 |                     IF options.!debug == 1 THEN say "  Page ="page
 | 
|---|
 | 2130 |                     /* Ok = VRset("Main", "Painting", 0) */
 | 
|---|
 | 2131 |                 end
 | 
|---|
 | 2132 |             end
 | 
|---|
 | 2133 |         end
 | 
|---|
 | 2134 |     end     
 | 
|---|
| [451] | 2135 |     if upCurSection = "GLOBAL" then do
 | 
|---|
 | 2136 |         if VRGet("EF_Netbios_name","Value") = "" then do
 | 
|---|
 | 2137 |             ok = VRset("EF_NETBIOS_NAME","Value",Value("HOSTNAME",,"OS2ENVIRONMENT"))
 | 
|---|
 | 2138 |             ok = VRFlush( , "EF_NETBIOS_NAME" ) 
 | 
|---|
 | 2139 |         end
 | 
|---|
 | 2140 |         if VRGet("EF_WorkGroup","Value") = "" then do
 | 
|---|
 | 2141 |             ok = VRset("EF_WorkGroup","Value","WORKGROUP")
 | 
|---|
 | 2142 |             ok = VRFlush( , "EF_WorkGroup" ) 
 | 
|---|
 | 2143 |         end
 | 
|---|
| [303] | 2144 |     end
 | 
|---|
 | 2145 | 
 | 
|---|
 | 2146 |     Ok = VRset("Main", "Painting", 1)
 | 
|---|
 | 2147 |     ok = VRSet("Main", 'Pointer', '<default>' )
 | 
|---|
 | 2148 |     IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() done'
 | 
|---|
 | 2149 | return
 | 
|---|
 | 2150 | /*:VRX         CN_smbconf_ContextMenu
 | 
|---|
 | 2151 | */
 | 
|---|
 | 2152 | CN_smbconf_ContextMenu: 
 | 
|---|
 | 2153 |     ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "Prophandle." )
 | 
|---|
 | 2154 |     if PropHandle.0 = 0 then return
 | 
|---|
 | 2155 |     ParentHandle = VRMethod("CN_smbconf","GetRecordAttr", Prophandle.1,"Parent")
 | 
|---|
 | 2156 |     ok = VRset("Menu_ShareContext_AddPrinter",    "Visible", 0)    
 | 
|---|
 | 2157 |     ok = VRset("Menu_ShareContext_RenamePrinter", "Visible", 0)    
 | 
|---|
 | 2158 |     ok = VRset("Menu_ShareContext_RemovePrinter", "Visible", 0)
 | 
|---|
 | 2159 |     ok = VRset("Menu_ShareContext_Add",           "Visible", 0)   
 | 
|---|
 | 2160 |     ok = VRset("Menu_ShareContext_Rename",        "Visible", 0) 
 | 
|---|
 | 2161 |     ok = VRset("Menu_ShareContext_Remove",        "Visible", 0)
 | 
|---|
 | 2162 | 
 | 
|---|
 | 2163 |     if Prophandle.1 = smbconf.!root          then ok = VRset("GB_Help",      "Visible", 1)
 | 
|---|
 | 2164 |     if Prophandle.1 = smbconf.!global   | Parenthandle = smbconf.!global   then return
 | 
|---|
 | 2165 |     if Prophandle.1 = smbconf.!homes    | Parenthandle = smbconf.!homes    then return
 | 
|---|
 | 2166 |     if Prophandle.1 = smbconf.!dirs then do
 | 
|---|
 | 2167 |         ok = VRset("Menu_ShareContext_Add", "Visible", 1)   
 | 
|---|
 | 2168 |     end
 | 
|---|
 | 2169 |     if Parenthandle = smbconf.!dirs then do
 | 
|---|
 | 2170 |         ok = VRset("Menu_ShareContext_Add", "Visible", 1)   
 | 
|---|
 | 2171 |         ok = VRset("Menu_ShareContext_Rename", "Visible", 1) 
 | 
|---|
 | 2172 |         ok = VRset("Menu_ShareContext_Remove", "Visible", 1)
 | 
|---|
 | 2173 |     end
 | 
|---|
 | 2174 |     if Prophandle.1 = smbconf.!printers then do
 | 
|---|
 | 2175 |         ok = VRset("Menu_ShareContext_AddPrinter", "Visible", 1)   
 | 
|---|
 | 2176 |     end
 | 
|---|
 | 2177 |     if Parenthandle = smbconf.!printers then do
 | 
|---|
 | 2178 |         ok = VRset("Menu_ShareContext_AddPrinter", "Visible", 1)   
 | 
|---|
 | 2179 |         ok = VRset("Menu_ShareContext_RenamePrinter", "Visible", 1)    
 | 
|---|
 | 2180 |         ok = VRset("Menu_ShareContext_RemovePrinter", "Visible", 1)
 | 
|---|
 | 2181 |     end
 | 
|---|
 | 2182 | 
 | 
|---|
 | 2183 |     ok = VRMethod( "Menu_ShareContext", "Popup", , , "", "" )
 | 
|---|
 | 2184 | 
 | 
|---|
 | 2185 | return
 | 
|---|
 | 2186 | 
 | 
|---|
 | 2187 | /*:VRX         EF_display_charset_Change
 | 
|---|
 | 2188 | */
 | 
|---|
 | 2189 | EF_display_charset_Change: 
 | 
|---|
 | 2190 |     call _ShareObject_Changed
 | 
|---|
 | 2191 | return
 | 
|---|
 | 2192 | 
 | 
|---|
 | 2193 | /*:VRX         EF_dos_charset_Change
 | 
|---|
 | 2194 | */
 | 
|---|
 | 2195 | EF_dos_charset_Change: 
 | 
|---|
 | 2196 |     call _ShareObject_Changed
 | 
|---|
 | 2197 | return
 | 
|---|
 | 2198 | 
 | 
|---|
 | 2199 | /*:VRX         EF_Log_file_Change
 | 
|---|
 | 2200 | */
 | 
|---|
 | 2201 | EF_Log_file_Change: 
 | 
|---|
 | 2202 |     call _ShareObject_Changed
 | 
|---|
 | 2203 | return
 | 
|---|
 | 2204 | 
 | 
|---|
 | 2205 | /*:VRX         EF_LOG_LEVEL_Change
 | 
|---|
 | 2206 | */
 | 
|---|
 | 2207 | EF_LOG_LEVEL_Change: 
 | 
|---|
 | 2208 |     call _ShareObject_Changed
 | 
|---|
 | 2209 | return
 | 
|---|
 | 2210 | 
 | 
|---|
 | 2211 | /*:VRX         EF_NetBIOS_Name_Change
 | 
|---|
 | 2212 | */
 | 
|---|
 | 2213 | EF_NetBIOS_Name_Change: 
 | 
|---|
 | 2214 |     call _ShareObject_Changed
 | 
|---|
 | 2215 | return
 | 
|---|
 | 2216 | 
 | 
|---|
 | 2217 | /*:VRX         EF_path_Change
 | 
|---|
 | 2218 | */
 | 
|---|
 | 2219 | EF_path_Change: 
 | 
|---|
 | 2220 |     call _ShareObject_Changed
 | 
|---|
 | 2221 | return
 | 
|---|
 | 2222 | 
 | 
|---|
 | 2223 | /*:VRX         EF_SECURITY_Change
 | 
|---|
 | 2224 | */
 | 
|---|
 | 2225 | EF_SECURITY_Change: 
 | 
|---|
 | 2226 |     call _ShareObject_Changed
 | 
|---|
 | 2227 | return
 | 
|---|
 | 2228 | 
 | 
|---|
 | 2229 | /*:VRX         EF_Server_String_Change
 | 
|---|
 | 2230 | */
 | 
|---|
 | 2231 | EF_Server_String_Change: 
 | 
|---|
 | 2232 |     call _ShareObject_Changed
 | 
|---|
 | 2233 | return
 | 
|---|
 | 2234 | 
 | 
|---|
 | 2235 | /*:VRX         EF_Unix_charset_Change
 | 
|---|
 | 2236 | */
 | 
|---|
 | 2237 | EF_Unix_charset_Change: 
 | 
|---|
 | 2238 |     call _ShareObject_Changed
 | 
|---|
 | 2239 | return
 | 
|---|
 | 2240 | 
 | 
|---|
 | 2241 | /*:VRX         EF_Workgroup_Change
 | 
|---|
 | 2242 | */
 | 
|---|
 | 2243 | EF_Workgroup_Change: 
 | 
|---|
 | 2244 |     call _ShareObject_Changed
 | 
|---|
 | 2245 | return
 | 
|---|
 | 2246 | 
 | 
|---|
 | 2247 | /*:VRX         Fini
 | 
|---|
 | 2248 | */
 | 
|---|
 | 2249 | Fini:
 | 
|---|
 | 2250 |     window = VRWindow()
 | 
|---|
 | 2251 |     call VRSet window, "Visible", 0
 | 
|---|
 | 2252 |     drop window
 | 
|---|
 | 2253 | return 0
 | 
|---|
 | 2254 | 
 | 
|---|
 | 2255 | /*:VRX         GB_Global_1_Close
 | 
|---|
 | 2256 | */
 | 
|---|
 | 2257 | GB_Global_1_Close: 
 | 
|---|
 | 2258 |     call GB_Global_1_Fini
 | 
|---|
 | 2259 | return
 | 
|---|
 | 2260 | 
 | 
|---|
 | 2261 | /*:VRX         GB_Global_1_Create
 | 
|---|
 | 2262 | */
 | 
|---|
 | 2263 | GB_Global_1_Create: 
 | 
|---|
| [859] | 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
 | 
|---|
| [303] | 2271 | return
 | 
|---|
 | 2272 | 
 | 
|---|
 | 2273 | /*:VRX         GB_Global_1_Fini
 | 
|---|
 | 2274 | */
 | 
|---|
 | 2275 | GB_Global_1_Fini: 
 | 
|---|
 | 2276 |     window = VRInfo( "Window" )
 | 
|---|
 | 2277 |     call VRDestroy window
 | 
|---|
 | 2278 |     drop window
 | 
|---|
 | 2279 | return
 | 
|---|
 | 2280 | /*:VRX         GB_Global_1_Init
 | 
|---|
 | 2281 | */
 | 
|---|
 | 2282 | GB_Global_1_Init: 
 | 
|---|
 | 2283 |     window = VRInfo( "Object" )
 | 
|---|
 | 2284 |     if( \VRIsChildOf( window, "Notebook" ) ) then do
 | 
|---|
 | 2285 |         call VRMethod window, "CenterWindow"
 | 
|---|
 | 2286 |         call VRSet window, "Visible", 1
 | 
|---|
 | 2287 |         call VRMethod window, "Activate"
 | 
|---|
 | 2288 |     end
 | 
|---|
 | 2289 |     drop window
 | 
|---|
 | 2290 | return
 | 
|---|
 | 2291 | 
 | 
|---|
 | 2292 | /*:VRX         Halt
 | 
|---|
 | 2293 | */
 | 
|---|
 | 2294 | Halt:
 | 
|---|
 | 2295 |     signal _VREHalt
 | 
|---|
 | 2296 | return
 | 
|---|
 | 2297 | 
 | 
|---|
 | 2298 | /*:VRX         Init
 | 
|---|
 | 2299 | */
 | 
|---|
 | 2300 | Init:
 | 
|---|
 | 2301 |     window = VRWindow()
 | 
|---|
 | 2302 |     call VRMethod window, "CenterWindow"
 | 
|---|
 | 2303 |     call VRSet window, "Visible", 1
 | 
|---|
 | 2304 |     call VRMethod window, "Activate"
 | 
|---|
 | 2305 |     drop window
 | 
|---|
 | 2306 | return
 | 
|---|
 | 2307 | 
 | 
|---|
 | 2308 | /*:VRX         Installer_Close
 | 
|---|
 | 2309 | */
 | 
|---|
 | 2310 | Installer_Close: 
 | 
|---|
 | 2311 |     Msg.Text = NLVGetMessage(114)
 | 
|---|
 | 2312 |     Msg.Type = "I"
 | 
|---|
 | 2313 |     call _ShowMsg
 | 
|---|
 | 2314 |     call Installer_Fini
 | 
|---|
 | 2315 | return
 | 
|---|
 | 2316 | 
 | 
|---|
 | 2317 | /*:VRX         Installer_Create
 | 
|---|
 | 2318 | */
 | 
|---|
 | 2319 | Installer_Create: 
 | 
|---|
 | 2320 |     call Installer_Init
 | 
|---|
 | 2321 |     CALL NLVSetText 'Installer',                  'Caption', 90
 | 
|---|
 | 2322 |     CALL NLVSetText 'DT_RootPasswordDescription', 'Caption', 91
 | 
|---|
 | 2323 |     CALL NLVSetText 'DT_RootPassword',            'Caption', 92
 | 
|---|
 | 2324 |     CALL NLVSetText 'DT_RootPassword_repeat',     'Caption', 93
 | 
|---|
 | 2325 |     CALL NLVSetText 'CB_NoRoot',                  'Caption', 94
 | 
|---|
 | 2326 |     CALL NLVSetText 'DT_Backend',                 'Caption', 95
 | 
|---|
 | 2327 |     CALL NLVSetText 'DT_ServerType',              'Caption', 96
 | 
|---|
 | 2328 |     CALL NLVSetText 'PB_Install_Default',         'Caption', 97
 | 
|---|
 | 2329 |     CALL NLVSetText 'PB_Install_Migration',       'Caption', 98
 | 
|---|
 | 2330 | 
 | 
|---|
 | 2331 |     ok = VRSet("PB_Install_Migration", "Enabled", lsshareiniexists * ibmlaniniexists )
 | 
|---|
 | 2332 |     ok = VRSet("TM_Installer","Enabled", 0)
 | 
|---|
 | 2333 |     if stream(samba.!group,'c','query exists') = "" | stream(samba.!group,'c','query size') < 120 then do
 | 
|---|
 | 2334 |         call _GroupCreate
 | 
|---|
 | 2335 |     end
 | 
|---|
 | 2336 |     if stream(samba.!masterpasswd,'c','query exists') = "" | stream(samba.!group,'c','query size') < 230 then do
 | 
|---|
 | 2337 |         call _MasterPasswdCreate
 | 
|---|
 | 2338 |         call _PasswordDBRewrite
 | 
|---|
| [408] | 2339 |         ok = VRSet("CB_NoRoot","Enabled", 0)
 | 
|---|
| [303] | 2340 |     end
 | 
|---|
 | 2341 |     if stream(samba.!pwddb,'c','query exists') = "" | stream(samba.!spwddb,'c','query exists') = "" then do
 | 
|---|
 | 2342 |         call _PasswordDBRewrite
 | 
|---|
| [408] | 2343 |         ok = VRSet("CB_NoRoot","Enabled", 0)
 | 
|---|
| [303] | 2344 |     end
 | 
|---|
| [451] | 2345 |     if \VRFileExists(ETC'\samba\private\secrets.tdb') then do
 | 
|---|
 | 2346 |         ok = VRSet("CB_NoRoot","Enabled", 0)
 | 
|---|
 | 2347 |     end
 | 
|---|
| [304] | 2348 |     UseTDBsam = 1
 | 
|---|
| [303] | 2349 |     CreatePDC = 0
 | 
|---|
 | 2350 | return
 | 
|---|
 | 2351 | 
 | 
|---|
 | 2352 | /*:VRX         Installer_Fini
 | 
|---|
 | 2353 | */
 | 
|---|
 | 2354 | Installer_Fini: 
 | 
|---|
 | 2355 |     window = VRInfo( "Window" )
 | 
|---|
 | 2356 |     call VRDestroy window
 | 
|---|
 | 2357 |     drop window
 | 
|---|
 | 2358 | return
 | 
|---|
 | 2359 | /*:VRX         Installer_Init
 | 
|---|
 | 2360 | */
 | 
|---|
 | 2361 | Installer_Init: 
 | 
|---|
 | 2362 |     window = VRInfo( "Object" )
 | 
|---|
 | 2363 |     if( \VRIsChildOf( window, "Notebook" ) ) then do
 | 
|---|
 | 2364 |         call VRMethod window, "CenterWindow"
 | 
|---|
 | 2365 |         call VRSet window, "Visible", 1
 | 
|---|
 | 2366 |         call VRMethod window, "Activate"
 | 
|---|
 | 2367 |     end
 | 
|---|
 | 2368 |     drop window
 | 
|---|
 | 2369 | return
 | 
|---|
 | 2370 | 
 | 
|---|
 | 2371 | /*:VRX         IPB_ChooseDir_Click
 | 
|---|
 | 2372 | */
 | 
|---|
 | 2373 | IPB_ChooseDir_Click: 
 | 
|---|
 | 2374 |     InitDir = VRGet("EF_Path","Value")
 | 
|---|
 | 2375 |     VarPos = pos('%', InitDir)
 | 
|---|
 | 2376 |     if VarPos > 0 then do
 | 
|---|
 | 2377 |         VarChar = substr(InitDir,VarPos,2)
 | 
|---|
 | 2378 |         InitDir = left(InitDir,VarPos-1)
 | 
|---|
 | 2379 |         say VarChar
 | 
|---|
 | 2380 |     end
 | 
|---|
 | 2381 |     NewPath = _dirDialog('Choose path for 'VRGet("DT_Shares","Caption"),_fs2bs(InitDir))
 | 
|---|
 | 2382 |     if NewPath = "" then return
 | 
|---|
 | 2383 |     if VarPos > 0 then NewPath = NewPath'\'VarChar
 | 
|---|
 | 2384 |     ok = VRset("EF_Path","value",NewPath)
 | 
|---|
 | 2385 | return
 | 
|---|
 | 2386 | 
 | 
|---|
 | 2387 | /*:VRX         IPB_NewItem_Click
 | 
|---|
 | 2388 | */
 | 
|---|
 | 2389 | IPB_NewItem_Click: 
 | 
|---|
 | 2390 |     smbconfopt = samba.!tools'\smbconf.opt'
 | 
|---|
 | 2391 | say smbconfopt
 | 
|---|
 | 2392 |     do until lines(smbconfopt) = 0
 | 
|---|
 | 2393 |         smbconfline = linein(smbconfopt)
 | 
|---|
 | 2394 | say smbconfline
 | 
|---|
 | 2395 |         I = I + 1
 | 
|---|
 | 2396 |         opt.I = smbconfline
 | 
|---|
 | 2397 |     end
 | 
|---|
 | 2398 |     opt.0 = I
 | 
|---|
 | 2399 |     ok = stream(smbconfopt,'c','close')
 | 
|---|
 | 2400 |     ok = VRMethod("DDCB_Add_Voc","Reset")
 | 
|---|
 | 2401 |     ok = VRMethod("DDCB_Add_Voc","AddStringList", opt.)
 | 
|---|
 | 2402 |     ok = VRSet("DDCB_Add_Voc","Top",ObjYPos-380)
 | 
|---|
 | 2403 |     ok = VRSet("EF_Add_Voc","Top",ObjYPos-380)
 | 
|---|
 | 2404 |     ok = VRSet("PB_Add_Voc_OK","Top",ObjYPos)
 | 
|---|
 | 2405 |     ok = VRSet("PB_Add_Voc_Cancel","Top",ObjYPos)
 | 
|---|
 | 2406 | 
 | 
|---|
 | 2407 |     ok = VRSet("DDCB_ADD_Voc","Visible",1)
 | 
|---|
 | 2408 |     ok = VRSet("EF_ADD_Voc","Visible",1)
 | 
|---|
 | 2409 |     ok = VRSet("PB_Add_Voc_OK","Visible",1)
 | 
|---|
 | 2410 |     ok = VRSet("PB_add_Voc_Cancel","Visible",1)
 | 
|---|
 | 2411 | return
 | 
|---|
 | 2412 | 
 | 
|---|
 | 2413 | /*:VRX         Main_Close
 | 
|---|
 | 2414 | */
 | 
|---|
 | 2415 | Main_Close:
 | 
|---|
 | 2416 |     call Quit
 | 
|---|
 | 2417 | return
 | 
|---|
 | 2418 | 
 | 
|---|
 | 2419 | /*:VRX         Main_Create
 | 
|---|
 | 2420 | */
 | 
|---|
 | 2421 | Main_Create: 
 | 
|---|
| [859] | 2422 |     ok = VRREdirectStdIO("ON")
 | 
|---|
 | 2423 |     options.!debug = 1
 | 
|---|
| [303] | 2424 | 
 | 
|---|
 | 2425 |     call _LoadOtherFuncs
 | 
|---|
| [333] | 2426 | 
 | 
|---|
| [303] | 2427 |     call _INIRead
 | 
|---|
| [333] | 2428 | 
 | 
|---|
| [303] | 2429 |     call _ParseCommandLine
 | 
|---|
 | 2430 | 
 | 
|---|
| [333] | 2431 |     call _InitTempDir
 | 
|---|
 | 2432 |     call _SambaInit
 | 
|---|
 | 2433 |     call _SambaExtendSearchPath
 | 
|---|
 | 2434 |     call _GUIInitNLV
 | 
|---|
| [303] | 2435 | 
 | 
|---|
 | 2436 |     call _FindHtpasswd
 | 
|---|
| [451] | 2437 |     call Main_Resize
 | 
|---|
| [303] | 2438 |     call _SambaCheckComponents
 | 
|---|
 | 2439 |     call _SambaVersion
 | 
|---|
 | 2440 |     call _FindIBMLANPath
 | 
|---|
 | 2441 |     call _SmbConfTreeInit /* creates the records for default sections */
 | 
|---|
 | 2442 | 
 | 
|---|
 | 2443 |     /* Installation mode is triggered by a timer activated in GUIInit, when no smb.conf exists */
 | 
|---|
 | 2444 |     call _GUIInit
 | 
|---|
 | 2445 | return
 | 
|---|
 | 2446 | 
 | 
|---|
 | 2447 | /*:VRX         Main_Resize
 | 
|---|
 | 2448 | */
 | 
|---|
 | 2449 | Main_Resize: 
 | 
|---|
 | 2450 |     IF options.!debug == 1 THEN SAY "Main_Resize() started"
 | 
|---|
 | 2451 |     Ok = VRset("Main", "Painting", 0)
 | 
|---|
| [333] | 2452 |     ok = VRSet("GB_SmbConfTree","Top",    FWidth)
 | 
|---|
 | 2453 |     ok = VRSet("GB_SmbConfTree","Left",   FWidth-24)
 | 
|---|
| [859] | 2454 |     ok = VRSet("GB_SmbConfTree","Height", VRGet("Main", "Height") -1400)
 | 
|---|
| [303] | 2455 | 
 | 
|---|
| [333] | 2456 |     ok = VRset("GB_SmbConfTree3","Top",     FWidth)
 | 
|---|
 | 2457 |     ok = VRset("GB_SmbConfTree3","Left",    FWidth)
 | 
|---|
 | 2458 |     ok = VRset("GB_SmbConfTree3","Height",  245  )
 | 
|---|
 | 2459 |     ok = VRset("GB_SmbConfTree3","Width",   VRGet("GB_SmbConfTree","Width") -(FWidth*2))
 | 
|---|
| [303] | 2460 | 
 | 
|---|
| [333] | 2461 |     ok = VRset("DT_SmbConfTree","Top",     8)
 | 
|---|
 | 2462 |     ok = VRset("DT_SmbConfTree","Left",    8)
 | 
|---|
 | 2463 |     ok = VRset("DT_SmbConfTree","Height",  213)
 | 
|---|
 | 2464 |     ok = VRset("DT_SmbConfTree","Width",   VRGet("GB_SmbConfTree3","Width") - 24)
 | 
|---|
| [303] | 2465 | 
 | 
|---|
| [333] | 2466 |     ok = VRset("GB_SmbConfTree2","Left",   FWidth)
 | 
|---|
 | 2467 |     ok = VRset("GB_SmbConfTree2","Top",    245 + FWidth*2)
 | 
|---|
 | 2468 |     ok = VRset("GB_SmbConfTree2","Width",  VRGet("GB_SmbConfTree","Width")-FWidth*2)
 | 
|---|
 | 2469 |     ok = VRset("GB_SmbConfTree2","Height", VRGet("GB_SmbConfTree","Height")-FWidth*3-245)
 | 
|---|
| [303] | 2470 | 
 | 
|---|
| [333] | 2471 |     ok = VRset("CN_SmbConf", "Top",    FWidth)
 | 
|---|
 | 2472 |     ok = VRset("CN_SmbConf", "Left",   FWidth)
 | 
|---|
 | 2473 |     ok = VRset("CN_SmbConf", "Width",  VRGet("GB_SmbConfTree2","Width") -(FWidth*2))
 | 
|---|
 | 2474 |     ok = VRset("CN_SmbConf", "Height", VRGet("GB_SmbConfTree2","Height")-(FWidth*2))
 | 
|---|
| [303] | 2475 | 
 | 
|---|
| [333] | 2476 |     ok = VRset("GB_Help",   "Top",    FWidth)
 | 
|---|
 | 2477 |     ok = VRset("GB_Help",   "Left",   VRGet("GB_SmbConfTree","Width") + 60)
 | 
|---|
 | 2478 |     ok = VRSet("GB_Help",   "Height", VRGet("GB_SmbConfTree","Height"))
 | 
|---|
 | 2479 |     ok = VRSet("GB_Help",   "Width",  VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2)
 | 
|---|
| [303] | 2480 | 
 | 
|---|
| [333] | 2481 |     ok = VRset("GB_Help3","Top",     FWidth)
 | 
|---|
 | 2482 |     ok = VRset("GB_Help3","Left",    FWidth)
 | 
|---|
 | 2483 |     ok = VRset("GB_Help3","Height",  245  )
 | 
|---|
 | 2484 |     ok = VRset("GB_Help3","Width",   VRGet("GB_Help","Width") -(FWidth*2))
 | 
|---|
| [303] | 2485 | 
 | 
|---|
| [333] | 2486 |     ok = VRset("GB_Help2","Left",   FWidth)
 | 
|---|
 | 2487 |     ok = VRset("GB_Help2","Top",    245 + FWidth*2)
 | 
|---|
 | 2488 |     ok = VRset("GB_Help2","Width",  VRGet("GB_Help","Width")-FWidth*2)
 | 
|---|
 | 2489 |     ok = VRset("GB_Help2","Height", VRGet("GB_Help","Height")-FWidth*3-245)
 | 
|---|
| [303] | 2490 | 
 | 
|---|
| [333] | 2491 |     ok = VRset("DT_Help","Top",     8)
 | 
|---|
 | 2492 |     ok = VRset("DT_Help","Left",    8)
 | 
|---|
 | 2493 |     ok = VRset("DT_Help","Height",  213)
 | 
|---|
 | 2494 |     ok = VRset("DT_Help","Width",   VRGet("GB_Help3","Width") - 24)
 | 
|---|
| [303] | 2495 | 
 | 
|---|
| [333] | 2496 |     ok = VRset("GB_Shares",   "Top",    FWidth)
 | 
|---|
 | 2497 |     ok = VRset("GB_Shares",   "Left",   VRGet("GB_SmbConfTree","Width") + 60)
 | 
|---|
 | 2498 |     ok = VRSet("GB_Shares",   "Height", VRGet("GB_SmbConfTree","Height"))
 | 
|---|
 | 2499 |     ok = VRSet("GB_Shares",   "Width",  VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2)
 | 
|---|
 | 2500 | 
 | 
|---|
 | 2501 |     ok = VRset("GB_Shares3","Top",     FWidth)
 | 
|---|
 | 2502 |     ok = VRset("GB_Shares3","Left",    FWidth)
 | 
|---|
 | 2503 |     ok = VRset("GB_Shares3","Height",  245  )
 | 
|---|
 | 2504 |     ok = VRset("GB_Shares3","Width",   VRGet("GB_Shares","Width") -(FWidth*2))
 | 
|---|
 | 2505 | 
 | 
|---|
 | 2506 |     ok = VRset("GB_Shares2","Left",   FWidth)
 | 
|---|
 | 2507 |     ok = VRset("GB_Shares2","Top",    245 + FWidth*2)
 | 
|---|
 | 2508 |     ok = VRset("GB_Shares2","Width",  VRGet("GB_Shares","Width")-FWidth*2)
 | 
|---|
 | 2509 |     ok = VRset("GB_Shares2","Height", VRGet("GB_Shares","Height")-FWidth*3-245)
 | 
|---|
 | 2510 | 
 | 
|---|
 | 2511 |     ok = VRset("DT_Shares", "Top",    8)
 | 
|---|
 | 2512 |     ok = VRset("DT_Shares", "Left",   8)
 | 
|---|
 | 2513 |     ok = VRset("DT_Shares", "Height", 213)
 | 
|---|
 | 2514 |     ok = VRset("DT_Shares", "Width",  VRGet("GB_Shares3","Width") - 24)
 | 
|---|
 | 2515 | 
 | 
|---|
 | 2516 |     ok = VRSet("GB_Global", "Height", VRGet("GB_SmbConfTree","Height"))
 | 
|---|
 | 2517 |     ok = VRSet("GB_Global", "Width",  VRGet("GB_Shares",     "Width"))
 | 
|---|
 | 2518 | 
 | 
|---|
| [451] | 2519 |     MButton.bTop   = VRGet("GB_SmbConfTree","height")+FWidth*2
 | 
|---|
 | 2520 |     MButton.bLeft  = VRGet("GB_Shares","Left")
 | 
|---|
| [569] | 2521 |     MButton.bWidth = VRGet("PB_Save","Width")
 | 
|---|
| [333] | 2522 | 
 | 
|---|
| [451] | 2523 |     if MButton.bTop < 1300 & MButton.bLeft < 1300 then do
 | 
|---|
| [859] | 2524 |         MButton.bTop = 4802
 | 
|---|
| [451] | 2525 |         MButton.bLeft = 3758
 | 
|---|
 | 2526 |         MButton.bWidth = 1241
 | 
|---|
 | 2527 |         FWidth = 32
 | 
|---|
 | 2528 |     end
 | 
|---|
| [333] | 2529 | 
 | 
|---|
| [451] | 2530 |     ok = VRSet("PB_Reload", "Top",    MButton.bTop)
 | 
|---|
 | 2531 |     ok = VRSet("PB_Reload", "Left",   MButton.bLeft)
 | 
|---|
 | 2532 |     ok = VRSet("PB_Reload", "Width",  MButton.bWidth)
 | 
|---|
| [333] | 2533 | 
 | 
|---|
| [859] | 2534 |     ok = VRSet("PB_Save", "Top",      MButton.bTop)
 | 
|---|
 | 2535 |     ok = VRSet("PB_Save", "Left",     MButton.bLeft+1*FWidth+MButton.bWidth)
 | 
|---|
| [451] | 2536 |     ok = VRSet("PB_Reload", "Width",  MButton.bWidth)
 | 
|---|
| [333] | 2537 | 
 | 
|---|
| [451] | 2538 |     ok = VRSet("PB_Undo",   "Top",    MButton.bTop)
 | 
|---|
 | 2539 |     ok = VRSet("PB_Undo",   "Left",   MButton.bLeft+2*FWidth+MButton.bWidth*2)
 | 
|---|
 | 2540 |     ok = VRSet("PB_Undo",   "Width",  MButton.bWidth)
 | 
|---|
| [333] | 2541 | 
 | 
|---|
| [451] | 2542 |     ok = VRSet("PB_Cancel", "Top",    MButton.bTop)
 | 
|---|
 | 2543 |     ok = VRSet("PB_Cancel", "Left",   MButton.bLeft+3*FWidth+MButton.bWidth*3)
 | 
|---|
 | 2544 |     ok = VRSet("PB_Cancel", "Width",  MButton.bWidth)
 | 
|---|
| [344] | 2545 | 
 | 
|---|
| [451] | 2546 |  /* ok = VRSet("PB_Help",   "Top",    MButton.bTop)
 | 
|---|
 | 2547 |     ok = VRSet("PB_Help",   "Left",   MButton.bLeft+6*FWidth+MButton.bWidth*3)
 | 
|---|
 | 2548 |     ok = VRSet("PB_Help",   "Width",  MButton.bWidth) */
 | 
|---|
| [344] | 2549 | 
 | 
|---|
| [451] | 2550 |     drop MButton.b
 | 
|---|
 | 2551 | 
 | 
|---|
| [333] | 2552 |     Top    = VRGet("Main","Top")
 | 
|---|
 | 2553 |     Left   = VRGet("Main","Left")
 | 
|---|
 | 2554 |     Width  = VRGet("Main","Width")
 | 
|---|
 | 2555 |     Height = VRGet("Main","Height")
 | 
|---|
 | 2556 | 
 | 
|---|
| [303] | 2557 |     if ActiveGroup = "Global" then do
 | 
|---|
 | 2558 | 
 | 
|---|
 | 2559 |     end
 | 
|---|
 | 2560 |     IF options.!debug == 1 THEN SAY "  Window size = "VRGet("Main","Width")', 'VRGet("Main","Height")
 | 
|---|
 | 2561 | 
 | 
|---|
 | 2562 |     /* check and empty event queue, trash spurious resize events */
 | 
|---|
 | 2563 |     EventString = ''
 | 
|---|
 | 2564 |     TrashedResize = 0
 | 
|---|
 | 2565 |     do until EventString = 'nop'
 | 
|---|
 | 2566 |         EventString = VREvent('N')
 | 
|---|
 | 2567 |         say '  Event: "'EventString'" ('TrashedResize')'
 | 
|---|
 | 2568 |         if EventString <> 'nop' then do
 | 
|---|
 | 2569 |             if EventString = 'CALL Main_Resize' then TrashedResize = TrashedResize + 1
 | 
|---|
 | 2570 |                                                 else interpret eventString 
 | 
|---|
 | 2571 |         end
 | 
|---|
 | 2572 |     end 
 | 
|---|
 | 2573 |     if TrashedResize >= 2 then CALL Main_Resize
 | 
|---|
 | 2574 | 
 | 
|---|
 | 2575 |     IF options.!debug == 1 THEN SAY "  Window size = "VRGet("Main","Width")', 'VRGet("Main","Height")
 | 
|---|
 | 2576 |     Ok = VRset("Main", "Painting", 1)
 | 
|---|
 | 2577 |     IF options.!debug == 1 THEN SAY "Main_Resize() done"
 | 
|---|
 | 2578 | return
 | 
|---|
 | 2579 | 
 | 
|---|
 | 2580 | /*:VRX         Menu_Action_AddHomes_Click
 | 
|---|
 | 2581 | */
 | 
|---|
 | 2582 | Menu_Action_AddHomes_Click: 
 | 
|---|
 | 2583 |     call _SmbConfDefault_Homes
 | 
|---|
 | 2584 |     call _SmbConfTreeInit
 | 
|---|
 | 2585 |     call _SmbConfLoad
 | 
|---|
 | 2586 | return
 | 
|---|
 | 2587 | 
 | 
|---|
 | 2588 | /*:VRX         Menu_Action_AddNetLogon_Click
 | 
|---|
 | 2589 | */
 | 
|---|
 | 2590 | Menu_Action_AddNetLogon_Click: 
 | 
|---|
 | 2591 |     call _SmbConfDefault_Netlogon
 | 
|---|
 | 2592 |     call _SmbConfTreeInit
 | 
|---|
 | 2593 |     call _SmbConfLoad
 | 
|---|
 | 2594 | return
 | 
|---|
 | 2595 | 
 | 
|---|
 | 2596 | /*:VRX         Menu_Action_AddProfiles_Click
 | 
|---|
 | 2597 | */
 | 
|---|
 | 2598 | Menu_Action_AddProfiles_Click: 
 | 
|---|
 | 2599 |     call _SmbConfDefault_Profiles
 | 
|---|
 | 2600 |     call _SmbConfTreeInit
 | 
|---|
 | 2601 |     call _SmbConfLoad
 | 
|---|
 | 2602 | return
 | 
|---|
 | 2603 | 
 | 
|---|
 | 2604 | /*:VRX         Menu_Action_EraseTransient_Click
 | 
|---|
 | 2605 | */
 | 
|---|
 | 2606 | Menu_Action_EraseTransient_Click:
 | 
|---|
 | 2607 |     if _SambaRunning() then do
 | 
|---|
 | 2608 |         Msg.Text = NLVGetMessage(70)
 | 
|---|
 | 2609 |         Msg.Type = "E"
 | 
|---|
 | 2610 |         ok = _ShowMsg()
 | 
|---|
 | 2611 |         return
 | 
|---|
 | 2612 |     end
 | 
|---|
 | 2613 | 
 | 
|---|
 | 2614 |     ok = VRMethod("CN_smbconf","SetRecordAttr", smbconf.!global, "Selected", 1)
 | 
|---|
 | 2615 |     call CN_smbconf_Click    
 | 
|---|
 | 2616 | 
 | 
|---|
 | 2617 |     if VRIsValidObject( "EF_LOCK_DIRECTORY" ) then do
 | 
|---|
 | 2618 |         LockDir = VRGet("EF_Lock_Directory","Value")
 | 
|---|
 | 2619 |         Msg.Text = NLVGetMessage(71)
 | 
|---|
 | 2620 |         Msg.Type = "Q"
 | 
|---|
 | 2621 |         ok = _MsgYesNo()
 | 
|---|
 | 2622 |         if ok <> 1 then return
 | 
|---|
 | 2623 | 
 | 
|---|
 | 2624 |         ok = SysFileDelete(LockDir"\gencache.tdb")
 | 
|---|
 | 2625 |         ok = SysFileDelete(LockDir"\brlock.tdb")
 | 
|---|
 | 2626 |         ok = SysFileDelete(LockDir"\unexpected.tdb")
 | 
|---|
 | 2627 |         ok = SysFileDelete(LockDir"\connections.tdb")
 | 
|---|
 | 2628 |         ok = SysFileDelete(LockDir"\locking.tdb")
 | 
|---|
 | 2629 |         ok = SysFileDelete(LockDir"\messages.tdb")
 | 
|---|
 | 2630 |     end
 | 
|---|
 | 2631 | return
 | 
|---|
 | 2632 | 
 | 
|---|
 | 2633 | /*:VRX         Menu_File_Debug_Click
 | 
|---|
 | 2634 | */
 | 
|---|
 | 2635 | Menu_File_Debug_Click: 
 | 
|---|
 | 2636 |     options.!debug = VRGet("Menu_File_debug","Checked")
 | 
|---|
 | 2637 | 
 | 
|---|
 | 2638 |     /* The following 2 lines are unnecessary for a checkbox ! */
 | 
|---|
 | 2639 |     ok = VRSet("Menu_File_debug","Checked",\options.!debug)
 | 
|---|
 | 2640 |     options.!debug = \options.!debug
 | 
|---|
 | 2641 | 
 | 
|---|
 | 2642 |     if options.!debug
 | 
|---|
 | 2643 |         then ok = VRRedirectStdIO("On")
 | 
|---|
 | 2644 |         else ok = VRRedirectStdIO("OFF")
 | 
|---|
 | 2645 |     
 | 
|---|
 | 2646 | return
 | 
|---|
 | 2647 | 
 | 
|---|
 | 2648 | /*:VRX         Menu_File_Exit_Click
 | 
|---|
 | 2649 | */
 | 
|---|
 | 2650 | Menu_File_Exit_Click: 
 | 
|---|
 | 2651 |     call Quit
 | 
|---|
 | 2652 | return
 | 
|---|
 | 2653 | 
 | 
|---|
 | 2654 | /*:VRX         Menu_File_Import_IBMPeer_Click
 | 
|---|
 | 2655 | */
 | 
|---|
 | 2656 | Menu_File_Import_IBMPeer_Click: 
 | 
|---|
 | 2657 |     call _SmbConfMigratePeer
 | 
|---|
 | 2658 |     ok = SysFileTree(smbconf,exist.,'FO')
 | 
|---|
 | 2659 |     SmbConfExists = exist.0
 | 
|---|
 | 2660 |     call _SmbConfTreeReset
 | 
|---|
 | 2661 | return
 | 
|---|
 | 2662 | 
 | 
|---|
 | 2663 | /*:VRX         Menu_File_ImportHosts_Click
 | 
|---|
 | 2664 | */
 | 
|---|
 | 2665 | Menu_File_ImportHosts_Click: 
 | 
|---|
 | 2666 |     if VRFileExists(ETC'\samba\lmhosts') then do
 | 
|---|
 | 2667 |         Msg.Text = NLVGetMessage(56, ETC'\samba\lmhosts')
 | 
|---|
 | 2668 |         Msg.Type = 'Q'
 | 
|---|
 | 2669 |         if _MsgYesNo() = 1 then do
 | 
|---|
 | 2670 |             call _LMHostsImport
 | 
|---|
 | 2671 |         end
 | 
|---|
 | 2672 |     end
 | 
|---|
 | 2673 |     else call _LMHostsImport
 | 
|---|
 | 2674 | return
 | 
|---|
 | 2675 | 
 | 
|---|
 | 2676 | /*:VRX         Menu_File_PrintCap_Click
 | 
|---|
 | 2677 | */
 | 
|---|
 | 2678 | Menu_File_PrintCap_Click: 
 | 
|---|
 | 2679 |     call _PrintcapCreate
 | 
|---|
 | 2680 |     Msg.Text = NLVGetMessage(50, samba.!printcap)
 | 
|---|
 | 2681 |     msg.Type = 'I'
 | 
|---|
 | 2682 |     call _ShowMsg
 | 
|---|
 | 2683 | return
 | 
|---|
 | 2684 | 
 | 
|---|
 | 2685 | /*:VRX         Menu_File_reset_Click
 | 
|---|
 | 2686 | */
 | 
|---|
 | 2687 | Menu_File_reset_Click: 
 | 
|---|
 | 2688 |     call _SmbConfCreateDefault
 | 
|---|
 | 2689 |     ok = SysFileTree(smbconf,exist.,'FO')
 | 
|---|
 | 2690 |     SmbConfExists = exist.0
 | 
|---|
 | 2691 |     call _SmbConfTreeReset
 | 
|---|
 | 2692 | return
 | 
|---|
 | 2693 | 
 | 
|---|
 | 2694 | /*:VRX         Menu_File_SmbUpdate_Click
 | 
|---|
 | 2695 | */
 | 
|---|
 | 2696 | Menu_File_SmbUpdate_Click: 
 | 
|---|
 | 2697 |     BuildFile = VRFileDialog( VRWindow(), NLVGetMessage(64), "Open", options.!builddir"\samba-*zip", , ,  )
 | 
|---|
 | 2698 |     if BuildFile = '' then return
 | 
|---|
 | 2699 |     options.!builddir = VRParseFilename(buildfile,'DP')
 | 
|---|
 | 2700 |     address CMD samba.!smbcmd' stop'
 | 
|---|
 | 2701 |     OldDir = Directory(Strip(samba.!bin,'T','\'))
 | 
|---|
 | 2702 |     ok = VRRedirectStdIO('ON')
 | 
|---|
 | 2703 |     address cmd 'unzip.exe -oCj 'BuildFile' *.exe *.dll'
 | 
|---|
 | 2704 |     say 'unzip RC = 'RC
 | 
|---|
 | 2705 |     if RC <> 0 then address cmd 'PAUSE'
 | 
|---|
 | 2706 |     IF options.!debug <> 1 THEN ok = VRRedirectStdIO('OFF')
 | 
|---|
 | 2707 |     ok = directory(OldDir)
 | 
|---|
 | 2708 |     call _SambaVersion
 | 
|---|
 | 2709 |     ok = VRSet("EF_Binaries_Version","value",samba.!version)
 | 
|---|
 | 2710 |     address CMD samba.!smbcmd' start'
 | 
|---|
 | 2711 | return
 | 
|---|
 | 2712 | 
 | 
|---|
 | 2713 | /*:VRX         Menu_Help_About_Click
 | 
|---|
 | 2714 | */
 | 
|---|
 | 2715 | Menu_Help_About_Click: 
 | 
|---|
 | 2716 |     say '  'samba.!smbd' -V --debuglevel=0 2>'samba.!error' 1>'smboutput
 | 
|---|
 | 2717 |     address cmd samba.!smbd' -V --debuglevel=0 2>'samba.!error' 1>'smboutput
 | 
|---|
 | 2718 | 
 | 
|---|
 | 2719 |     SambaVer = "Samba "||strip(linein(smboutput))
 | 
|---|
 | 2720 |     ok = stream(smboutput,'c','close')
 | 
|---|
 | 2721 | 
 | 
|---|
 | 2722 |     window = VRLoadSecondary( "About", "W" )
 | 
|---|
 | 2723 | return
 | 
|---|
 | 2724 | 
 | 
|---|
 | 2725 | /*:VRX         Menu_Options_ExportMode_Click
 | 
|---|
 | 2726 | */
 | 
|---|
 | 2727 | Menu_Options_ExportMode_Click: 
 | 
|---|
| [490] | 2728 |     say 'ExpertMode_Click started'
 | 
|---|
 | 2729 |     say         samba.!testparmexe' -v -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
 | 
|---|
| [303] | 2730 |     address cmd samba.!testparmexe' -v -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
 | 
|---|
| [490] | 2731 |     say 'VRCopyFile('TempDir'smb.conf, 'smbconf' )'
 | 
|---|
 | 2732 |     say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE')
 | 
|---|
| [303] | 2733 |     ok = VRCopyFile( TempDir'smb.conf', smbconf )
 | 
|---|
| [490] | 2734 |     say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE')
 | 
|---|
 | 2735 |     say 'Copy ok ='ok' (1 = success, 0 = failure)'
 | 
|---|
| [303] | 2736 |     call _SmbConfTreeReset
 | 
|---|
 | 2737 |     call Main_Resize
 | 
|---|
| [490] | 2738 |     say 'ExpertMode_Click done'
 | 
|---|
| [303] | 2739 | return
 | 
|---|
 | 2740 | 
 | 
|---|
| [333] | 2741 | /*:VRX         Menu_Options_MiniIcons_Click
 | 
|---|
 | 2742 | */
 | 
|---|
 | 2743 | Menu_Options_MiniIcons_Click: 
 | 
|---|
 | 2744 |     advanced.!bigicons = \advanced.!bigicons
 | 
|---|
 | 2745 |     ok = VRset("CN_SMBCONF", "MiniIcons", \advanced.!bigicons)
 | 
|---|
 | 2746 |     ok = VRset("Menu_Options_MiniIcons",  "Checked", \advanced.!bigicons)
 | 
|---|
 | 2747 | return
 | 
|---|
 | 2748 | 
 | 
|---|
| [303] | 2749 | /*:VRX         Menu_Options_SimpleMode_Click
 | 
|---|
 | 2750 | */
 | 
|---|
 | 2751 | Menu_Options_SimpleMode_Click: 
 | 
|---|
| [490] | 2752 |     say 'SimpleMode_Click started'
 | 
|---|
| [569] | 2753 | 
 | 
|---|
 | 2754 |     /* Workaround for testparm bugs */
 | 
|---|
 | 2755 |     say 'VRCopyFile('smbconf', 'TempDir'smb.conf )'
 | 
|---|
 | 2756 |     ok = VRCopyFile( smbconf, TempDir'smb.conf')
 | 
|---|
 | 2757 |     call _SmbConfCommitChanges
 | 
|---|
 | 2758 | 
 | 
|---|
| [490] | 2759 |     say samba.!testparmexe' -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
 | 
|---|
| [303] | 2760 |     address cmd samba.!testparmexe' -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
 | 
|---|
| [490] | 2761 |     NewSize = stream(TempDir"smb.conf",'c','QUERY SIZE')
 | 
|---|
 | 2762 |     say "  "TempDir"smb.conf Gráe: "NewSize
 | 
|---|
 | 2763 |     if NewSize = 0 then 'pause'
 | 
|---|
 | 2764 |     say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE')
 | 
|---|
 | 2765 |     say 'VRCopyFile('TempDir'smb.conf, 'smbconf' )'
 | 
|---|
| [303] | 2766 |     ok = VRCopyFile( TempDir'smb.conf' , smbconf )
 | 
|---|
| [490] | 2767 |     say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE')
 | 
|---|
 | 2768 |     say 'Copy ok ='ok' (1 = success, 0 = failure)'
 | 
|---|
| [303] | 2769 |     call _SmbConfTreeReset
 | 
|---|
 | 2770 |     do I = Page to 3 by -1 
 | 
|---|
 | 2771 |         ok = VRMethod( "GB_Global", "DeletePage", I  ) 
 | 
|---|
 | 2772 |         ok = VRDestroy("GL_GLOBAL_"I)
 | 
|---|
 | 2773 |     end
 | 
|---|
 | 2774 |     Page = 2
 | 
|---|
 | 2775 |     call Main_resize
 | 
|---|
 | 2776 | say 'SimpleMode_Click done'
 | 
|---|
 | 2777 | return
 | 
|---|
 | 2778 | 
 | 
|---|
 | 2779 | /*:VRX         Menu_ShareContext_Add_Click
 | 
|---|
 | 2780 | */
 | 
|---|
 | 2781 | Menu_ShareContext_Add_Click: 
 | 
|---|
 | 2782 |         NewShareDir = _dirDialog()
 | 
|---|
 | 2783 |         if NewShareDir = "" then return
 | 
|---|
 | 2784 |         NewShareName = filespec("N",NewShareDir)
 | 
|---|
 | 2785 |         Buttons.1 = "OK"
 | 
|---|
 | 2786 |         Buttons.2 = "Abort"
 | 
|---|
 | 2787 |         Buttons.0 = 2
 | 
|---|
 | 2788 |         id = VRPrompt( VRWindow(), "Enter name for new share", "NewShareName", "Add new Samba share", "Buttons.", buttons.1, buttons.2 )
 | 
|---|
 | 2789 |         if ID = 2 | NewShareName = "" then return
 | 
|---|
 | 2790 |         NewShareHandle = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,, NewShareName,"#4")
 | 
|---|
 | 2791 |         call lineout smbconf, '['NewShareName']'
 | 
|---|
 | 2792 |         call lineout smbconf, Indent||'path = '_bs2fs(NewShareDir)
 | 
|---|
 | 2793 |         call lineout smbconf, Indent||'comment = 'NewShareName' directory'
 | 
|---|
 | 2794 |         call lineout smbconf, Indent||'browseable = Yes'
 | 
|---|
 | 2795 |         call lineout smbconf, Indent||'read only = Yes'
 | 
|---|
 | 2796 |         call lineout smbconf, Indent||'hide files = /*.?SF/'
 | 
|---|
 | 2797 |         call lineout smbconf
 | 
|---|
 | 2798 |         call _SmbConfTreeReset
 | 
|---|
 | 2799 |         Msg.Text = NLVGetMessage(69)
 | 
|---|
 | 2800 |         Msg.Type = 'I'
 | 
|---|
 | 2801 |         call _ShowMsg
 | 
|---|
 | 2802 |         ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 )
 | 
|---|
 | 2803 |         ok = VRMethod("CN_smbconf","SetRecordAttr",NewShareHandle, "Selected", 1 )
 | 
|---|
 | 2804 | return
 | 
|---|
 | 2805 | 
 | 
|---|
 | 2806 | /*:VRX         Menu_ShareContext_AddPrinter_Click
 | 
|---|
 | 2807 | */
 | 
|---|
 | 2808 | Menu_ShareContext_AddPrinter_Click: 
 | 
|---|
 | 2809 |         AbortPrinter = 1
 | 
|---|
 | 2810 |         window = VRLoadSecondary( "PrinterSelection", "W" )
 | 
|---|
 | 2811 |         if AbortPrinter then return
 | 
|---|
 | 2812 |         parse var SharePrinter PrinterName';'PrinterQueue';'PrinterDriver
 | 
|---|
 | 2813 |         NewShareHandle = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,, PrinterQueue,"#4")
 | 
|---|
 | 2814 |         call lineout smbconf, '['PrinterQueue']'
 | 
|---|
 | 2815 |         call lineout smbconf, Indent||'path = '_bs2fs(ETC'\samba\spool\'printerqueue)
 | 
|---|
 | 2816 |         ok = SysMkDir(ETC'\samba\spool\'printerqueue)
 | 
|---|
 | 2817 |         call lineout smbconf, Indent||'comment = 'Printername
 | 
|---|
 | 2818 |         call lineout smbconf, Indent||'create mask = 0700'
 | 
|---|
 | 2819 |         call lineout smbconf, Indent||'printer name = 'printerqueue
 | 
|---|
 | 2820 |         call lineout smbconf, Indent||'printing = os2'
 | 
|---|
 | 2821 |         call lineout smbconf, Indent||'printable = Yes'
 | 
|---|
 | 2822 |         call lineout smbconf, Indent||'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"'
 | 
|---|
 | 2823 |         call lineout smbconf, Indent||'browseable = Yes'
 | 
|---|
 | 2824 |         call lineout smbconf, Indent||'guest ok = Yes'
 | 
|---|
 | 2825 |         call lineout smbconf, Indent||'read only = No'
 | 
|---|
 | 2826 |         call lineout smbconf
 | 
|---|
 | 2827 |         call _SmbConfTreeReset
 | 
|---|
 | 2828 |         Msg.Text = NLVGetMessage(69)
 | 
|---|
 | 2829 |         Msg.Type = 'I'
 | 
|---|
 | 2830 |         call _ShowMsg
 | 
|---|
 | 2831 |         ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 )
 | 
|---|
 | 2832 |         ok = VRMethod("CN_smbconf","SetRecordAttr",NewShareHandle, "Selected", 1 )
 | 
|---|
 | 2833 | return
 | 
|---|
 | 2834 | 
 | 
|---|
 | 2835 | /*:VRX         Menu_ShareContext_Remove_Click
 | 
|---|
 | 2836 | */
 | 
|---|
 | 2837 | Menu_ShareContext_Remove_Click: 
 | 
|---|
 | 2838 |     call _SmbConfShareRemove
 | 
|---|
 | 2839 |     if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 )
 | 
|---|
 | 2840 | return
 | 
|---|
 | 2841 | 
 | 
|---|
 | 2842 | /*:VRX         Menu_ShareContext_RemovePrinter_Click
 | 
|---|
 | 2843 | */
 | 
|---|
 | 2844 | Menu_ShareContext_RemovePrinter_Click: 
 | 
|---|
 | 2845 |     call _SmbConfShareRemove
 | 
|---|
 | 2846 |     if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 )
 | 
|---|
 | 2847 | return
 | 
|---|
 | 2848 | 
 | 
|---|
 | 2849 | /*:VRX         Menu_ShareContext_Rename_Click
 | 
|---|
 | 2850 | */
 | 
|---|
 | 2851 | Menu_ShareContext_Rename_Click: 
 | 
|---|
 | 2852 |     call _SmbConfShareRename
 | 
|---|
 | 2853 |     if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 )
 | 
|---|
 | 2854 | return
 | 
|---|
 | 2855 | 
 | 
|---|
 | 2856 | /*:VRX         Menu_ShareContext_RenamePrinter_Click
 | 
|---|
 | 2857 | */
 | 
|---|
 | 2858 | Menu_ShareContext_RenamePrinter_Click: 
 | 
|---|
 | 2859 |     call _SmbConfShareRename
 | 
|---|
 | 2860 |     if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 )
 | 
|---|
 | 2861 | return
 | 
|---|
 | 2862 | 
 | 
|---|
| [859] | 2863 | /*:VRX         PB_1_Click
 | 
|---|
 | 2864 | */
 | 
|---|
 | 2865 | PB_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 */
 | 
|---|
 | 2877 | return
 | 
|---|
 | 2878 | 
 | 
|---|
| [303] | 2879 | /*:VRX         PB_AboutOK_Click
 | 
|---|
 | 2880 | */
 | 
|---|
 | 2881 | PB_AboutOK_Click: 
 | 
|---|
 | 2882 |     call About_Close
 | 
|---|
 | 2883 | return
 | 
|---|
 | 2884 | 
 | 
|---|
 | 2885 | /*:VRX         PB_Add_Voc_Cancel_Click
 | 
|---|
 | 2886 | */
 | 
|---|
 | 2887 | PB_Add_Voc_Cancel_Click: 
 | 
|---|
 | 2888 |     drop opt.
 | 
|---|
 | 2889 |     ok = VRSet("DDCB_Add_Voc","Value","")
 | 
|---|
 | 2890 |     ok = VRSet("EF_Add_Voc", "Value","")
 | 
|---|
 | 2891 | 
 | 
|---|
 | 2892 |     ok = VRSet("DDCB_ADD_Voc","Visible",0)
 | 
|---|
 | 2893 |     ok = VRSet("EF_ADD_Voc","Visible",0)
 | 
|---|
 | 2894 |     ok = VRSet("PB_Add_Voc_OK","Visible",0)
 | 
|---|
 | 2895 |     ok = VRSet("PB_add_Voc_Cancel","Visible",0)
 | 
|---|
 | 2896 | return
 | 
|---|
 | 2897 | 
 | 
|---|
 | 2898 | /*:VRX         PB_Add_Voc_OK_Click
 | 
|---|
 | 2899 | */
 | 
|---|
 | 2900 | PB_Add_Voc_OK_Click: 
 | 
|---|
 | 2901 |     NewVoc = VRGet("DDCB_Add_Voc","Value")
 | 
|---|
 | 2902 |     NewValue=VRGet("EF_Add_Voc", "Value")
 | 
|---|
 | 2903 |     call IniSet NewVoc, NewValue, CurSection, samba.!smbconf
 | 
|---|
 | 2904 |     drop opt.
 | 
|---|
 | 2905 |     ok = VRSet("DDCB_Add_Voc","Value","")
 | 
|---|
 | 2906 |     ok = VRSet("EF_Add_Voc", "Value","")
 | 
|---|
 | 2907 |     ok = VRSet("DDCB_ADD_Voc","Visible",0)
 | 
|---|
 | 2908 |     ok = VRSet("EF_ADD_Voc","Visible",0)
 | 
|---|
 | 2909 |     ok = VRSet("PB_Add_Voc_OK","Visible",0)
 | 
|---|
 | 2910 |     ok = VRSet("PB_add_Voc_Cancel","Visible",0)
 | 
|---|
 | 2911 | 
 | 
|---|
 | 2912 |     call Menu_Options_SimpleMode_Click
 | 
|---|
 | 2913 | return
 | 
|---|
 | 2914 | 
 | 
|---|
 | 2915 | /*:VRX         PB_Cancel_Click
 | 
|---|
 | 2916 | */
 | 
|---|
 | 2917 | PB_Cancel_Click: 
 | 
|---|
| [580] | 2918 |     IF options.!debug == 1 THEN say 'PB_Cancel_Click() started'    
 | 
|---|
 | 2919 |     if VRGet("PB_Save","Enabled") then call PB_Save_Click
 | 
|---|
| [303] | 2920 |     call Quit
 | 
|---|
| [580] | 2921 |     IF options.!debug == 1 THEN say 'PB_Cancel_Click() done'    
 | 
|---|
| [303] | 2922 | return
 | 
|---|
 | 2923 | 
 | 
|---|
 | 2924 | /*:VRX         PB_Help_Click
 | 
|---|
 | 2925 | */
 | 
|---|
 | 2926 | PB_Help_Click: 
 | 
|---|
 | 2927 | 
 | 
|---|
 | 2928 | return
 | 
|---|
 | 2929 | 
 | 
|---|
 | 2930 | /*:VRX         PB_Install_Default_Click
 | 
|---|
 | 2931 | */
 | 
|---|
 | 2932 | PB_Install_Default_Click:
 | 
|---|
| [574] | 2933 |     if VRGet("EF_Workgroup_Initial","Value") = "" then return
 | 
|---|
 | 2934 | 
 | 
|---|
| [303] | 2935 |     if \VRGet("CB_NoRoot","Set") then do
 | 
|---|
 | 2936 |         if \_SambaRootPWCheck() then return 
 | 
|---|
 | 2937 |     end
 | 
|---|
| [451] | 2938 | 
 | 
|---|
| [303] | 2939 |     call _SmbConfCreateDefault
 | 
|---|
| [859] | 2940 |     /* call _Smb35Init */
 | 
|---|
| [303] | 2941 |     ok = SysFileTree(smbconf,exist.,'FO')
 | 
|---|
 | 2942 |     SmbConfExists = exist.0
 | 
|---|
 | 2943 |     call _SmbConfBackup
 | 
|---|
 | 2944 |     call _SmbConfTreeReset
 | 
|---|
| [859] | 2945 | 
 | 
|---|
| [303] | 2946 |     if \VRGet("CB_NoRoot","Set") then do
 | 
|---|
 | 2947 |         call _SambaRootPWSet
 | 
|---|
 | 2948 |     end
 | 
|---|
 | 2949 |     call _SambaGuestCreate
 | 
|---|
| [451] | 2950 | 
 | 
|---|
 | 2951 |     call _SambaUserCreate
 | 
|---|
 | 2952 |     ok = VRSet("Main", 'Pointer', 'WAIT' )
 | 
|---|
| [303] | 2953 |     call _SambaGroupMapInst
 | 
|---|
| [451] | 2954 |     ok = VRSet("Main", 'Pointer', '<default>' )
 | 
|---|
 | 2955 |     /* call Menu_File_ImportHosts_Click */
 | 
|---|
| [303] | 2956 | 
 | 
|---|
 | 2957 |     call Installer_Close
 | 
|---|
 | 2958 | return
 | 
|---|
 | 2959 | 
 | 
|---|
 | 2960 | /*:VRX         PB_Install_Migration_Click
 | 
|---|
 | 2961 | */
 | 
|---|
 | 2962 | PB_Install_Migration_Click: 
 | 
|---|
| [574] | 2963 |     if VRGet("EF_Workgroup_Initial","Value") = "" then return
 | 
|---|
 | 2964 | 
 | 
|---|
| [303] | 2965 |     if \VRGet("CB_NoRoot","Set") then do
 | 
|---|
 | 2966 |         if \_SambaRootPWCheck() then return 
 | 
|---|
 | 2967 |     end
 | 
|---|
| [451] | 2968 | 
 | 
|---|
 | 2969 | 
 | 
|---|
| [303] | 2970 |     call _SmbConfMigratePeer
 | 
|---|
 | 2971 |     ok = SysFileTree(smbconf,exist.,'FO')
 | 
|---|
 | 2972 |     SmbConfExists = exist.0
 | 
|---|
 | 2973 |     call _SmbConfBackup
 | 
|---|
 | 2974 |     call _SmbConfTreeReset
 | 
|---|
 | 2975 |     if \VRGet("CB_NoRoot","Set") then do
 | 
|---|
 | 2976 |         call _SambaRootPWSet
 | 
|---|
 | 2977 |     end
 | 
|---|
 | 2978 |     call _SambaGuestCreate
 | 
|---|
| [451] | 2979 | 
 | 
|---|
 | 2980 |     call _SambaUserCreate
 | 
|---|
 | 2981 |     ok = VRSet("Main", 'Pointer', 'WAIT' )
 | 
|---|
| [303] | 2982 |     call _SambaGroupMapInst
 | 
|---|
| [451] | 2983 |     ok = VRSet("Main", 'Pointer', '<default>' )
 | 
|---|
| [303] | 2984 | 
 | 
|---|
| [451] | 2985 | /*  call Menu_File_ImportHosts_Click */
 | 
|---|
| [303] | 2986 | 
 | 
|---|
 | 2987 |     call Installer_Close
 | 
|---|
 | 2988 | return
 | 
|---|
 | 2989 | 
 | 
|---|
 | 2990 | /*:VRX         PB_Printer_Abort_Click
 | 
|---|
 | 2991 | */
 | 
|---|
 | 2992 | PB_Printer_Abort_Click: 
 | 
|---|
 | 2993 |     call PrinterSelection_Close
 | 
|---|
 | 2994 | return
 | 
|---|
 | 2995 | 
 | 
|---|
 | 2996 | /*:VRX         PB_Printer_OK_Click
 | 
|---|
 | 2997 | */
 | 
|---|
 | 2998 | PB_Printer_OK_Click: 
 | 
|---|
 | 2999 |     SharePrinter = RawPrinter(VRGet("LB_Printers","SelectedString"))
 | 
|---|
 | 3000 |     AbortPrinter = 0
 | 
|---|
 | 3001 |     say SharePrinter
 | 
|---|
 | 3002 |     call PrinterSelection_Close
 | 
|---|
 | 3003 | return
 | 
|---|
 | 3004 | 
 | 
|---|
 | 3005 | RawPrinter:
 | 
|---|
 | 3006 |     do I = 1 to printer.0 until PurePrinter(printer.I) = arg(1)
 | 
|---|
 | 3007 |     end
 | 
|---|
 | 3008 | return printer.I
 | 
|---|
 | 3009 | /*:VRX         PB_Reload_Click
 | 
|---|
 | 3010 | */
 | 
|---|
 | 3011 | PB_Reload_Click: 
 | 
|---|
| [569] | 3012 |     call PB_Save_Click    
 | 
|---|
| [303] | 3013 |     call beep 960, 1
 | 
|---|
 | 3014 |     address CMD samba.!smbcmd' reload'
 | 
|---|
 | 3015 | return
 | 
|---|
 | 3016 | 
 | 
|---|
| [451] | 3017 | /*:VRX         PB_RemoveContinue_Click
 | 
|---|
 | 3018 | */
 | 
|---|
 | 3019 | PB_RemoveContinue_Click: 
 | 
|---|
 | 3020 | 
 | 
|---|
 | 3021 |     if VRGet("CB_RemoveSmbConf","set") then do
 | 
|---|
 | 3022 |         ok = SysFileDelete(samba.!smbconf)
 | 
|---|
 | 3023 |         SmbConfExists = 0
 | 
|---|
 | 3024 |         Installmode = 1
 | 
|---|
 | 3025 |     end
 | 
|---|
 | 3026 |     else Installmode = 0
 | 
|---|
 | 3027 | 
 | 
|---|
 | 3028 |     if VRGet("CB_RemoveBackend","set") then do
 | 
|---|
 | 3029 |         ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS')
 | 
|---|
 | 3030 |         do I = 1 to xdb.0
 | 
|---|
 | 3031 |             ok = SysFileDelete(xdb.I)
 | 
|---|
 | 3032 |             if ok <> 0 then do
 | 
|---|
 | 3033 |                 Msg.Text = "Error "ok" deleting "xdb.I"!"
 | 
|---|
 | 3034 |                 Msg.Type = "W"
 | 
|---|
 | 3035 |                 call _ShowMsg
 | 
|---|
 | 3036 |             end
 | 
|---|
 | 3037 |         end
 | 
|---|
 | 3038 |     end
 | 
|---|
 | 3039 |     if VRGet("CB_RemoveLMHosts","set") then do
 | 
|---|
 | 3040 |         call _LMHostsImport
 | 
|---|
 | 3041 |     end
 | 
|---|
 | 3042 | 
 | 
|---|
 | 3043 |     call RemoveConfig_Close
 | 
|---|
 | 3044 | return
 | 
|---|
 | 3045 | 
 | 
|---|
| [569] | 3046 | /*:VRX         PB_Save_Click
 | 
|---|
 | 3047 | */
 | 
|---|
 | 3048 | PB_Save_Click: 
 | 
|---|
| [580] | 3049 |     IF options.!debug == 1 THEN say 'PB_Save_Click() started' 
 | 
|---|
| [569] | 3050 |     if ValueChanged then do
 | 
|---|
 | 3051 |         if CurSection <> "" then do
 | 
|---|
 | 3052 |             call _SaveChanges
 | 
|---|
 | 3053 |             ok = VRSet("PB_Save", "Enabled", 0)
 | 
|---|
 | 3054 |             call CN_smbconf_Click
 | 
|---|
 | 3055 |         end
 | 
|---|
 | 3056 |     end
 | 
|---|
| [580] | 3057 |     IF options.!debug == 1 THEN say 'PB_Save_Click() done' 
 | 
|---|
| [569] | 3058 | return
 | 
|---|
 | 3059 | 
 | 
|---|
| [303] | 3060 | /*:VRX         PB_Undo_Click
 | 
|---|
 | 3061 | */
 | 
|---|
 | 3062 | PB_Undo_Click: 
 | 
|---|
 | 3063 |     call _SmbConfRestore
 | 
|---|
 | 3064 |     SmbConfExists = 1
 | 
|---|
 | 3065 |     call _SmbConfTreeReset    
 | 
|---|
 | 3066 | return
 | 
|---|
 | 3067 | 
 | 
|---|
 | 3068 | /*:VRX         PrinterSelection_Close
 | 
|---|
 | 3069 | */
 | 
|---|
 | 3070 | PrinterSelection_Close: 
 | 
|---|
 | 3071 |     call PrinterSelection_Fini
 | 
|---|
 | 3072 | return
 | 
|---|
 | 3073 | 
 | 
|---|
 | 3074 | /*:VRX         PrinterSelection_Create
 | 
|---|
 | 3075 | */
 | 
|---|
 | 3076 | PrinterSelection_Create: 
 | 
|---|
 | 3077 |     call PrinterSelection_Init
 | 
|---|
 | 3078 |     ok = VRMethod( "Application", "ListPrinters", "printer." ) 
 | 
|---|
 | 3079 | 
 | 
|---|
 | 3080 |     CALL NLVSetText 'Printerselection',     'Caption', 40
 | 
|---|
 | 3081 |     CALL NLVSetText 'PB_Printer_OK',        'Caption',  2
 | 
|---|
 | 3082 |     CALL NLVSetText 'PB_Printer_Abort',     'Caption',  3
 | 
|---|
 | 3083 | 
 | 
|---|
 | 3084 |     do I = 1 to printer.0
 | 
|---|
 | 3085 |         ok = VRMethod("LB_Printers","AddString",PurePrinter(printer.I))
 | 
|---|
 | 3086 |         if PurePrinter(printer.!default) = PurePrinter(printer.I) then ok = VRSet("LB_Printers","Selected",I)
 | 
|---|
 | 3087 |     end
 | 
|---|
 | 3088 | return
 | 
|---|
 | 3089 | /*:VRX         PrinterSelection_Fini
 | 
|---|
 | 3090 | */
 | 
|---|
 | 3091 | PrinterSelection_Fini: 
 | 
|---|
 | 3092 |     window = VRInfo( "Window" )
 | 
|---|
 | 3093 |     call VRDestroy window
 | 
|---|
 | 3094 |     drop window
 | 
|---|
 | 3095 | return
 | 
|---|
 | 3096 | /*:VRX         PrinterSelection_Init
 | 
|---|
 | 3097 | */
 | 
|---|
 | 3098 | PrinterSelection_Init: 
 | 
|---|
 | 3099 |     window = VRInfo( "Object" )
 | 
|---|
 | 3100 |     if( \VRIsChildOf( window, "Notebook" ) ) then do
 | 
|---|
 | 3101 |         call VRMethod window, "CenterWindow"
 | 
|---|
 | 3102 |         call VRSet window, "Visible", 1
 | 
|---|
 | 3103 |         call VRMethod window, "Activate"
 | 
|---|
 | 3104 |     end
 | 
|---|
 | 3105 |     drop window
 | 
|---|
 | 3106 | return
 | 
|---|
 | 3107 | 
 | 
|---|
 | 3108 | /*:VRX         PurePrinter
 | 
|---|
 | 3109 | */
 | 
|---|
 | 3110 | PurePrinter: 
 | 
|---|
 | 3111 | return substr(arg(1),1,pos(';',arg(1))-1)
 | 
|---|
 | 3112 | 
 | 
|---|
 | 3113 | /*:VRX         Quit
 | 
|---|
 | 3114 | */
 | 
|---|
 | 3115 | Quit:
 | 
|---|
| [580] | 3116 |     IF options.!debug == 1 THEN say "Quit() start" 
 | 
|---|
 | 3117 | 
 | 
|---|
| [303] | 3118 |     if VRGet("Main","WindowState") = "Maximized"|,
 | 
|---|
 | 3119 |        VRGet("Main","WindowState") = "Minimized" then ok = VRMethod("Main", "Restore")
 | 
|---|
| [490] | 3120 | 
 | 
|---|
| [569] | 3121 |     if samba.!testparmexe <> "" then do
 | 
|---|
| [303] | 3122 |         address cmd samba.!testparmexe' -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
 | 
|---|
 | 3123 |         call _SmbConfCommitChanges
 | 
|---|
| [569] | 3124 |     end
 | 
|---|
| [303] | 3125 | 
 | 
|---|
 | 3126 |     call _INIWrite
 | 
|---|
 | 3127 |     call _SambaFinish
 | 
|---|
| [408] | 3128 |     ok = SysFileDelete(TempDir'sscc.testparm')
 | 
|---|
| [303] | 3129 |     ok = SysFileDelete(smboutput)
 | 
|---|
 | 3130 | 
 | 
|---|
| [580] | 3131 |     IF options.!debug == 1 THEN say "Quit() done" 
 | 
|---|
| [490] | 3132 |     /* ok = VRRedirectStdio('OFF') */
 | 
|---|
| [303] | 3133 |     window = VRWindow()
 | 
|---|
 | 3134 |     call VRSet window, "Shutdown", 1
 | 
|---|
 | 3135 |     drop window
 | 
|---|
 | 3136 | return
 | 
|---|
 | 3137 | 
 | 
|---|
 | 3138 | /*:VRX         RB_PDC_Click
 | 
|---|
 | 3139 | */
 | 
|---|
 | 3140 | RB_PDC_Click: 
 | 
|---|
 | 3141 |     CreatePDC = VRGet("RB_PDC","Set")
 | 
|---|
 | 3142 | return
 | 
|---|
 | 3143 | 
 | 
|---|
 | 3144 | /*:VRX         RB_smbpasswd_Click
 | 
|---|
 | 3145 | */
 | 
|---|
 | 3146 | RB_smbpasswd_Click: 
 | 
|---|
 | 3147 |     UseTDBsam = 0
 | 
|---|
 | 3148 | return
 | 
|---|
 | 3149 | 
 | 
|---|
 | 3150 | /*:VRX         RB_Standalone_Click
 | 
|---|
 | 3151 | */
 | 
|---|
 | 3152 | RB_Standalone_Click: 
 | 
|---|
 | 3153 |     CreatePDC = \VRGet("RB_Standalone","Set")
 | 
|---|
 | 3154 | return
 | 
|---|
 | 3155 | 
 | 
|---|
 | 3156 | /*:VRX         RB_tdbsam_Click
 | 
|---|
 | 3157 | */
 | 
|---|
 | 3158 | RB_tdbsam_Click: 
 | 
|---|
 | 3159 |     UseTDBsam = 1
 | 
|---|
 | 3160 | return
 | 
|---|
 | 3161 | 
 | 
|---|
| [451] | 3162 | /*:VRX         RemoveConfig_Close
 | 
|---|
 | 3163 | */
 | 
|---|
 | 3164 | RemoveConfig_Close: 
 | 
|---|
 | 3165 |     call RemoveConfig_Fini
 | 
|---|
 | 3166 | return
 | 
|---|
 | 3167 | 
 | 
|---|
 | 3168 | /*:VRX         RemoveConfig_Create
 | 
|---|
 | 3169 | */
 | 
|---|
 | 3170 | RemoveConfig_Create: 
 | 
|---|
 | 3171 |     call RemoveConfig_Init
 | 
|---|
 | 3172 |     CALL NLVSetText 'RemoveConfig',                  'Caption', 90
 | 
|---|
 | 3173 |     CALL NLVSetText 'PB_RemoveContinue',             'Caption', 14
 | 
|---|
 | 3174 | 
 | 
|---|
 | 3175 |     ok = VRset("CB_RemoveSmbConf","Caption", NLVGetMessage(56, 'smb.conf'))
 | 
|---|
 | 3176 |     ok = VRset("CB_RemoveBackend","Caption", NLVGetMessage(56, 'Backend'))
 | 
|---|
 | 3177 |     ok = VRset("CB_RemoveLMHosts","Caption", NLVGetMessage(56, 'lmhosts'))
 | 
|---|
 | 3178 | 
 | 
|---|
 | 3179 |     /* Check if ?db backend files exist */
 | 
|---|
 | 3180 |     ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS')
 | 
|---|
 | 3181 |     if xdb.0 = 0 then ok = VRset("CB_RemoveBackend","Enabled", 0)
 | 
|---|
 | 3182 | 
 | 
|---|
 | 3183 |     /* Check if LMHOsts exists */
 | 
|---|
 | 3184 |     ok = VRset("CB_RemoveLMHosts","Enabled", VRFileExists(ETC'\samba\lmhosts'))
 | 
|---|
 | 3185 | return
 | 
|---|
 | 3186 | 
 | 
|---|
 | 3187 | /*:VRX         RemoveConfig_Fini
 | 
|---|
 | 3188 | */
 | 
|---|
 | 3189 | RemoveConfig_Fini: 
 | 
|---|
 | 3190 |     window = VRInfo( "Window" )
 | 
|---|
 | 3191 |     call VRDestroy window
 | 
|---|
 | 3192 |     drop window
 | 
|---|
 | 3193 | return
 | 
|---|
 | 3194 | /*:VRX         RemoveConfig_Init
 | 
|---|
 | 3195 | */
 | 
|---|
 | 3196 | RemoveConfig_Init: 
 | 
|---|
 | 3197 |     window = VRInfo( "Object" )
 | 
|---|
 | 3198 |     if( \VRIsChildOf( window, "Notebook" ) ) then do
 | 
|---|
 | 3199 |         call VRMethod window, "CenterWindow"
 | 
|---|
 | 3200 |         call VRSet window, "Visible", 1
 | 
|---|
 | 3201 |         call VRMethod window, "Activate"
 | 
|---|
 | 3202 |     end
 | 
|---|
 | 3203 |     drop window
 | 
|---|
 | 3204 | return
 | 
|---|
 | 3205 | 
 | 
|---|
| [303] | 3206 | /*:VRX         TM_Installer_Trigger
 | 
|---|
 | 3207 | */
 | 
|---|
 | 3208 | TM_Installer_Trigger: 
 | 
|---|
 | 3209 |     call _InstallerMode
 | 
|---|
 | 3210 | return
 | 
|---|
 | 3211 | 
 | 
|---|
 | 3212 | /*:VRX         TM_Value_Trigger
 | 
|---|
 | 3213 | */
 | 
|---|
 | 3214 | TM_Value_Trigger: 
 | 
|---|
 | 3215 |     say "TM_Value_Trigger started"
 | 
|---|
 | 3216 |     ValueChanged = 0
 | 
|---|
| [569] | 3217 |     ok = VRSet("PB_Save", "Enabled", 0)
 | 
|---|
| [303] | 3218 |     ChangeList = ""
 | 
|---|
 | 3219 |     ok = VRSet("TM_Value", "Enabled", 0)
 | 
|---|
 | 3220 |     say "TM_Value_Trigger done"
 | 
|---|
 | 3221 | return
 | 
|---|