source: branches/guitools-1.0/install/sscc.vrx@ 304

Last change on this file since 304 was 304, checked in by Herwig Bauernfeind, 16 years ago

GUI tools: Several minor changes for Samba 1.0.1 package

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