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

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

GUI-Tools: Fix problem in smbusers

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