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