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

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

GUI-Tools: SSCC 0.9.3, SmbUsers 0.9.5, SmbMon 0.9.26,

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