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

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

SSCC: Fix log level not being saved in Samba 3.6

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