source: trunk/guitools/sscc/sscc.vrx@ 1036

Last change on this file since 1036 was 1024, checked in by Herwig Bauernfeind, 8 years ago

GUITools: Add GPLv3 header to all .VRX, .WIS and some .CMD files

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