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

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

Fixes for Ticket #275 (sscc) and Ticket #276 (smbmon)

File size: 118.3 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 U:\Develop\Samba\guitools-1.0\shared\inittempdir.vrs
94#append U:\Develop\Samba\guitools-1.0\shared\sambainit.vrs
95#append U:\Develop\Samba\guitools-1.0\shared\swat.vrs
96#append U:\Develop\Samba\trunk\guitools\shared\nlv.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 eCSUser = value("USER",,"OS2ENVIRONMENT")
1018 if translate(eCSUser) <> "root" & translate(eCSUser) <> "guest" then do
1019 Msg.Text = NLVGetMessage(75, eCSUser)
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("winbind separator",smbline) > 0 then iterate
1179 if pos("copy ",smbline) > 0 then iterate
1180 call lineout trg, smbline
1181 lct = lct + 1
1182 end
1183 say "Lines saved "lct
1184 ok = stream(trg,'c','close')
1185 ok = stream(src,'c','close')
1186 ok = SysFileDelete(src)
1187 IF options.!debug == 1 THEN say '_SmbConfCommitChanges() done'
1188return
1189
1190/*:VRX _SmbConfCreateDefault
1191*/
1192_SmbConfCreateDefault:
1193 call _debuglog "_SmbConfCreateDefault() started"
1194 ok = SysFileDelete(smbconf)
1195
1196 /* Create a basic smb.conf */
1197 call _SmbConfDefault_Global
1198 call _SmbConfDefault_Scripts
1199 if CreatePDC then do
1200 call _SmbConfDefault_NetLogon
1201 call _SmbConfDefault_Profiles
1202 end
1203 call _SmbConfDefault_Homes
1204 call _SmbConfDefault_SharePrinters
1205 call _SmbConfDefault_ShareDrives
1206 ok = stream(smbconf,'c','close')
1207 call _debuglog "_SmbConfCreateDefault() done"
1208return
1209
1210/*:VRX _SmbConfCreateDefault_OldInstall
1211*/
1212_SmbConfCreateDefault_OldInstall:
1213 DriveList = SysDriveMap('C:','Local')
1214 ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.')
1215 ok = VRSet("EF_NetBIOS_Name","Value", Value("HOSTNAME",,"OS2ENVIRONMENT"))
1216
1217 DrivesOH.0 = 0
1218 do I = 1 to words(DriveList)
1219 CurDrive = word(DriveList,I)
1220 Filesys = SysFilesystemType(Curdrive)
1221 DriveInfo=SysDriveInfo(CurDrive)
1222 parse var DriveInfo DrvLet CurFree CurSize CurLabel
1223 curlabel = strip(Curlabel)
1224 CurFree = word(Driveinfo,2)
1225 CurSize = word(Driveinfo,3)
1226 if Curlabel = "" then Curlabel = '?'
1227
1228 if datatype(CurSize) = 'NUM' then do
1229 CurSize = CurSize/(1024*1024)
1230 CurFree = CurFree/(1024*1024)
1231
1232 CurSize = format(CurSize,,0)'MB'
1233 CurFree = format(CurFree,,0)'MB'
1234 end
1235 else do
1236 CurSize = '?'
1237 CurFree = '?'
1238 end
1239
1240/* 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) */
1241 Shares.!drives.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,,left(CurDrive,1) ,"#4")
1242 if FileSys = '' | FileSys = 'CDFS' then do
1243/* ok = VRSet(DrivesOH.I, "ForeColor", "Red") */
1244 end
1245/* if CurDrive = SysBootDrive() then ok = VRSet(DrivesOH.I, "Set", 0)
1246 if CurDrive = translate(left(samba.!bin,2)) then ok = VRSet(DrivesOH.I, "Set", 0) */
1247 end
1248 DrivesOH.0 = I-1
1249
1250 PrintersOH.0 = 0
1251 Colum = 1325
1252 dx = 0
1253 do I = 1 to printers.0
1254 queue = printers.I
1255 name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';')
1256/* 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) */
1257 Shares.!printers.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,,queue,"#6")
1258 if I = 6 then do
1259 Colum = 4000
1260 dx = 6
1261 end
1262 end
1263 PrintersOH.0 = I-1
1264return
1265
1266/*:VRX _SmbConfDefault_Global
1267*/
1268_SmbConfDefault_Global:
1269 call _debuglog "_SmbConfDefault_Global() started"
1270 Migrate = (arg(1) = 1)
1271 if \Migrate then do /* when migrating these 4 lines are there already */
1272 section = '[global]'
1273 call lineout smbconf, section
1274 call lineout smbconf, Indent||'workgroup = WORKGROUP'
1275 call lineout smbconf, Indent||'netbios name = 'value('HOSTNAME',,'OS2ENVIRONMENT')
1276 call lineout smbconf, Indent||'server string = %h Samba Server for eCS (OS/2)'
1277 call lineout smbconf, Indent||'comment = Samba Server for eCS (OS/2)'
1278 end
1279
1280 if SysQueryProcessCodePage() = "850" then do
1281 call lineout smbconf, Indent||'dos charset = IBM-850'
1282 call lineout smbconf, Indent||'display charset = IBM-850'
1283 call lineout smbconf, Indent||'unix charset = IBM-850'
1284 end
1285 else do
1286 call lineout smbconf, Indent||'dos charset = IBM-850'
1287 call lineout smbconf, Indent||'display charset = SYSTEM'
1288 call lineout smbconf, Indent||'unix charset = SYSTEM'
1289 end
1290
1291 CurCP = SysQueryProcessCodePage()
1292 if CurCP <> "850" then do
1293 Msg.Text = NLVGetMessage(117)
1294 Msg.Type = "W"
1295 call _ShowMsg
1296 end
1297 if UseTDBsam = 1 then do
1298 call lineout smbconf, Indent||'passdb backend = tdbsam'
1299 end
1300 call lineout smbconf, Indent||'log level = 2'
1301 call lineout smbconf, Indent||'log file = '||ETC||'\samba\log\log.smbd.%U.%M'
1302 call lineout smbconf, Indent||'null passwords = Yes'
1303 call lineout smbconf, Indent||'guest account = guest'
1304 call lineout smbconf, Indent||'security = user'
1305 call lineout smbconf, Indent||'load printers = No'
1306 call lineout smbconf, Indent||'time server = Yes'
1307 call lineout smbconf, Indent||'lock directory = '||ETC||'\samba\lock'
1308 /* This EA makes the testparm warning about browsing go away.
1309 Note: The EA is NOT marked critical as it should be,
1310 neverthelesse this fix works */
1311 ok = SysPutEA(ETC||'\samba\lock',"MODE", "FEFF0400ED410000"x)
1312 call lineout smbconf, Indent||'ea support = Yes'
1313 call lineout smbconf, Indent||'store dos attributes = Yes'
1314 call lineout smbconf, Indent||'lm announce = Yes'
1315 call lineout smbconf, Indent||'wins support = Yes'
1316 call lineout smbconf, Indent||'wide links = No'
1317 ok = SysFileTree(samba.!printcap,exist.,'FO')
1318 if exist.0 = 1 then do
1319 call lineout smbconf, Indent||'printcap name = 'samba.!printcap
1320 end
1321 samba.!smbusermap = ETC||'\samba\private\smbusermap'
1322 call lineout smbconf, Indent||'username map = 'samba.!smbusermap
1323 if \VRFileExists(samba.!smbusermap) then call _SmbUserMapCreate
1324 if CreatePDC then do
1325 call lineout smbconf, Indent||'local master = Yes'
1326 call lineout smbconf, Indent||'preferred master = Yes'
1327 call lineout smbconf, Indent||'domain master = Yes'
1328 call lineout smbconf, Indent||'os level = 65'
1329 call lineout smbconf, ';'Indent||'domain groups ='
1330 call lineout smbconf, ';'Indent||'domain admin group = '
1331 call lineout smbconf, Indent||'domain admin users = root'
1332 call lineout smbconf, Indent||'domain logons = Yes'
1333 call lineout smbconf, Indent||'logon home = \\%L\Profiles\%U'
1334 call lineout smbconf, Indent||'logon path = \\%L\Profiles\%U'
1335 call lineout smbconf, Indent||'logon drive = z:'
1336 call lineout smbconf, Indent||'logon script = %U.cmd'
1337 end
1338 else do
1339 call lineout smbconf, Indent||'create mask = 0777'
1340 end
1341 ok = stream(smbconf, 'c','close')
1342 call _debuglog "_SmbConfDefault_Global() done"
1343return
1344/*:VRX _SmbConfDefault_Homes
1345*/
1346_SmbConfDefault_Homes:
1347 /* Create Homes section */
1348 call lineout smbconf, '[HOMES]'
1349 call lineout smbconf, Indent||"comment = Home directory"
1350 smbhome = samba.!bin'\homes'
1351 Home = strip(value('Home',,'OS2ENVIRONMENT'),'T','\')
1352 if Home <> '' then do
1353 User = value('USER',,'OS2ENVIRONMENT')
1354 if User <> '' then do
1355 if translate(User) = translate(Filespec('N',Home)) | translate(Filespec('N',Home)) = "DEFAULT" then smbHome = strip(filespec('D',Home)||filespec('P',Home),'T','\')
1356 end
1357 end
1358 ok = SysMkDir(smbhome)
1359 call lineout smbconf, Indent||"path = "_bs2fs(smbhome)'/%u'
1360 call lineout smbconf, Indent||"read only = No"
1361 call lineout smbconf, Indent||"browseable = No"
1362 call lineout smbconf, Indent
1363 ok = stream(smbconf, 'c','close')
1364return
1365
1366/*:VRX _SmbConfDefault_Netlogon
1367*/
1368_SmbConfDefault_Netlogon:
1369 /* Create Netlogon section */
1370 call lineout smbconf, '[NETLOGON]'
1371 call lineout smbconf, Indent||"comment = Netlogon service"
1372 smbnetlogon = samba.!bin'\netlogon'
1373 ok = SysMkDir(smbnetlogon)
1374 call lineout smbconf, Indent||"path = "_bs2fs(smbnetlogon)
1375 call lineout smbconf, Indent||"read only = Yes"
1376 call lineout smbconf, Indent||"browseable = Yes"
1377 call lineout smbconf, Indent||"share modes = No"
1378 call lineout smbconf, Indent
1379 ok = stream(smbconf, 'c','close')
1380return
1381
1382/*:VRX _SmbConfDefault_Profiles
1383*/
1384_SmbConfDefault_Profiles:
1385 /* Create profiles section */
1386 call lineout smbconf, '[profiles]'
1387 call lineout smbconf, Indent||"comment = profiles"
1388 smbprofiles = samba.!bin'\profiles'
1389 ok = SysMkDir(smbprofiles)
1390 call lineout smbconf, Indent||"path = "_bs2fs(smbprofiles)
1391 call lineout smbconf, Indent||"profile acls = Yes"
1392 call lineout smbconf, Indent||"read only = No"
1393 call lineout smbconf, Indent||"browseable = Yes"
1394 call lineout smbconf, Indent||"create mask = 0777"
1395 call lineout smbconf, Indent||"directory mask = 0777"
1396 call lineout smbconf, Indent
1397 ok = stream(smbconf, 'c','close')
1398return
1399
1400/*:VRX _SmbConfDefault_Scripts
1401*/
1402_SmbConfDefault_Scripts:
1403 smbtools = samba.!bin
1404
1405 /* user scripts */
1406 call lineout smbconf, ';'||Indent||'user scripts'
1407 call lineout smbconf, Indent||'add user script = '||smbtools||'\usermod.cmd -a "%u"'
1408 call lineout smbconf, Indent||'delete user script = '||smbtools||'\usermod.cmd -x "%u"'
1409 call lineout smbconf, Indent||'rename user script = '||smbtools||'\usermod.cmd -r "%uold" "%unew"'
1410 call lineout smbconf, Indent||'add machine script = '||smbtools||'\usermod.cmd -a "%u"'
1411 call lineout smbconf, Indent||'set primary group script = '||smbtools||'\usermod.cmd -p "%u" "%g"'
1412
1413 /* group scripts */
1414 call lineout smbconf, ';'||Indent||'group scripts'
1415 call lineout smbconf, Indent||'add group script = '||smbtools||'\groupmod.cmd -a "%g"'
1416 call lineout smbconf, Indent||'delete group script = '||smbtools||'\groupmod.cmd -x "%g"'
1417 call lineout smbconf, Indent||'add user to group script = '||smbtools||'\groupmod.cmd -j "%g" "%u"'
1418 call lineout smbconf, Indent||'delete user from group script = '||smbtools||'\groupmod.cmd -l "%g" "%u"'
1419
1420 /* share scripts */
1421 call lineout smbconf, ';'||Indent||'share scripts'
1422 call lineout smbconf, Indent||'add share command = '||smbtools||'\addshare.cmd'
1423 call lineout smbconf, Indent||'change share command = '||smbtools||'\changeshare.cmd'
1424 call lineout smbconf, Indent||'delete share command = '||smbtools||'\delshare.cmd'
1425
1426 /* other scripts */
1427 call lineout smbconf, ';'||Indent||'other scripts'
1428 call lineout smbconf, Indent||'enumports command = '||smbtools||'\enumports.cmd'
1429 call lineout smbconf, Indent
1430 call lineout smbconf
1431 ok = stream(smbconf, 'c','close')
1432return
1433
1434/*:VRX _SmbConfDefault_ShareDrives
1435*/
1436_SmbConfDefault_ShareDrives:
1437 DriveList = SysDriveMap('C:','Local')
1438
1439 do I = 1 to words(DriveList)
1440 CurDrive = word(DriveList,I)
1441say CurDrive
1442 Filesys = SysFilesystemType(Curdrive)
1443 DriveInfo=SysDriveInfo(CurDrive)
1444 parse var DriveInfo DrvLet CurFree CurSize CurLabel
1445
1446 if FileSys = '' | FileSys = 'CDFS' then do
1447 read_write = 'read only = Yes'
1448 end
1449 else do
1450 read_write = 'read only = No'
1451 end
1452 if FileSys = '' then FileSys = 'CDFS'
1453
1454 section = '['left(curdrive,1)']'
1455 comment = 'comment = 'Drive' 'CurDrive' ('FileSys')'
1456 path = 'path = 'Curdrive'/'
1457 guest_ok = 'guest ok = Yes'
1458 hide_files = 'hide files = /*. SF/root/'
1459
1460 call lineout smbconf, section
1461 call lineout smbconf, Indent||comment
1462 call lineout smbconf, Indent||path
1463 call lineout smbconf, Indent||read_write
1464 call lineout smbconf, Indent||guest_ok
1465 call lineout smbconf, Indent||hide_files
1466 call lineout smbconf, Indent
1467 end
1468 ok = stream(smbconf, 'c','close')
1469return
1470
1471/* browsable = 'browsable = Yes'
1472 printable = 'printable = No'
1473 public = 'public = Yes'
1474 call lineout smbconf, Indent||browsable
1475 call lineout smbconf, Indent||printable
1476 call lineout smbconf, Indent||public */
1477/*:VRX _SmbConfDefault_SharePrinters
1478*/
1479_SmbConfDefault_SharePrinters:
1480 ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.')
1481
1482 do I = 1 to printers.0
1483 queue = printers.I
1484 name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';')
1485
1486/* call lineout samba.!printcap, queue'|'name */
1487
1488 section = '['queue']'
1489 path = 'path = 'ETC'\samba\spool\'queue
1490 ok = SysMkDir(ETC'\samba\spool\'queue)
1491 comment = 'comment = 'name
1492 create_mask = 'create mask = 0700'
1493 guest_ok = 'guest ok = Yes'
1494
1495 printable = 'printable = Yes'
1496 print_command = 'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"'
1497 printer_name = 'printer name = 'queue
1498
1499 call lineout smbconf, section
1500 call lineout smbconf, Indent||comment
1501 call lineout smbconf, Indent||path
1502 call lineout smbconf, Indent||create_mask
1503 call lineout smbconf, Indent||printable
1504 call lineout smbconf, Indent||print_command
1505 call lineout smbconf, Indent||printer_name
1506 call lineout smbconf, Indent||guest_ok
1507
1508 call lineout smbconf, Indent
1509
1510 end
1511 ok = stream(smbconf, 'c','close')
1512 ok = stream(samba.!printcap,'c','close')
1513return
1514
1515/* browsable = 'browsable = Yes'
1516 call lineout smbconf, Indent||browsable */
1517/*:VRX _SmbConfLoad
1518*/
1519_SmbConfLoad:
1520 call _debuglog '_SmbConfLoad() started'
1521 call _debuglog 'Loading "'samba.!smbconf'" ('stream(samba.!smbconf,'c','query size')' bytes)'
1522
1523/* ok = IniEnumSections(sections., samba.!smbconf) */
1524
1525 section. = ""
1526 sections.0 = 0
1527 call _MyIniEnumSections(samba.!smbconf)
1528
1529 special = 'global printers netlogon print$ homes profiles'
1530 Specialstatus.0 = sections.0
1531 PrintStatus.0 = sections.0
1532 sectionhandles.0 = sections.0
1533 recordhandle.0 = sections.0
1534
1535 do I = 1 to sections.0
1536 IF options.!debug == 1 THEN say ' ['sections.I'] section loaded'
1537 if wordpos(translate(sections.I),translate(special)) > 0 Then SpecialStatus.I = 1
1538 Else SpecialStatus.I = 0
1539 PrintRes = IniGet("Printable", sections.I, samba.!smbconf)
1540 if Translate(PrintRes) = "YES" | Translate(PrintRes) = "TRUE" then PrintStatus.I = 1
1541 else PrintStatus.I = 0
1542
1543 IF options.!debug == 1 THEN say ' ['sections.I'] status (special:'SpecialStatus.I', print:'Printstatus.I')'
1544 if Printstatus.I = 1 & SpecialStatus.I = 0 then do /* printer share */
1545 recordhandle.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,,sections.I,"#65:PMWP.DLL")
1546 ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"ReadOnly", 1)
1547 IF options.!debug == 1 THEN say ' ['sections.I'] added to shared printer tree'
1548 end
1549 if Printstatus.I = 0 & SpecialStatus.I = 0 then do /* directory share */
1550 recordhandle.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,, sections.I,"#64:PMWP.DLL")
1551 ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"ReadOnly", 1)
1552 IF options.!debug == 1 THEN say ' ['sections.I'] added to shared folder tree'
1553 end
1554 if translate(sections.I) = 'PROFILES' then do
1555 recordhandle.I = smbconf.!profiles
1556 ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1)
1557 end
1558 if translate(sections.I) = 'NETLOGON' then do
1559 recordhandle.I = smbconf.!netlogon
1560 ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1)
1561 end
1562 if translate(sections.I) = 'HOMES' then do
1563 recordhandle.I = smbconf.!homes
1564 ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1)
1565 end
1566 if translate(sections.I) = 'GLOBAL' then recordhandle.I = smbconf.!global
1567 end
1568 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!root, "Collapsed", 0 )
1569 call _debuglog '_SmbConfLoad() done'
1570return
1571
1572
1573/* if VRGet("DT_AlreadySmbConf","Visible") then do
1574 smbline = strip(translate(linein(smbconf),' ','09'x))
1575
1576 do while translate(left(smbline,8)) <> "[GLOBAL]"
1577 smbline = strip(translate(linein(smbconf),' ','09'x))
1578 end
1579
1580 do until left(smbline,1) = '['
1581 smbline = strip(translate(linein(smbconf),' ','09'x))
1582 parse var smbline voc '=' val
1583 voc = strip(voc)
1584 val = strip(val)
1585 if translate(voc) = "WORKGROUP" then do
1586 ok = VRset("EF_WorkGroup", "Value", val)
1587 ok = VRSet("EF_WorkGroup", "BackColor", "(255,255,180)")
1588 end
1589 if translate(voc) = "NETBIOS NAME" then do
1590 ok = VRset("EF_NetBIOS_Name", "Value", val)
1591 ok = VRSet("EF_NetBIOS_Name", "BackColor", "(255,255,180)")
1592 end
1593 if translate(voc) = "SERVER STRING" then do
1594 ok = VRset("EF_Server_String", "Value", val)
1595 ok = VRSet("EF_server_string", "BackColor", "(255,255,180)")
1596 end
1597
1598 end
1599 ok = stream(smbconf, 'c','close')
1600 end */
1601
1602/*:VRX _SmbConfMigratePeer
1603*/
1604_SmbConfMigratePeer:
1605 Ok = SysFileDelete(smbconf)
1606 /* Migrate Peer To Samba */
1607
1608 /* IBMLAN.INI part */
1609 ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
1610
1611 do while translate(left(ibmlanline,11)) <> "[REQUESTER]"
1612 ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
1613 end
1614
1615 call lineout smbconf, '[global]'
1616 do until left(ibmlanline,1) = '['
1617 ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
1618 parse var ibmlanline voc '=' val
1619 voc = strip(voc)
1620 val = strip(val)
1621 if translate(voc) = "DOMAIN" then do
1622 call lineout smbconf, Indent||'workgroup = 'val
1623 end
1624 if translate(voc) = "COMPUTERNAME" then do
1625 call lineout smbconf, Indent||'netbios name = 'val
1626 end
1627 end
1628 do while translate(left(ibmlanline,6)) <> '[PEER]'
1629 ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
1630 end
1631 do until left(ibmlanline,1) = '[' | lines(ibmlanini) = 0
1632 ibmlanline = strip(translate(linein(ibmlanini),' ',Indent))
1633 parse var ibmlanline voc '=' val
1634 voc = strip(voc)
1635 val = strip(val)
1636 if translate(voc) = "SRVCOMMENT" then do
1637 call lineout smbconf, Indent||'server string = 'val
1638 call lineout smbconf, Indent||'comment = 'val
1639 end
1640 end
1641 call _SmbConfDefault_Global 1 /* 1 = migration mode */
1642
1643 call _SmbConfDefault_Scripts
1644 if CreatePDC then do
1645 call _SmbConfDefault_NetLogon
1646 call _SmbConfDefault_Profiles
1647 end
1648 call _SmbConfDefault_Homes
1649
1650 /* LSSHARE.INI part */
1651
1652 ok = SysINI(lsshareini,"ALL:","Shares." )
1653 SharePath.0 = shares.0
1654 Comment.0 = shares.0
1655 Type.0 = shares.0
1656
1657 ok = VRMethod( "Application", "ListPrinters", "printer." )
1658
1659 do I = 1 to shares.0
1660 call lineout smbconf, '['Shares.I']'
1661 sharepath.I = SysINI(lsshareini, shares.I, 'Path')
1662 Type.I = c2d(left(SysINI(lsshareini, shares.I, 'Type'),1))
1663 if Type.I = '1' then do /* We migrate a printer */
1664 do J = 1 to printer.0
1665 parse var printer.J PrinterName';'PrinterQueue';'PrinterDriver
1666 if PrinterQueue = Sharepath.I then leave
1667 end
1668 call lineout smbconf, Indent||'path = '_bs2fs(ETC'\samba\spool\'printerqueue)
1669 ok = SysMkDir(ETC'\samba\spool\'printerqueue)
1670 call lineout smbconf, Indent||'comment = 'Printername
1671 call lineout smbconf, Indent||'create mask = 0700'
1672 call lineout smbconf, Indent||'printer name = 'printerqueue
1673 call lineout smbconf, Indent||'printing = os2'
1674 call lineout smbconf, Indent||'printable = Yes'
1675 call lineout smbconf, Indent||'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"'
1676 call lineout smbconf, Indent||'browseable = Yes'
1677 call lineout smbconf, Indent||'guest ok = Yes'
1678 call lineout smbconf, Indent||'read only = No'
1679 end
1680 else do /* we migrate a folder */
1681 Comment.I = SysINI(lsshareini, shares.I, 'Remark')
1682 call lineout smbconf, Indent||'comment = 'Comment.I
1683 call lineout smbconf, Indent||'path = 'translate(Sharepath.I,'/','\')
1684 call lineout smbconf, Indent||'read only = No'
1685 call lineout smbconf, Indent||'browseable = Yes'
1686 call lineout smbconf, Indent||'hide files = /*. SF/root/'
1687 end
1688 call lineout smbconf, " "
1689 end
1690 ok = stream(smbconf,'c','close')
1691return
1692
1693/*:VRX _SmbConfRestore
1694*/
1695_SmbConfRestore:
1696 ok = VRCopyFile( SmbConf"-backup", SmbConf)
1697return
1698
1699/*:VRX _SmbConfShareRemove
1700*/
1701_SmbConfShareRemove:
1702 Aborted = 0
1703 ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "SelectedHandle." )
1704 if Selectedhandle.0 = 0 then return
1705 Msg.Title = NLVGetMessage(67)
1706 do I = 1 to sections.0
1707 if recordhandle.I = SelectedHandle.1 then do
1708 if recordhandle.I = smbconf.!homes | recordhandle.I = smbconf.!global then do
1709 Msg.Text = NLVGetMessage(61, Sections.I)
1710 Msg.Type = 'E'
1711 call _ShowMsg
1712 Aborted = 1
1713 return
1714 end
1715
1716 Msg.Text = NLVGetMessage(62, Sections.I)
1717 Msg.Type = "Q"
1718 ok = _MsgYesNo()
1719 if ok = 2 then return
1720
1721 NewSmbConf = TempDir'smb.conf'
1722 ok = SysFileDelete(NewSmbConf)
1723 smbline = strip(linein(smbconf))
1724 do while left(translate(smbline),length(sections.I)+2) <> translate('['sections.I']')
1725 call lineout NewSmbConf, smbline
1726 smbline = strip(linein(smbconf))
1727 end
1728 smbline = strip(linein(smbconf))
1729 do while left(translate(smbline),1) <> '[' & lines(smbconf) <> 0
1730 smbline = strip(linein(smbconf))
1731 end
1732 do until lines(smbconf) = 0
1733 call lineout NewSmbConf, smbline
1734 smbline = strip(linein(smbconf))
1735 end
1736 call lineout NewSmbConf, smbline
1737 ok = stream(smbconf, 'c', 'close')
1738 ok = stream(Newsmbconf, 'c', 'close')
1739 ok = VRCopyFile( NewSmbConf, smbconf )
1740 end
1741 end
1742 call _SmbConfTreeReset
1743
1744 if _SambaRunning() then do
1745 Msg.Text = NLVGetMessage(69)
1746 Msg.Type = 'I'
1747 call _ShowMsg
1748 end
1749return
1750
1751/*:VRX _SmbConfShareRename
1752*/
1753_SmbConfShareRename:
1754 Aborted = 0
1755 ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "SelectedHandle." )
1756 if Selectedhandle.0 = 0 then return
1757
1758 do I = 1 to sections.0
1759 if recordhandle.I = SelectedHandle.1 then do
1760 if recordhandle.I = smbconf.!homes | recordhandle.I = smbconf.!global then do
1761 Msg.Text = NLVGetMessage(66, Sections.I)
1762 Msg.Type = 'E'
1763 call _ShowMsg
1764 Aborted = 1
1765 return
1766 end
1767 Buttons.1 = NLVGetMessage(2)
1768 Buttons.2 = NLVGetMessage(3)
1769 Buttons.0 = 2
1770 NewShareName = Sections.I
1771 id = VRPrompt( VRWindow(), NLVGetMessage(66), "NewShareName", NLVGetMessage(68), "Buttons.", buttons.1, buttons.2 )
1772 if ID = 2 | NewShareName = "" then return
1773
1774 NewSmbConf = TempDir'smb.conf'
1775 ok = SysFileDelete(NewSmbConf)
1776 smbline = strip(linein(smbconf))
1777 do while left(translate(smbline),length(sections.I)+2) <> translate('['sections.I']')
1778 call lineout NewSmbConf, smbline
1779 smbline = strip(linein(smbconf))
1780 end
1781 call lineout NewSmbConf, '['NewShareName']'
1782 smbline = strip(linein(smbconf))
1783 do until lines(smbconf) = 0
1784 call lineout NewSmbConf, smbline
1785 smbline = strip(linein(smbconf))
1786 end
1787 call lineout NewSmbConf, smbline
1788 ok = stream(smbconf, 'c', 'close')
1789 ok = stream(Newsmbconf, 'c', 'close')
1790 ok = VRCopyFile( NewSmbConf, smbconf )
1791 end
1792 end
1793 call _SmbConfTreeReset
1794
1795 if _SambaRunning() then do
1796 Msg.Text = NLVGetMessage(69)
1797 Msg.Type = 'I'
1798 call _ShowMsg
1799 end
1800return
1801
1802/*:VRX _SmbConfTreeInit
1803*/
1804_SmbConfTreeInit:
1805 IF options.!debug == 1 THEN say '_SmbConfTreeInit() started.'
1806 call _CfgPageSetupSize "GB_Help"
1807 call _CfgPageSetupSize "GB_Global"
1808 call _CfgPageSetupSize "GB_Shares"
1809 IF options.!debug == 1 THEN say ' Page setup done.'
1810
1811 ok = VRMethod("CN_smbconf", "RemoveRecord", "ALL")
1812 smbconf.!root = VRMethod( "CN_smbconf", "AddRecord",,, "smb.conf","#33:PMWP.DLL")
1813 smbconf.!global = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Global","#33:PMWP.DLL")
1814 smbconf.!homes = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Homes","#33:PMWP.DLL")
1815 smbconf.!netlogon = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Netlogon","#33:PMWP.DLL")
1816 smbconf.!profiles = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Profiles","#33:PMWP.DLL")
1817 smbconf.!printers = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, NLVGetMessage(45),"#93:PMWP.DLL")
1818 smbconf.!dirs = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, NLVGetMessage(46),"#27:PMWP.DLL")
1819 IF options.!debug == 1 THEN say ' smb.conf sections created.'
1820
1821 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!netlogon, "Visible", 0 , "ReadOnly", 1)
1822 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!profiles, "Visible", 0 , "ReadOnly", 1)
1823 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!homes, "Visible", 0 , "ReadOnly", 1)
1824 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!root, "Collapsed",1, "ReadOnly", 1 )
1825 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!global, "ReadOnly", 1)
1826 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "ReadOnly", 1)
1827 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "ReadOnly", 1)
1828
1829 IF options.!debug == 1 THEN say ' visibility set.'
1830 IF options.!debug == 1 THEN say '_SmbConfTreeInit() done.'
1831return
1832
1833/*:VRX _SmbConfTreeReset
1834*/
1835_SmbConfTreeReset:
1836 call _debuglog '_SmbConfTreeReset() started'
1837 call _SharesReset
1838 ok = VRMethod( "CN_SmbConf", "RemoveRecord", smbconf.!root )
1839 call _SmbConfTreeInit
1840 call _GUIInit
1841 call _debuglog '_SmbConfTreeReset() done'
1842return
1843
1844/*:VRX _SmbUserMapCreate
1845*/
1846_SmbUserMapCreate:
1847 call lineout samba.!smbusermap, '# Created by SSCC version 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time()
1848 call lineout samba.!smbusermap, '# syntax:'
1849 call lineout samba.!smbusermap, '# Samba username = Windows username'
1850 call lineout samba.!smbusermap, 'root = Administrator'
1851 ok = stream(samba.!smbusermap,'c','close')
1852return
1853
1854/*:VRX About_Close
1855*/
1856About_Close:
1857 call About_Fini
1858return
1859
1860/*:VRX About_Create
1861*/
1862About_Create:
1863 call About_Init
1864 ok = VRSet("About","Caption", NLVGetMessage(31))
1865 ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2))
1866 SambaTeam.0 = 9
1867 SambaTeam.1 = 'Silvan Scherrer'
1868 SambaTeam.2 = 'Herwig Bauernfeind'
1869 SambaTeam.3 = 'Vitali Pelenyov'
1870 SambaTeam.4 = 'Paul Smedley'
1871 SambaTeam.5 = 'Yuri Dario'
1872 SambaTeam.6 = 'Alex Taylor'
1873 SambaTeam.7 = 'Nikolay Kolosov'
1874 SambaTeam.8 = 'All the Samba people'
1875 SambaTeam.9 = 'All the netlabs people'
1876 ok = VRSet("About","Font", VRGet("GB_Help2","Font"))
1877 ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
1878 ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(72))
1879 ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
1880return
1881
1882/*:VRX About_Fini
1883*/
1884About_Fini:
1885 window = VRInfo( "Window" )
1886 call VRDestroy window
1887 drop window
1888return
1889/*:VRX About_Init
1890*/
1891About_Init:
1892 window = VRInfo( "Object" )
1893 if( \VRIsChildOf( window, "Notebook" ) ) then do
1894 call VRMethod window, "CenterWindow"
1895 call VRSet window, "Visible", 1
1896 call VRMethod window, "Activate"
1897 end
1898 drop window
1899return
1900
1901/*:VRX CB_Browseable_Click
1902*/
1903CB_Browseable_Click:
1904 call _ShareObject_Changed
1905return
1906
1907/*:VRX CB_EA_Support_Click
1908*/
1909CB_EA_Support_Click:
1910 call _ShareObject_Changed
1911return
1912
1913/*:VRX CB_Guest_OK_Click
1914*/
1915CB_Guest_OK_Click:
1916 call _ShareObject_Changed
1917return
1918
1919/*:VRX CB_LM_Announce_Click
1920*/
1921CB_LM_Announce_Click:
1922 call _ShareObject_Changed
1923return
1924
1925/*:VRX CB_Null_passwords_Click
1926*/
1927CB_Null_passwords_Click:
1928 call _ShareObject_Changed
1929return
1930
1931/*:VRX CB_Read_Only_Click
1932*/
1933CB_Read_Only_Click:
1934 call _ShareObject_Changed
1935return
1936
1937/*:VRX CB_RemoveSmbConf_Click
1938*/
1939CB_RemoveSmbConf_Click:
1940 ok = VRSet("CB_RemoveBackend", "Enabled", VRGet("CB_RemoveSmbConf","set"))
1941 if VRGet("CB_RemoveBackend", "Enabled") = 0 then ok = VRSet("CB_RemoveBackend", "Set", 0)
1942return
1943
1944/*:VRX CB_Store_DOS_attributes_Click
1945*/
1946CB_Store_DOS_attributes_Click:
1947 call _ShareObject_Changed
1948return
1949
1950/*:VRX CB_Time_Server_Click
1951*/
1952CB_Time_Server_Click:
1953 call _ShareObject_Changed
1954return
1955
1956/*:VRX CB_WINS_Support_Click
1957*/
1958CB_WINS_Support_Click:
1959 call _ShareObject_Changed
1960return
1961
1962/*:VRX CN_smbconf_Click
1963*/
1964CN_smbconf_Click:
1965 IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() started'
1966 IF options.!debug == 1 THEN SAY ' Using 'smbconf' ('stream(smbconf,'c','query size')' bytes)'
1967 if ValueChanged then do
1968 if CurSection <> "" then do
1969 Msg.Title = NLVGetMessage('1')
1970 Msg.Text = NLVGetMessage(60, CurSection)
1971 ok = _MsgYesNo()
1972 if ok = 1 then call _SaveChanges
1973 CurSection = ""
1974 end
1975 end
1976
1977 Ok = VRset("Main", "Painting", 0)
1978 ok = VRSet("Main", 'Pointer', 'WAIT' )
1979 ok = VRset("GB_Help", "Visible", 0)
1980 ok = VRset("GB_Global", "Visible", 0)
1981 ok = VRset("GB_Shares", "Visible", 0)
1982
1983 ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "Prophandle." )
1984 if PropHandle.0 = 0 then do
1985 IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() aborted, no handle'
1986 Ok = VRset("Main", "Painting", 1)
1987 ok = VRSet("Main", 'Pointer', '<default>' )
1988 return
1989 end
1990 ParentHandle = VRMethod("CN_smbconf","GetRecordAttr", Prophandle.1,"Parent")
1991
1992 if Prophandle.1 = smbconf.!root then ok = VRset("GB_Help", "Visible", 1)
1993 if Prophandle.1 = smbconf.!global | Parenthandle = smbconf.!global then call _ActiveGroup "Global"
1994 if Prophandle.1 = smbconf.!homes | Parenthandle = smbconf.!homes then call _ActiveGroup "Shares"
1995 if Prophandle.1 = smbconf.!netlogon | Parenthandle = smbconf.!netlogon then call _ActiveGroup "Shares"
1996 if Prophandle.1 = smbconf.!profiles | Parenthandle = smbconf.!profiles then call _ActiveGroup "Shares"
1997 if Prophandle.1 = smbconf.!dirs then call _ActiveGroup "Help"
1998 if Prophandle.1 = smbconf.!printers then call _ActiveGroup "Help"
1999 if Parenthandle = smbconf.!dirs then call _ActiveGroup "Shares"
2000 if Parenthandle = smbconf.!printers then call _ActiveGroup "Shares"
2001
2002 call _SharesReset
2003 Ok = VRset("Main", "Painting", 1)
2004 ok = VRSet("Main", 'Pointer', '<default>' )
2005
2006 ok = VRSet("TM_Value", "Enabled", 1)
2007 if Prophandle.1 = smbconf.!root | Prophandle.1 = smbconf.!dirs | Prophandle.1 = smbconf.!printers then do
2008 IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() aborted, got parent handle'
2009 Ok = VRset("Main", "Painting", 1)
2010 ok = VRSet("Main", 'Pointer', '<default>' )
2011 return
2012 end
2013 IF options.!debug == 1 THEN SAY ' Got child handle, start populating now'
2014 ObjYPos = 1280+361+72-120
2015 ObjXPos = 1325+72
2016 ObjDelta= 380
2017 CreatedObjs.0 = 0
2018 Objs = 0
2019
2020 Page = 1 /* for global */
2021
2022 do I = 1 to sections.0
2023 if Prophandle.1 <> recordhandle.I then iterate
2024
2025 Ok = VRset("Main", "Painting", 0)
2026 ok = VRSet("Main", 'Pointer', 'WAIT' )
2027 CurSection = sections.I
2028 CurSIdx = I
2029 upCurSection = translate(CurSection)
2030 IF options.!debug == 1 THEN SAY ' Section ['sections.I']'
2031
2032 if upCurSection = 'GLOBAL' then do
2033 ObjYPos = 1605+-120+361+361+361+361+361+361
2034 ObjXPos = 1325
2035 ObjDelta = 320
2036 if Page = 1 then do
2037 if \VRIsValidObject("GB_"ActiveGroup"_1") then do
2038 ActiveGroupObj = VRCreate("GB_Global", "Window", "Name", "GL_GLOBAL_"Page, "Height", 1500, "Width", 1500, "Visible", 0, "Font", "9.WarpSans")
2039 IF options.!debug == 1 THEN say ' Neues Fenster VRCreate = 'ok
2040 ok = VRLoad( "GB_Global", VRWindowPath(), "GL_GLOBAL_"Page )
2041 IF options.!debug == 1 THEN say ' VRLoad = 'ok
2042 ok = VRMethod("GB_Global", "InsertPage", "GL_GLOBAL_"Page, "+"Page)
2043 IF options.!debug == 1 THEN say ' InsertPage = 'ok
2044
2045/* ok = VRset("Main", "Painting", 1)
2046 ok = VRSet("Main", 'Pointer', '<default>' )
2047 Msg.Text = NLVGetMessage(114)
2048 Msg.Type = "I"
2049 call _ShowMsg
2050 return */
2051 end
2052 ActiveGroupObj = VRGet("GB_"ActiveGroup"_1", "Self")
2053 end
2054 end
2055 else do
2056 if \VRIsValidObject("GB_"ActiveGroup) then do
2057 ok = VRset("Main", "Painting", 1)
2058 ok = VRSet("Main", 'Pointer', '<default>' )
2059 Msg.Text = NLVGetMessage(114)
2060 Msg.Type = "I"
2061 call _ShowMsg
2062 return
2063 end
2064 ActiveGroupObj = "GB_"ActiveGroup
2065 ok = VRSet("DT_"ActiveGroup,"Caption",sections.I)
2066 end
2067 say "CurSection="CurSection
2068 say "smbconf="smbconf
2069
2070 /* ok = IniEnum("Voc", hdl) */ /* Old command: Fill the Voc stem with vocabulary */
2071
2072 call _MyIniEnum(CurSection)
2073
2074 if upCurSection <> 'GLOBAL' then do
2075 ok = VRSet("CB_Read_Only", "set", 1)
2076 end
2077 do V = 1 to Voc.0 /* loop for every vocabulary */
2078 ValueChanged = 0
2079 ChangeList = ""
2080
2081 /* get value for this vocabulary */
2082 Val.V = IniGet(Voc.V, CurSection, samba.!smbconf) /* this is currently done by _MyIniEnum (which is probably not good) */
2083 select
2084 when pos("\\",Val.V) > 0 then nop
2085 when pos(" dir",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
2086 when pos("file",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
2087 when pos("path",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
2088 when pos("username map",Voc.V) > 0 then Val.V = _fs2bs(Val.V)
2089 otherwise nop /* do not beautify */
2090 end
2091
2092 IF options.!debug == 1 THEN say ' Process: "'Voc.V'" = "'Val.V'"'
2093
2094 /* Proper format to ease checking and object creation */
2095 upVal = translate(Val.V)
2096 upVoc = translate(translate(Voc.V,'_',' '))
2097
2098 if upVal = 'YES'| upVal = 'NO'
2099 then VocObjType = 'CB'
2100 else VocObjType = 'EF'
2101
2102 /* Non configurable items */
2103 if upVoc = "PRINTABLE" then iterate
2104 if pos('SCRIPT', upVoc) > 0 then iterate
2105 if pos('COMMAND', upVoc) > 0 then iterate
2106
2107 if upVoc = "COMMENT" then do
2108 CurPage = Page
2109 CurActiveGroupObj = ActiveGroupObj
2110 if Page <> 1 then ActiveGroupObj = VRGet("GB_"ActiveGroup"_1", "Self")
2111 OldObjYPos = ObjYPos
2112 if upCurSection = "GLOBAL" then ObjYPos = 860-120
2113 else ObjYPos = 860+361+72
2114 if _CreateVocObject() then do
2115 ok = VRSet(VocObjType"_"upVoc, 'Value', Val.V)
2116 ok = VRFlush( , VocObjType"_"upVoc )
2117 end
2118 ActiveGroupObj = CurActiveGroupObj
2119 Page = CurPage
2120 ObjYPos = OldObjYPos
2121 end
2122 else do /* Normalfall */
2123 if _CreateVocObject() then do
2124 if upVal = "YES" | upVal = "NO" then do
2125 ok = VRset(VocObjType"_"upVoc,"Set", (upVal="YES"))
2126 ok = VRFlush( , VocObjType"_"upVoc )
2127 end
2128 else do
2129 ok = VRSet(VocObjType"_"upVoc, 'Value', Val.V)
2130 ok = VRFlush( , VocObjType"_"upVoc )
2131 if translate(VocObjType"_"upVoc) = VocObjType"_PRINTER_NAME" then do
2132 ok = VRSet(VocObjType"_"upVoc, 'ReadOnly', 1)
2133 ok = VRSet(VocObjType"_"upVoc, 'BackColor', 'PaleGray')
2134 end
2135 end
2136 end
2137 nop
2138 end
2139 ok = VRSet(VocObjType"_"upVoc, 'Userdata', V)
2140
2141 if upCurSection = 'GLOBAL' then do
2142 if upVoc = "WINBIND_SEPARATOR" then do /* Workaround for Samba Ticket #57 */
2143 ok = VRset("DT_WINBIND_SEPARATOR","Visible","0")
2144 ok = VRset("EF_WINBIND_SEPARATOR","Value","|")
2145 ok = VRFlush( , "EF_WINBIND_SEPARATOR" )
2146 ok = VRset("EF_WINBIND_SEPARATOR","Visible",0)
2147 ObjYPos = ObjYPos - ObjDelta
2148 end
2149
2150 if ObjYPos > VRGet("GB_Global","Height") - 1200 then do
2151 /* Ok = VRset("Main", "Painting", 1)
2152 ok = VRSet("Main", 'Pointer', '<default>' )*/
2153 Page = Page + 1
2154 if Page = 2 then do
2155 Ok = VRset("Main", "Painting", 1)
2156 Ok = VRset("Main", "Painting", 0)
2157 ok = VRSet("Main", 'Pointer', 'Wait' )
2158 end
2159 if \VRIsValidOBject("GL_GLOBAL_"Page) then do
2160 ActiveGroupObj = VRCreate("GB_Global", "Window", "Name", "GL_GLOBAL_"Page, "Height", 1500, "Width", 1500, "Visible", 0, "Font", "9.WarpSans")
2161 IF options.!debug == 1 THEN say ' Neues Fenster VRCreate = 'ok
2162 ok = VRLoad( "GB_Global", VRWindowPath(), "GL_GLOBAL_"Page )
2163 IF options.!debug == 1 THEN say ' VRLoad = 'ok
2164 ok = VRMethod("GB_Global", "InsertPage", "GL_GLOBAL_"Page, "+"Page)
2165 IF options.!debug == 1 THEN say ' InsertPage = 'ok
2166 end
2167 else do
2168 ActiveGroupObj = VRGet("GL_GLOBAL_"Page, "Self")
2169 end
2170 ObjYPos = 0
2171 IF options.!debug == 1 THEN say " Page ="page
2172 /* Ok = VRset("Main", "Painting", 0) */
2173 end
2174 end
2175 end
2176 end
2177 if upCurSection = "GLOBAL" then do
2178 if VRGet("EF_Netbios_name","Value") = "" then do
2179 ok = VRset("EF_NETBIOS_NAME","Value",Value("HOSTNAME",,"OS2ENVIRONMENT"))
2180 ok = VRFlush( , "EF_NETBIOS_NAME" )
2181 end
2182 if VRGet("EF_WorkGroup","Value") = "" then do
2183 ok = VRset("EF_WorkGroup","Value","WORKGROUP")
2184 ok = VRFlush( , "EF_WorkGroup" )
2185 end
2186 end
2187
2188 Ok = VRset("Main", "Painting", 1)
2189 ok = VRSet("Main", 'Pointer', '<default>' )
2190 IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() done'
2191return
2192/*:VRX CN_smbconf_ContextMenu
2193*/
2194CN_smbconf_ContextMenu:
2195 ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "Prophandle." )
2196 if PropHandle.0 = 0 then return
2197 ParentHandle = VRMethod("CN_smbconf","GetRecordAttr", Prophandle.1,"Parent")
2198 ok = VRset("Menu_ShareContext_AddPrinter", "Visible", 0)
2199 ok = VRset("Menu_ShareContext_RenamePrinter", "Visible", 0)
2200 ok = VRset("Menu_ShareContext_RemovePrinter", "Visible", 0)
2201 ok = VRset("Menu_ShareContext_Add", "Visible", 0)
2202 ok = VRset("Menu_ShareContext_Rename", "Visible", 0)
2203 ok = VRset("Menu_ShareContext_Remove", "Visible", 0)
2204
2205 if Prophandle.1 = smbconf.!root then ok = VRset("GB_Help", "Visible", 1)
2206 if Prophandle.1 = smbconf.!global | Parenthandle = smbconf.!global then return
2207 if Prophandle.1 = smbconf.!homes | Parenthandle = smbconf.!homes then return
2208 if Prophandle.1 = smbconf.!dirs then do
2209 ok = VRset("Menu_ShareContext_Add", "Visible", 1)
2210 end
2211 if Parenthandle = smbconf.!dirs then do
2212 ok = VRset("Menu_ShareContext_Add", "Visible", 1)
2213 ok = VRset("Menu_ShareContext_Rename", "Visible", 1)
2214 ok = VRset("Menu_ShareContext_Remove", "Visible", 1)
2215 end
2216 if Prophandle.1 = smbconf.!printers then do
2217 ok = VRset("Menu_ShareContext_AddPrinter", "Visible", 1)
2218 end
2219 if Parenthandle = smbconf.!printers then do
2220 ok = VRset("Menu_ShareContext_AddPrinter", "Visible", 1)
2221 ok = VRset("Menu_ShareContext_RenamePrinter", "Visible", 1)
2222 ok = VRset("Menu_ShareContext_RemovePrinter", "Visible", 1)
2223 end
2224
2225 ok = VRMethod( "Menu_ShareContext", "Popup", , , "", "" )
2226
2227return
2228
2229/*:VRX EF_display_charset_Change
2230*/
2231EF_display_charset_Change:
2232 call _ShareObject_Changed
2233return
2234
2235/*:VRX EF_dos_charset_Change
2236*/
2237EF_dos_charset_Change:
2238 call _ShareObject_Changed
2239return
2240
2241/*:VRX EF_Log_file_Change
2242*/
2243EF_Log_file_Change:
2244 call _ShareObject_Changed
2245return
2246
2247/*:VRX EF_LOG_LEVEL_Change
2248*/
2249EF_LOG_LEVEL_Change:
2250 call _ShareObject_Changed
2251return
2252
2253/*:VRX EF_NetBIOS_Name_Change
2254*/
2255EF_NetBIOS_Name_Change:
2256 call _ShareObject_Changed
2257return
2258
2259/*:VRX EF_path_Change
2260*/
2261EF_path_Change:
2262 call _ShareObject_Changed
2263return
2264
2265/*:VRX EF_SECURITY_Change
2266*/
2267EF_SECURITY_Change:
2268 call _ShareObject_Changed
2269return
2270
2271/*:VRX EF_Server_String_Change
2272*/
2273EF_Server_String_Change:
2274 call _ShareObject_Changed
2275return
2276
2277/*:VRX EF_Unix_charset_Change
2278*/
2279EF_Unix_charset_Change:
2280 call _ShareObject_Changed
2281return
2282
2283/*:VRX EF_Workgroup_Change
2284*/
2285EF_Workgroup_Change:
2286 call _ShareObject_Changed
2287return
2288
2289/*:VRX Fini
2290*/
2291Fini:
2292 window = VRWindow()
2293 call VRSet window, "Visible", 0
2294 drop window
2295return 0
2296
2297/*:VRX GB_Global_1_Close
2298*/
2299GB_Global_1_Close:
2300 call GB_Global_1_Fini
2301return
2302
2303/*:VRX GB_Global_1_Create
2304*/
2305GB_Global_1_Create:
2306 call GB_Global_1_Init
2307 SysCP = SysQueryProcessCodePage()
2308 ok = VRMethod( "EF_unix_charset", "AddString", "IBM-"SysCP, 2)
2309 ok = VRMethod( "EF_display_charset", "AddString", "IBM-"SysCP, 2)
2310 if pos("IBM-"SysCP, VRGet( "EF_dos_charset","InitialList")) = 0 then do
2311 ok = VRMethod( "EF_dos_charset", "AddString", "IBM-"SysCP, 2)
2312 end
2313return
2314
2315/*:VRX GB_Global_1_Fini
2316*/
2317GB_Global_1_Fini:
2318 window = VRInfo( "Window" )
2319 call VRDestroy window
2320 drop window
2321return
2322/*:VRX GB_Global_1_Init
2323*/
2324GB_Global_1_Init:
2325 window = VRInfo( "Object" )
2326 if( \VRIsChildOf( window, "Notebook" ) ) then do
2327 call VRMethod window, "CenterWindow"
2328 call VRSet window, "Visible", 1
2329 call VRMethod window, "Activate"
2330 end
2331 drop window
2332return
2333
2334/*:VRX Halt
2335*/
2336Halt:
2337 signal _VREHalt
2338return
2339
2340/*:VRX Init
2341*/
2342Init:
2343 window = VRWindow()
2344 call VRMethod window, "CenterWindow"
2345 call VRSet window, "Visible", 1
2346 call VRMethod window, "Activate"
2347 drop window
2348return
2349
2350/*:VRX Installer_Close
2351*/
2352Installer_Close:
2353 Msg.Text = NLVGetMessage(114)
2354 Msg.Type = "I"
2355 call _ShowMsg
2356 call Installer_Fini
2357return
2358
2359/*:VRX Installer_Create
2360*/
2361Installer_Create:
2362 call Installer_Init
2363 CALL NLVSetText 'Installer', 'Caption', 90
2364 CALL NLVSetText 'DT_RootPasswordDescription', 'Caption', 91
2365 CALL NLVSetText 'DT_RootPassword', 'Caption', 92
2366 CALL NLVSetText 'DT_RootPassword_repeat', 'Caption', 93
2367 CALL NLVSetText 'CB_NoRoot', 'Caption', 94
2368 CALL NLVSetText 'DT_Backend', 'Caption', 95
2369 CALL NLVSetText 'DT_ServerType', 'Caption', 96
2370 CALL NLVSetText 'PB_Install_Default', 'Caption', 97
2371 CALL NLVSetText 'PB_Install_Migration', 'Caption', 98
2372
2373 ok = VRSet("PB_Install_Migration", "Enabled", lsshareiniexists * ibmlaniniexists )
2374 ok = VRSet("TM_Installer","Enabled", 0)
2375 if stream(samba.!group,'c','query exists') = "" | stream(samba.!group,'c','query size') < 120 then do
2376 call _GroupCreate
2377 end
2378 if stream(samba.!masterpasswd,'c','query exists') = "" | stream(samba.!group,'c','query size') < 230 then do
2379 call _MasterPasswdCreate
2380 call _PasswordDBRewrite
2381 ok = VRSet("CB_NoRoot","Enabled", 0)
2382 end
2383 if stream(samba.!pwddb,'c','query exists') = "" | stream(samba.!spwddb,'c','query exists') = "" then do
2384 call _PasswordDBRewrite
2385 ok = VRSet("CB_NoRoot","Enabled", 0)
2386 end
2387 if \VRFileExists(ETC'\samba\private\secrets.tdb') then do
2388 ok = VRSet("CB_NoRoot","Enabled", 0)
2389 end
2390 UseTDBsam = 1
2391 CreatePDC = 0
2392return
2393
2394/*:VRX Installer_Fini
2395*/
2396Installer_Fini:
2397 window = VRInfo( "Window" )
2398 call VRDestroy window
2399 drop window
2400return
2401/*:VRX Installer_Init
2402*/
2403Installer_Init:
2404 window = VRInfo( "Object" )
2405 if( \VRIsChildOf( window, "Notebook" ) ) then do
2406 call VRMethod window, "CenterWindow"
2407 call VRSet window, "Visible", 1
2408 call VRMethod window, "Activate"
2409 end
2410 drop window
2411return
2412
2413/*:VRX IPB_ChooseDir_Click
2414*/
2415IPB_ChooseDir_Click:
2416 InitDir = VRGet("EF_Path","Value")
2417 VarPos = pos('%', InitDir)
2418 if VarPos > 0 then do
2419 VarChar = substr(InitDir,VarPos,2)
2420 InitDir = left(InitDir,VarPos-1)
2421 say VarChar
2422 end
2423 NewPath = _dirDialog('Choose path for 'VRGet("DT_Shares","Caption"),_fs2bs(InitDir))
2424 if NewPath = "" then return
2425 if VarPos > 0 then NewPath = NewPath'\'VarChar
2426 ok = VRset("EF_Path","value",NewPath)
2427return
2428
2429/*:VRX IPB_NewItem_Click
2430*/
2431IPB_NewItem_Click:
2432 smbconfopt = samba.!tools'\smbconf.opt'
2433say smbconfopt
2434 do until lines(smbconfopt) = 0
2435 smbconfline = linein(smbconfopt)
2436say smbconfline
2437 I = I + 1
2438 opt.I = smbconfline
2439 end
2440 opt.0 = I
2441 ok = stream(smbconfopt,'c','close')
2442 ok = VRMethod("DDCB_Add_Voc","Reset")
2443 ok = VRMethod("DDCB_Add_Voc","AddStringList", opt.)
2444 ok = VRSet("DDCB_Add_Voc","Top",ObjYPos-380)
2445 ok = VRSet("EF_Add_Voc","Top",ObjYPos-380)
2446 ok = VRSet("PB_Add_Voc_OK","Top",ObjYPos)
2447 ok = VRSet("PB_Add_Voc_Cancel","Top",ObjYPos)
2448
2449 ok = VRSet("DDCB_ADD_Voc","Visible",1)
2450 ok = VRSet("EF_ADD_Voc","Visible",1)
2451 ok = VRSet("PB_Add_Voc_OK","Visible",1)
2452 ok = VRSet("PB_add_Voc_Cancel","Visible",1)
2453return
2454
2455/*:VRX Main_Close
2456*/
2457Main_Close:
2458 call Quit
2459return
2460
2461/*:VRX Main_Create
2462*/
2463Main_Create:
2464 ok = VRREdirectStdIO("ON")
2465 options.!debug = 1
2466
2467 call _LoadOtherFuncs
2468
2469 call _INIRead
2470
2471 call _ParseCommandLine
2472
2473 call _InitTempDir
2474 call _SambaInit
2475 call _SambaExtendSearchPath
2476 call _GUIInitNLV
2477
2478 call _FindHtpasswd
2479 call Main_Resize
2480 call _SambaCheckComponents
2481 call _SambaVersion
2482 call _FindIBMLANPath
2483 call _SmbConfTreeInit /* creates the records for default sections */
2484
2485 /* Installation mode is triggered by a timer activated in GUIInit, when no smb.conf exists */
2486 call _GUIInit
2487return
2488
2489/*:VRX Main_Resize
2490*/
2491Main_Resize:
2492 IF options.!debug == 1 THEN SAY "Main_Resize() started"
2493 Ok = VRset("Main", "Painting", 0)
2494 ok = VRSet("GB_SmbConfTree","Top", FWidth)
2495 ok = VRSet("GB_SmbConfTree","Left", FWidth-24)
2496 ok = VRSet("GB_SmbConfTree","Height", VRGet("Main", "Height") -1400)
2497
2498 ok = VRset("GB_SmbConfTree3","Top", FWidth)
2499 ok = VRset("GB_SmbConfTree3","Left", FWidth)
2500 ok = VRset("GB_SmbConfTree3","Height", 245 )
2501 ok = VRset("GB_SmbConfTree3","Width", VRGet("GB_SmbConfTree","Width") -(FWidth*2))
2502
2503 ok = VRset("DT_SmbConfTree","Top", 8)
2504 ok = VRset("DT_SmbConfTree","Left", 8)
2505 ok = VRset("DT_SmbConfTree","Height", 213)
2506 ok = VRset("DT_SmbConfTree","Width", VRGet("GB_SmbConfTree3","Width") - 24)
2507
2508 ok = VRset("GB_SmbConfTree2","Left", FWidth)
2509 ok = VRset("GB_SmbConfTree2","Top", 245 + FWidth*2)
2510 ok = VRset("GB_SmbConfTree2","Width", VRGet("GB_SmbConfTree","Width")-FWidth*2)
2511 ok = VRset("GB_SmbConfTree2","Height", VRGet("GB_SmbConfTree","Height")-FWidth*3-245)
2512
2513 ok = VRset("CN_SmbConf", "Top", FWidth)
2514 ok = VRset("CN_SmbConf", "Left", FWidth)
2515 ok = VRset("CN_SmbConf", "Width", VRGet("GB_SmbConfTree2","Width") -(FWidth*2))
2516 ok = VRset("CN_SmbConf", "Height", VRGet("GB_SmbConfTree2","Height")-(FWidth*2))
2517
2518 ok = VRset("GB_Help", "Top", FWidth)
2519 ok = VRset("GB_Help", "Left", VRGet("GB_SmbConfTree","Width") + 60)
2520 ok = VRSet("GB_Help", "Height", VRGet("GB_SmbConfTree","Height"))
2521 ok = VRSet("GB_Help", "Width", VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2)
2522
2523 ok = VRset("GB_Help3","Top", FWidth)
2524 ok = VRset("GB_Help3","Left", FWidth)
2525 ok = VRset("GB_Help3","Height", 245 )
2526 ok = VRset("GB_Help3","Width", VRGet("GB_Help","Width") -(FWidth*2))
2527
2528 ok = VRset("GB_Help2","Left", FWidth)
2529 ok = VRset("GB_Help2","Top", 245 + FWidth*2)
2530 ok = VRset("GB_Help2","Width", VRGet("GB_Help","Width")-FWidth*2)
2531 ok = VRset("GB_Help2","Height", VRGet("GB_Help","Height")-FWidth*3-245)
2532
2533 ok = VRset("DT_Help","Top", 8)
2534 ok = VRset("DT_Help","Left", 8)
2535 ok = VRset("DT_Help","Height", 213)
2536 ok = VRset("DT_Help","Width", VRGet("GB_Help3","Width") - 24)
2537
2538 ok = VRset("GB_Shares", "Top", FWidth)
2539 ok = VRset("GB_Shares", "Left", VRGet("GB_SmbConfTree","Width") + 60)
2540 ok = VRSet("GB_Shares", "Height", VRGet("GB_SmbConfTree","Height"))
2541 ok = VRSet("GB_Shares", "Width", VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2)
2542
2543 ok = VRset("GB_Shares3","Top", FWidth)
2544 ok = VRset("GB_Shares3","Left", FWidth)
2545 ok = VRset("GB_Shares3","Height", 245 )
2546 ok = VRset("GB_Shares3","Width", VRGet("GB_Shares","Width") -(FWidth*2))
2547
2548 ok = VRset("GB_Shares2","Left", FWidth)
2549 ok = VRset("GB_Shares2","Top", 245 + FWidth*2)
2550 ok = VRset("GB_Shares2","Width", VRGet("GB_Shares","Width")-FWidth*2)
2551 ok = VRset("GB_Shares2","Height", VRGet("GB_Shares","Height")-FWidth*3-245)
2552
2553 ok = VRset("DT_Shares", "Top", 8)
2554 ok = VRset("DT_Shares", "Left", 8)
2555 ok = VRset("DT_Shares", "Height", 213)
2556 ok = VRset("DT_Shares", "Width", VRGet("GB_Shares3","Width") - 24)
2557
2558 ok = VRSet("GB_Global", "Height", VRGet("GB_SmbConfTree","Height"))
2559 ok = VRSet("GB_Global", "Width", VRGet("GB_Shares", "Width"))
2560
2561 MButton.bTop = VRGet("GB_SmbConfTree","height")+FWidth*2
2562 MButton.bLeft = VRGet("GB_Shares","Left")
2563 MButton.bWidth = VRGet("PB_Save","Width")
2564
2565 if MButton.bTop < 1300 & MButton.bLeft < 1300 then do
2566 MButton.bTop = 4802
2567 MButton.bLeft = 3758
2568 MButton.bWidth = 1241
2569 FWidth = 32
2570 end
2571
2572 ok = VRSet("PB_Reload", "Top", MButton.bTop)
2573 ok = VRSet("PB_Reload", "Left", VRGet("GB_SmbConfTree","Left"))
2574 ok = VRSet("PB_Reload", "Width", MButton.bWidth)
2575
2576 ok = VRSet("PB_StartStop","Top", MButton.bTop)
2577 ok = VRSet("PB_StartStop","Left", VRGet("GB_SmbConfTree","Width")-MButton.bWidth-FWidth)
2578 ok = VRSet("PB_StartStop","Width", MButton.bWidth)
2579
2580 ok = VRSet("PB_Save", "Top", MButton.bTop)
2581 ok = VRSet("PB_Save", "Left", MButton.bLeft)
2582 ok = VRSet("PB_Reload", "Width", MButton.bWidth)
2583
2584 ok = VRSet("PB_Undo", "Top", MButton.bTop)
2585 ok = VRSet("PB_Undo", "Left", MButton.bLeft+2*FWidth+MButton.bWidth*1)
2586 ok = VRSet("PB_Undo", "Width", MButton.bWidth)
2587
2588 ok = VRSet("PB_Help", "Top", MButton.bTop)
2589 ok = VRSet("PB_Help", "Left", MButton.bLeft+6*FWidth+MButton.bWidth*2)
2590 ok = VRSet("PB_Help", "Width", MButton.bWidth)
2591
2592 ok = VRSet("PB_Cancel", "Top", MButton.bTop)
2593 ok = VRSet("PB_Cancel", "Left", MButton.bLeft+3*FWidth+MButton.bWidth*3)
2594 ok = VRSet("PB_Cancel", "Width", MButton.bWidth)
2595
2596
2597 drop MButton.b
2598
2599 Top = VRGet("Main","Top")
2600 Left = VRGet("Main","Left")
2601 Width = VRGet("Main","Width")
2602 Height = VRGet("Main","Height")
2603
2604 if ActiveGroup = "Global" then do
2605
2606 end
2607 IF options.!debug == 1 THEN SAY " Window size = "VRGet("Main","Width")', 'VRGet("Main","Height")
2608
2609 /* check and empty event queue, trash spurious resize events */
2610 EventString = ''
2611 TrashedResize = 0
2612 do until EventString = 'nop'
2613 EventString = VREvent('N')
2614 say ' Event: "'EventString'" ('TrashedResize')'
2615 if EventString <> 'nop' then do
2616 if EventString = 'CALL Main_Resize' then TrashedResize = TrashedResize + 1
2617 else interpret eventString
2618 end
2619 end
2620 if TrashedResize >= 2 then CALL Main_Resize
2621
2622 IF options.!debug == 1 THEN SAY " Window size = "VRGet("Main","Width")', 'VRGet("Main","Height")
2623 Ok = VRset("Main", "Painting", 1)
2624 IF options.!debug == 1 THEN SAY "Main_Resize() done"
2625return
2626
2627/*:VRX Menu_Action_AddHomes_Click
2628*/
2629Menu_Action_AddHomes_Click:
2630 call _SmbConfDefault_Homes
2631 call _SmbConfTreeInit
2632 call _SmbConfLoad
2633return
2634
2635/*:VRX Menu_Action_AddNetLogon_Click
2636*/
2637Menu_Action_AddNetLogon_Click:
2638 call _SmbConfDefault_Netlogon
2639 call _SmbConfTreeInit
2640 call _SmbConfLoad
2641return
2642
2643/*:VRX Menu_Action_AddProfiles_Click
2644*/
2645Menu_Action_AddProfiles_Click:
2646 call _SmbConfDefault_Profiles
2647 call _SmbConfTreeInit
2648 call _SmbConfLoad
2649return
2650
2651/*:VRX Menu_Action_EraseTransient_Click
2652*/
2653Menu_Action_EraseTransient_Click:
2654 if _SambaRunning() then do
2655 Msg.Text = NLVGetMessage(70)
2656 Msg.Type = "E"
2657 ok = _ShowMsg()
2658 return
2659 end
2660
2661 ok = VRMethod("CN_smbconf","SetRecordAttr", smbconf.!global, "Selected", 1)
2662 call CN_smbconf_Click
2663
2664 if VRIsValidObject( "EF_LOCK_DIRECTORY" ) then do
2665 LockDir = VRGet("EF_Lock_Directory","Value")
2666 Msg.Text = NLVGetMessage(71)
2667 Msg.Type = "Q"
2668 ok = _MsgYesNo()
2669 if ok <> 1 then return
2670
2671 ok = SysFileDelete(LockDir"\gencache.tdb")
2672 ok = SysFileDelete(LockDir"\brlock.tdb")
2673 ok = SysFileDelete(LockDir"\unexpected.tdb")
2674 ok = SysFileDelete(LockDir"\connections.tdb")
2675 ok = SysFileDelete(LockDir"\locking.tdb")
2676 ok = SysFileDelete(LockDir"\messages.tdb")
2677 end
2678return
2679
2680/*:VRX Menu_File_Debug_Click
2681*/
2682Menu_File_Debug_Click:
2683 options.!debug = VRGet("Menu_File_debug","Checked")
2684
2685 /* The following 2 lines are unnecessary for a checkbox ! */
2686 ok = VRSet("Menu_File_debug","Checked",\options.!debug)
2687 options.!debug = \options.!debug
2688
2689 if options.!debug
2690 then ok = VRRedirectStdIO("On")
2691 else ok = VRRedirectStdIO("OFF")
2692
2693return
2694
2695/*:VRX Menu_File_Exit_Click
2696*/
2697Menu_File_Exit_Click:
2698 call Quit
2699return
2700
2701/*:VRX Menu_File_Import_IBMPeer_Click
2702*/
2703Menu_File_Import_IBMPeer_Click:
2704 call _SmbConfMigratePeer
2705 ok = SysFileTree(smbconf,exist.,'FO')
2706 SmbConfExists = exist.0
2707 call _SmbConfTreeReset
2708return
2709
2710/*:VRX Menu_File_ImportHosts_Click
2711*/
2712Menu_File_ImportHosts_Click:
2713 if VRFileExists(ETC'\samba\lmhosts') then do
2714 Msg.Text = NLVGetMessage(56, ETC'\samba\lmhosts')
2715 Msg.Type = 'Q'
2716 if _MsgYesNo() = 1 then do
2717 call _LMHostsImport
2718 end
2719 end
2720 else call _LMHostsImport
2721return
2722
2723/*:VRX Menu_File_PrintCap_Click
2724*/
2725Menu_File_PrintCap_Click:
2726 call _PrintcapCreate
2727 Msg.Text = NLVGetMessage(50, samba.!printcap)
2728 msg.Type = 'I'
2729 call _ShowMsg
2730return
2731
2732/*:VRX Menu_File_reset_Click
2733*/
2734Menu_File_reset_Click:
2735 say "Menu_File_reset_Click() started"
2736 call _SmbConfCreateDefault
2737 ok = SysFileTree(smbconf,exist.,'FO')
2738 SmbConfExists = exist.0
2739 call _SmbConfTreeReset
2740 say "Menu_File_reset_Click() done"
2741return
2742
2743/*:VRX Menu_File_SmbUpdate_Click
2744*/
2745Menu_File_SmbUpdate_Click:
2746 BuildFile = VRFileDialog( VRWindow(), NLVGetMessage(64), "Open", options.!builddir"\samba-*zip", , , )
2747 if BuildFile = '' then return
2748 options.!builddir = VRParseFilename(buildfile,'DP')
2749 address CMD samba.!smbcmd' stop'
2750 OldDir = Directory(Strip(samba.!bin,'T','\'))
2751 ok = VRRedirectStdIO('ON')
2752 address cmd 'unzip.exe -oCj 'BuildFile' *.exe *.dll'
2753 say 'unzip RC = 'RC
2754 if RC <> 0 then address cmd 'PAUSE'
2755 IF options.!debug <> 1 THEN ok = VRRedirectStdIO('OFF')
2756 ok = directory(OldDir)
2757 call _SambaVersion
2758 ok = VRSet("EF_Binaries_Version","value",samba.!version)
2759 address CMD samba.!smbcmd' start'
2760return
2761
2762/*:VRX Menu_File_YumInstall_Click
2763*/
2764Menu_File_YumInstall_Click:
2765 address cmd 'yum install --assumeyes libc libcx libgcc1 cups-libs popt-libs gettext-libs zlib readline'
2766return
2767
2768/*:VRX Menu_Help_About_Click
2769*/
2770Menu_Help_About_Click:
2771 say ' 'samba.!smbd' -V --debuglevel=0 2>'samba.!error' 1>'smboutput
2772 address cmd samba.!smbd' -V --debuglevel=0 2>'samba.!error' 1>'smboutput
2773
2774 SambaVer = "Samba "||strip(linein(smboutput))
2775 ok = stream(smboutput,'c','close')
2776
2777 window = VRLoadSecondary( "About", "W" )
2778return
2779
2780/*:VRX Menu_Options_ExportMode_Click
2781*/
2782Menu_Options_ExportMode_Click:
2783 say 'ExpertMode_Click started'
2784 ok = VRSet("Main", 'Pointer', 'WAIT' )
2785 log_level = IniGet('log level', 'global', samba.!smbconf)
2786 if datatype(log_level) <> "NUM" then log_level = 2
2787 say samba.!testparmexe' -v -s -d='log_level' 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
2788 address cmd samba.!testparmexe' -v -s -d='log_level' 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
2789 say 'VRCopyFile('TempDir'smb.conf, 'smbconf' )'
2790 say " smb.conf GrӇe: "stream(smbconf,'c','QUERY SIZE')
2791 ok = VRCopyFile( TempDir'smb.conf', smbconf )
2792 say " smb.conf GrӇe: "stream(smbconf,'c','QUERY SIZE')
2793 say 'Copy ok ='ok' (1 = success, 0 = failure)'
2794 call _SmbConfTreeReset
2795 call Main_Resize
2796 ok = VRSet("Main", 'Pointer', '<default>' )
2797 say 'ExpertMode_Click done'
2798return
2799
2800/*:VRX Menu_Options_MiniIcons_Click
2801*/
2802Menu_Options_MiniIcons_Click:
2803 advanced.!bigicons = \advanced.!bigicons
2804 ok = VRset("CN_SMBCONF", "MiniIcons", \advanced.!bigicons)
2805 ok = VRset("Menu_Options_MiniIcons", "Checked", \advanced.!bigicons)
2806return
2807
2808/*:VRX Menu_Options_SimpleMode_Click
2809*/
2810Menu_Options_SimpleMode_Click:
2811 call _debuglog 'Menu_SimpleMode_Click() started'
2812 ok = VRSet("Main", 'Pointer', 'WAIT' )
2813 /* Workaround for testparm bugs */
2814 say 'VRCopyFile('smbconf', 'TempDir'smb.conf )'
2815 ok = VRCopyFile( smbconf, TempDir'smb.conf')
2816 call _SmbConfCommitChanges
2817 log_level = IniGet('log level', 'global', samba.!smbconf)
2818 if datatype(log_level) <> "NUM" then log_level = 2
2819 say samba.!testparmexe' -s -d='log_level' 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
2820 address cmd samba.!testparmexe' -s -d='log_level' 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
2821 NewSize = stream(TempDir"smb.conf",'c','QUERY SIZE')
2822 say " "TempDir"smb.conf GrӇe: "NewSize
2823 if NewSize = 0 then 'pause'
2824 say " smb.conf GrӇe: "stream(smbconf,'c','QUERY SIZE')
2825 say 'VRCopyFile('TempDir'smb.conf, 'smbconf' )'
2826 ok = VRCopyFile( TempDir'smb.conf' , smbconf )
2827 say " smb.conf GrӇe: "stream(smbconf,'c','QUERY SIZE')
2828 say 'Copy ok ='ok' (1 = success, 0 = failure)'
2829 call _SmbConfTreeReset
2830
2831 if datatype(Page) = "NUM" then do
2832 do I = Page to 3 by -1
2833 ok = VRMethod( "GB_Global", "DeletePage", I )
2834 ok = VRDestroy("GL_GLOBAL_"I)
2835 end
2836 end
2837 Page = 2
2838 call Main_resize
2839 ok = VRSet("Main", 'Pointer', '<>default' )
2840 call _debuglog 'Menu_SimpleMode_Click() done'
2841return
2842
2843/*:VRX Menu_ShareContext_Add_Click
2844*/
2845Menu_ShareContext_Add_Click:
2846 NewShareDir = _dirDialog()
2847 if NewShareDir = "" then return
2848 NewShareName = filespec("N",NewShareDir)
2849 Buttons.1 = "OK"
2850 Buttons.2 = "Abort"
2851 Buttons.0 = 2
2852 id = VRPrompt( VRWindow(), "Enter name for new share", "NewShareName", "Add new Samba share", "Buttons.", buttons.1, buttons.2 )
2853 if ID = 2 | NewShareName = "" then return
2854 NewShareHandle = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,, NewShareName,"#4")
2855 call lineout smbconf, '['NewShareName']'
2856 call lineout smbconf, Indent||'path = '_bs2fs(NewShareDir)
2857 call lineout smbconf, Indent||'comment = 'NewShareName' directory'
2858 call lineout smbconf, Indent||'browseable = Yes'
2859 call lineout smbconf, Indent||'read only = Yes'
2860 call lineout smbconf, Indent||'hide files = /*.?SF/'
2861 call lineout smbconf
2862 call _SmbConfTreeReset
2863 Msg.Text = NLVGetMessage(69)
2864 Msg.Type = 'I'
2865 call _ShowMsg
2866 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 )
2867 ok = VRMethod("CN_smbconf","SetRecordAttr",NewShareHandle, "Selected", 1 )
2868return
2869
2870/*:VRX Menu_ShareContext_AddPrinter_Click
2871*/
2872Menu_ShareContext_AddPrinter_Click:
2873 AbortPrinter = 1
2874 window = VRLoadSecondary( "PrinterSelection", "W" )
2875 if AbortPrinter then return
2876 parse var SharePrinter PrinterName';'PrinterQueue';'PrinterDriver
2877 NewShareHandle = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,, PrinterQueue,"#4")
2878 call lineout smbconf, '['PrinterQueue']'
2879 call lineout smbconf, Indent||'path = '_bs2fs(ETC'\samba\spool\'printerqueue)
2880 ok = SysMkDir(ETC'\samba\spool\'printerqueue)
2881 call lineout smbconf, Indent||'comment = 'Printername
2882 call lineout smbconf, Indent||'create mask = 0700'
2883 call lineout smbconf, Indent||'printer name = 'printerqueue
2884 call lineout smbconf, Indent||'printing = os2'
2885 call lineout smbconf, Indent||'printable = Yes'
2886 call lineout smbconf, Indent||'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"'
2887 call lineout smbconf, Indent||'browseable = Yes'
2888 call lineout smbconf, Indent||'guest ok = Yes'
2889 call lineout smbconf, Indent||'read only = No'
2890 call lineout smbconf
2891 call _SmbConfTreeReset
2892 Msg.Text = NLVGetMessage(69)
2893 Msg.Type = 'I'
2894 call _ShowMsg
2895 ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 )
2896 ok = VRMethod("CN_smbconf","SetRecordAttr",NewShareHandle, "Selected", 1 )
2897return
2898
2899/*:VRX Menu_ShareContext_Remove_Click
2900*/
2901Menu_ShareContext_Remove_Click:
2902 call _SmbConfShareRemove
2903 if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 )
2904return
2905
2906/*:VRX Menu_ShareContext_RemovePrinter_Click
2907*/
2908Menu_ShareContext_RemovePrinter_Click:
2909 call _SmbConfShareRemove
2910 if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 )
2911return
2912
2913/*:VRX Menu_ShareContext_Rename_Click
2914*/
2915Menu_ShareContext_Rename_Click:
2916 call _SmbConfShareRename
2917 if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 )
2918return
2919
2920/*:VRX Menu_ShareContext_RenamePrinter_Click
2921*/
2922Menu_ShareContext_RenamePrinter_Click:
2923 call _SmbConfShareRename
2924 if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 )
2925return
2926
2927/*:VRX PB_1_Click
2928*/
2929PB_1_Click:
2930 ok = VRREdirectStdIO("ON")
2931 Buttons.1 = NLVGetMessage(2)
2932 Buttons.2 = NLVGetMessage(3)
2933 Buttons.0 = 2
2934 command = 'd:\samba\smbpasswd.exe'
2935 id = VRPrompt( VRWindow(), "Console", "command", "Console", "Buttons.", buttons.1, buttons.2 )
2936 if id = 2 then return
2937 say command
2938 address cmd command
2939 /* samba.!netexe' rpc 'command' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg */
2940 /* if RC <> 0 then call _SambaShowError; else call _SambaShowMsg */
2941return
2942
2943/*:VRX PB_AboutOK_Click
2944*/
2945PB_AboutOK_Click:
2946 call About_Close
2947return
2948
2949/*:VRX PB_Add_Voc_Cancel_Click
2950*/
2951PB_Add_Voc_Cancel_Click:
2952 drop opt.
2953 ok = VRSet("DDCB_Add_Voc","Value","")
2954 ok = VRSet("EF_Add_Voc", "Value","")
2955
2956 ok = VRSet("DDCB_ADD_Voc","Visible",0)
2957 ok = VRSet("EF_ADD_Voc","Visible",0)
2958 ok = VRSet("PB_Add_Voc_OK","Visible",0)
2959 ok = VRSet("PB_add_Voc_Cancel","Visible",0)
2960return
2961
2962/*:VRX PB_Add_Voc_OK_Click
2963*/
2964PB_Add_Voc_OK_Click:
2965 NewVoc = VRGet("DDCB_Add_Voc","Value")
2966 NewValue=VRGet("EF_Add_Voc", "Value")
2967 call IniSet NewVoc, NewValue, CurSection, samba.!smbconf
2968 drop opt.
2969 ok = VRSet("DDCB_Add_Voc","Value","")
2970 ok = VRSet("EF_Add_Voc", "Value","")
2971 ok = VRSet("DDCB_ADD_Voc","Visible",0)
2972 ok = VRSet("EF_ADD_Voc","Visible",0)
2973 ok = VRSet("PB_Add_Voc_OK","Visible",0)
2974 ok = VRSet("PB_add_Voc_Cancel","Visible",0)
2975
2976 call Menu_Options_SimpleMode_Click
2977return
2978
2979/*:VRX PB_Cancel_Click
2980*/
2981PB_Cancel_Click:
2982 IF options.!debug == 1 THEN say 'PB_Cancel_Click() started'
2983 if VRGet("PB_Save","Enabled") then call PB_Save_Click
2984 call Quit
2985 IF options.!debug == 1 THEN say 'PB_Cancel_Click() done'
2986return
2987
2988/*:VRX PB_Help_Click
2989*/
2990PB_Help_Click:
2991
2992return
2993
2994/*:VRX PB_Install_Default_Click
2995*/
2996PB_Install_Default_Click:
2997 if VRGet("EF_Workgroup_Initial","Value") = "" then return
2998
2999 if \VRGet("CB_NoRoot","Set") then do
3000 if \_SambaRootPWCheck() then return
3001 end
3002
3003 call _SmbConfCreateDefault
3004 /* call _Smb35Init */
3005 ok = SysFileTree(smbconf,exist.,'FO')
3006 SmbConfExists = exist.0
3007 call _SmbConfBackup
3008 call _SmbConfTreeReset
3009
3010 if \VRGet("CB_NoRoot","Set") then do
3011 call _SambaRootPWSet
3012 end
3013 call _SambaGuestCreate
3014
3015 call _SambaUserCreate
3016 ok = VRSet("Main", 'Pointer', 'WAIT' )
3017 call _SambaGroupMapInst
3018 ok = VRSet("Main", 'Pointer', '<default>' )
3019 /* call Menu_File_ImportHosts_Click */
3020
3021 call Installer_Close
3022return
3023
3024/*:VRX PB_Install_Migration_Click
3025*/
3026PB_Install_Migration_Click:
3027 if VRGet("EF_Workgroup_Initial","Value") = "" then return
3028
3029 if \VRGet("CB_NoRoot","Set") then do
3030 if \_SambaRootPWCheck() then return
3031 end
3032
3033
3034 call _SmbConfMigratePeer
3035 ok = SysFileTree(smbconf,exist.,'FO')
3036 SmbConfExists = exist.0
3037 call _SmbConfBackup
3038 call _SmbConfTreeReset
3039 if \VRGet("CB_NoRoot","Set") then do
3040 call _SambaRootPWSet
3041 end
3042 call _SambaGuestCreate
3043
3044 call _SambaUserCreate
3045 ok = VRSet("Main", 'Pointer', 'WAIT' )
3046 call _SambaGroupMapInst
3047 ok = VRSet("Main", 'Pointer', '<default>' )
3048
3049/* call Menu_File_ImportHosts_Click */
3050
3051 call Installer_Close
3052return
3053
3054/*:VRX PB_Printer_Abort_Click
3055*/
3056PB_Printer_Abort_Click:
3057 call PrinterSelection_Close
3058return
3059
3060/*:VRX PB_Printer_OK_Click
3061*/
3062PB_Printer_OK_Click:
3063 SharePrinter = RawPrinter(VRGet("LB_Printers","SelectedString"))
3064 AbortPrinter = 0
3065 say SharePrinter
3066 call PrinterSelection_Close
3067return
3068
3069RawPrinter:
3070 do I = 1 to printer.0 until PurePrinter(printer.I) = arg(1)
3071 end
3072return printer.I
3073/*:VRX PB_Reload_Click
3074*/
3075PB_Reload_Click:
3076 call PB_Save_Click
3077 call beep 960, 1
3078 address CMD samba.!smbcmd' reload'
3079return
3080
3081/*:VRX PB_RemoveContinue_Click
3082*/
3083PB_RemoveContinue_Click:
3084
3085 if VRGet("CB_RemoveSmbConf","set") then do
3086 ok = SysFileDelete(samba.!smbconf)
3087 SmbConfExists = 0
3088 Installmode = 1
3089 end
3090 else Installmode = 0
3091
3092 if VRGet("CB_RemoveBackend","set") then do
3093 ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS')
3094 do I = 1 to xdb.0
3095 ok = SysFileDelete(xdb.I)
3096 if ok <> 0 then do
3097 Msg.Text = "Error "ok" deleting "xdb.I"!"
3098 Msg.Type = "W"
3099 call _ShowMsg
3100 end
3101 end
3102 end
3103 if VRGet("CB_RemoveLMHosts","set") then do
3104 call _LMHostsImport
3105 end
3106 if VRGet("CB_YumInstall","set") then do
3107 call Menu_File_YumInstall_Click
3108 end
3109 call RemoveConfig_Close
3110return
3111
3112/*:VRX PB_Save_Click
3113*/
3114PB_Save_Click:
3115 IF options.!debug == 1 THEN say 'PB_Save_Click() started'
3116 if ValueChanged then do
3117 if CurSection <> "" then do
3118 call _SaveChanges
3119 ok = VRSet("PB_Save", "Enabled", 0)
3120 call CN_smbconf_Click
3121 end
3122 end
3123 IF options.!debug == 1 THEN say 'PB_Save_Click() done'
3124return
3125
3126/*:VRX PB_StartStop_Click
3127*/
3128PB_StartStop_Click:
3129 call PB_Save_Click
3130 call beep 960, 1
3131 if _SambaRunning() then do
3132 address CMD samba.!smbcmd' stop'
3133 ok = VRSet("PB_StartStop", "BackColor", "Green")
3134 ok = VRSet("PB_StartStop", "Caption", startst)
3135 end
3136 else do
3137 address CMD samba.!smbcmd' start'
3138 ok = VRSet("PB_StartStop", "BackColor", "Red")
3139 ok = VRSet("PB_StartStop", "Caption", stopst)
3140 end
3141return
3142
3143/*:VRX PB_Undo_Click
3144*/
3145PB_Undo_Click:
3146 call _SmbConfRestore
3147 SmbConfExists = 1
3148 call _SmbConfTreeReset
3149return
3150
3151/*:VRX PrinterSelection_Close
3152*/
3153PrinterSelection_Close:
3154 call PrinterSelection_Fini
3155return
3156
3157/*:VRX PrinterSelection_Create
3158*/
3159PrinterSelection_Create:
3160 call PrinterSelection_Init
3161 ok = VRMethod( "Application", "ListPrinters", "printer." )
3162
3163 CALL NLVSetText 'Printerselection', 'Caption', 40
3164 CALL NLVSetText 'PB_Printer_OK', 'Caption', 2
3165 CALL NLVSetText 'PB_Printer_Abort', 'Caption', 3
3166
3167 do I = 1 to printer.0
3168 ok = VRMethod("LB_Printers","AddString",PurePrinter(printer.I))
3169 if PurePrinter(printer.!default) = PurePrinter(printer.I) then ok = VRSet("LB_Printers","Selected",I)
3170 end
3171return
3172/*:VRX PrinterSelection_Fini
3173*/
3174PrinterSelection_Fini:
3175 window = VRInfo( "Window" )
3176 call VRDestroy window
3177 drop window
3178return
3179/*:VRX PrinterSelection_Init
3180*/
3181PrinterSelection_Init:
3182 window = VRInfo( "Object" )
3183 if( \VRIsChildOf( window, "Notebook" ) ) then do
3184 call VRMethod window, "CenterWindow"
3185 call VRSet window, "Visible", 1
3186 call VRMethod window, "Activate"
3187 end
3188 drop window
3189return
3190
3191/*:VRX PurePrinter
3192*/
3193PurePrinter:
3194return substr(arg(1),1,pos(';',arg(1))-1)
3195
3196/*:VRX Quit
3197*/
3198Quit:
3199 IF options.!debug == 1 THEN say "Quit() start"
3200
3201 if VRGet("Main","WindowState") = "Maximized"|,
3202 VRGet("Main","WindowState") = "Minimized" then ok = VRMethod("Main", "Restore")
3203
3204 if samba.!testparmexe <> "" then do
3205 address cmd samba.!testparmexe' -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm'
3206 call _SmbConfCommitChanges
3207 end
3208
3209 call _INIWrite
3210 call _SambaFinish
3211 ok = SysFileDelete(TempDir'sscc.testparm')
3212 ok = SysFileDelete(smboutput)
3213
3214 IF options.!debug == 1 THEN say "Quit() done"
3215 /* ok = VRRedirectStdio('OFF') */
3216 window = VRWindow()
3217 call VRSet window, "Shutdown", 1
3218 drop window
3219return
3220
3221/*:VRX RB_PDC_Click
3222*/
3223RB_PDC_Click:
3224 CreatePDC = VRGet("RB_PDC","Set")
3225return
3226
3227/*:VRX RB_smbpasswd_Click
3228*/
3229RB_smbpasswd_Click:
3230 UseTDBsam = 0
3231return
3232
3233/*:VRX RB_Standalone_Click
3234*/
3235RB_Standalone_Click:
3236 CreatePDC = \VRGet("RB_Standalone","Set")
3237return
3238
3239/*:VRX RB_tdbsam_Click
3240*/
3241RB_tdbsam_Click:
3242 UseTDBsam = 1
3243return
3244
3245/*:VRX RemoveConfig_Close
3246*/
3247RemoveConfig_Close:
3248 call RemoveConfig_Fini
3249return
3250
3251/*:VRX RemoveConfig_Create
3252*/
3253RemoveConfig_Create:
3254 call RemoveConfig_Init
3255 CALL NLVSetText 'RemoveConfig', 'Caption', 90
3256 CALL NLVSetText 'PB_RemoveContinue', 'Caption', 14
3257
3258 ok = VRset("CB_RemoveSmbConf","Caption", NLVGetMessage(56, 'smb.conf'))
3259 ok = VRset("CB_RemoveBackend","Caption", NLVGetMessage(56, 'Backend'))
3260 ok = VRset("CB_RemoveLMHosts","Caption", NLVGetMessage(56, 'lmhosts'))
3261 ok = VRset("CB_YumInstall","Caption", NLVGetMessage(99))
3262
3263 /* Check if ?db backend files exist */
3264 ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS')
3265 if xdb.0 = 0 then ok = VRset("CB_RemoveBackend","Enabled", 0)
3266
3267 /* Check if LMHOsts exists */
3268 ok = VRset("CB_RemoveLMHosts","Enabled", VRFileExists(ETC'\samba\lmhosts'))
3269return
3270
3271/*:VRX RemoveConfig_Fini
3272*/
3273RemoveConfig_Fini:
3274 window = VRInfo( "Window" )
3275 call VRDestroy window
3276 drop window
3277return
3278/*:VRX RemoveConfig_Init
3279*/
3280RemoveConfig_Init:
3281 window = VRInfo( "Object" )
3282 if( \VRIsChildOf( window, "Notebook" ) ) then do
3283 call VRMethod window, "CenterWindow"
3284 call VRSet window, "Visible", 1
3285 call VRMethod window, "Activate"
3286 end
3287 drop window
3288return
3289
3290/*:VRX TM_Installer_Trigger
3291*/
3292TM_Installer_Trigger:
3293 call _InstallerMode
3294return
3295
3296/*:VRX TM_Value_Trigger
3297*/
3298TM_Value_Trigger:
3299 say "TM_Value_Trigger started"
3300 ValueChanged = 0
3301 ok = VRSet("PB_Save", "Enabled", 0)
3302 ChangeList = ""
3303 ok = VRSet("TM_Value", "Enabled", 0)
3304 say "TM_Value_Trigger done"
3305return
Note: See TracBrowser for help on using the repository browser.