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

Last change on this file since 1016 was 1013, checked in by Herwig Bauernfeind, 9 years ago

GUITools: Optionally install Samba silently

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