source: trunk/guitools/smbusers/SMBUSERS.VRX@ 1036

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

GUITools: Add GPLv3 header to all .VRX, .WIS and some .CMD files

File size: 155.3 KB
Line 
1/*:VRX Main
2*/
3/* Samba User Administration tool for OS/2
4Copyright (C) 2007-2017 Herwig Bauernfeind for bww bitwise works GmbH.
5
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19/* Main
20*/
21Main:
22/* Process the arguments.
23 Get the parent window.
24*/
25 parse source . calledAs .
26 parent = ""
27 argCount = arg()
28 argOff = 0
29 if( calledAs \= "COMMAND" )then do
30 if argCount >= 1 then do
31 parent = arg(1)
32 argCount = argCount - 1
33 argOff = 1
34 end
35 end; else do
36 call VROptions 'ImplicitNames'
37 call VROptions 'NoEchoQuit'
38 end
39 InitArgs.0 = argCount
40 if( argCount > 0 )then do i = 1 to argCount
41 InitArgs.i = arg( i + argOff )
42 end
43 drop calledAs argCount argOff
44
45/* Load the windows
46*/
47 call VRInit
48 parse source . . spec
49 _VREPrimaryWindowPath = ,
50 VRParseFileName( spec, "dpn" ) || ".VRW"
51 _VREPrimaryWindow = ,
52 VRLoad( parent, _VREPrimaryWindowPath )
53 drop parent spec
54 if( _VREPrimaryWindow == "" )then do
55 call VRMessage "", "Cannot load window:" VRError(), ,
56 "Error!"
57 _VREReturnValue = 32000
58 signal _VRELeaveMain
59 end
60
61/* Process events
62*/
63 call Init
64 signal on halt
65 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
66 _VREEvent = VREvent()
67 interpret _VREEvent
68 end
69_VREHalt:
70 _VREReturnValue = Fini()
71 call VRDestroy _VREPrimaryWindow
72_VRELeaveMain:
73 call VRFini
74exit _VREReturnValue
75
76VRLoadSecondary:
77 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
78 if __vrlsWait then do
79 call VRFlush
80 end
81 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
82 if __vrlsHWnd = '' then signal __vrlsDone
83 if __vrlsWait \= 1 then signal __vrlsDone
84 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
85 __vrlsTmp = __vrlsWindows.0
86 if( DataType(__vrlsTmp) \= 'NUM' ) then do
87 __vrlsTmp = 1
88 end
89 else do
90 __vrlsTmp = __vrlsTmp + 1
91 end
92 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
93 __vrlsWindows.0 = __vrlsTmp
94 do while( VRIsValidObject( VRWindow() ) = 1 )
95 __vrlsEvent = VREvent()
96 interpret __vrlsEvent
97 end
98 __vrlsTmp = __vrlsWindows.0
99 __vrlsWindows.0 = __vrlsTmp - 1
100 call VRWindow __vrlsWindows.__vrlsTmp
101 __vrlsHWnd = ''
102__vrlsDone:
103return __vrlsHWnd
104
105/*:VRX __VXREXX____APPENDS__
106*/
107__VXREXX____APPENDS__:
108/*
109#append U:\Develop\Samba\trunk\guitools\shared\smbtree.vrs
110#append U:\Develop\Samba\trunk\guitools\shared\inittempdir.vrs
111#append U:\Develop\Samba\trunk\guitools\shared\nlv.vrs
112#append U:\Develop\Samba\trunk\guitools\shared\swat.vrs
113#append U:\Develop\Samba\trunk\guitools\shared\sambainit.vrs
114*/
115return
116/*:VRX _ColumnShow
117*/
118_ColumnShow:
119 userdata = VRGet(VRInfo("OBject"),"Userdata")
120 parse var userdata Container '|' fieldh '|' VisStatus
121 ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus )
122return
123
124/*:VRX _ColumnsMenu
125*/
126_ColumnsMenu:
127 Container = arg(1)
128 ok = VRMethod(Container, "GetFieldList", "Fields." )
129
130 do I = 1 to 17
131 if I <= fields.0 then do
132/* say "Columns_"||right("0"||I,2)' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */
133 ok = VRset("Columns_"||right("0"||I,2), "Visible", 1)
134 ok = VRset("Columns_"||right("0"||I,2), "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
135 ok = VRset("Columns_"||right("0"||I,2), "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
136 ok = VRset("Columns_"||right("0"||I,2), "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
137 end
138 else ok = VRset("Columns_"||right("0"||I,2), "Visible", 0)
139 end
140 ok = VRMethod( "Columns", "Popup", , , "", "" )
141return
142
143/*:VRX _ContainersInit
144*/
145_ContainersInit:
146 /* User */
147 NrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) )
148 FlagsFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) ) /* smbpasswd */
149 UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) ) /* master.passwd and smbpasswd */
150 xpwFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) ) /* master.passwd, not used */
151 UIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(134) ) /* master.passwd and smbpasswd */
152 GeCOSFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(135) ) /* master.passwd */
153 GIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(136) ) /* master.passwd */
154 xlcFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(137) ) /* master.passwd, not used */
155 xcpwFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(138) ) /* master.passwd, not used */
156 xDeactFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(139) ) /* master.passwd, not used */
157 HomeFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(140) ) /* master.passwd */
158 ShellFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(141) ) /* master.passwd, not used */
159 LMHashFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(142) ) /* smbpasswd */
160 NTHashFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(143) ) /* smbpasswd */
161 LCTFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(144) ) /* smbpasswd */
162 MapToFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(145) ) /* smbusermap */
163 StatusFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(146) )
164
165/* ok = VRSet("CN_Users","LastSplitfield", MapToFH)
166 ok = VRSet("CN_Users","SplitBarLeft", VRGet("CN_Users","Width")*0.90) */
167
168 ok = VRMethod("CN_Users","SetfieldAttr",NrFH, "ReadOnly", 1, "Justification", "Right")
169 ok = VRMethod("CN_Users","SetfieldAttr",FlagsFH, "ReadOnly", 1)
170 ok = VRMethod("CN_Users","SetfieldAttr",UserNameFH,"ReadOnly", 1)
171 ok = VRMethod("CN_Users","SetfieldAttr",GIDFH, "Justification", "Right" )
172 ok = VRMethod("CN_Users","SetfieldAttr",UIDFH, "ReadOnly", 1, "Justification", "Right" )
173 ok = VRMethod("CN_Users","SetfieldAttr",LCTFH, "ReadOnly", 1)
174 ok = VRMethod("CN_Users","SetfieldAttr",LMHashFH, "ReadOnly", 1)
175 ok = VRMethod("CN_Users","SetfieldAttr",NTHashFH, "ReadOnly", 1)
176
177 ok = VRMethod("CN_Users","SetfieldAttr",xpwFH, "Visible", 0)
178 ok = VRMethod("CN_Users","SetfieldAttr",xlcFH, "Visible", 0)
179 ok = VRMethod("CN_Users","SetfieldAttr",xcpwFH, "Visible", 0)
180 ok = VRMethod("CN_Users","SetfieldAttr",xDeactFH, "Visible", 0)
181 ok = VRMethod("CN_Users","SetfieldAttr",LMHashFH, "Visible", 0)
182 ok = VRMethod("CN_Users","SetfieldAttr",NTHashFH, "Visible", 0)
183 ok = VRMethod("CN_Users","SetfieldAttr",ShellFH, "Visible", 0)
184 ok = VRMethod("CN_Users","SetfieldAttr",LCTFH, "Visible", 0)
185
186 if samba.!smbusermap = "" then do
187 ok = VRMethod("CN_Users","SetfieldAttr",MapToFH, "Visible", 0)
188 ok = VRMethod("CN_Users","SetfieldAttr",MapToFH, "ReadOnly", 1)
189 end
190
191
192 /* master.passwd syntax:
193 Username:password:UID:GID:Login-Class:Change pw in x seconds:Deactivate in x seconds:GECOS (Fullname):HOME:SHELL */
194
195 /* smbpasswd syntax:
196 Username:UID:Lanman Password Hash:NT Password Hash:flags:LCT (Last Change Time) */
197
198 GNrFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(130) ) /* private */
199 GroupNameFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(150) ) /* group */
200 NTGroupNameFH= VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(151) ) /* net group */
201 GpasswdFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(152) ) /* group, not used */
202 GGIDFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(153) ) /* group */
203 GUsersFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(154) ) /* group */
204 SIDFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(155) ) /* net group */
205 RIDFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(156) ) /* net group */
206 NTCommentFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(157) ) /* net group */
207 NTGroupTypeFH= VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(158) ) /* net group */
208 GStatusFH = VRMethod( "CN_Groups", "AddField", "String", NLVGetMessage(159) ) /* private */
209
210 ok = VRMethod("CN_Groups","SetfieldAttr",GNrFH,"ReadOnly", 1, "Justification", "Right")
211 ok = VRMethod("CN_Groups","SetfieldAttr",GroupnameFH,"ReadOnly", 1)
212 ok = VRMethod("CN_Groups","SetfieldAttr",NTGroupnameFH,"ReadOnly", 1)
213 ok = VRMethod("CN_Groups","SetfieldAttr",NTCommentFH,"ReadOnly", 1)
214 ok = VRMethod("CN_Groups","SetfieldAttr",NTGroupTypeFH,"ReadOnly", 1)
215 ok = VRMethod("CN_Groups","SetfieldAttr",SIDFH,"ReadOnly", 1)
216 ok = VRMethod("CN_Groups","SetfieldAttr",SIDFH,"Visible", 0)
217 ok = VRMethod("CN_Groups","SetfieldAttr",RIDFH,"ReadOnly", 1)
218 ok = VRMethod("CN_Groups","SetfieldAttr",GGIDFH,"ReadOnly", 1, "Justification", "Right")
219 ok = VRMethod("CN_Groups","SetfieldAttr",GPasswdFH, "Visible", 0)
220 ok = VRMethod("CN_Groups","SetfieldAttr",GPasswdFH, "ReadOnly", 1)
221return
222
223/*:VRX _ContGroupsPopulate
224*/
225_ContGroupsPopulate:
226 IF options.!debug == 1 THEN say time()' _ContGroupsPopulate() started.'
227 ok = VRSet("CN_Groups","Painting", 0 )
228 ok = VRMethod( "CN_Groups", "GetRecordList", "Selected", "SelGRH." )
229 if SelGRH.0 <> 0 then SelGNr = VRMethod("CN_Users", "GetFieldData", SelGRH.1, GNrFH)
230 else SelGNr = 0
231 IF options.!debug == 1 THEN say ' Selected group number = 'SelGNr
232 ok = VRMethod("CN_Groups","RemoveRecord", "ALL")
233 drop GRH.
234
235 do i = 1 to Groupname.0
236 GRH.i = VRMethod("CN_Groups", "AddRecord", , , Groupname.I , "#50" )
237 ok = VRMethod("CN_Groups","SetFieldData", GRH.i, GNrFH, I, GroupnameFH, Groupname.I, GGIDFH, GGid.I, GUsersFH, Gusers.I )
238 /* private field */
239 ok = VRMethod( "CN_Groups", "SetFieldData", GRH.i, GpasswdFH, Gpasswd.I, NTGroupNameFH, NTGroupName.I, RIDFH, RID.I, SIDFH, SID.I,NTCommentFH, NTComment.I, NTGroupTypeFH, NTGroupType.I,GStatusFH, GStatus.I)
240 if (RID.i = "" & settings.!SmbGroupsOnly) then do
241 ok = VRMethod( "CN_Groups", "SetRecordAttr", GRH.i, "Visible", 0)
242 end
243 end
244 GRH.0 = Groupname.0
245 if SelGNr <= I & SelGNr <> 0 & Groupname.0 > 0 then ok = VRMethod("CN_Groups", "SetRecordAttr", GRH.SelGNr, "Selected", 1)
246 ok = VRMethod("CN_Groups", "Arrange")
247 ok = VRSet("CN_Groups","Painting", 1 )
248 IF options.!debug == 1 THEN say time()' _ContGroupsPopulate() done.'
249return
250
251/*:VRX _ContUsersPopulate
252*/
253_ContUsersPopulate:
254 IF options.!debug == 1 THEN say time()' _ContUsersPopulate() started'
255 ok = VRSet("CN_Users","Painting", 0 )
256 ok = VRMethod( "CN_Users", "GetRecordList", "Selected", "SelRH." )
257 if SelRH.0 <> 0 then SelNr = VRMethod("CN_Users", "GetFieldData", SelRH.1, NrFH)
258 else SelNr = 0
259 IF options.!debug == 1 THEN say ' Selected user number = 'SelNr
260 ok = VRMethod("CN_Users","RemoveRecord", "ALL")
261 drop RH.
262
263 do i = 1 to username.0
264 RH.i = VRMethod("CN_Users", "AddRecord", , , username.I , "#29" )
265
266 ok = VRMethod("CN_Users","SetFieldData", RH.i, NrFH, I, UsernameFH, username.I, UIDFH, Uid.I, GIDFH, GID.I, GECOSFH, GECOS.I, HomeFH, _PathStrOS2(Home.I), ShellFH, Shell.I)
267 ok = VRMethod("CN_Users","SetFieldData", RH.i, xpwFH, password.i,xlcFH,LoginClass.I,xcpwFH, pwchange.I,xDeactFH, deact.I )
268 /* smbpasswd fields */
269 ok = VRMethod("CN_Users","SetFieldData", RH.i, FLagsFH, flags.I, LMHashFH, LMHash.I,NTHashFH, NTHash.I, LCTFH, LCT.I)
270 /* smbusermap field */
271 ok = VRMethod( "CN_Users", "SetFieldData", RH.i, MapToFH, MapTo.I)
272 /* private field */
273 ok = VRMethod( "CN_Users", "SetFieldData", RH.i, StatusFH, Status.I)
274
275 if (flags.i = "" & settings.!SmbOnly) then do
276 ok = VRMethod( "CN_Users", "SetRecordAttr", RH.i, "Visible", 0)
277 end
278 end
279 RH.0 = username.0
280 if SelNr <= I & SelNr <> 0 & Username.0 > 0 then do
281 MSelNr = Min(SelNr, Username.0)
282 ok = VRMethod("CN_Users", "SetRecordAttr", RH.MSelNr, "Selected", 1)
283 end
284 ok = VRMethod("CN_users", "Arrange")
285 ok = VRSet("CN_Users","Painting", 1 )
286 IF options.!debug == 1 THEN say time()' _ContUsersPopulate() done'
287return
288
289/*:VRX _DirDialog
290*/
291_DirDialog: procedure
292 Title = arg(1)
293 InitDir = arg(2)
294 RC = RxFuncQuery("DRCtrlPickDirectory")
295 if RC = 0 then do /* use DrCtrl if available */
296 MyDir=DRCtrlPickDirectory(InitDir, Title)
297 end
298 else do
299 MyDir = VRFileDialog(VRWindow,Title, 'o', InitDir||'\dummy')
300 if MyDir <> '' then MyDir = strip(filespec('D',MyDir)||Filespec('P',MyDir),'T','\')
301 end
302return MyDir
303/*:VRX _GetNextGID
304*/
305_GetNextGID: procedure expose MinGGID GGID.
306 say "_GetNextGID() started"
307 do nextGID = minGGID to 65535 by 1
308 do i=1 to GGID.0 while GGID.i <> nextGID
309 end
310 if GGID.i <> nextGID then leave
311 end
312 say "_GetNextGID() done, returning "nextGID
313return nextGID
314/*:VRX _GetNextUID
315*/
316_GetNextUID: procedure expose MinUID UID.
317 nextusername = translate(arg(1))
318 say "_GetNextUID() started"
319 do nextUID = minUID to 65535 by 1
320 do i=1 to UID.0 while UID.i <> nextUID
321 end
322 if uid.i <> nextUID then leave
323 end
324 if translate(nextusername) = "ROOT" then NextUID = 0
325 if translate(nextusername) = "GUEST" then NextUID = 65534
326 if translate(nextusername) = "NOBODY" then NextUID = 65533
327 say "_GetNextUID() done, returning "nextUID
328return nextUID
329/*:VRX _GroupRead
330*/
331_GroupRead:
332 IF options.!debug == 1 THEN say time()' _GroupRead() started'
333 /* Read complete group file */
334 I = 0
335 do while lines(samba.!group) <> 0
336 groupline = strip(linein(samba.!group))
337
338 /* Skip comments */
339 if left(groupline,1) = "#" then iterate
340 if left(groupline,1) = ";" then iterate
341
342 /* parse fields into stem variables */
343 I = I + 1
344
345 parse var groupline groupname.I':'Gpasswd.I':'GGid.I':'Gusers.I
346
347 GStatus.I =""
348 if pos(',,',GUsers.I) > 0 then GStatus.I='DOUBLE COMMA FOUND'
349 if right(GUsers.I,1) <> ',' & Gusers.I <> "" then GStatus.I='MISSING TRAILING COMMA'
350 do J = 1 to I - 1
351 if translate(groupname.J) = translate(groupname.I) then do
352 gstatus.I = "DUPLICATE"
353 leave
354 end
355 end
356 blGUsers = translate(translate(Gusers.I,' ',','))
357 do J = 1 to Username.0
358 UPos = wordpos(translate(Username.J),blGusers)
359 if Upos > 0 then blGUsers = delword(BlGusers,UPos,1)
360 if GID.J = GGID.I & UPos = 0 then do
361 Gusers.I = strip(Gusers.I||Username.J,,',')','
362 GStatus.I = 'MISSING USERS ADDED'
363 end
364 end
365 if strip(BlGusers) <> "" then gstatus.I = "NONEXISTENT USER"
366 end
367 ok = stream(samba.!group,'c','close')
368
369 NTGroupname. = "(klibc group)"
370 NTComment. = ""
371 NTGroupType. = ""
372 RID. = ""
373 SID. = ""
374 /* set "stem roots" properly */
375 groupname.0 = I
376 gpasswd.0 = I
377 ggid.0 = I
378 gusers.0 = I
379 NTGroupname.0 = I
380 NTComment.0 = I
381 NTGroupType.0 = I
382 SID.0 = I
383 RID.0 = I
384
385 /* our private stem */
386 gstatus.0 = I
387 IF options.!debug == 1 THEN say time()' _GroupRead() done, read 'groupname.0' kLIBC groups'
388return
389
390/*:VRX _GroupRecWriteBackToStems
391*/
392_GroupRecWriteBackToStems:
393 IF options.!debug == 1 THEN say time()' _GroupRecWriteBackToStems() started'
394 Cur = VRMethod("CN_Groups","GetFieldData", GRH, GNrFH)
395 Groupname.Cur = VRMethod("CN_Groups","GetFieldData", GRH, GroupnameFH)
396 GGID.Cur = VRMethod("CN_Groups","GetFieldData", GRH, GGIDFH)
397 GUsers.Cur = VRMethod("CN_Groups","GetFieldData", GRH, GusersFH)
398 if Gusers.Cur = "," then Gusers.Cur = ""
399 IF options.!debug == 1 THEN say time()' _GroupRecWriteBackToStems() done'
400return
401
402/*:VRX _GroupWrite
403*/
404_GroupWrite:
405 IF options.!debug == 1 THEN say time()' _GroupWrite() started'
406 newgroup = TempDir'group'
407 ok = SysFileDelete(newgroup)
408 call lineout newgroup, '# Created by smbusers Version 'word(VRGet("Main", "Hinttext"),2)
409 call lineout newgroup, '# syntax:'
410 call lineout newgroup, '# groupname:password:GID:user[,user,...,]'
411 do I = 1 to groupname.0
412 /* say "GUsers."I"="Gusers.I */
413 if settings.!FixErrors then do
414 if Gusers.I = "," then Gusers.I = ""
415 if pos(',,',Gusers.I) > 0 then do
416 blGUsers = translate(Gusers.I,' ',',')
417 Gusers.I = ""
418 do ii = 1 to words(blGusers)
419 Gusers.I = GUsers.I||word(blGusers,II)||','
420 end
421 end
422 if Gusers.I <> "" & right(Gusers.I,1) <> ',' then GUsers.I = Gusers.I||','
423 end
424 NewUsers = ""
425 select
426 when GStatus.I = "DUPLICATE" & settings.!FixErrors then iterate
427 when GStatus.I = "NONEXISTENT USER" & settings.!FixErrors then do
428 blGUsers = translate(translate(Gusers.I,' ',','))
429 do J = 1 to Username.0
430 UPos = wordpos(translate(Username.J),blGusers)
431 if Upos > 0 then NewUsers = NewUsers||UserName.J','
432 end
433 call lineout newgroup, groupname.I':'Gpasswd.I':'GGid.I':'strip(NewUsers,'L',',')
434 end
435 otherwise call lineout newgroup, groupname.I':'Gpasswd.I':'GGid.I':'strip(GUsers.I,'L',',')
436 end
437 end
438 ok = stream(newgroup,'c','close')
439 ok = VRCopyFile( samba.!group, samba.!group'.bak' )
440 ok = VRCopyFile( newgroup, samba.!group )
441 ok = SysFileDelete(newgroup)
442 IF options.!debug == 1 THEN say time()' _GroupWrite() done'
443return
444
445/*:VRX _GUIINit
446*/
447_GUIINit:
448 IF options.!debug == 1 THEN say time()' _GUIInit() started'
449
450 /* NL Users page */
451 CALL NLVSetText 'GB_Users', 'Hinttext', 28
452 CALL NLVSetText 'CB_SmbOnly', 'Caption', 17
453 CALL NLVSetText 'CB_SmbOnly', 'Hinttext',121
454 CALL NLVSetText 'ContextMenu_UserAdd', 'Caption', 195
455 CALL NLVSetText 'ContextMenu_UserProperties', 'Caption', 120
456 CALL NLVSetText 'ContextMenu_UserDel', 'Caption', 196
457 CALL NLVSetText 'Contextmenu_UserDetailView', 'Caption', 118
458 CALL NLVSetText 'Contextmenu_UserSymbolView', 'Caption', 119
459 CALL NLVSetText 'PB_UserAdd', 'Caption', 195
460 CALL NLVSetText 'PB_UserEdit', 'Caption', 120
461 CALL NLVSetText 'PB_UserDel', 'Caption', 196
462 CALL NLVSetText 'PB_UserJoinGroup', 'Caption', 197
463 CALL NLVSetText 'PB_UserLeaveGroup', 'Caption', 198
464
465 /* NL Groups page */
466 CALL NLVSetText 'GB_Groups', 'Hinttext', 29
467 CALL NLVSetText 'CB_SmbGroupsOnly', 'Caption', 21
468 CALL NLVSetText 'CB_SmbGroupsOnly', 'Hinttext', 122
469 CALL NLVSetText 'ContextMenu_UserJoinGroup', 'Caption', 80
470 CALL NLVSetText 'ContextMenu_UserLeaveGroup', 'Caption', 85
471 CALL NLVSetText 'Contextmenu_GroupDetailView', 'Caption', 118
472 CALL NLVSetText 'Contextmenu_GroupSymbolView', 'Caption', 119
473 CALL NLVSetText 'ContextMenu_GroupMembers', 'Caption', 89
474 CALL NLVSetText 'ContextMenu_GroupAdd', 'Caption', 70
475 CALL NLVSetText 'ContextMenu_GroupDel', 'Caption', 75
476 CALL NLVSetText 'ContextMenu_GroupMap', 'Caption', 90
477 CALL NLVSetText 'ContextMenu_GroupUnmap', 'Caption', 95
478 CALL NLVSetText 'ContextMenu_GroupRebuildScript','Caption', 98
479 CALL NLVSetText 'ContextMenu_GroupWellknown', 'Caption', 92
480 CALL NLVSetText 'PB_GroupAdd', 'Caption', 195
481 CALL NLVSetText 'PB_GroupDel', 'Caption', 196
482 CALL NLVSetText 'PB_GroupMap', 'Caption', 199
483 CALL NLVSetText 'PB_GroupUnmap', 'Caption', 200
484 CALL NLVSetText 'PB_GroupScript', 'Caption', 98
485 CALL NLVSetText 'PB_GroupWellKnown', 'Caption', 88
486
487
488 /* NL Policy page */
489 CALL NLVSetText 'GB_Policies', 'Hinttext',171
490 CALL NLVSetText 'DT_Policy', 'Caption', 172
491 CALL NLVSetText 'DT_PolValue', 'Caption', 173
492 CALL NLVSetText 'PB_PolReset', 'Caption', 174
493 CALL NLVSetText 'PB_PolUpdate', 'Caption', 175
494
495 /* NL Settings page */
496 CALL NLVSetText 'GB_Settings', 'Hinttext',30
497 CALL NLVSetText 'CB_FixErrors', 'Caption', 25
498 CALL NLVSetText 'CB_SyncFullName', 'Caption', 26
499 CALL NLVSetText 'CB_SyncPrimGID', 'Caption', 27
500 CALL NLVSetText 'CB_WriteMasterPwd', 'Caption', 190
501
502 /* Set position */
503 if datatype(Top) = 'NUM' then do
504 ok = VRset("Main","Top",Top)
505 ok = VRset("Main","Left",Left)
506 ok = VRset("Main","Width",max(Width,11000))
507 ok = VRset("Main","Height",Height)
508 end
509
510 /* Set fonts */
511 ok = VRSet("Main", "Font", Font_Main)
512 ok = VRSet("Main", "Statusfont", Font_Status)
513 ok = VRSet("GB_Users", "Font", Font_Page_1)
514 ok = VRSet("GB_Groups", "Font", Font_Page_2)
515 ok = VRSet("GB_Policies","Font", Font_Page_3)
516 ok = VRSet("GB_Settings","Font", Font_Page_4)
517
518 /* Set settings and options */
519 ok = VRSet("CB_SmbOnly", "set", settings.!SmbOnly )
520 ok = VRSet("CB_SmbGroupsOnly", "set", settings.!SmbGroupsOnly )
521 ok = VRSet("CB_SyncFullName", "set", settings.!SyncFullName )
522 ok = VRSet("CB_SyncPrimGID", "set", settings.!SyncPrimGID )
523 ok = VRSet("CB_WriteMasterPwd", "set", settings.!WriteMasterPwd )
524
525 ok = VRSet("CN_Users","Hinttext","@unixroot/etc = "UnixETC)
526 ok = VRSet("CN_Groups","Hinttext","@unixroot/etc = "UnixETC)
527
528 /* Set container layout */
529 call _INILayoutRead "CN_Users"
530 call _INILayoutRead "CN_Groups"
531
532 /* Common margin around controls - needed for proper resizing */
533 margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
534 marginx2 = margin * 2
535 marginx4 = margin * 4
536
537 /* Make sure we have at least 512K temporary free space */
538 if _ChkTempFreeSpace() < 524288 then do
539 Msg.Type = "W"
540 Msg.Text = NLVGetMessage(180, TempDir)
541 call _ShowMsg
542 end
543
544 IF options.!debug == 1 THEN say time()' _GUIInit() done'
545return
546
547/*:VRX _INILayoutRead
548*/
549_INILayoutRead:
550 Container = arg(1)
551 ok = VRMethod(Container, "GetFieldList", "Fields." )
552 Layout = VRGetIni( "Layout", Container, OurINI )
553 if Layout = "" then return
554 do I = 1 to Fields.0
555 ok = VRMethod(Container, "SetFieldAttr", fields.I,"Visible", substr(Layout,I,1))
556 end
557return
558
559/*:VRX _INILayoutWrite
560*/
561_INILayoutWrite:
562 Container = arg(1)
563 ok = VRMethod(Container, "GetFieldList", "Fields." )
564 Layout = ""
565 do I = 1 to fields.0
566 Layout = Layout||VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )
567 end
568 ok = VRSetIni( "Layout", Container , Layout, OurINI, 'NoClose' )
569return
570
571/*:VRX _INIRead
572*/
573_INIRead:
574 IF options.!debug == 1 THEN say time()' _INIRead() started'
575 OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBUSERS.INI',,'\')
576 ok = SysFileTree(OurINI, INIFound.,'FO')
577 if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
578 IF options.!debug == 1 THEN say time()' OurINI = "'OurINI'"'
579
580 /* Window position */
581 Top = VRGetIni( "Pos", "Top", OurINI , 'NoClose')
582 Left = VRGetIni( "Pos", "Left", OurINI , 'NoClose')
583 Width = VRGetIni( "Pos", "Width", OurINI , 'NoClose')
584 Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
585
586 /* Window fonts */
587 Font_Main = VRGetIni( "Fonts", "Main", OurINI , 'NoClose' )
588 Font_Status = VRGetIni( "Fonts", "Statusfont", OurINI , 'NoClose' )
589 Font_Page_1 = VRGetIni( "Fonts", "GB_Users", OurINI , 'NoClose' )
590 Font_Page_2 = VRGetIni( "Fonts", "GB_Groups", OurINI , 'NoClose' )
591 Font_Page_3 = VRGetIni( "Fonts", "GB_Policies", OurINI , 'NoClose' )
592 Font_Page_4 = VRGetIni( "Fonts", "GB_Settings", OurINI , 'NoClose' )
593
594 if Font_Main = "" then Font_Main = "9.WarpSans"
595 if Font_Status = "" then Font_Status = "9.WarpSans"
596 if Font_Page_1 = "" then Font_Page_1 = "9.WarpSans"
597 if Font_Page_2 = "" then Font_Page_2 = "9.WarpSans"
598 if Font_Page_3 = "" then Font_Page_3 = "9.WarpSans"
599 if Font_Page_4 = "" then Font_Page_4 = "9.WarpSans"
600
601 /* Settings and options */
602 settings.!SmbOnly = VRGetIni( "Settings", "SmbOnly", OurINI)
603 if settings.!SmbOnly = "" then settings.!SmbOnly = 0
604
605 settings.!SmbGroupsOnly = VRGetIni( "Settings", "SmbGroupsOnly", OurINI)
606 if settings.!SmbGroupsOnly = "" then settings.!SmbGroupsOnly = 0
607
608 settings.!FixErrors = VRGetIni( "Settings", "FixErrors", OurINI)
609 if settings.!FixErrors = "" then settings.!FixErrors = 1
610
611 settings.!SyncFullName = VRGetIni( "Settings", "SyncFullName", OurINI)
612 if settings.!SyncFullName = "" then settings.!SyncFullName = 1
613
614 settings.!SyncPrimGID = VRGetIni( "Settings", "SyncPrimGID", OurINI)
615 if settings.!SyncPrimGID = "" then settings.!SyncPrimGID = 0
616
617 settings.!WriteMasterPwd = VRGetIni( "Settings", "WriteMasterPwd", OurINI)
618 if settings.!WriteMasterPwd = "" then settings.!WriteMasterPwd = 1
619
620 options.!debug = VRGetIni( "Options", "Debug", OurINI)
621 if options.!debug = "" then options.!debug = 0
622
623 options.!curpage = VRGetIni( "Options", "CurPage", OurINI)
624 if options.!curpage = "" then options.!curpage = 1
625
626 ok = VRSet("CB_Debug","set",options.!Debug)
627 if options.!Debug then ok = VRREdirectStdIO("ON")
628 else ok = VRREdirectStdIO("OFF")
629
630 smbdoutput = 'smbd.out'
631 sambaver = ''
632
633 MinUID = 100
634 MinGGID = 3000
635 msg = ''
636 Credentials. = ''
637
638 IF options.!debug == 1 THEN say time()' _INIRead() done'
639return
640
641/*:VRX _INIWrite
642*/
643_INIWrite:
644 say 'start _INIWrite()'
645 ok = VRSetIni( "Pos", "Top", VRGet("Main","Top"), OurINI, 'NoClose' )
646 ok = VRSetIni( "Pos", "Left", VRGet("Main","Left"), OurINI, 'NoClose' )
647 ok = VRSetIni( "Pos", "Width", VRGet("Main","Width"), OurINI, 'NoClose' )
648 ok = VRSetIni( "Pos", "Height", VRGet("Main","Height"), OurINI, 'NoClose' )
649 ok = VRSetIni( "Settings", "SmbOnly", settings.!SmbOnly, OurINI, 'NoClose' )
650 ok = VRSetIni( "Settings", "SmbGroupsOnly", settings.!SmbGroupsOnly, OurINI, 'NoClose' )
651 ok = VRSetIni( "Settings", "FixErrors", settings.!FixErrors, OurINI, 'NoClose' )
652 ok = VRSetIni( "Settings", "SyncFullName", settings.!SyncFullName, OurINI, 'NoClose' )
653 ok = VRSetIni( "Settings", "SyncPrimGID" , settings.!SyncPrimGID , OurINI, 'NoClose' )
654 ok = VRSetIni( "Settings", "WriteMasterPwd",settings.!WriteMasterPwd,OurINI, 'NoClose' )
655
656 ok = VRSetIni( "Options", "Debug", options.!debug, OurINI, 'NoClose' )
657 ok = VRSetIni( "Options", "CurPage", options.!curpage, OurINI, 'NoClose' )
658
659 if VRget("CN_Users", "Font") <> "<default>" then ok = VRset("GB_Users", "Font", VRget("CN_Users", "Font"))
660 if VRget("CN_Groups", "Font") <> "<default>" then ok = VRset("GB_Groups", "Font", VRget("CN_Groups", "Font"))
661
662 call _INILayoutWrite "CN_Users"
663 call _INILayoutWrite "CN_Groups"
664
665 ok = VRSetIni( "Fonts", "GB_Users", VRGet("GB_Users","Font"), OurINI, 'NoClose' )
666 ok = VRSetIni( "Fonts", "GB_Groups", VRGet("GB_Groups","Font"), OurINI, 'NoClose' )
667 ok = VRSetIni( "Fonts", "GB_Settings", VRGet("GB_Settings","Font"), OurINI, 'NoClose' )
668 ok = VRSetIni( "Fonts", "GB_Policies", VRGet("GB_Policies","Font"), OurINI, 'NoClose' )
669 ok = VRSetIni( "Fonts", "Statusfont", VRGet("Main","Statusfont"), OurINI, 'NoClose' )
670 ok = VRSetIni( "Fonts", "Main", VRGet("Main","Font"), OurINI )
671 say 'done _INIWrite()'
672return
673
674/*:VRX _kLIBCGroupAdd
675*/
676_kLIBCGroupAdd:
677 NewGroupName = arg(1)
678 NewGroupGGID = arg(2)
679
680 nx = Groupname.0 + 1
681 Groupname.0 = nx
682 groupname.nx = NewGroupName
683 Gpasswd.nx ="*"
684 GGid.nx = NewGroupGGID
685 Gusers.nx = ""
686 NTGroupname.nx = ""
687 NTComment.nx = ""
688 RID.nx = ""
689 gstatus.nx = ""
690return
691
692/*:VRX _LoadotherFuncs
693*/
694_LoadotherFuncs:
695 IF options.!debug == 1 THEN say "_LoadotherFuncs() started"
696 ok = VRRedirectStdIO("ON")
697 /* ELSE ok = VRRedirectStdIO("OFF") */
698
699 /* what REXX script would be complete without this... */
700 call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
701 call SysLoadFuncs
702
703 call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
704 call IniLoadFuncs
705
706 call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
707 call PRLoadFuncs
708
709 /* Deal with DRCtrlxxx */
710 RC = RxFuncQuery("DRCtrlPickDirectory")
711 if RC = 1 then do /* DRCtrlXXX not already registered */
712 /* Load DRCtrl functions */
713 ok = RxFuncAdd('DRCtrlLoadFuncs', 'drctl017', 'DRCtrlLoadFuncs')
714 if ok = 0 then CALL DRCtrlLoadFuncs
715 end
716
717 IF options.!debug == 1 THEN say "_LoadotherFuncs() done"
718return
719
720/*:VRX _Login
721*/
722_Login:
723 IF options.!debug == 1 THEN say time()' _Login() started'
724 if Credentials.!username <> "" then do
725 if \_UserIsValid(Credentials.!username) then do
726 Msg.Type ="E"
727 Msg.Title= VRget("Main","Caption")
728 Msg.Text = NLVGetMessage(111, Credentials.!username )
729 call _ShowMsg
730 Credentials.!username = "root"
731 Credentials.!password = ""
732 end
733 end
734 LoginStatus = ""
735
736EnterCredentials:
737 if Credentials.!username = "" | Credentials.!password = "" then window = VRLoadSecondary( "SW_Login", "W" )
738
739 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0
740 then UserCred = '--user='Credentials.!username'%'Credentials.!password
741 else UserCred = '--user='Credentials.!username'%%'Credentials.!password
742
743 /* Lets see if the credentials are good */
744 ok = VRSet("Main", 'Pointer', 'Wait' )
745 say ' 'samba.!netexe' rpc user 'DebugLevel' 'UserCred' 1>'samba.!msg
746 address cmd samba.!netexe' rpc user 'DebugLevel' 'UserCred' 1>'samba.!msg
747 ok = VRSet("Main", 'Pointer', '<default>' )
748 do while lines(samba.!msg) > 0
749 loginLine = linein(samba.!msg)
750 if words(loginline) <> 1 then do
751 if pos("NT_STATUS",loginline) > 0 then leave /* Bad login */
752 end
753 else leave /* Good login */
754 /* retry - we read garbage - probably debug data */
755 end
756 ok = stream(samba.!msg,'c','close')
757 ok = SysFileDelete(samba.!msg)
758
759 /* If did not get a valid user back i.e. the first entry of the list, login was not successful */
760 if \_UserIsValid(strip(loginLine)) then do
761 Msg.Title = NLVGetMessage(31)': 'Credentials.!username'@'copies('*',length(Credentials.!password))
762 Msg.Text = substr(loginLine, pos("NT_STATUS",loginline))
763 Msg.Type = "E"
764 call _ShowMsg
765 Credentials.!username = ""
766 Credentials.!password = ""
767 IF options.!debug == 1 THEN say time()' _Login() failed, credentials used were "'UserCred'"'
768 signal EnterCredentials
769 end
770
771 IF options.!debug == 1 THEN say time()' _Login() succeeded, credentials used are "'UserCred'"'
772return
773
774/*:VRX _MasterpasswdRead
775*/
776_MasterpasswdRead:
777 IF options.!debug == 1 THEN say time()' _MasterpasswdRead() started'
778 /* Read complete master.passwd */
779 I = 0
780
781 do until lines(samba.!masterpasswd) = 0
782 userline = strip(linein(samba.!masterpasswd))
783
784 /* Skip comments */
785 if left(userline,1) = "#" then iterate
786 if left(userline,1) = ";" then iterate
787
788 /* parse fields into stem variables */
789 I = I + 1
790 parse var userline username.I':'password.I':'uid.I':'gid.I':'LoginClass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
791
792 Status.I =""
793 do J = 1 to I - 1
794 if translate(Username.J) = translate(Username.I) then do
795 status.I = "DUPLICATE"
796 leave
797 end
798 end
799 end
800 ok = stream(samba.!masterpasswd,'c','close')
801 drop userline
802
803 /* set "stem roots" properly */
804 username.0 = I
805 password.0 = I
806 uid.0 = I
807 gid.0 = I
808 loginclass.0= I
809 pwchange.0 = I
810 deact.0 = I
811 gecos.0 = I
812 home.0 = I
813 shell.0 = I
814
815 /* also smbpasswd stems */
816 lmhash. = ''
817 nthash. = ''
818 flags. = ''
819 lct. = ''
820 lmhash.0 = I
821 nthash.0 = I
822 flags.0 = I
823 lct.0 = I
824
825 /* smbusermap stem */
826 MapTo. = ''
827 MapTo.0 = I
828
829 /* our private stem */
830 status.0 = I
831 IF options.!debug == 1 THEN say time()' _MasterpasswdRead() done, read 'username.0' users'
832return
833
834/*:VRX _MasterpasswdWrite
835*/
836_MasterpasswdWrite:
837 IF options.!debug == 1 THEN say "_MasterpasswdWrite() started"
838 newmasterpasswd = TempDir'master.passwd'
839 ok = SysFileDelete(newmasterpasswd)
840 call lineout newmasterpasswd, '# Created by smbusers Version 'word(VRGet("Main", "Hinttext"),2)
841 call lineout newmasterpasswd, '# syntax:'
842 call lineout newmasterpasswd, '# username:passwd:UID:GID:login-class:chg pw x sec:deact x sec:GECOS:home:shell'
843 do I = 1 to username.0
844 select
845 when Status.I = "DUPLICATE" & settings.!FixErrors then iterate
846 when Status.I = "UID MISMATCH" then do
847 call lineout newmasterpasswd, username.I':'password.I':'word(uid.I,1)':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
848 end
849 when Status.I = "UNIX MISSING" & settings.!FixErrors then do
850 call lineout newmasterpasswd, username.I':'password.I':'uid.I':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
851 end
852 otherwise call lineout newmasterpasswd, username.I':'password.I':'uid.I':'gid.I':'loginclass.I':'pwchange.I':'deact.I':'gecos.I':'home.I':'shell.I
853 end
854 end
855 ok = stream(newmasterpasswd,'c','close')
856 ok = VRCopyFile( samba.!masterpasswd, samba.!masterpasswd'.bak' )
857 ok = VRCopyFile( newmasterpasswd, samba.!masterpasswd )
858 ok = SysFileDelete(newmasterpasswd)
859 IF options.!debug == 1 THEN say "_MasterpasswdWrite() done"
860return
861
862/*:VRX _MsgYesNo
863*/
864_MsgYesNo:
865 say "_MsgYesNo() started"
866 buttons.0 = 2
867 buttons.1 = NLVGetMessage(6)
868 buttons.2 = NLVGetMessage(7)
869 default = 2
870 buttons.default = NLVGetMessage(7)
871 esc = 2
872 buttons.esc = NLVGetMessage(7)
873 RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc )
874 say "_MsgYesNo() done, answer "RC
875return RC
876/*:VRX _NLVSetup
877*/
878_NLVSetup:
879 settings.!messages = 1 /* language files exist(s) */
880 settings.!helpfile = 0 /* helpfiles do not exist */
881 settings.!nlv8dot3 = 0 /* NLV may have long filenames */
882 call NLVSetup
883
884 CALL NLVSetText 'Main', 'Caption', 1
885
886 CALL NLVSetText 'PB_Save', 'Caption', 10
887 CALL NLVSetText 'PB_Refresh', 'Caption', 11
888 CALL NLVSetText 'PB_Exit', 'Caption', 12
889 CALL NLVSetText 'PB_Help', 'Caption', 13
890 CALL NLVSetText 'PB_About', 'Caption', 14
891 CALL NLVSetText 'PB_RPC', 'Caption', 23
892
893 CALL NLVSetText 'PB_Save', 'Hinttext', 123
894 CALL NLVSetText 'PB_Refresh', 'Hinttext', 124
895 CALL NLVSetText 'PB_Exit', 'Hinttext', 125
896 CALL NLVSetText 'PB_Help', 'Hinttext', 126
897 CALL NLVSetText 'PB_About', 'Hinttext', 127
898 CALL NLVSetText 'PB_RPC', 'Hinttext', 128
899return
900/*:VRX _OnErrorDisable
901*/
902_OnErrorDisable:
903 ok = VRSet("PB_Save","Enabled",0)
904 ok = VRSet("PB_Refresh","Enabled",0)
905 ok = VRSet("IPB_UserAdd","Enabled",0)
906 ok = VRSet("IPB_UserDel","Enabled",0)
907 ok = VRSet("IPB_UserLeaveGroup","Enabled",0)
908 ok = VRSet("IPB_UserJoinGroup","Enabled",0)
909 ok = VRSet("IPB_GroupAdd","Enabled",0)
910 ok = VRSet("IPB_GroupDel","Enabled",0)
911 ok = VRSet("IPB_GroupMap","Enabled",0)
912 ok = VRSet("IPB_GroupUnmap","Enabled",0)
913return
914
915/*:VRX _ParseCommandLine
916*/
917_ParseCommandLine:
918 IF options.!debug == 1 THEN SAY time()' _ParseCommandLine() started'
919 CmdLine = VRGet("Application","Commandline")
920 IF options.!debug == 1 THEN say ' original commandline ="'CmdLine'"'
921 upCmdLine = translate(CmdLine)
922
923 UserPos = 0
924 UserPos = pos('--USER=',upCmdLine)
925
926 if UserPos > 0 then do
927 IF options.!debug == 1 THEN SAY ' --USER switch detected'
928 UserPasswd = translate(word(substr(CmdLine,UserPos+7,),1),'%','|')
929 parse var UserPasswd Credentials.!Username '%' Credentials.!password
930 end
931 else do
932 UserPos = pos('-U ',upCmdLine)
933 If UserPos > 0 then do
934 IF options.!debug == 1 THEN SAY " -U switch detected"
935 UserPasswd = translate(word(substr(CmdLine,UserPos+3,),1),'%','|')
936 parse var UserPasswd Credentials.!Username '%' Credentials.!password
937 end
938 end
939 IF options.!debug == 1 THEN say ' Username ="'Credentials.!Username'"'
940 IF options.!debug == 1 THEN say ' Password ="'Credentials.!password'"'
941
942 IF options.!debug == 1 THEN SAY time()' _ParseCommandLine() done'
943return
944/*:VRX _PasswordDBRewrite
945*/
946_PasswordDBRewrite:
947 IF options.!debug == 1 then say time()' _PasswordDBRewrite() started'
948
949 /* Reset any old rc from pwd_mkdb.exe */
950 pwd_mkdbrc = 0
951
952 /* delete old .db.tmp files */
953 ok = SysFileDelete(UnixETC'\pwd.db.tmp')
954 ok = SysFileDelete(UnixETC'\spwd.db.tmp')
955
956 /* create backups of old .db files */
957 ok = VRCopyFile( UnixETC'\pwd.db', UnixETC'\pwd.db.bak' )
958 ok = VRCopyFile( UnixETC'\spwd.db', UnixETC'\spwd.db.bak' )
959
960 /* delete old .db files */
961 ok = SysFileDelete(UnixETC'\pwd.db')
962 ok = SysFileDelete(UnixETC'\spwd.db')
963
964 /* Create new password db */
965 address cmd samba.!pwd_mkdb' -d 'unixetc' 'samba.!masterpasswd' 2>'samba.!error
966 pwd_mkdbrc = rc
967 if \VRFileExists(samba.!pwddb) | pwd_mkdbrc <> 0 then do
968 call _ShowError
969 end
970 IF options.!debug == 1 then say time()" _PasswordDBRewrite() done ("pwd_mkdbrc")"
971return
972
973/*:VRX _PathStrkLIBC
974*/
975_PathStrkLIBC: procedure
976 PathStr = translate(arg(1),'/','\')
977 PathStr = translate(left(PathStr,2),'$',':')||substr(PathStr,3)
978return PathStr
979
980/*:VRX _PathStrOS2
981*/
982_PathStrOS2: procedure
983 PathStr = translate(arg(1),'\','/')
984 PathStr = translate(left(PathStr,2),':','$')||substr(PathStr,3)
985return PathStr
986
987/*:VRX _PoliciesPopulate
988*/
989_PoliciesPopulate:
990 IF options.!debug == 1 THEN say time()' _PoliciesPopulate() started'
991 say ' 'samba.!pdbeditexe' -P -?'DebugLevel' 1>'samba.!msg' 2>'samba.!error
992 address cmd samba.!pdbeditexe' -P -?'DebugLevel' 1>'samba.!msg' 2>'samba.!error
993
994 ok = file2stem(samba.!error,"pol.", , ": !")
995 ok = VRMethod("DDCB_Policy","AddstringList", "pol.")
996
997 IF options.!debug == 1 THEN say time()' _PoliciesPopulate() done'
998return
999
1000/*:VRX _PolicyGet
1001*/
1002_PolicyGet:
1003 IF options.!debug == 1 THEN say time()' _PoliciesGet("'arg(1)'") started'
1004 address cmd samba.!pdbeditexe' -P "'arg(1)'" 'DebugLevel' 1>'samba.!msg
1005 ok = file2stem(samba.!msg,"pol.")
1006 PolDesc = pol.1
1007 PolValue = pol.2
1008
1009 parse var PolDesc . ': ' PolDesc
1010 parse var PolValue . ': ' PolValue
1011
1012 IF options.!debug == 1 THEN say time()' _PoliciesGet("'PolDesc'", "'PolValue'") done'
1013return PolValue
1014
1015/*:VRX _PolicySet
1016*/
1017_PolicySet:
1018 IF options.!debug == 1 THEN say time()' _PoliciesSet() started'
1019 IF options.!debug == 1 THEN say time()' _PoliciesSet() done'
1020return
1021
1022/*:VRX _Refresh
1023*/
1024_Refresh:
1025 ok = VRSet("Main", 'Pointer', 'Wait' )
1026 ok = SysSleep(0.25)
1027 call _MasterPasswdRead
1028 call _SmbpasswdRead
1029 call _SmbUserMapRead
1030 call _GroupRead
1031 call _SmbGroupsRead
1032
1033 call _ContUsersPopulate
1034 call _ContGroupsPopulate
1035 ok = VRSet("Main", 'Pointer', '<default>' )
1036return
1037
1038/*:VRX _SambaGetProperties
1039*/
1040_SambaGetProperties: procedure expose options. samba.
1041 IF options.!debug == 1 THEN say time()' _SambaGetProperties() started'
1042 samba.!homes = ""
1043
1044 /* Read some values from smb.conf into samba. stem */
1045 samba.!smbusermap = VRParseFileName(translate(IniGet("username map", "global",samba.!smbconf),'\','/'),'DPNE')
1046 if samba.!smbusermap = 0 then samba.!smbusermap = ""
1047 IF options.!debug == 1 THEN say ' Samba Usermap = "'samba.!smbusermap'"'
1048
1049 samba.!homes = VRParseFileName(translate(IniGet("path", "homes",samba.!smbconf),'\','/'),'DP')
1050 if samba.!homes = 0 then samba.!homes = ""
1051 IF options.!debug == 1 THEN say ' Samba homes = "'samba.!homes'"'
1052
1053 samba.!profiles = translate(IniGet("path", "profiles",samba.!smbconf),'\','/')
1054 if samba.!profiles = 0 then samba.!profiles = ""
1055 IF options.!debug == 1 THEN say ' Samba profiles = "'samba.!profiles'"'
1056
1057 samba.!netlogon = translate(IniGet("path", "netlogon",samba.!smbconf),'\','/')
1058 if samba.!netlogon = 0 then samba.!netlogon = ""
1059 IF options.!debug == 1 THEN say ' Samba netlogon = "'samba.!netlogon'"'
1060
1061 IF options.!debug == 1 THEN say time()' _SambaGetProperties() done'
1062return
1063
1064/*:VRX _SambaShowError
1065*/
1066_SambaShowError: procedure expose samba. settings. options.
1067 if stream(samba.!error,'c','query size') > 0 then do
1068 I = 0
1069 do while lines(samba.!error) <> 0
1070 I = I + 1
1071 smberr.I = linein(samba.!error)
1072 end
1073 smberr.0 = I
1074 Buttons.1 = NLVGetMessage(2)
1075 Buttons.0 = 1
1076 id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
1077 end
1078 ok = stream(Samba.!error,"c","close")
1079 ok = SysFileDelete(Samba.!error)
1080return
1081
1082/*:VRX _SambaShowMsg
1083*/
1084_SambaShowMsg: procedure expose samba. settings. options.
1085 if stream(samba.!msg,'c','query size') > 0 then do
1086 skipWords = arg(1)
1087 ok = file2stem(samba.!msg,"smbmsg.", ,skipwords)
1088
1089 if smbmsg.0 > 0 then do
1090 Buttons.1 = "OK" /* NLVGetMessage(2) */
1091 Buttons.0 = 1
1092 id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
1093 end
1094 end
1095return
1096/*:VRX _SetFlag
1097*/
1098_SetFlag: procedure
1099 FlagVar = arg(1)
1100 FlagStatus = arg(2)
1101 FlagType = arg(3)
1102 say FlagVar
1103 if FlagStatus then do
1104 FlagVar = FlagType||translate(FlagVar,' ',FlagType)
1105 end
1106 else do
1107 FlagVar = translate(FlagVar,' ',FlagType)
1108 end
1109 FlagVar = space(FlagVar,0)
1110 say FlagVar
1111return FlagVar
1112
1113/*:VRX _ShowMsg
1114*/
1115_ShowMsg:
1116 Buttons.1 = NLVGetMessage( 2 )
1117 Buttons.0 = 1
1118 id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
1119 IF options.!debug == 1 THEN say Msg.Text
1120return
1121
1122/*:VRX _SmbGroupMembersSync
1123*/
1124_SmbGroupMembersSync:
1125 IF options.!debug == 1 THEN say time()' _SmbGroupMembersSync() started'
1126 CurGID = arg(1)
1127 if datatype(CurGID) = "NUM" then do
1128 CurNTGroupName = ""
1129 do Idx = 1 to GGID.0
1130/* say '"'CurGID'" --- "'GGID.Idx'"' */
1131 if CurGID = GGID.Idx then do
1132 CurNTGroupName = NTGroupName.Idx
1133 CurGroupIdx = Idx
1134 leave
1135 end
1136 end
1137 if CurNTGroupName = "" then do
1138 say "Invalid GID "CurGID
1139 return
1140 end
1141 end
1142 else CurNTGroupName = arg(1)
1143 say samba.!netexe' rpc group members "'CurNTGroupName'" 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
1144 address cmd samba.!netexe' rpc group members "'CurNTGroupName'" 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
1145 if RC <> 0 then call _SambaShowError
1146 else do
1147 Z = 0
1148 SyncedUsers = ""
1149 do while lines(samba.!msg) <> 0
1150 Z = Z + 1
1151 smbmsg.Z = linein(samba.!msg)
1152 parse var smbmsg.Z WorkGroup'\'User
1153 SyncedUsers = SyncedUsers||User','
1154 end
1155 ok = stream(Samba.!msg,"c","close")
1156 smbmsg.0 = Z
1157 Gusers.CurGroupIdx = SyncedUsers
1158 end
1159 IF options.!debug == 1 THEN say time()' _SmbGroupMembersSync() done'
1160return
1161
1162/*:VRX _SmbGroupsRead
1163*/
1164_SmbGroupsRead:
1165 IF options.!debug == 1 THEN say time()' _SmbGroupsRead() started'
1166
1167 /* Read group mapping */
1168 groupmapf = TempDir'netgroupmap.txt'
1169 ok = SysFileDelete(groupmapf)
1170 say ' 'samba.!netexe' groupmap list -l --debuglevel=0 >'groupmapf
1171 address cmd samba.!netexe' groupmap list -l --debuglevel=0 >'groupmapf
1172
1173 ok = file2stem(groupmapf, "groupmap.")
1174 gname.0 = 0
1175
1176 do G = 1 to groupmap.0
1177 sidline = groupmap.G
1178 if pos("SID ",sidline) > 0 then do /* Found group */
1179 gname.0 = gname.0 + 1
1180
1181 idx = G - 1; smbgname = strip(groupmap.idx)
1182 idx = G ; SID = substr(groupmap.idx,14)
1183 idx = G + 1; UnixGID = substr(groupmap.idx,14)
1184 idx = G + 2; Unixgroup = substr(groupmap.idx,14)
1185 idx = G + 3; GroupType = substr(groupmap.idx,14)
1186 idx = G + 4; GroupComment = substr(groupmap.idx,14)
1187 G = G + 4
1188 do I = 1 to Groupname.0
1189 if GGID.I = UnixGID then do
1190 NTGroupname.I = smbgname
1191 SID.I = SID
1192 RID.I = substr(SID,lastpos('-',SID)+1)
1193 NTComment.I = GroupComment
1194 NTGroupType.I = delword(GroupType,words(GroupType))
1195 GStatus.I = 'NOT FOUND' /* we set this FOR all NT groups - the variable is cleared, when an appriate LIBC group exists */
1196 leave
1197 end
1198 end
1199 end
1200 end
1201 IF options.!debug == 1 THEN say ' Found 'gname.0' mapped Samba groups.'
1202
1203 /* Now read the group list */
1204 grouplistf = TempDir'netgrouplist.txt'
1205 ok = SysFileDelete(grouplistf)
1206 GroupListError = 0
1207 say ' 'samba.!netexe' rpc group -l 'DebugLevel' 'UserCred' 1>'grouplistf' 2>'samba.!error
1208 address cmd samba.!netexe' rpc group -l 'DebugLevel' 'UserCred' 1>'grouplistf' 2>'samba.!error
1209 if RC <> 0 then do
1210 call _SambaShowError
1211 GroupListError = 1
1212 end
1213
1214 /* Read grouplist */
1215 ok = file2stem(grouplistf,"grouplist.","NODEL")
1216
1217 I = 0
1218 do G = 1 to grouplist.0
1219 groupline = grouplist.G
1220 if pos("Group",groupline) > 0 & pos("name",groupline) > 0 & pos("Comment",groupline) > 0 then do /* The header */
1221 commentpos = pos("Comment",groupline)
1222 do H = G + 1 to grouplist.0
1223 grline = strip(grouplist.H)
1224 do J = 1 to words(grline) /* Check whether this is really a group */
1225 gword = word(grline,J)
1226 if lastpos(gword,grline) = commentpos then do /* This is a group! */
1227 i = i + 1
1228 gline.i = grline
1229 leave
1230 end
1231 end
1232 end
1233 end
1234 end
1235 gline.0 = i
1236 IF options.!debug == 1 THEN say ' Found 'gline.0' total Samba groups.'
1237
1238 do i = 1 to gline.0
1239 ngroup = strip(left(gline.i,CommentPos-1))
1240 ncomment = strip(substr(gline.i,CommentPos))
1241 do j=1 to groupname.0
1242 if GStatus.j = "" then iterate
1243 if ngroup = strip(left(NTGroupname.j,CommentPos-2)) then do
1244 nox = 0
1245 GStatus.j = ""
1246 leave
1247 end
1248 end
1249 end
1250
1251
1252 if gname.0 <> gline.0 & GroupListError = 0 then do
1253 Msg.Title= VRGet("Main","Caption")
1254 Msg.Type = "W"
1255 Msg.Text = NLVGetMessage(112, gline.0, gname.0)
1256 call _ShowMsg
1257 end
1258 else IF options.!debug == 1 THEN say time()' Samba groups appear to be workable.'
1259
1260 IF options.!debug == 1 THEN say time()'_SmbGroupsRead() done, 'gline.0' smbgroups read'
1261return
1262/*:VRX _SmbpasswdRead
1263*/
1264_SmbpasswdRead:
1265 IF options.!debug == 1 THEN say time()' _SmbpasswdRead() started'
1266
1267 /* clear existing stems */
1268 drop sline.
1269 drop sname.
1270
1271 /* create our temporary smbpasswd file */
1272 ok = SysFileDelete(TempDir'smbpasswd.tmp')
1273 address cmd samba.!pdbeditexe' --debuglevel=0 -L -w >'TempDir'smbpasswd.tmp'
1274 ok = SysFileDelete(samba.!smbpasswd)
1275
1276 do while lines(TempDir'smbpasswd.tmp') <> 0
1277 tmpline = linein(TempDir'smbpasswd.tmp')
1278 if pos(':', tmpline) = 0 then iterate
1279 if pos('corrupt', tmpline) > 0 then do
1280 parse var tmpline . 'username 'username' with uid 'uid ' is' .
1281 tmpline = username':'uid':?:?:[?'copies(' ',12)']:?:'
1282 end
1283 call lineout samba.!smbpasswd, tmpline
1284 end
1285 ok = stream(samba.!smbpasswd,'c','close')
1286 ok = stream(TempDir'smbpasswd.tmp','c','close')
1287
1288 ok = SysFileDelete(TempDir'smbpasswd.tmp')
1289
1290 /* Read smbpasswd */
1291 i = 0
1292 err = 0
1293 cmt = 0
1294 do while lines(samba.!smbpasswd) <> 0
1295 i = i + 1
1296 sline.i = strip(linein(samba.!smbpasswd))
1297
1298 select
1299 when left(sline.i,1) = '#' then do
1300 sname.i = '#'
1301 cmt = cmt + 1
1302 end
1303 when pos('UNKNOWN PARAMETER', translate(sline.i)) > 0 then do
1304 sname.i = '#'
1305 err = err + 1
1306 Msg.Title= "Broken "samba.!smbconf
1307 Msg.Text = sline.i
1308 Msg.Type = "E"
1309 call _ShowMsg
1310 end
1311 when pos(':[',translate(sline.i)) > 0 & pos(']:LCT-',translate(sline.i)) > 0 then do
1312 /* we guess a valid smbdpasswd user entry here */
1313 parse var sline.i name':'.
1314 sname.i = translate(name)
1315 /* still something wrong - we got no name, trash this line */
1316 if sname.i = '' then i = i - 1
1317 end
1318 otherwise do
1319 /* if we did not find a valid line in the previous check this line is garbage, likely debug output.. */
1320 i = i - 1
1321 end
1322 end
1323 end
1324
1325 sline.0 = i
1326 sname.0 = i
1327 ok = stream(samba.!smbpasswd,'c','close')
1328
1329 /* list each line in smbpasswd */
1330 do i=1 to sline.0
1331
1332 /* skip comments in smbpasswd */
1333 if sname.i = '#' then iterate
1334
1335 /* parse smbpasswd info */
1336 parse var sline.i name':'uid':'lmhash':'nthash':['flags']:'lct':'
1337 flags = strip(flags)
1338 ucName = translate(name)
1339
1340 /* find matching entry in master.passwd & confirm UIDs match */
1341 ok = 0
1342 bad = 0
1343 nox = 1
1344 do j=1 to username.0
1345 if translate(username.j) = ucName then do
1346 nox = 0
1347 lmhash.j = lmhash
1348 nthash.j = nthash
1349 flags.j = flags
1350 if pos('?',flags.j) > 0 then status.J = "CORRUPT SMB USER"
1351 lct.j = lct
1352 if uid.j = uid | (uid = 0 & uid.j > 65500) then
1353 ok = j
1354 else do
1355 status.j = "UID MISMATCH"
1356 IF options.!debug == 1 THEN say time()' UID MISMATCH: 'uid.j' from master.passwd vs 'uid' from Samba'
1357 uid.j = uid.j
1358 end
1359 leave
1360 end
1361 end
1362 if nox then do /* No master.passwd entry found ! */
1363 nx = 1 + username.0
1364 username.0 = nx
1365 password.0 = nx
1366 username.nx = name
1367 uid.nx = uid
1368 gid.nx = uid
1369 password.nx = "*"
1370 loginclass.NX = '' /* dummy value */
1371 pwchange.NX = '0' /* dummy value */
1372 deact.NX = '0' /* dummy value */
1373 gecos.NX = name /* not really appropriate, but better than a dummy value */
1374 home.NX = '/nonexistent' /* dummy value */
1375 shell.NX = '/usr/sbin/nologin' /* dummy value */
1376 lmhash.NX = lmhash
1377 nthash.NX = nthash
1378 flags.NX = flags
1379 lct.NX = lct
1380 Status.nx = 'UNIX MISSING'
1381 /* we must fix this immediately! */
1382 say "WARNING! Missing master.passwd record created using defaults!!!!!!!!!!!!!!!!!"
1383 call _MasterpasswdWrite
1384 call _PasswordDBRewrite
1385 end
1386 end
1387 IF options.!debug == 1 THEN say time()' _SmbpasswdRead() done, read 'sname.0-cmt-err' Samba users, 'cmt' comments, 'err' errors.'
1388return
1389
1390/*:VRX _SmbUserMapRead
1391*/
1392_SmbUserMapRead:
1393 IF options.!debug == 1 THEN say time()' _SmbUserMapRead() started'
1394 /* Read complete smbusermap */
1395 I = 0
1396 if samba.!smbusermap <> "" then do
1397 do until lines(samba.!smbusermap) = 0
1398 usermapline = strip(linein(samba.!smbusermap))
1399
1400 /* Skip comments */
1401 if left(usermapline,1) = "#" then iterate
1402 if left(usermapline,1) = ";" then iterate
1403
1404 /* parse fields into stem variables */
1405 I = I + 1
1406 parse var usermapline usermapname.I' = 'usernamemapto.I
1407
1408 do J = 1 to Username.0
1409 if translate(Username.J) = translate(Usermapname.I) then do
1410 MapTo.J = usernamemapto.I
1411 leave
1412 end
1413 end
1414 end
1415 ok = stream(samba.!smbusermap,'c','close')
1416 drop usermapline
1417 drop usermapname.
1418 drop usernamemapto.
1419 IF options.!debug == 1 THEN say time()' _SmbUserMapRead() done, 'I' user mappings read'
1420 end
1421 else IF options.!debug == 1 THEN say time()' _SmbUserMapRead() done, not installed'
1422return
1423
1424/*:VRX _SmbUserMapWrite
1425*/
1426_SmbUserMapWrite:
1427 IF options.!debug == 1 THEN say time()' _SmbUserMapWrite() started'
1428 HaveMappedUser = 0
1429 do I = 1 to MapTo.0
1430 if MapTo.I <> "" then do
1431 HaveMappedUser = 1
1432 leave
1433 end
1434 end
1435 if samba.!smbusermap = "" & HaveMappedUser then do
1436 Msg.Text = NLVGetMessage(110)
1437 Msg.Type = "E"
1438 call _ShowMsg
1439 IF options.!debug == 1 THEN say time()' _SmbUserMapWrite() done, not installed.'
1440 return
1441 end
1442
1443 if samba.!smbusermap <> "" then do
1444 ok = VRCopyFile( samba.!smbusermap, samba.!smbusermap'.bak' )
1445 ok = SysFileDelete(samba.!smbusermap)
1446 call lineout samba.!smbusermap, '# Created by smbusers Version 'word(VRGet("Main", "Hinttext"),2)
1447 call lineout samba.!smbusermap, '# syntax:'
1448 call lineout samba.!smbusermap, '# Samba username = Windows username'
1449
1450 do I = 1 to MapTo.0
1451 if MapTo.I <> "" then do
1452 call lineout samba.!smbusermap, Username.I' = 'MapTo.I
1453 end
1454 end
1455 ok = stream(samba.!smbusermap,'c','close')
1456 IF options.!debug == 1 THEN say time()' _SmbUserMapWrite() done'
1457 end
1458 else IF options.!debug == 1 THEN say time()' _SmbUserMapWrite() done, not installed.'
1459return
1460
1461/*:VRX _SmbUsersList
1462*/
1463_SmbUsersList:
1464
1465userCnt = 0
1466
1467/* list each line in smbpasswd */
1468do i=1 to sline.0
1469
1470 /* skip comments in smbpasswd */
1471 if sname.i = '#' then
1472 iterate
1473
1474 /* parse smbpasswd info */
1475 parse var sline.i name':'uid':'.':'.':'flags':'.
1476 ucName = translate(name)
1477
1478 /* find matching entry in master.passwd & confirm UIDs match */
1479 ok = 0
1480 bad = 0
1481 do j=1 to mname.0
1482 if mname.j = ucName then do
1483 if muid.j = uid | (uid = 0 & muid.j > 65500) then
1484 ok = j
1485 else
1486 bad = j
1487 leave
1488 end
1489 end
1490
1491 /* if there was a match, show all info;
1492 otherwise, show smbpasswd info & an error message */
1493 userCnt = userCnt + 1
1494 RH = VRMethod("CN_Users","AddRecord")
1495
1496 if ok <> 0 then do
1497 parse var mline.ok .':'.':'.':'gid':'.':'.':'.':'full':'home':'.
1498 home = _PathStrOS2(home)
1499 say left(userCnt, 4) substr(flags, 2, 4) left(name, 11) left(uid, 6),
1500 left(gid, 6) left(full, 18) left(home, 23)
1501 flags = strip(substr(flags, 2, 4))
1502 ok = VRMethod("CN_Users","SetFieldData", RH, NrFH, UserCnt, SmbFH, flags, NameFH, Name, UIDFH, Uid, GIdFH, GID, FullNameFH, full, HomeFH, Home)
1503 end
1504 else do
1505 if bad <> 0 then
1506 error = "* UID should be '" || muid.bad || "' - use 'Change' to fix *"
1507 else
1508 error = "* Unix-user not found - use 'Change' to fix *"
1509 say left(userCnt, 4) substr(flags, 2, 4) left(name, 11) left(uid, 6),
1510 left(error, 50)
1511 flags = strip(substr(flags, 2, 4))
1512 ok = VRMethod("CN_Users","SetFieldData", RH, SCommentFH, error)
1513 ok = VRMethod("CN_Users","SetFieldData", RH, NrFH, UserCnt, SmbFH, flags, NameFH, Name, UIDFH, Uid )
1514 end
1515
1516
1517end
1518
1519if userCnt = 0 then
1520 say " * No Samba users have been defined - use the 'Add' command * "
1521
1522return
1523
1524/*:VRX _TabbedDialogSetup
1525*/
1526_TabbedDialogSetup:
1527 IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup started'
1528 w = VRLoad( "TDL_1", VRWindowPath(), "SW_Users" )
1529 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(15)" ")
1530
1531 w = VRLoad( "TDL_1", VRWindowPath(), "SW_Groups" )
1532 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(16)" ")
1533
1534 w = VRLoad( "TDL_1", VRWindowPath(), "SW_Policies" )
1535 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(170)" ")
1536
1537 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
1538 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(24)" ")
1539
1540 IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup done'
1541return
1542
1543/*:VRX _useraddsmb
1544*/
1545_useraddsmb:
1546 IF options.!debug == 1 THEN say time()' _UserAddSmb() started'
1547 select
1548 when VRGet("CB_MachineAccount","Set") then do
1549 say ' 'samba.!smbpasswdexe' -a 'VRGet("EF_Username","Value")' -m'
1550 address cmd samba.!smbpasswdexe' -a 'VRGet("EF_Username","Value")' -m 2>'samba.!error' 1>'samba.!msg
1551 smbpasswdrc = rc
1552 if rc <> 0 then call _SambaShowError
1553 else call _SambaShowMsg
1554 end
1555 when VRGet("CB_NoPassword","Set") then do
1556 say ' 'samba.!smbpasswdexe' -a 'VRGet("EF_Username","Value")' -n'
1557 address cmd samba.!smbpasswdexe' -a 'VRGet("EF_Username","Value")' -n 2>'samba.!error' 1>'samba.!msg
1558 smbpasswdrc = rc
1559 if rc <> 0 then call _SambaShowError
1560 else call _SambaShowMsg
1561 end
1562 otherwise do
1563 pwdfile = TempDir'newpwd'
1564 call lineout pwdfile, VRGet("EF_Password","value")
1565 call lineout pwdfile, VRGet("EF_Password","value")
1566 ok = stream(pwdfile,"c","close")
1567 say ' 'samba.!smbpasswdexe' -a 'VRGet("EF_Username","Value")' -s <'pwdfile' 2>'samba.!error
1568 address cmd samba.!smbpasswdexe' -a 'VRGet("EF_Username","Value")' -s <'pwdfile' 2>'samba.!error' 1>'samba.!msg
1569 smbpasswdrc = rc
1570 if rc <> 0 then call _SambaShowError
1571 else call _SambaShowMsg
1572 if swatauth & VRGet("CB_Swat_Allowed","set") then do
1573 if VRFileExists(swatusers) then cFlag = ""; else cFlag="c"
1574 say ' 'samba.!htpasswdexe' -b "'swatusers'" 'VRGet("EF_Username","Value")' 'copies("*",length(VRGet("EF_Password","value")))
1575 address cmd samba.!htpasswdexe' -b'cFlag' "'swatusers'" 'VRGet("EF_Username","Value")' 'VRGet("EF_Password","value")' 2>'samba.!error' 1>'samba.!msg
1576 if rc <> 0 then call _SambaShowError
1577 else call _SambaShowMsg
1578 end
1579 ok = SysFileDelete(pwdfile)
1580 end
1581 end
1582 IF options.!debug == 1 THEN say time()' _UserAddSmb() done'
1583return
1584
1585/*:VRX _UserIsValid
1586*/
1587_UserIsValid: procedure expose username.
1588 User = arg(1)
1589 HaveValidUser = 0
1590 do I = 1 to username.0
1591 if translate(username.I) = translate(User) then do
1592 HaveValiduser = 1
1593 leave
1594 end
1595 end
1596return HaveValidUser
1597
1598/*:VRX _UserPropertiesGet
1599*/
1600_UserPropertiesGet:
1601 IF options.!debug == 1 THEN say time()' _UserPropertiesGet() started'
1602 CurUser = arg(1)
1603
1604 /* "up" is an abbreviation for UserProperties in here */
1605
1606 UserProperties = TempDir'UserProperties.txt'
1607 ok = SysFileDelete(UserProperties)
1608
1609 IF options.!debug == 1 THEN say time()' 'samba.!pdbeditexe' 'CurUser' -L -v 'debuglevel
1610 address cmd samba.!pdbeditexe' 'CurUser' -L -v 'DebugLevel' >'UserProperties
1611
1612 /* Read user properties */
1613 ok = file2stem(Userproperties,"upline.")
1614
1615 ok = VRSet("CN_UserProperties","Painting", 0 )
1616 ok = VRMethod("CN_UserProperties","RemoveRecord","ALL")
1617 do i = 1 to upline.0
1618 parse var upline.i uptype.i ':' upvalue.i
1619 uptype.i = strip(uptype.i)
1620 upvalue.i = strip(upvalue.i)
1621 CurType = translate(uptype.i)
1622 /* say CurType */
1623 select
1624 when CurType = "DOMAIN" then upCommand.i = "--domain="
1625 when CurType = "PROFILE PATH" then upCommand.i = "--profile="
1626 when CurType = "ACCOUNT DESC" then upCommand.i = "--account-desc="
1627 when CurType = "FULL NAME" then upCommand.i = "--fullname="
1628 when CurType = "LOGON SCRIPT" then upCommand.i = "--script="
1629 when CurType = "HOME DIRECTORY" then upCommand.i = "--homedir="
1630 when CurType = "HOMEDIR DRIVE" then upCommand.i = "--drive="
1631 /* when CurType = "ACCOUNT FLAGS" then upCommand.i = '-c "[NDHLX]"' */
1632 when CurType = "PRIMARY GROUP SID" then do
1633 upCommand.i = ""
1634 if Settings.!SyncPrimGID = 1 & \(translate(Username.CurUserNr) = "GUEST"|translate(Username.CurUserNr) = "NOBODY") then do
1635 NewPrimGID = substr(upvalue.i,lastpos('-',upvalue.i)+1,)
1636 IF options.!debug == 1 THEN say " NewPrimGID = "NewPrimGID
1637 If GID.CurUserNr <> NewPrimGID then do
1638 GID.CurUserNr = NewPrimGID
1639 IF options.!debug == 1 THEN say " Synced Primary GID!"
1640 SyncedPrimGID = 1
1641 end
1642 end
1643 end
1644
1645 otherwise upCommand.i = ""
1646 end
1647 uprh.i = VRMethod("CN_UserProperties","AddRecord")
1648 ok = VRMethod("CN_UserProperties","SetFieldData", uprh.i, upNrFH, i, upTypeFH, uptype.i, upValueFH, upValue.i, upCommandFH, upCommand.i )
1649 NotHaveCommand = (upCommand.i = "")
1650 ok = VRMethod("CN_UserProperties","SetRecordAttr", uprh.i, "ReadOnly", NotHaveCommand)
1651 if VRGet("CB_EditableFieldsOnly","Set") then ok = VRMethod("CN_UserProperties","SetRecordAttr", uprh.i, "Visible", \NotHaveCommand)
1652 select
1653 when CurType = "ACCOUNT FLAGS" then do
1654 /* ok = VRMethod("CN_UserProperties","SetRecordAttr", uprh.i, "Visible", 0) */
1655 parse var upvalue.I '['CurFlags']'
1656 if pos("U", CurFlags) > 0 then ok = VRSet("EF_AccountType","Value", "Regular user account")
1657 if pos("T", CurFlags) > 0 then ok = VRSet("EF_AccountType","Value", "Temporary duplicate of other account")
1658 if pos("M", CurFlags) > 0 then ok = VRSet("EF_AccountType","Value", "MNS logon user account")
1659 if pos("W", CurFlags) > 0 then ok = VRSet("EF_AccountType","Value", "Workstation Trust Account")
1660 if pos("S", CurFlags) > 0 then ok = VRSet("EF_AccountType","Value", "Server Trust Account")
1661 if pos("I", CurFlags) > 0 then ok = VRSet("EF_AccountType","Value", "Domain Trust Account")
1662
1663 ok = VRSet("CB_upNoPassword", "Set", (pos("N",CurFlags) > 0))
1664 call CB_upNoPassword_Click
1665 ok = VRSet("CB_upPassword_doesnt_expire", "Set", (pos("X",CurFlags) > 0))
1666 ok = VRSet("CB_upDeactivated", "Set", (pos("D",CurFlags) > 0))
1667 end
1668 when right(CurType,8) = "USERNAME" then do
1669 ok = VRMethod("CN_UserProperties","SetRecordAttr", uprh.i, "Visible", 0)
1670 ok = VRSet("UserProperties", "caption", NLVGetMessage(120)' "'Username.CurUserNr'"')
1671 end
1672 otherwise nop
1673 end
1674 end
1675 if SwatAuth then do
1676 ok = VRSet("CB_upSWAT_Allowed","Enabled",0)
1677 ok = VRSet("CB_upSWAT_Allowed","set",0)
1678 swatchanged = 0
1679 if VRFileExists(swatusers) then do
1680 do until lines(swatusers) = 0
1681 swatline = linein(swatusers)
1682 parse var swatline curswatuser ':' curswatpw
1683 if curswatuser = CurUser then do
1684 ok = VRSet("CB_upSWAT_Allowed","set",1)
1685 leave
1686 end
1687 end
1688 ok = stream(swatusers,'c','close')
1689 end
1690 end
1691 ok = VRSet("CN_UserProperties","Painting", 1 )
1692 IF options.!debug == 1 THEN say time()' _UserPropertiesGet() done'
1693return
1694
1695/*:VRX _UserRecWriteBackToStems
1696*/
1697_UserRecWriteBackToStems:
1698 IF options.!debug == 1 THEN say time()' _UserRecWriteBackToStems() started'
1699
1700 if VRMethod( "CN_Users", "ValidateRecord", RH ) then do
1701 Cur = VRMethod("CN_Users","GetFieldData", RH, NrFH)
1702 Username.Cur = VRMethod("CN_Users","GetFieldData", RH, UsernameFH)
1703 UID.Cur = VRMethod("CN_Users","GetFieldData", RH, UIDFH)
1704 GID.Cur = VRMethod("CN_Users","GetFieldData", RH, GIDFH)
1705 GECOS.Cur = VRMethod("CN_Users","GetFieldData", RH, GECOSFH)
1706 Home.Cur = _PathStrkLIBC(VRMethod("CN_Users","GetFieldData", RH, HomeFH))
1707 Shell.Cur = VRMethod("CN_Users","GetFieldData", RH, ShellFH)
1708 MapTo.Cur = VRMethod("CN_Users","GetFieldData", RH, MapToFH)
1709
1710 if Settings.!SyncFullName = 1 & flags.Cur <> "" then do
1711 say " Sync is enabled, therefore we must save now!"
1712 call PB_Save_Click
1713 say samba.!pdbeditexe' --user='Username.Cur' --modify --fullname="'GECOS.Cur'" 'DebugLevel' 1>NUL 2>'samba.!error
1714 address cmd samba.!pdbeditexe' --user='Username.Cur' --modify --fullname="'GECOS.Cur'" 'DebugLevel' 1>NUL 2>'samba.!error
1715 if RC <> 0 then call _SambaShowError /* ; else call _SambaShowMsg */
1716 end
1717 /* These are not editable/visible xpwFH, password.i,xlcFH,LoginClass.I,xcpwFH, pwchange.I,xDeactFH, deact.I, Status.I ) */
1718
1719 /* smbpasswd fields */
1720 /* we do not allow editing these
1721 FLagsFH, flags.I, LMHashFH, LMHash.I,NTHashFH, NTHash.I, LCTFH, LCT.I)
1722 */
1723 end
1724 else say RH' is no valid record!'
1725 IF options.!debug == 1 THEN say time()' _UserRecWriteBackToStems() done'
1726return
1727
1728/*:VRX About_Close
1729*/
1730About_Close:
1731 call About_Fini
1732return
1733
1734/*:VRX About_Create
1735*/
1736About_Create:
1737 call About_Init
1738 ok = VRSet("About","Caption", NLVGetMessage(127))
1739 ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2))
1740 SambaTeam.0 = 11
1741 SambaTeam.1 = 'Silvan Scherrer'
1742 SambaTeam.2 = 'Herwig Bauernfeind'
1743 SambaTeam.3 = 'Dmitriy Kuminov'
1744 SambaTeam.4 = 'Vitali Pelenyov'
1745 SambaTeam.5 = 'Paul Smedley'
1746 SambaTeam.6 = 'Yuri Dario'
1747 SambaTeam.7 = 'Alex Taylor'
1748 SambaTeam.8 = 'Nikolay Kolosov'
1749 SambaTeam.9 = 'All the Samba people'
1750 SambaTeam.10= 'All the ArcaNoae people'
1751 SambaTeam.11= 'All the netlabs people'
1752 ok = VRSet("About","Font", VRGet("GB_Settings","Font"))
1753 ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
1754 ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(129))
1755 ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
1756return
1757
1758/*:VRX About_Fini
1759*/
1760About_Fini:
1761 window = VRInfo( "Window" )
1762 call VRDestroy window
1763 drop window
1764return
1765/*:VRX About_Init
1766*/
1767About_Init:
1768 window = VRInfo( "Object" )
1769 if( \VRIsChildOf( window, "Notebook" ) ) then do
1770 call VRMethod window, "CenterWindow"
1771 call VRSet window, "Visible", 1
1772 call VRMethod window, "Activate"
1773 end
1774 drop window
1775return
1776
1777/*:VRX AddGroup_Close
1778*/
1779AddGroup_Close:
1780 call AddGroup_Fini
1781return
1782
1783/*:VRX AddGroup_Create
1784*/
1785AddGroup_Create:
1786 call AddGroup_Init
1787 CALL NLVSetText 'AddGroup', 'Caption', 70
1788 CALL NLVSetText 'PB_GroupAddOK', 'Caption', 2
1789 CALL NLVSetText 'PB_GroupAddCancel', 'Caption', 3
1790 CALL NLVSetText 'DT_GroupName', 'Caption', 71
1791 CALL NLVSetText 'DT_Comment', 'Caption', 72
1792 CALL NLVSetText 'CB_UnixGroupOnly', 'Caption', 73
1793 CALL NLVSetText 'CB_AutomaticGGID', 'Caption', 74
1794 UnixGroupOnly = 0
1795return
1796
1797/*:VRX AddGroup_Fini
1798*/
1799AddGroup_Fini:
1800 window = VRInfo( "Window" )
1801 call VRDestroy window
1802 drop window
1803return
1804/*:VRX AddGroup_Init
1805*/
1806AddGroup_Init:
1807 window = VRInfo( "Object" )
1808 if( \VRIsChildOf( window, "Notebook" ) ) then do
1809 call VRMethod window, "CenterWindow"
1810 call VRSet window, "Visible", 1
1811 call VRMethod window, "Activate"
1812 end
1813 drop window
1814return
1815
1816/*:VRX AddUser_Close
1817*/
1818AddUser_Close:
1819 call AddUser_Fini
1820return
1821
1822/*:VRX AddUser_Create
1823*/
1824AddUser_Create:
1825 call AddUser_Init
1826 CALL NLVSetText 'AddUser', 'Caption', 40
1827
1828 Msg.Title = VRGet("AddUser","Caption")
1829 CALL NLVSetText 'DT_Username', 'Caption', 41
1830 CALL NLVSetText 'DT_GECOS', 'Caption', 42
1831 CALL NLVSetText 'DT_Password_Repeat', 'Caption', 43
1832 CALL NLVSetText 'DT_GID', 'Caption', 44
1833 CALL NLVSetText 'DT_Home', 'Caption', 140
1834 CALL NLVSetText 'DT_Description', 'Caption', 52
1835 CALL NLVSetText 'CB_Must_change_password', 'Caption', 46
1836 CALL NLVSetText 'CB_Cannot_change_password','Caption', 47
1837 CALL NLVSetText 'CB_Password_doesnt_expire', 'Caption', 48
1838 CALL NLVSetText 'CB_Deactivated', 'Caption', 49
1839 CALL NLVSetText 'CB_NoHome', 'Caption', 9
1840
1841 CALL NLVSetText 'PB_AddUserOK', 'Caption', 2
1842 CALL NLVSetText 'PB_AddUserCancel', 'Caption', 3
1843 CALL NLVSetText 'CB_UnixUserOnly', 'Caption', 18
1844 CALL NLVSetText 'CB_MachineAccount', 'Caption', 19
1845 CALL NLVSetText 'CB_NoPassword', 'Caption', 20
1846 CALL NLVSetText 'DT_Password', 'Caption', 33
1847 CALL NLVSetText 'CB_SWAT_Allowed', 'Caption', 35
1848
1849 ok = VRSet("CB_SWAT_Allowed","enabled",Swatauth)
1850
1851 MinPWLength = _PolicyGet("min password length")
1852
1853 if IsUnixUser then do
1854 ok = VRSet("EF_Username","value", Username.SelNr)
1855 call EF_Username_LostFocus
1856 ok = VRMethod("EF_GECOS","SetFocus")
1857 end
1858 else do
1859 NextUID = _GetNextUID()
1860 ok = VRSet("DT_UID","Caption", "UID: "NextUID)
1861 ok = VRSet("DDCB_GID","Value", NextUID)
1862 do I = 1 to GGID.0
1863 if GGID.I = "513" then do
1864 ok = VRSet("DDCB_GID","Value", "513")
1865 leave
1866 end
1867 end
1868 ok = VRMethod( "DDCB_GID", "Reset")
1869 ok = VRMethod( "DDCB_GID", "AddString", NextUID)
1870 ok = VRMethod( "DDCB_GID", "AddStringList", "GGID.")
1871 ok = VRSet("EF_Home", "Value", Samba.!Homes'\')
1872 call EF_Home_Change
1873 end
1874 SecondStage = 0
1875return
1876
1877/*:VRX AddUser_Fini
1878*/
1879AddUser_Fini:
1880 window = VRInfo( "Window" )
1881 call VRDestroy window
1882 drop window
1883return
1884/*:VRX AddUser_Init
1885*/
1886AddUser_Init:
1887 window = VRInfo( "Object" )
1888 if( \VRIsChildOf( window, "Notebook" ) ) then do
1889 call VRMethod window, "CenterWindow"
1890 call VRSet window, "Visible", 1
1891 call VRMethod window, "Activate"
1892 end
1893 drop window
1894return
1895
1896/*:VRX CB_AutomaticGGID_Click
1897*/
1898CB_AutomaticGGID_Click:
1899 ok = VRSet("EF_GGID","Enabled", \VRget("CB_AutomaticGGID","Set"))
1900 if \VRget("CB_AutomaticGGID","Set") then ok = VRSet("EF_GGID","BackColor","<default>")
1901 else ok = VRSet("EF_GGID","BackColor","PaleGray")
1902return
1903
1904/*:VRX CB_Cannot_change_password_Click
1905*/
1906CB_Cannot_change_password_Click:
1907 SecondStage = (SecondStage | VRGet("CB_Cannot_change_password","set"))
1908return
1909
1910/*:VRX CB_Deactivated_Click
1911*/
1912CB_Deactivated_Click:
1913 SecondStage = (SecondStage | VRGet("CB_Deactivated","set"))
1914return
1915
1916/*:VRX CB_Debug_Click
1917*/
1918CB_Debug_Click:
1919 options.!Debug = VRGet("CB_Debug","set")
1920 if options.!Debug then ok = VRREdirectStdIO("ON")
1921 else ok = VRREdirectStdIO("OFF")
1922return
1923
1924/*:VRX CB_EditableFieldsOnly_Click
1925*/
1926CB_EditableFieldsOnly_Click:
1927 call _UserPropertiesGet Username.CurUserNr
1928return
1929
1930/*:VRX CB_FixErrors_Click
1931*/
1932CB_FixErrors_Click:
1933 settings.!FixErrors = VRGet("CB_FixErrors","set")
1934return
1935
1936/*:VRX CB_MachineAccount_Click
1937*/
1938CB_MachineAccount_Click:
1939 IF options.!debug == 1 THEN say time()' CB_MachineAccount_Click started'
1940 if right(VRGet("EF_Username","Value"),1) = "$" then do
1941 if VRGet("EF_Username","Value") <> translate(VRGet("EF_Username","Value")) then
1942 ok = VRSet("EF_Username","Value",translate(VRGet("EF_Username","Value")))
1943 ok = VRset("CB_UnixUserOnly","set", 0)
1944 ok = VRset("CB_MachineAccount","set", 1)
1945 ok = VRSet("CB_NoPassword","set", 0)
1946 ok = VRSet("CB_NoPassword","Enabled", 0)
1947 ok = VRSet("EF_Password","BackColor", "PaleGray")
1948 ok = VRSet("EF_Password_Repeat","BackColor", "PaleGray")
1949 ok = VRSet("EF_Password","Enabled", 0)
1950 ok = VRSet("EF_Password_Repeat","Enabled", 0)
1951 ok = VRSet("CB_Must_Change_Password","Enabled", 0)
1952 ok = VRSet("CB_Cannot_change_password","Enabled", 0)
1953 ok = VRSet("CB_Password_doesnt_expire","Enabled", 0)
1954
1955 end
1956 else do
1957 ok = VRset("CB_MachineAccount","set", 0)
1958 ok = VRSet("CB_NoPassword","Enabled", 1)
1959 call CB_NoPassword_Click
1960 end
1961 IF options.!debug == 1 THEN say time()' CB_MachineAccount_Click done'
1962return
1963
1964/*:VRX CB_Must_change_password_Click
1965*/
1966CB_Must_change_password_Click:
1967 SecondStage = (SecondStage | VRGet("CB_Must_change_password","set"))
1968 if VRGet("CB_Must_Change_Password","set") then do
1969 ok = VRSet("CB_Cannot_change_password","Set", 0)
1970 ok = VRSet("CB_Password_doesnt_expire","Set", 0)
1971 ok = VRSet("CB_Cannot_change_password","Enabled", 0)
1972 ok = VRSet("CB_Password_doesnt_expire","Enabled", 0)
1973 end
1974 else do
1975 ok = VRSet("CB_Cannot_change_password","Enabled", 1)
1976 ok = VRSet("CB_Password_doesnt_expire","Enabled", 1)
1977 end
1978return
1979
1980/*:VRX CB_NoHome_Click
1981*/
1982CB_NoHome_Click:
1983 ok = VRSet("EF_Home","Enabled",\VRGet("CB_NoHome","set"))
1984 ok = VRset("PB_CreateHome","Enabled",\VRGet("CB_NoHome","set"))
1985 ok = VRSet("PB_ChooseHome","Enabled",\VRGet("CB_NoHome","set"))
1986 if VRGet("CB_NoHome","set") then ok = VRSet("EF_HOME","Value", "\nonexistent")
1987return
1988
1989/*:VRX CB_NoPassword_Click
1990*/
1991CB_NoPassword_Click:
1992 if VRGet("CB_NoPassword","set") then do
1993 ok = VRSet("EF_Password","BackColor", "PaleGray")
1994 ok = VRSet("EF_Password_Repeat","BackColor", "PaleGray")
1995 ok = VRSet("EF_Password","Enabled", 0)
1996 ok = VRSet("EF_Password_Repeat","Enabled", 0)
1997 ok = VRSet("CB_Must_Change_Password","Enabled", 0)
1998 ok = VRSet("CB_Cannot_change_password","Enabled", 0)
1999 ok = VRSet("CB_Password_doesnt_expire","Enabled", 0)
2000 ok = VRSet("CB_SWAT_Allowed","Enabled", 0)
2001 end
2002 else do
2003 ok = VRSet("EF_Password","BackColor", "<default>")
2004 ok = VRSet("EF_Password_Repeat","BackColor", "<default>")
2005 ok = VRSet("EF_Password","Enabled", 1)
2006 ok = VRSet("EF_Password_Repeat","Enabled", 1)
2007 ok = VRSet("CB_Must_Change_Password","Enabled", 1)
2008 ok = VRSet("CB_Cannot_change_password","Enabled", 1)
2009 ok = VRSet("CB_Password_doesnt_expire","Enabled", 1)
2010 ok = VRSet("CB_SWAT_Allowed","Enabled", 1)
2011 end
2012return
2013
2014/*:VRX CB_Password_doesnt_expire_Click
2015*/
2016CB_Password_doesnt_expire_Click:
2017 SecondStage = (SecondStage | VRGet("CB_Password_doesnt_expire","set"))
2018return
2019
2020/*:VRX CB_SmbGroupsOnly_Click
2021*/
2022CB_SmbGroupsOnly_Click:
2023 settings.!SmbGroupsOnly = VRGet("CB_SmbGroupsOnly","Set")
2024 call _ContGroupsPopulate
2025return
2026
2027/*:VRX CB_SmbOnly_Click
2028*/
2029CB_SmbOnly_Click:
2030 settings.!SmbOnly = VRGet("CB_SmbOnly","Set")
2031 call _ContUsersPopulate
2032return
2033
2034/*:VRX CB_SWAT_Allowed_Click
2035*/
2036CB_SWAT_Allowed_Click:
2037 call CB_MachineAccount_Click
2038return
2039
2040/*:VRX CB_SyncFullName_Click
2041*/
2042CB_SyncFullName_Click:
2043 settings.!SyncFullName = VRGet("CB_SyncFullName","set")
2044return
2045
2046/*:VRX CB_SyncPrimGID_Click
2047*/
2048CB_SyncPrimGID_Click:
2049 settings.!SyncPrimGID = VRGet("CB_SyncPrimGID","set")
2050return
2051
2052/*:VRX CB_UnixGroupOnly_Click
2053*/
2054CB_UnixGroupOnly_Click:
2055 UnixGroupOnly = VRGet("CB_UnixGroupOnly","set")
2056 ok = VRSet("EF_Comment","Enabled", \VRget("CB_UnixGroupOnly","Set"))
2057 if \VRget("CB_UnixGroupOnly","Set") then ok = VRSet("EF_Comment","BackColor","<default>")
2058 else ok = VRSet("EF_Comment","BackColor","PaleGray")
2059return
2060
2061/*:VRX CB_UnixUserOnly_Click
2062*/
2063CB_UnixUserOnly_Click:
2064 if VRGet("CB_UnixUserOnly","set") then do
2065 ok = VRSet("CB_NoPassword","set",1)
2066 call CB_NoPassword_Click
2067 ok = VRSet("EF_Description", "BackColor", "PaleGray")
2068 ok = VRSet("EF_Description", "Enabled", 0)
2069 end
2070 else do
2071 ok = VRSet("EF_Description", "BackColor", "<default>")
2072 ok = VRSet("EF_Description", "Enabled", 1)
2073 ok = VRSet("CB_NoPassword","set",0)
2074 call CB_NoPassword_Click
2075 end
2076return
2077
2078/*:VRX CB_upCannot_change_password_Click
2079*/
2080CB_upCannot_change_password_Click:
2081
2082return
2083
2084/*:VRX CB_upDeactivated_Click
2085*/
2086CB_upDeactivated_Click:
2087 CurFlags = _SetFlag(CurFlags, VRGet("CB_upDeactivated","set"), 'D')
2088return
2089
2090/*:VRX CB_upMust_change_password_Click
2091*/
2092CB_upMust_change_password_Click:
2093
2094return
2095
2096/*:VRX CB_upNoPassword_Click
2097*/
2098CB_upNoPassword_Click:
2099 CurFlags = _SetFlag(CurFlags, VRGet("CB_upNoPassword","set"), 'N')
2100 if VRGet("CB_upNoPassword","set") then do
2101 ok = VRSet("EF_upPassword","value","")
2102 ok = VRSet("EF_upPassword_Repeat","value","")
2103 ok = VRSet("DT_upPassword","Enabled",0)
2104 ok = VRSet("DT_upPassword_Repeat","Enabled",0)
2105 ok = VRSet("EF_upPassword","Enabled",0)
2106 ok = VRSet("EF_upPassword_Repeat","Enabled",0)
2107 ok = VRSet("EF_upPassword","BackColor", "PaleGray")
2108 ok = VRSet("EF_upPassword_Repeat","BackColor", "PaleGray")
2109 end
2110 else do
2111 ok = VRSet("DT_upPassword","Enabled",1)
2112 ok = VRSet("DT_upPassword_Repeat","Enabled",1)
2113 ok = VRSet("EF_upPassword","Enabled",1)
2114 ok = VRSet("EF_upPassword_Repeat","Enabled",1)
2115 ok = VRSet("EF_upPassword","BackColor", "<default>")
2116 ok = VRSet("EF_upPassword_Repeat","BackColor", "<default>")
2117 end
2118return
2119
2120/*:VRX CB_upPassword_doesnt_expire_Click
2121*/
2122CB_upPassword_doesnt_expire_Click:
2123 CurFlags = _SetFlag(CurFlags, VRGet("CB_upPassword_doesnt_expire","set"), 'X')
2124return
2125
2126/*:VRX CB_upSWAT_Allowed_Click
2127*/
2128CB_upSWAT_Allowed_Click:
2129 swatchanged = 1
2130return
2131
2132/*:VRX CB_WriteMasterPwd_Click
2133*/
2134CB_WriteMasterPwd_Click:
2135 settings.!WriteMasterPwd = VRGet("CB_WriteMasterPwd","set")
2136return
2137
2138/*:VRX CN_Groups_ContextMenu
2139*/
2140CN_Groups_ContextMenu:
2141 if VRInfo("Top") < 446 & VRGet("CN_Groups", "View") = "Detail" then call _ColumnsMenu "CN_Groups"
2142 else ok = VRMethod( "Contextmenu_Group", "Popup", , , "", "PositionOnItem" )
2143return
2144
2145/*:VRX CN_Groups_DoubleClick
2146*/
2147CN_Groups_DoubleClick:
2148 call Contextmenu_GroupMembers_Click
2149return
2150
2151/*:VRX CN_Groups_EndEdit
2152*/
2153CN_Groups_EndEdit:
2154call beep 880, 20
2155 GRH = VRInfo("Record")
2156
2157 /* write back all editable field to the stems */
2158 call _GroupRecWritebackToStems
2159
2160return
2161
2162/*:VRX CN_UserProperties_BeginEdit
2163*/
2164CN_UserProperties_BeginEdit:
2165 drop NewupValue
2166 drop OldupValue
2167 upRH = VRInfo("Record")
2168 OldupValue = VRMethod("CN_UserProperties","GetFieldData", upRH, upValueFH)
2169 say OldupValue
2170return
2171
2172/*:VRX CN_UserProperties_EndEdit
2173*/
2174CN_UserProperties_EndEdit:
2175 upRH = VRInfo("Record")
2176 NewupValue = VRMethod("CN_UserProperties","GetFieldData", upRH, upValueFH)
2177 say NewupValue
2178 if OldUpValue <> NewupValue then do
2179 newcommand = newcommand||' 'VRMethod("CN_UserProperties","GetFieldData", upRH,upCommandFH)||'"'NewupValue'"'
2180 say "New command: "newcommand
2181 end
2182return
2183
2184/*:VRX CN_Users_Click
2185*/
2186CN_Users_Click:
2187 if VRInfo("Top") < 1325 & VRGet("CN_Users", "View") = "Detail" then return
2188return
2189
2190/*:VRX CN_Users_ContextMenu
2191*/
2192CN_Users_ContextMenu:
2193 say VRInfo("top")
2194 if VRInfo("Top") < 446 & VRGet("CN_Users", "View") = "Detail" then call _ColumnsMenu "CN_users"
2195 else do
2196 RH = VRInfo("Record")
2197 if RH <> "" then do
2198 CurFlags = VRMethod("CN_Users","GetFieldData", RH, FlagsFH)
2199 ok = VRset("Contextmenu_UserProperties", "Enabled", (CurFlags <> ""))
2200 ok = VRMethod( "Contextmenu_user", "Popup", , , "", "PositionOnItem" )
2201 end
2202 end
2203return
2204
2205/*:VRX CN_Users_DoubleClick
2206*/
2207CN_Users_DoubleClick:
2208 IF options.!debug == 1 THEN say time()' CN_Users_DoubleClick() started'
2209 if VRInfo("Top") < 340 & VRGet("CN_Users", "View") = "Detail" then return
2210 IF options.!debug == 1 THEN say time()' CN_Users_DoubleClick() entered'
2211 RH = VRInfo("Record")
2212 CurUserNr = VRMethod("CN_Users","GetFieldData", RH, NrFH)
2213 CurFlags = VRMethod("CN_Users","GetFieldData", RH, FlagsFH)
2214 if CurFlags <> "" then window = VRLoadSecondary( "UserProperties", "W" )
2215 IF options.!debug == 1 THEN say time()' CN_Users_DoubleClick() done'
2216return
2217
2218/*:VRX CN_Users_EndEdit
2219*/
2220CN_Users_EndEdit:
2221 if VRInfo("Top") < 340 & VRGet("CN_Users", "View") = "Detail" then do
2222 say VRInfo("Object")
2223 return
2224 end
2225 call beep 880, 20
2226 RH = VRInfo("Record")
2227 say "RH="RH
2228
2229 /* write back all editable field to the stems */
2230 call _UserRecWritebackToStems
2231return
2232
2233/*:VRX Columns_01_Click
2234*/
2235Columns_01_Click:
2236 call _ColumnShow
2237return
2238
2239/*:VRX Columns_02_Click
2240*/
2241Columns_02_Click:
2242 call _ColumnShow
2243return
2244
2245/*:VRX Columns_03_Click
2246*/
2247Columns_03_Click:
2248 call _ColumnShow
2249return
2250
2251/*:VRX Columns_04_Click
2252*/
2253Columns_04_Click:
2254 call _ColumnShow
2255return
2256
2257/*:VRX Columns_05_Click
2258*/
2259Columns_05_Click:
2260 call _ColumnShow
2261return
2262
2263/*:VRX Columns_06_Click
2264*/
2265Columns_06_Click:
2266 call _ColumnShow
2267return
2268
2269/*:VRX Columns_07_Click
2270*/
2271Columns_07_Click:
2272 call _ColumnShow
2273return
2274
2275/*:VRX Columns_08_Click
2276*/
2277Columns_08_Click:
2278 call _ColumnShow
2279return
2280
2281/*:VRX Columns_09_Click
2282*/
2283Columns_09_Click:
2284 call _ColumnShow
2285return
2286
2287/*:VRX Columns_10_Click
2288*/
2289Columns_10_Click:
2290 call _ColumnShow
2291return
2292
2293/*:VRX Columns_11_Click
2294*/
2295Columns_11_Click:
2296 call _ColumnShow
2297return
2298
2299/*:VRX Columns_12_Click
2300*/
2301Columns_12_Click:
2302 call _ColumnShow
2303return
2304
2305/*:VRX Columns_13_Click
2306*/
2307Columns_13_Click:
2308 call _ColumnShow
2309return
2310
2311/*:VRX Columns_14_Click
2312*/
2313Columns_14_Click:
2314 call _ColumnShow
2315return
2316
2317/*:VRX Columns_15_Click
2318*/
2319Columns_15_Click:
2320 call _ColumnShow
2321return
2322
2323/*:VRX Columns_16_Click
2324*/
2325Columns_16_Click:
2326 call _ColumnShow
2327return
2328
2329/*:VRX Columns_17_Click
2330*/
2331Columns_17_Click:
2332 call _ColumnShow
2333return
2334
2335/*:VRX Contextmenu_GroupAdd_Click
2336*/
2337Contextmenu_GroupAdd_Click:
2338 window = VRLoadSecondary( "AddGroup", "W" )
2339return
2340
2341/*:VRX Contextmenu_GroupDel_Click
2342*/
2343Contextmenu_GroupDel_Click:
2344 ok = VRMethod( "CN_Groups", "GetRecordList", "Selected", "SelGRH." )
2345 if SelGRH.0 = 0 then return
2346 SelGNr = VRMethod("CN_Groups", "GetFieldData", SelGRH.1, GNrFH)
2347 IF options.!debug == 1 THEN say ' Selected group number = 'SelGNr
2348 Msg.Title = NLVGetMessage(75)
2349 Msg.Type = "Q"
2350 Msg.Text = NLVGetMessage(76,Groupname.SelGNr,NTGroupname.SelGNr,GGID.SelGNr)
2351 ok = _MsgYesNo()
2352 if ok = 1 then do
2353 if RID.SelGNr <> "" then do
2354 say samba.!netexe' rpc group delete "'NTGroupname.SelGNr'" 'UserCred
2355 address cmd samba.!netexe' rpc group delete "'NTGroupname.SelGNr'" 'UserCred' 2>'samba.!error' 1>'samba.!msg
2356 if RC <> 0 then do
2357 call _SambaShowError
2358 return
2359 end
2360 else call _SambaShowMsg
2361 end
2362 do I = 1 to Username.0
2363 if GID.I = GGID.SelGNr then do
2364 GID.I = UID.I
2365 ok = VRMethod("CN_users","SetFieldData", RH.I, GIDFH, GID.I)
2366 end
2367 end
2368 ok = SysStemDelete("groupname.", SelGNr)
2369 ok = SysStemDelete("gpasswd.", SelGNr)
2370 ok = SysStemDelete("ggid.", SelGNr)
2371 ok = SysStemDelete("gusers.", SelGNr)
2372 ok = SysStemDelete("NTGroupname.",SelGNr)
2373 ok = SysStemDelete("RID.", SelGNr)
2374 ok = SysStemDelete("Gstatus.", SelGNr)
2375 ok = VRMethod("CN_Groups", "RemoveRecord", SelGRH.1)
2376 call PB_Save_Click
2377 call PB_Refresh_Click
2378 end
2379return
2380
2381/*:VRX Contextmenu_GroupDetailView_Click
2382*/
2383Contextmenu_GroupDetailView_Click:
2384 ok = VRSet("CN_Groups", "View", "Detail")
2385return
2386
2387/*:VRX Contextmenu_GroupMap_Click
2388*/
2389Contextmenu_GroupMap_Click:
2390 ok = VRMethod( "CN_Groups", "GetRecordList", "Selected", "SelGRH." )
2391 if SelGRH.0 = 0 then return
2392 SelGNr = VRMethod("CN_Groups", "GetFieldData", SelGRH.1, GNrFH)
2393 IF options.!debug == 1 THEN say ' Selected group number = ' SelGNr
2394 if RID.SelGnr <> "" then do
2395 Msg.Type = "E"
2396 Msg.Title = NLVGetMessage(91)
2397 Msg.Text = NLVGetMessage(114,Groupname.SelGNr)
2398 call _showMsg
2399 return
2400 end
2401 window = VRLoadSecondary( "MapGroup", "W" )
2402return
2403
2404/*:VRX Contextmenu_GroupMembers_Click
2405*/
2406Contextmenu_GroupMembers_Click:
2407 ok = VRMethod( "CN_Groups", "GetRecordList", "Selected", "SelGRH." )
2408 if SelGRH.0 = 0 then return
2409 SelGNr = VRMethod("CN_Groups", "GetFieldData", SelGRH.1, GNrFH)
2410 IF options.!debug == 1 THEN say ' Selected group number = 'SelGNr
2411 CurNTGroupName = NTGroupname.SelGNr
2412 window = VRLoadSecondary( "Group_Members", "W" )
2413return
2414
2415/*:VRX Contextmenu_GroupRebuildScript_Click
2416*/
2417Contextmenu_GroupRebuildScript_Click:
2418 RebuildScript = VRFileDialog( VRWindow(), NLVGetMessage( 99 ), "Save", samba.!bin"\RebuildGroups.CMD", , , )
2419 if RebuildScript = "" then return
2420 ok = SysFileDelete(RebuildScript)
2421 call lineout RebuildScript,'@echo off'
2422 call lineout RebuildScript, 'rem Created by SmbUsers 'VRGet("Main","Hinttext")
2423 do I = 1 to groupname.0
2424 if RID.I <> "" then do
2425 select
2426 when left(translate(NTGroupType.I),4) = "WELL" then Gtype = 'builtin'
2427 when left(translate(NTGroupType.I),4) = "LOCA" then Gtype = 'local'
2428 otherwise Gtype = 'domain'
2429 end
2430 call lineout RebuildScript, 'net groupmap add rid='RID.I' ntgroup="'NTGroupName.I'" unixgroup="'Groupname.I'" type='GType' comment="'NTComment.I'"'
2431 end
2432 end
2433 call lineout RebuildScript, 'echo Done.'
2434 Msg.Title = NLVGetMessage( 98 )
2435 Msg.Type = "I"
2436 Msg.Text = NLVGetMessage( 108, RebuildScript )
2437 call _ShowMsg
2438return
2439
2440/*:VRX Contextmenu_GroupSymbolView_Click
2441*/
2442Contextmenu_GroupSymbolView_Click:
2443 ok = VRSet("CN_Groups", "View", "Icon")
2444return
2445
2446/*:VRX Contextmenu_GroupUnmap_Click
2447*/
2448Contextmenu_GroupUnmap_Click:
2449 ok = VRMethod( "CN_Groups", "GetRecordList", "Selected", "SelGRH." )
2450 if SelGRH.0 = 0 then return
2451 SelGNr = VRMethod("CN_Groups", "GetFieldData", SelGRH.1, GNrFH)
2452 IF options.!debug == 1 THEN say ' Selected group number = 'SelGNr
2453 if RID.SelGnr = "" then do
2454 Msg.Type = "E"
2455 Msg.Title = NLVGetMessage( 95 )
2456 Msg.Text = NLVGetMessage(96, Groupname.SelGNr )
2457 call _showMsg
2458 return
2459 end
2460 Msg.Type = "E"
2461 Msg.Title = NLVGetMessage( 95 )
2462 Msg.Text = NLVGetMessage( 97, NTGroupname.SelGNr, GroupName.SelGNr )
2463 ok = _MsgYesNo()
2464 if ok = 1 then do
2465 blGusers = translate(Gusers.SelGnr,' ',',')
2466 do I = 1 to words(blGusers)
2467 address cmd samba.!netexe' rpc group delmem "'NTGroupname.SelGNr'" 'word(BlGusers,I)' 'UserCred' 2>'samba.!error' 1>'samba.!msg
2468 if RC <> 0 then call _SambaShowError
2469 else call _SambaShowMsg
2470 say samba.!netexe' RC = 'RC
2471 end
2472 say samba.!netexe' groupmap delete ntgroup="'NTGroupname.SelGNr'" 'debuglevel
2473 address cmd samba.!netexe' groupmap delete ntgroup="'NTGroupname.SelGNr'" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2474 if RC <> 0 then call _SambaShowError
2475 else call _SambaShowMsg
2476 call PB_Refresh_Click
2477 end
2478return
2479
2480/*:VRX Contextmenu_GroupWellKnown_Click
2481*/
2482Contextmenu_GroupWellKnown_Click:
2483 if Groupname.0 <> 0 then do
2484 Msg.Title = NLVGetMessage( 92 )
2485 Msg.Text = NLVGetMessage( 93 )
2486 Msg.Type = "W"
2487 call _ShowMsg
2488 return
2489 end
2490 call _kLIBCGroupADD "admin", 512
2491 call _kLIBCGroupADD "users", 513
2492 call _kLIBCGroupADD "guests", 514
2493 call _kLIBCGroupADD "machines", 515
2494 call _kLIBCGroupADD "dc", 516
2495 call _kLIBCGroupADD "certadmin", 517
2496 call _kLIBCGroupADD "schemeadmin", 518
2497 call _kLIBCGroupADD "entadmin", 519
2498 call _kLIBCGroupADD "poladmin", 520
2499 call PB_Save_Click
2500
2501 address cmd samba.!netexe' groupmap add rid=512 ntgroup="Domain Admins" unixgroup="admin" type=domain comment="Domain Administrators" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2502 if RC <> 0 then call _SambaShowError
2503
2504 address cmd samba.!netexe' groupmap add rid=513 ntgroup="Domain Users" unixgroup="users" type=domain comment="Domain Users" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2505 if RC <> 0 then call _SambaShowError
2506
2507 address cmd samba.!netexe' groupmap add rid=514 ntgroup="Domain Guests" unixgroup="guests" type=domain comment="Domain Guest Accounts" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2508 if RC <> 0 then call _SambaShowError
2509
2510 address cmd samba.!netexe' groupmap add rid=515 ntgroup="Domain Computers" unixgroup="machines" type=domain comment="Domain Computers" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2511 if RC <> 0 then call _SambaShowError
2512
2513 address cmd samba.!netexe' groupmap add rid=516 ntgroup="Domain Controllers" unixgroup="dc" type=domain comment="Domain Controllers" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2514 if RC <> 0 then call _SambaShowError
2515
2516 address cmd samba.!netexe' groupmap add rid=517 ntgroup="Domain Certificate Admins" unixgroup="certadmin" type=domain comment="Domain Certificate Administrators" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2517 if RC <> 0 then call _SambaShowError
2518
2519 address cmd samba.!netexe' groupmap add rid=518 ntgroup="Domain Scheme Admins" unixgroup="schemeadmin" type=domain comment="Domain Scheme Administrators" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2520 if RC <> 0 then call _SambaShowError
2521
2522 address cmd samba.!netexe' groupmap add rid=519 ntgroup="Domain Enterprise Admins" unixgroup="entadmin" type=domain comment="Domain Enterprise Administrators" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2523 if RC <> 0 then call _SambaShowError
2524
2525 address cmd samba.!netexe' groupmap add rid=520 ntgroup="Domain Policy Admins" unixgroup="poladmin" type=domain comment="Domain Policy Administrators" 'debuglevel' 2>'samba.!error' 1>'samba.!msg
2526 if RC <> 0 then call _SambaShowError
2527
2528 Msg.Title = NLVGetMessage( 92 )
2529 Msg.Type = "I"
2530 Msg.Text = NLVGetMessage( 94 )
2531 call _ShowMsg
2532 call PB_Refresh_Click
2533return
2534
2535/*:VRX Contextmenu_UserAdd_Click
2536*/
2537Contextmenu_UserAdd_Click:
2538 IF options.!debug == 1 THEN say time()' Contextmenu_UserAdd_Click() started'
2539 ok = VRMethod( "CN_Users", "GetRecordList", "Selected", "SelRH." )
2540 if SelRH.0 = 0 then do
2541 IF options.!debug == 1 THEN say time()' Contextmenu_UserAdd_Click() done, aborted'
2542 return
2543 end
2544 SelNr = VRMethod("CN_Users", "GetFieldData", SelRH.1, NrFH)
2545/* IF options.!debug == 1 THEN say ' Flags.SelNr = "'flags.SelNr'"' */
2546 if flags.SelNr = "" then IsUnixUser = 1
2547 else IsUnixUser = 0
2548 IF options.!debug == 1 THEN say ' Selected user number = 'SelNr
2549 IF options.!debug == 1 THEN say ' Is it kLIBC user only? 'IsUnixUser
2550 window = VRLoadSecondary( "AddUser", "W" )
2551 IF options.!debug == 1 THEN say time()' Contextmenu_UserAdd_Click() done'
2552return
2553
2554/*:VRX Contextmenu_UserDel_Click
2555*/
2556Contextmenu_UserDel_Click:
2557 IF options.!debug == 1 THEN say time()' Contextmenu_UserDel_Click() started'
2558 ok = VRMethod( "CN_Users", "GetRecordList", "Selected", "SelRH." )
2559 if SelRH.0 = 0 then return
2560 IF options.!debug == 1 THEN say time()' Contextmenu_UserDel_Click() entered'
2561 SelNr = VRMethod("CN_Users", "GetFieldData", SelRH.1, NrFH)
2562 IF options.!debug == 1 THEN say ' Selected user number = 'SelNr
2563 Msg.Title = NLVGetMessage(50)
2564 Msg.Text = NLVGetMessage(51, '"'Username.SelNr'" (UID: 'UID.SelNr')')
2565 ok = _MsgYesNo()
2566 if ok = 1 then do
2567 if flags.SelNr <> "" then do
2568 say ' 'samba.!netexe' rpc user delete "'Username.SelNr'" 'UserCred' 'Debuglevel' 2>'samba.!error' 1>'samba.!msg
2569 address cmd samba.!netexe' rpc user delete "'Username.SelNr'" 'UserCred' 'Debuglevel' 2>'samba.!error' 1>'samba.!msg
2570 if rc <> 0 then call _SambaShowError; else call _SambaShowMsg
2571 if swatauth then do
2572 say ' 'samba.!htpasswdexe' -D "'swatusers'" 'Username.SelNr
2573 address cmd samba.!htpasswdexe' -D "'swatusers'" 'Username.SelNr' 2>'samba.!error' 1>'samba.!msg
2574 if rc <> 0 then call _SambaShowError
2575 else call _SambaShowMsg
2576 end
2577 end
2578 else do /* kLIBC user only */
2579 ExUserName = Username.SelNr
2580 ExUID = UID.SelNr
2581 ExGID = GID.SelNr
2582 ok = SysStemDelete("username.",SelNr)
2583 ok = SysStemDelete("password.",SelNr)
2584 ok = SysStemDelete("uid.",SelNr)
2585 ok = SysStemDelete("gid.",SelNr)
2586 ok = SysStemDelete("loginclass.",SelNr)
2587 ok = SysStemDelete("pwchange.",SelNr)
2588 ok = SysStemDelete("deact.",SelNr)
2589 ok = SysStemDelete("gecos.",SelNr)
2590 ok = SysStemDelete("home.",SelNr)
2591 ok = SysStemDelete("shell.",SelNr)
2592 ok = SysStemDelete("status.",SelNr)
2593 ok = SysStemDelete("lmhash.",SelNr)
2594 ok = SysStemDelete("nthash.",SelNr)
2595 ok = SysStemDelete("flags.",SelNr)
2596 ok = SysStemDelete("lct.",SelNr)
2597 do I = 1 to gusers.0
2598 blGUsers = translate(Gusers.I,' ',',')
2599 UPos = wordpos(translate(ExUserName),translate(blGusers))
2600 if Upos > 0 then do
2601 blGUsers = delword(BlGusers,UPos,1)
2602 Gusers.I = translate(blGusers,',',' ')
2603 end
2604 end
2605 call PB_Save_Click
2606 Msg.Title = NLVGetMessage(50)
2607 Msg.Text = NLVGetMessage(53, '"'ExUsername'"' )
2608 Msg.Type = 'I'
2609 call _ShowMsg
2610 end
2611 call PB_Refresh_Click
2612 end
2613 IF options.!debug == 1 THEN say time()' Contextmenu_UserDel_Click() done'
2614return
2615
2616/*:VRX Contextmenu_UserDetailView_Click
2617*/
2618Contextmenu_UserDetailView_Click:
2619 ok = VRSet("CN_users", "View", "Detail")
2620return
2621
2622/*:VRX Contextmenu_UserJoinGroup_Click
2623*/
2624Contextmenu_UserJoinGroup_Click:
2625 ok = VRMethod( "CN_Users", "GetRecordList", "Selected", "SelRH." )
2626 if SelRH.0 = 0 then return
2627 SelNr = VRMethod("CN_Users", "GetFieldData", SelRH.1, NrFH)
2628 IF options.!debug == 1 THEN say ' Selected user number = 'SelNr
2629 window = VRLoadSecondary( "Join_Group", "W" )
2630return
2631
2632/*:VRX Contextmenu_UserLeaveGroup_Click
2633*/
2634Contextmenu_UserLeaveGroup_Click:
2635 ok = VRMethod( "CN_Users", "GetRecordList", "Selected", "SelRH." )
2636 if SelRH.0 = 0 then return
2637 SelNr = VRMethod("CN_Users", "GetFieldData", SelRH.1, NrFH)
2638 IF options.!debug == 1 THEN say ' Selected user number = 'SelNr
2639 window = VRLoadSecondary( "Leave_Group", "W" )
2640return
2641
2642/*:VRX Contextmenu_UserProperties_Click
2643*/
2644Contextmenu_UserProperties_Click:
2645 ok = VRMethod( "CN_Users", "GetRecordList", "Selected", "Selected." )
2646 if Selected.0 = 0 then return
2647 RH = Selected.1
2648 CurUserNr = VRMethod("CN_Users","GetFieldData", RH, NrFH)
2649 CurFlags = VRMethod("CN_Users","GetFieldData", RH, FlagsFH)
2650 if CurFlags <> "" then window = VRLoadSecondary( "UserProperties", "W" )
2651return
2652
2653/*:VRX Contextmenu_UserSymbolView_Click
2654*/
2655Contextmenu_UserSymbolView_Click:
2656 ok = VRSet("CN_users", "View", "Icon")
2657return
2658
2659/*:VRX DDCB_GID_Change
2660*/
2661DDCB_GID_Change:
2662 ok = VRSet("DT_PrimaryGroupName","Caption","UID")
2663 if VRGet("DDCB_GID","Value") = NextUID then return
2664 do x = 1 to groupname.0
2665 if VRGet("DDCB_GID","Value") = GGID.x then do
2666 ok = VRSet("DT_PrimaryGroupName","Caption",groupname.x' ('NTGroupName.x')')
2667 leave
2668 end
2669 end
2670return
2671
2672/*:VRX DDCB_Policy_Change
2673*/
2674DDCB_Policy_Change:
2675 IF options.!debug == 1 THEN say time()' DDCB_Policy_Change started'
2676
2677 PolValue = _PolicyGet(VRGet("DDCB_Policy","Value"))
2678
2679 ok = VRset("EF_PolValue","Value",strip(PolValue))
2680 ok = VRSet("GB_Policy","HintText",strip(PolDesc)) /* _PolicyGet sets this one */
2681 IF options.!debug == 1 THEN say time()' DDCB_Policy_Change done'
2682return
2683
2684/*:VRX EF_Comment_Change
2685*/
2686EF_Comment_Change:
2687 if pos(':',VRGet("EF_GroupName","Value")) > 0 then ok = VRset("EF_Groupname","Value",translate(VRGet("EF_GroupName","Value"),'-',':'))
2688return
2689
2690/*:VRX EF_Description_Change
2691*/
2692EF_Description_Change:
2693 if VRGet("EF_Description","value") <> "" then do
2694 SecondStage = 1
2695 end
2696 else SecondStage = (SecondStage | 0)
2697return
2698
2699/*:VRX EF_GGID_Change
2700*/
2701EF_GGID_Change:
2702 if VRGet("EF_GGID","Value") <> "" then do
2703 if datatype(VRGet("EF_GGID","Value")) <> "NUM" then ok = VRSet("EF_GGID","Value","")
2704 end
2705return
2706
2707/*:VRX EF_Groupname_Change
2708*/
2709EF_Groupname_Change:
2710 if pos(':',VRGet("EF_GroupName","Value")) > 0 then ok = VRset("EF_Groupname","Value",translate(VRGet("EF_GroupName","Value"),'-',':'))
2711return
2712
2713/*:VRX EF_Home_Change
2714*/
2715EF_Home_Change:
2716 if pos('NONEXISTENT', translate(VRGet("EF_Home", "Value"))) > 0 then do
2717 ok = VRset("PB_CreateHome","Enabled",0)
2718 return
2719 end
2720
2721 if \VRFileExists( VRGet("EF_Home", "Value") ) then do
2722 ok = VRSet("EF_Home","ForeColor", "Red")
2723 ok = VRset("PB_CreateHome","Enabled",\VRGet("CB_NoHome","set"))
2724 end
2725 else do
2726 ok = VRSet("EF_Home","ForeColor", "<default>")
2727 ok = VRset("PB_CreateHome","Enabled",0)
2728 end
2729return
2730
2731/*:VRX EF_LoginPassword_KeyPress
2732*/
2733EF_LoginPassword_KeyPress:
2734 obj = VRInfo( "Object" )
2735 keystr = VRGet( obj, "KeyString" )
2736/* say keystr */
2737 select
2738 when keystr = "{Enter}" then call PB_LOGIN_OK_Click
2739 when keystr = "{Newline}" then call PB_LOGIN_OK_Click
2740 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2741 otherwise nop
2742 end
2743return
2744
2745/*:VRX EF_LoginUser_KeyPress
2746*/
2747EF_LoginUser_KeyPress:
2748 obj = VRInfo( "Object" )
2749 keystr = VRGet( obj, "KeyString" )
2750/* say keystr */
2751 select
2752 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
2753 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
2754 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2755 otherwise nop
2756 end
2757return
2758
2759/*:VRX EF_upPassword_Change
2760*/
2761EF_upPassword_Change:
2762 ok = VRSet("CB_upSWAT_Allowed","Enabled",1)
2763return
2764
2765/*:VRX EF_Username_Change
2766*/
2767EF_Username_Change:
2768 IF options.!debug == 1 THEN say time()' EF_Username_Change started'
2769 if pos(':',VRGet("EF_Username","Value")) > 0 then ok = VRset("EF_Username","Value",translate(VRGet("EF_Username","Value"),'-',':'))
2770 ok = VRSet("EF_Home","Value", Samba.!homes'\'VRGet("EF_Username","Value"))
2771 call CB_MachineAccount_Click
2772 if VRGet("EF_Username","Value") = "" then do
2773 if IsUnixUser then do
2774 IsUnixuser = 0
2775 drop UnixUserNr
2776 ok = VRSet( "DT_UID", "BackColor", "<default>")
2777 ok = VRSet( "DT_UID", "ForeColor", "<default>")
2778 NextUID = _GetNextUID(VRGet("EF_Username","value"))
2779 IsUnixUser = 0
2780 ok = VRSet("DT_UID","Caption", "UID: "NextUID)
2781 ok = VRSet("DDCB_GID","Value", NextUID)
2782 ok = VRMethod( "DDCB_GID", "Reset")
2783 ok = VRMethod( "DDCB_GID", "AddString", NextUID)
2784 ok = VRMethod( "DDCB_GID", "AddStringList", "GGID.")
2785 ok = VRSet("EF_GECOS","Value","")
2786 ok = VRSet("EF_Home","Value","")
2787 end
2788 end
2789 else do
2790 NextUID = _GetNextUID(VRGet("EF_Username","value"))
2791 ok = VRSet("DT_UID","Caption", "UID: "NextUID)
2792 if NextUID > 65000 then do
2793 ok = VRset("EF_Description","Value",NLVGetMessage(116))
2794 ok = VRset("CB_NoPassword","set", 1)
2795 call CB_NoPassword_Click
2796 ok = VRset("DDCB_GID","value",NextUID)
2797 ok = VRMethod("DDCB_GID","addString", NextUID)
2798 end
2799 else ok = VRset("DDCB_GID","value","513")
2800 end
2801 IF options.!debug == 1 THEN say time()' EF_Username_Change done'
2802return
2803
2804/*:VRX EF_Username_LostFocus
2805*/
2806EF_Username_LostFocus:
2807 do I = 1 to Username.0
2808 if translate(Username.I) = translate(VRGet("EF_username","value")) then do
2809 if flags.I = "" then do
2810 IsUnixuser = 1
2811 UnixUserNr = I
2812 ok = VRSet( "DT_UID", "BackColor", "DarkGreen")
2813 ok = VRSet( "DT_UID", "ForeColor", "White")
2814 ok = VRSet( "DT_UID", "Caption", "UID: "UID.I)
2815 ok = VRSet( "EF_GECOS","Value", GECOS.I)
2816 ok = VRSet( "DDCB_GID","Value", GID.I)
2817 ok = VRMethod( "DDCB_GID", "Reset")
2818 ok = VRMethod( "DDCB_GID", "AddString", UID.I)
2819 ok = VRMethod( "DDCB_GID", "AddStringList", "GGID.")
2820 ok = VRSet( "EF_Home","Value", _PathStrOS2(Home.I))
2821 end
2822 else do
2823 Msg.Type = "E"
2824 Msg.Text = NLVGetMessage( 105)
2825 call _ShowMsg
2826 ok = VRSet("EF_username","value","")
2827 ok = VRMethod("EF_username","SetFocus")
2828 end
2829 leave
2830 end
2831 end
2832return
2833
2834/*:VRX Fini
2835*/
2836Fini:
2837 window = VRWindow()
2838 call VRSet window, "Visible", 0
2839 drop window
2840return 0
2841
2842/*:VRX GetBootDrive
2843*/
2844GetBootDrive:
2845/* Use SysBootDrive if possible */
2846If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
2847 Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
2848Else
2849 Return SysBootDrive()
2850
2851
2852/*:VRX Group_Members_Close
2853*/
2854Group_Members_Close:
2855 call Group_Members_Fini
2856return
2857
2858/*:VRX Group_Members_Create
2859*/
2860Group_Members_Create:
2861 call Group_Members_Init
2862 ok = VRSet("Group_Members","Caption", NLVGetMessage(89)||' "'CurNTGroupName'"')
2863 CALL NLVSetText 'PB_GroupMembersOK', 'Caption', 2
2864
2865 ok = VRMethod("LB_GroupMembers","Reset")
2866 ok = VRSet("Main", 'Pointer', 'Wait' )
2867 say samba.!netexe' rpc group members "'CurNTGroupName'" 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
2868 address cmd samba.!netexe' rpc group members "'CurNTGroupName'" 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
2869 if RC <> 0 then call _SambaShowError
2870 else do
2871 do while lines(samba.!msg) <> 0
2872 groupmember = linein(samba.!msg)
2873 say groupmember
2874 ok = VRMethod("LB_GroupMembers","AddString", groupmember)
2875 end
2876 ok = stream(Samba.!msg,"c","close")
2877 end
2878 ok = VRSet("Main", 'Pointer', '<default>' )
2879return
2880
2881/*:VRX Group_Members_Fini
2882*/
2883Group_Members_Fini:
2884 window = VRInfo( "Window" )
2885 call VRDestroy window
2886 drop window
2887return
2888/*:VRX Group_Members_Init
2889*/
2890Group_Members_Init:
2891 window = VRInfo( "Object" )
2892 if( \VRIsChildOf( window, "Notebook" ) ) then do
2893 call VRMethod window, "CenterWindow"
2894 call VRSet window, "Visible", 1
2895 call VRMethod window, "Activate"
2896 end
2897 drop window
2898return
2899
2900/*:VRX Halt
2901*/
2902Halt:
2903 signal _VREHalt
2904return
2905
2906/*:VRX Init
2907*/
2908Init:
2909 window = VRWindow()
2910 call VRMethod window, "CenterWindow"
2911 call VRSet window, "Visible", 0
2912 call VRMethod window, "Activate"
2913 drop window
2914return
2915
2916/*:VRX Join_Group_Close
2917*/
2918Join_Group_Close:
2919 call Join_Group_Fini
2920return
2921
2922/*:VRX Join_Group_Create
2923*/
2924Join_Group_Create:
2925 call Join_Group_Init
2926 CALL NLVSetText 'Join_Group', 'Caption', 80
2927 CALL NLVSetText 'DT_JoinGroup', 'Caption', 81
2928 CALL NLVSetText 'PB_JoinOK', 'Caption', 2
2929 CALL NLVSetText 'PB_JoinCancel', 'Caption', 3
2930
2931 call VRSet "LB_Groups", "Painting", 0
2932 ok = VRMethod("LB_Groups","AddStringList", "NTGroupName.")
2933 address cmd samba.!netexe' rpc user info 'Username.SelNr' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
2934 if RC <> 0 then call _SambaShowError
2935 else do
2936 do while lines(samba.!msg) <> 0
2937 AlreadyMember = linein(samba.!msg)
2938 ok = VRMethod( "LB_Groups", "DeleteString", AlreadyMember )
2939 if settings.!FixErrors then do
2940 do I = 1 to NTGroupName.0
2941 if AlreadyMember = NTGroupName.I then do
2942 if pos(Username.SelNr,GUsers.I) = 0 then do
2943 Gusers.I = Username.SelNr','Gusers.I
2944 ok = VRMethod("CN_Groups", "SetFieldData", GRH.I, GUsersFH, Gusers.I)
2945 call _GroupWrite
2946 end
2947 end
2948 end
2949 end
2950 end
2951 ok = stream(Samba.!msg,"c","close")
2952 end
2953 call VRSet "LB_Groups", "Painting", 1
2954return
2955
2956/*:VRX Join_Group_Fini
2957*/
2958Join_Group_Fini:
2959 window = VRInfo( "Window" )
2960 call VRDestroy window
2961 drop window
2962return
2963/*:VRX Join_Group_Init
2964*/
2965Join_Group_Init:
2966 window = VRInfo( "Object" )
2967 if( \VRIsChildOf( window, "Notebook" ) ) then do
2968 call VRMethod window, "CenterWindow"
2969 call VRSet window, "Visible", 1
2970 call VRMethod window, "Activate"
2971 end
2972 drop window
2973return
2974
2975/*:VRX Leave_Group_Close
2976*/
2977Leave_Group_Close:
2978 call Leave_Group_Fini
2979return
2980
2981/*:VRX Leave_Group_Create
2982*/
2983Leave_Group_Create:
2984 call Leave_Group_Init
2985 CALL NLVSetText 'Leave_Group', 'Caption', 85
2986 CALL NLVSetText 'DT_LeaveGroup', 'Caption', 86
2987 CALL NLVSetText 'PB_LeaveOK', 'Caption', 2
2988 CALL NLVSetText 'PB_LeaveCancel', 'Caption', 3
2989 address cmd samba.!netexe' rpc user info 'Username.SelNr' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
2990 if RC <> 0 then call _SambaShowError
2991 else do
2992 call VRSet "LB_LeaveGroups", "Painting", 0
2993 do while lines(samba.!msg) <> 0
2994 ok = VRMethod("LB_LeaveGroups","AddString", linein(samba.!msg))
2995 end
2996 ok = stream(Samba.!msg,"c","close")
2997 call VRSet "LB_LeaveGroups", "Painting", 1
2998 end
2999return
3000
3001/*:VRX Leave_Group_Fini
3002*/
3003Leave_Group_Fini:
3004 window = VRInfo( "Window" )
3005 call VRDestroy window
3006 drop window
3007return
3008/*:VRX Leave_Group_Init
3009*/
3010Leave_Group_Init:
3011 window = VRInfo( "Object" )
3012 if( \VRIsChildOf( window, "Notebook" ) ) then do
3013 call VRMethod window, "CenterWindow"
3014 call VRSet window, "Visible", 1
3015 call VRMethod window, "Activate"
3016 end
3017 drop window
3018return
3019
3020/*:VRX Main_Close
3021*/
3022Main_Close:
3023 call Quit
3024return
3025
3026/*:VRX Main_Create
3027*/
3028Main_Create:
3029 options.!debug = 0
3030 ok = VRSet("Main", 'Pointer', 'Wait' )
3031 if options.!Debug then ok = VRREdirectStdIO("ON")
3032 else ok = VRREdirectStdIO("OFF")
3033
3034 /* Default title */
3035 Msg.Title = VRGet("Main", "Caption")
3036
3037 call _LoadOtherFuncs
3038
3039 call _NLVSetup
3040 call _TabbedDialogSetup
3041 call _IniRead
3042
3043 /* Nationalized title */
3044 Msg.Title = VRGet("Main", "Caption")
3045 call _InitTempdir
3046 call _ParseCommandLine
3047
3048 StartSamba = \_SambaRunning()
3049
3050 call _SambaInit
3051 if ErrorState then call _OnErrorDisable
3052
3053 if StartSamba then do
3054 address cmd samba.!smbcmd' start'
3055 end
3056 if \_SambaRunning() then do
3057 Msg.Text = NLVGetMessage(107)
3058 Msg.Type = "E"
3059 call _ShowMsg
3060 call Quit
3061 return
3062 end
3063 else if StartSamba then do
3064 Msg.Text = NLVGetMessage(109)
3065 Msg.Type = "I"
3066 call _ShowMsg
3067 end
3068
3069 call _SambaGetProperties
3070
3071 call _FindHtpasswd
3072
3073 call _ContainersInit
3074
3075 call _MasterPasswdRead
3076 ok = VRSet("Main", 'Pointer', '<default>' )
3077 call _Login
3078 ok = VRSet("Main", 'Pointer', 'Wait' )
3079
3080 ok = VRset("Main","Visible", 0)
3081 call _SmbpasswdRead
3082 call _SmbUserMapRead
3083 call _GroupRead
3084 call _SmbGroupsRead
3085
3086 call _GUIInit
3087
3088 call _ContUsersPopulate
3089 call _ContGroupsPopulate
3090 call _PoliciesPopulate
3091
3092 ok = VRMethod("PB_Exit","SetFocus")
3093
3094 call Main_Resize
3095 ok = VRSet("Main","WindowIcon", "$2")
3096 ok = VRSet("Main", 'Pointer', '<default>' )
3097return
3098/*:VRX Main_Resize
3099*/
3100Main_Resize:
3101 IF options.!debug == 1 THEN say time()' Main_Resize() started.'
3102 MainWin = "Main"
3103 ok = VRSet(MainWin,"Painting", 0)
3104
3105 /* Basic measurements */
3106 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
3107 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
3108 sbar_height = 0 /* 209 */ /* Height of status-bar */
3109
3110 pbtn_dist = 980
3111 pbtn_nr = 5
3112 pbtn_pos = max((main_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin
3113 pbtn_height = 400 /* Height of the panels' internal button areas */
3114 pbtn_width = 940
3115
3116/* ipbtn_width = VRGet("IPB_GroupScript","Width") */
3117
3118 pane_height = main_iheight- sbar_height - pbtn_height - margin * 7 /* Height of notebook panel */
3119 pane_width = main_iwidth - marginx2 /* Width of notebook panel */
3120
3121 /* Tabbed Dialog */
3122 ok = VRset("TDL_1", "Top", marginx2 )
3123 ok = VRset("TDL_1", "Left", margin )
3124 ok = VRset("TDL_1", "Width", pane_width )
3125 ok = VRset("TDL_1", "Height", pane_height )
3126
3127 /* Main window buttons */
3128 ok = VRSet("PB_RPC", "top", VRGet("TDL_1","Height")+marginx4)
3129 ok = VRSet("PB_Help", "top", VRGet("TDL_1","Height")+marginx4)
3130 ok = VRSet("PB_Save", "top", VRGet("TDL_1","Height")+marginx4)
3131 ok = VRSet("PB_Refresh","top", VRGet("TDL_1","Height")+marginx4)
3132 ok = VRSet("PB_Exit", "top", VRGet("TDL_1","Height")+marginx4)
3133 ok = VRSet("PB_About", "top", VRGet("TDL_1","Height")+marginx4)
3134
3135 ok = VRset("GB_Users","Top", margin )
3136 ok = VRset("GB_Users","Left", marginx2)
3137 ok = VRset("GB_Users","Width", pane_width - 760)
3138 ok = VRset("GB_Users","Height", pane_height- 1020)
3139 ok = VRset("CN_Users","Top", marginx2)
3140 ok = VRset("CN_Users","Left", marginx2)
3141 ok = VRset("CN_Users","Width", pane_width - 760 - pbtn_width- marginx4-marginx2 )
3142 ok = VRset("CN_Users","Height", pane_height- 1020- pbtn_height- margin )
3143
3144 ok = VRset("GB_Groups","Top", margin )
3145 ok = VRset("GB_Groups","Left", marginx2)
3146 ok = VRset("GB_Groups","Width", pane_width - 760)
3147 ok = VRset("GB_Groups","Height", pane_height- 1020)
3148 ok = VRset("CN_Groups","Top", marginx2)
3149 ok = VRset("CN_Groups","Left", marginx2)
3150 ok = VRset("CN_Groups","Width", pane_width - 760 - pbtn_width- marginx4-marginx2 )
3151 ok = VRset("CN_Groups","Height", pane_height- 1020- pbtn_height- margin )
3152
3153 ok = VRset("GB_Policies","Top", margin)
3154 ok = VRset("GB_Policies","Left", marginx2)
3155 ok = VRset("GB_Policies","Width", pane_width - 760)
3156 ok = VRset("GB_Policies","Height", pane_height- 1020)
3157
3158 ok = VRset("GB_Settings","Top", margin)
3159 ok = VRset("GB_Settings","Left", marginx2)
3160 ok = VRset("GB_Settings","Width", pane_width - 760)
3161 ok = VRset("GB_Settings","Height", pane_height- 1020)
3162
3163 /* Users page */
3164 ok = VRSet("CB_SmbOnly","Left", marginx2)
3165 ok = VRSet("CB_SmbOnly","Top", VRGet("CN_Users","Height")+ marginx2+margin )
3166
3167 ok = VRSet("PB_UserAdd", "Top", pbtn_height*1 + marginx2 )
3168 ok = VRSet("PB_UserAdd", "Left", VRGet("CN_Users","Width") + marginx4 )
3169 ok = VRSet("PB_UserEdit", "Top", pbtn_height*2 + margin * 3 )
3170 ok = VRSet("PB_UserEdit", "Left", VRGet("CN_Users","Width") + marginx4 )
3171 ok = VRSet("PB_UserDel", "Top", pbtn_height*3 + margin * 4 )
3172 ok = VRSet("PB_UserDel", "Left", VRGet("CN_Users","Width") + marginx4 )
3173 ok = VRSet("PB_UserJoinGroup", "Top", pbtn_height*4 + margin * 5 )
3174 ok = VRSet("PB_UserJoinGroup", "Left", VRGet("CN_Users","Width") + marginx4 )
3175 ok = VRSet("PB_UserLeaveGroup","Top", pbtn_height*5 + margin * 6 )
3176 ok = VRSet("PB_UserLeaveGroup","Left", VRGet("CN_Users","Width") + marginx4 )
3177
3178 /* Groups page */
3179 ok = VRSet("CB_SmbGroupsOnly","Left", marginx2)
3180 ok = VRSet("CB_SmbGroupsOnly","Top", VRGet("CN_Groups","Height")+marginx2+margin )
3181
3182 ok = VRSet("PB_GroupAdd", "Top", pbtn_height*1 + marginx2 )
3183 ok = VRSet("PB_GroupAdd", "Left", VRGet("CN_Groups","Width") + marginx4 )
3184 ok = VRSet("PB_GroupDel", "Top", pbtn_height*2 + margin * 3 )
3185 ok = VRSet("PB_GroupDel", "Left", VRGet("CN_Groups","Width") + marginx4 )
3186
3187 ok = VRSet("PB_GroupMap", "Top", pbtn_height*4 + margin * 5 )
3188 ok = VRSet("PB_GroupMap", "Left", VRGet("CN_Groups","Width") + marginx4 )
3189 ok = VRSet("PB_GroupUnMap", "Top", pbtn_height*5 + margin * 6 )
3190 ok = VRSet("PB_GroupUnMap", "Left", VRGet("CN_Groups","Width") + marginx4 )
3191
3192 ok = VRSet("PB_GroupScript", "Top", pbtn_height*7 + margin * 8 )
3193 ok = VRSet("PB_GroupScript", "Left", VRGet("CN_Groups","Width") + marginx4 )
3194 ok = VRSet("PB_GroupWellknown","Top", pbtn_height*8 + margin * 9 )
3195 ok = VRSet("PB_GroupWellknown","Left", VRGet("CN_Groups","Width") + marginx4 )
3196
3197 ButtonDist= 1120
3198 ButtonNr = 6
3199 ButtonPos = format(max((VRget(MainWin,"Width")-ButtonDist*ButtonNr)/2,0),,0)
3200 ok = VRSet("PB_RPC", "left",ButtonPos+ButtonDist*(ButtonNr-6))
3201 ok = VRSet("PB_Save", "left",ButtonPos+ButtonDist*(ButtonNr-5))
3202 ok = VRSet("PB_Refresh","left",ButtonPos+ButtonDist*(ButtonNr-4))
3203 ok = VRSet("PB_Help", "left",ButtonPos+ButtonDist*(ButtonNr-3))
3204 ok = VRSet("PB_About", "left",ButtonPos+ButtonDist*(ButtonNr-2))
3205 ok = VRSet("PB_Exit", "left",ButtonPos+ButtonDist*(ButtonNr-1))
3206
3207 ok = VRSet("PB_RPC", "width",ButtonDist-80)
3208 ok = VRSet("PB_Save", "width",ButtonDist-80)
3209 ok = VRSet("PB_Refresh","width",ButtonDist-80)
3210 ok = VRSet("PB_Help", "width",ButtonDist-80)
3211 ok = VRSet("PB_About", "width",ButtonDist-80)
3212 ok = VRSet("PB_Exit", "width",ButtonDist-80)
3213
3214 /* check and empty event queue, trash spurious resize events */
3215 EventString = ''
3216 TrashedResize = 0
3217 do until EventString = 'nop'
3218 EventString = VREvent('N')
3219 if EventString <> 'nop' then do
3220 if EventString = 'CALL 'MainWin'_Resize' then TrashedResize = 1
3221 else interpret eventString
3222 end
3223 end
3224 if TrashedResize then CALL Main_Resize
3225 ok = VRSet(MainWin, "Painting", 1)
3226
3227 ok = VRSet(MainWin,"Visible", 1)
3228 IF options.!debug == 1 THEN say time()' Main_Resize() done.'
3229return
3230
3231/*:VRX MapGroup_Close
3232*/
3233MapGroup_Close:
3234 call MapGroup_Fini
3235return
3236
3237/*:VRX MapGroup_Create
3238*/
3239MapGroup_Create:
3240 call MapGroup_Init
3241 CALL NLVSetText 'MapGroup', 'Caption', 60
3242 CALL NLVSetText 'PB_GroupMapOK', 'Caption', 2
3243 CALL NLVSetText 'PB_GroupMapCancel', 'Caption', 3
3244
3245 CALL NLVSetText 'DT_NTGroupname', 'Caption', 61
3246 CALL NLVSetText 'DT_NTGroupComment', 'Caption', 52
3247 CALL NLVSetText 'DT_NTRID', 'Caption', 62
3248 CALL NLVSetText 'DT_NTGroupType', 'Caption', 63
3249 CALL NLVSetText 'RB_NTGroupType_domain','Caption', 64
3250 CALL NLVSetText 'RB_NTGroupType_builtin','Caption', 65
3251 CALL NLVSetText 'RB_NTGroupType_local','Caption', 66
3252
3253 ok = VRSet("EF_NTGroupName","Value", GroupName.SelGNr)
3254 ok = VRSet("EF_NTRID","Value", GGID.SelGNr)
3255 NTGroupType = 'domain'
3256return
3257
3258/*:VRX MapGroup_Fini
3259*/
3260MapGroup_Fini:
3261 window = VRInfo( "Window" )
3262 call VRDestroy window
3263 drop window
3264return
3265/*:VRX MapGroup_Init
3266*/
3267MapGroup_Init:
3268 window = VRInfo( "Object" )
3269 if( \VRIsChildOf( window, "Notebook" ) ) then do
3270 call VRMethod window, "CenterWindow"
3271 call VRSet window, "Visible", 1
3272 call VRMethod window, "Activate"
3273 end
3274 drop window
3275return
3276
3277/*:VRX PB_About_Click
3278*/
3279PB_About_Click:
3280 window = VRLoadSecondary( "About", "W" )
3281return
3282
3283/*:VRX PB_AboutOK_Click
3284*/
3285PB_AboutOK_Click:
3286 call About_Close
3287return
3288
3289/*:VRX PB_AddUserCancel_Click
3290*/
3291PB_AddUserCancel_Click:
3292 call AddUser_Close
3293return
3294
3295/*:VRX PB_AddUserOK_Click
3296*/
3297PB_AddUserOK_Click:
3298 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click started.'
3299 if VRGet("EF_username","Value") ="" then do
3300 Msg.type = "E"
3301 Msg.Text = NLVGetMessage( 101 )
3302 call _ShowMsg
3303 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click aborted.'
3304 return
3305 end
3306 if VRGet("EF_password","Value") ="" & \(VRGet("CB_NoPassword","Set") | VRGet("CB_MachineAccount","Set")) then do
3307 Msg.type = "E"
3308 Msg.Text = NLVGetMessage( 102 )
3309 call _ShowMsg
3310 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click aborted.'
3311 return
3312 end
3313 if VRGet("EF_password_repeat","Value") ="" & \(VRGet("CB_NoPassword","Set") | VRGet("CB_MachineAccount","Set")) then do
3314 Msg.type = "E"
3315 Msg.Text = NLVGetMessage( 103 )
3316 call _ShowMsg
3317 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click aborted.'
3318 return
3319 end
3320
3321 if VRGet("EF_password","Value") <> VRGet("EF_password_repeat","Value") then do
3322 Msg.type = "E"
3323 Msg.Text = NLVGetMessage( 104 )
3324 call _ShowMsg
3325 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click aborted.'
3326 return
3327 end
3328
3329 if length(VRGet("EF_password","Value")) < MinPWLength & \(VRGet("CB_NoPassword","Set") | VRGet("CB_MachineAccount","Set")) then do
3330 Msg.type = "E"
3331 Msg.Text = NLVGetMessage( 117 )
3332 call _ShowMsg
3333 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click aborted.'
3334 return
3335 end
3336
3337 if (substr(VRGet("DT_UID","Caption"),6) = VRGet("DDCB_GID","Value")) & (substr(VRGet("DT_UID","Caption"),6) < 65000) then do
3338 Msg.Type = "W"
3339 Msg.Text = NLVGetMessage(115)
3340 ok = _MsgYesNo()
3341 if ok = 2 then do
3342 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click aborted.'
3343 return
3344 end
3345 end
3346
3347 if IsUnixUser then nx = UnixUserNr
3348 else do
3349 nx = Username.0 + 1
3350 Username.0 = nx
3351 end
3352 Username.nx = VRGet("EF_Username","Value")
3353 UID.nx = substr(VRGet("DT_UID","Caption"),6)
3354 GID.nx = VRGet("DDCB_GID","Value")
3355
3356 if settings.!WriteMasterPwd = 1 then do
3357 call rxFuncAdd "Crypt", "RxCrypt", "RxCrypt"
3358 itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
3359 salt = ""
3360 do i = 1 to 8
3361 salt = salt || substr( itoa64, random( 0, 63 ) + 1, 1 )
3362 end
3363 password.nx = Crypt(VRGet("EF_password","Value"), salt )
3364 end
3365 else password.nx = "*"
3366 loginclass.NX = '' /* dummy value */
3367 pwchange.NX = '0' /* dummy value */
3368 deact.NX = '0' /* dummy value */
3369 gecos.NX = VRGet("EF_GECOS","Value") /* Full name */
3370 home.NX = _PathStrkLIBC(VRGet("EF_Home","Value"))
3371 shell.NX = '/usr/sbin/nologin' /* dummy value */
3372 lmhash.NX = ""
3373 nthash.NX = ""
3374 flags.NX = ""
3375 lct.NX = ""
3376 Status.nx = ""
3377 call _MasterpasswdWrite
3378 call _PasswordDBRewrite
3379
3380 if pwd_mkdbRC = 0 then do
3381 if \VRGet("CB_UnixUserOnly","set") then do
3382 call _useraddsmb
3383 if SecondStage then do
3384 command = ""
3385 newflags = ""
3386 if VRGet("EF_Description","value") <> "" then command = ' --account-desc="'VRGet("EF_Description","value")'" '
3387 if VRGet("CB_Password_doesnt_expire","set") then newFlags = NewFlags||"X"
3388 if VRGet("CB_Deactivated","set") then newFlags = NewFlags||"D"
3389 if NewFlags <> "" then command = command||' -c "['NewFlags']"'
3390 say ' 'samba.!pdbeditexe' --user='Username.nx' --modify 'command' 'DebugLevel' 2>'samba.!error' 1>'samba.!msg
3391 address cmd samba.!pdbeditexe' --user='Username.nx' --modify 'command' 'DebugLevel' 2>'samba.!error' 1>'samba.!msg
3392
3393 if RC <> 0 then call _SambaShowError /* ; else call _SambaShowMsg */
3394 end
3395/* if GID.NX <> UID.NX then call _SmbGroupMembersSync GID.NX
3396 else call _SmbGroupMembersSync 513
3397 call _GroupWrite
3398 call _ContGroupsPopulate */
3399 end
3400 end
3401 call PB_Refresh_Click
3402
3403 call AddUser_Close
3404 IF options.!debug == 1 THEN say time()' PB_AddUserOK_Click done.'
3405return
3406
3407/*:VRX PB_ChooseHome_Click
3408*/
3409PB_ChooseHome_Click:
3410 TargetDir = _DirDialog("",Samba.!homes)
3411 if TargetDir = "" then return
3412 ok = VRSet("EF_Home","value", TargetDir)
3413 drop TargetDir
3414return
3415
3416/*:VRX PB_CreateHome_Click
3417*/
3418PB_CreateHome_Click:
3419 if translate(VRGet("EF_Home","Value")) = "\NONEXISTENT" | translate(VRGet("EF_Home","Value")) = "\DEV\NULL" then return
3420 ok = SysMkDir(VRGet("EF_Home","Value"))
3421 call EF_Home_Change
3422return
3423
3424/*:VRX PB_Exit_Click
3425*/
3426PB_Exit_Click:
3427 say 'start PB_Cancel_Click'
3428 Call Quit
3429 say 'done PB_Cancel_Click'
3430return
3431
3432/*:VRX PB_GroupAdd_Click
3433*/
3434PB_GroupAdd_Click:
3435 call Contextmenu_GroupAdd_Click
3436return
3437
3438/*:VRX PB_GroupAddCancel_Click
3439*/
3440PB_GroupAddCancel_Click:
3441 call AddGroup_Close
3442return
3443
3444/*:VRX PB_GroupAddOK_Click
3445*/
3446PB_GroupAddOK_Click:
3447 if \UnixGroupOnly then do
3448 if VRGet("EF_Comment","Value") <> "" then Comment = ' -C "'VRGet("EF_Comment","Value")'"'
3449 else Comment = ""
3450 address cmd samba.!netexe' rpc group add "'VRGet("EF_GroupName","Value")'" 'Comment' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3451 if RC <> 0 then call _SambaShowError
3452 else call _SambaShowMsg
3453 end
3454 else do
3455 if VRGet("CB_AutomaticGGID","set")
3456 then call _kLibcGroupAdd VRGet("EF_GroupName","Value") , _GetNextGID()
3457 else call _kLibcGroupAdd VRGet("EF_GroupName","Value") , VRget("EF_GGID","Value")
3458 call PB_Save_Click
3459 end
3460 call PB_Refresh_Click
3461 call AddGroup_Close
3462return
3463
3464/*:VRX PB_GroupDel_Click
3465*/
3466PB_GroupDel_Click:
3467 call Contextmenu_GroupDel_Click
3468return
3469
3470/*:VRX PB_GroupMap_Click
3471*/
3472PB_GroupMap_Click:
3473 call Contextmenu_GroupMap_Click
3474return
3475
3476/*:VRX PB_GroupMapCancel_Click
3477*/
3478PB_GroupMapCancel_Click:
3479 call MapGroup_Close
3480return
3481
3482/*:VRX PB_GroupMapOK_Click
3483*/
3484PB_GroupMapOK_Click:
3485 if VRGet("EF_NTGRoupComment","value") <> "" then Comment = ' comment="'VRGet("EF_NTGRoupComment","value")'"'
3486 else Comment = ""
3487/* net groupmap add rid=512 ntgroup="Domain Admins" unixgroup="root" type=domain */
3488
3489say address cmd samba.!netexe' groupmap add rid='VRGet("EF_NTRID","Value")' ntgroup="'VRGet("EF_NTGroupName","Value")'" unixgroup="'GroupName.SelGnr'" type='NTGroupType' 'Comment' 'debuglevel
3490 address cmd samba.!netexe' groupmap add rid='VRGet("EF_NTRID","Value")' ntgroup="'VRGet("EF_NTGroupName","Value")'" unixgroup="'GroupName.SelGnr'" type='NTGroupType' 'Comment' 'debuglevel' 2>'samba.!error' 1>'samba.!msg
3491 if RC <> 0 then call _SambaShowError
3492 else do
3493 call _SambaShowMsg
3494 blGusers = translate(Gusers.SelGnr,' ',',')
3495 do I = 1 to words(blGusers)
3496 address cmd samba.!netexe' rpc group addmem "'VRGet("EF_NTGroupName","Value")'" 'word(BlGusers,I)' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3497 if RC <> 0 then call _SambaShowError
3498 else call _SambaShowMsg
3499 say samba.!netexe' RC = 'RC
3500 end
3501 end
3502 call PB_Refresh_Click
3503 call MapGroup_Close
3504return
3505
3506/*:VRX PB_GroupMembersOK_Click
3507*/
3508PB_GroupMembersOK_Click:
3509 IF options.!debug == 1 THEN say time()' PB_Group_MembersOK_Click started.'
3510 call Group_Members_Close
3511 IF options.!debug == 1 THEN say time()' PB_Group_MembersOK_Click done.'
3512return
3513
3514/*:VRX PB_GroupScript_Click
3515*/
3516PB_GroupScript_Click:
3517 call Contextmenu_GroupRebuildScript_Click
3518return
3519
3520/*:VRX PB_GroupUnMap_Click
3521*/
3522PB_GroupUnMap_Click:
3523 call Contextmenu_GroupUnMap_Click
3524return
3525
3526/*:VRX PB_GroupWellKnown_Click
3527*/
3528PB_GroupWellKnown_Click:
3529 call Contextmenu_GroupWellKnown_Click
3530return
3531
3532/*:VRX PB_Help_Click
3533*/
3534PB_Help_Click:
3535 Msg.Title = VRGet("Main", "Caption")
3536 Msg.Type = "I"
3537 Msg.Text = "Not implemented"
3538 call _ShowMsg
3539return
3540
3541/*:VRX PB_JoinCancel_Click
3542*/
3543PB_JoinCancel_Click:
3544 call Join_Group_Close
3545return
3546
3547/*:VRX PB_JoinOK_Click
3548*/
3549PB_JoinOK_Click:
3550 ok = VRMethod( "LB_Groups", "GetSelectedStringList", SelGroups. )
3551 if SelGroups.0 = 0 then return
3552 do I = 1 to SelGroups.0
3553 if SelGroups.I = "(klibc group)" then iterate
3554 ok = VRCopyFile(samba.!group, samba.!group'.bak')
3555 say samba.!netexe' rpc addmem "'SelGroups.I'" 'Username.SelNr' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3556 address cmd samba.!netexe' rpc group addmem "'SelGroups.I'" 'Username.SelNr' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3557 if RC <> 0 then do
3558 call _SambaShowError
3559 ok = VRCopyFile(samba.!group'.bak', samba.!group)
3560 end
3561 else call _SambaShowMsg
3562
3563/* call _SmbGroupMembersSync SelGroups.I
3564 call _GroupWrite */
3565 end
3566 call Join_Group_Close
3567 call PB_Refresh_Click
3568return
3569
3570/*:VRX PB_LeaveCancel_Click
3571*/
3572PB_LeaveCancel_Click:
3573 call Leave_Group_Close
3574return
3575
3576/*:VRX PB_LeaveOK_Click
3577*/
3578PB_LeaveOK_Click:
3579 ok = VRMethod( "LB_LeaveGroups", "GetSelectedStringList", SelGroups. )
3580 if SelGroups.0 = 0 then return
3581 do I = 1 to SelGroups.0
3582 ok = VRCopyFIle(samba.!group, samba.!group'.bak')
3583 say samba.!netexe' rpc delmem "'SelGroups.I'" 'Username.SelNr' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3584 address cmd samba.!netexe' rpc group delmem "'SelGroups.I'" 'Username.SelNr' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3585 if RC <> 0 then do
3586 call _SambaShowError
3587 ok = VRCopyFile(samba.!group'.bak', samba.!group)
3588 end
3589 else call _SambaShowMsg
3590/* call _SmbGroupMembersSync SelGroups.I
3591 call _GroupWrite */
3592 end
3593 call Leave_Group_Close
3594 call PB_Refresh_Click
3595return
3596
3597/*:VRX PB_LOGIN_CANCEL_Click
3598*/
3599PB_LOGIN_CANCEL_Click:
3600 say " Login Abort"
3601 call SW_Login_Close
3602 exit 0
3603return
3604
3605/*:VRX PB_LOGIN_OK_Click
3606*/
3607PB_LOGIN_OK_Click:
3608 IF options.!debug == 1 THEN say " SW_LOGIN OK started"
3609 Credentials.!Username = VRGet("EF_LoginUser","Value")
3610 Credentials.!Password = VRGet("EF_LoginPassword","Value")
3611
3612 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0
3613 then UserCred = '--user='Credentials.!username'%'Credentials.!password
3614 else UserCred = '--user='Credentials.!username'%%'Credentials.!password
3615
3616 Call SW_Login_Close
3617 IF options.!debug == 1 THEN say " SW_LOGIN OK done"
3618return
3619
3620/*:VRX PB_pdbeditConsole_Click
3621*/
3622PB_pdbeditConsole_Click:
3623 Buttons.1 = NLVGetMessage(2)
3624 Buttons.2 = NLVGetMessage(3)
3625 Buttons.0 = 2
3626 command = ' --account-desc= --fullname --homedir= --drive= --script= --profile= --domain= -c "[NDHLX]"'
3627 id = VRPrompt( VRWindow(), 'pdbedit --user='Username.CurUserNr' --modify', "command", "pdbedit Console", "Buttons.", buttons.1, buttons.2 )
3628 if id = 2 then return
3629 say samba.!pdbeditexe' --user='Username.CurUserNr' --modify 'command' 'DebugLevel' 2>'samba.!error
3630 address cmd samba.!pdbeditexe' --user='Username.CurUserNr' --modify 'command' 'DebugLevel' 2>'samba.!error
3631 if RC <> 0 then call _SambaShowError
3632 call _UserPropertiesGet Username.CurUserNr
3633return
3634
3635/*
3636Settable account flags
3637 N: No password required
3638 D: Account disabled
3639 H: Home directory required
3640 L: Automatic Locking
3641 X: Password does not expire
3642
3643Account Types:
3644 U: Regular user account
3645 T: Temporary duplicate of other account
3646 M: MNS logon user account
3647 W: Workstation Trust Account
3648 S: Server Trust Account
3649 I: Domain Trust Account
3650
3651 */
3652/*:VRX PB_PolReset_Click
3653*/
3654PB_PolReset_Click:
3655 say samba.!pdbeditexe' --policies-reset 'DebugLevel' 1>'samba.!msg
3656 address cmd samba.!pdbeditexe' --policies-reset 'DebugLevel' 1>'samba.!msg
3657 call _SambaShowMsg "description unknown parameter"
3658return
3659
3660/*:VRX PB_PolUpdate_Click
3661*/
3662PB_PolUpdate_Click:
3663 say samba.!pdbeditexe' -P "'VRGet("DDCB_Policy","Value")'" -C 'VRGet("EF_PolValue","Value")' 'DebugLevel' 1>'samba.!msg
3664 address cmd samba.!pdbeditexe' -P "'VRGet("DDCB_Policy","Value")'" -C 'VRGet("EF_PolValue","Value")' 'DebugLevel' 1>'samba.!msg
3665 call _SambaShowMsg "description unknown parameter"
3666return
3667
3668/*:VRX PB_Refresh_Click
3669*/
3670PB_Refresh_Click:
3671 call _Refresh
3672return
3673
3674/*:VRX PB_RPC_Click
3675*/
3676PB_RPC_Click:
3677 Buttons.1 = NLVGetMessage(2)
3678 Buttons.2 = NLVGetMessage(3)
3679 Buttons.0 = 2
3680 command = 'group'
3681 id = VRPrompt( VRWindow(), "net rpc", "command", "net rpc Console", "Buttons.", buttons.1, buttons.2 )
3682 if id = 2 then return
3683 say samba.!netexe' rpc 'command' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3684 address cmd samba.!netexe' rpc 'command' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
3685 if RC <> 0 then call _SambaShowError; else call _SambaShowMsg
3686 call PB_Refresh_Click
3687return
3688
3689/*:VRX PB_Save_Click
3690*/
3691PB_Save_Click:
3692 IF options.!debug == 1 THEN say time()' PB_Save_Click() started'
3693 call _MasterpasswdWrite
3694 call _GroupWrite
3695 call _PasswordDBRewrite
3696 call _SmbUserMapWrite
3697 IF options.!debug == 1 THEN say time()' PB_Save_Click() done'
3698return
3699
3700/*:VRX PB_upCancel_Click
3701*/
3702PB_upCancel_Click:
3703 call UserProperties_Close
3704return
3705
3706/*:VRX PB_upSave_Click
3707*/
3708PB_upSave_Click:
3709/* U: Regular user account
3710 T: Temporary duplicate of other account
3711 M: MNS logon user account
3712 W: Workstation Trust Account
3713 S: Server Trust Account
3714 I: Domain Trust Account */
3715
3716 /* we mask out flags that cannot be modified anyway here */
3717 CurFlags = translate(CurFlags,' ','UTMWSI')
3718
3719 if VRGet("CB_upResetLogonHours", "set") then newcommand = newcommand||' -Z'
3720
3721 say samba.!pdbeditexe' --user='Username.CurUserNr' --modify 'newcommand' -c "['CurFlags']" 'DebugLevel' 2>'samba.!error /* ' 1>'samba.!msg */
3722 address cmd samba.!pdbeditexe' --user='Username.CurUserNr' --modify 'newcommand' -c "['CurFlags']" 'DebugLevel' 2>'samba.!error /* ' 1>'samba.!msg */
3723 if RC <> 0 then call _SambaShowError /* ; else call _SambaShowMsg */
3724
3725 else do
3726 if VRGet("EF_upPassword","Value") <> "" | VRGet("EF_upPassword_repeat","Value") <> "" then do /* Password change! */
3727 if VRGet("EF_upPassword","Value") <> VRGet("EF_upPassword_repeat","Value") then do
3728 Msg.type = "E"
3729 Msg.Text = NLVGetMessage( 104 )
3730 call _ShowMsg
3731 return
3732 end
3733 else do
3734 if length(VRGet("EF_upPassword","Value")) < MinPWLength then do
3735 Msg.type = "E"
3736 Msg.Text = NLVGetMessage( 117 )
3737 call _ShowMsg
3738 return
3739 end
3740 else do
3741 pwdfile = TempDir'newpwd'
3742 call lineout pwdfile, VRGet("EF_upPassword","value")
3743 call lineout pwdfile, VRGet("EF_upPassword","value")
3744 ok = stream(pwdfile,"c","close")
3745 say samba.!smbpasswdexe' -a 'Username.CurUserNr' -s <'pwdfile' 2>'samba.!error
3746 address cmd samba.!smbpasswdexe' -a 'Username.CurUserNr' -s <'pwdfile' 2>'samba.!error' 1>'samba.!msg
3747 smbpasswdrc = rc
3748 if rc <> 0 then call _SambaShowError
3749 else call _SambaShowMsg
3750 ok = SysFileDelete(pwdfile)
3751 if SwatAuth then do
3752 /* we always remove the old swat */
3753 say ' 'samba.!htpasswdexe' -D "'swatusers'" 'Username.CurUserNr
3754 address cmd samba.!htpasswdexe' -D "'swatusers'" 'Username.CurUserNr /* ' 2>'samba.!error' 1>'samba.!msg
3755 if rc <> 0 then call _SambaShowError; else call _SambaShowMsg */
3756
3757 if VRGet("CB_upSWAT_Allowed","Set") then do
3758 if VRFileExists(swatusers) then cFlag = ""; else cFlag="c"
3759 say ' 'samba.!htpasswdexe' -b'cFLag' "'swatusers'" 'Username.CurUserNr' **********'
3760 address cmd samba.!htpasswdexe' -b'cFlag' "'swatusers'" 'Username.CurUserNr' 'VRGet("EF_upPassword","value")' 2>'samba.!error' 1>'samba.!msg
3761 if rc <> 0 then call _SambaShowError
3762 else call _SambaShowMsg
3763 end
3764 end
3765 if settings.!WriteMasterPwd = 1 then do
3766 call rxFuncAdd "Crypt", "RxCrypt", "RxCrypt"
3767 itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
3768 salt = ""
3769 do i = 1 to 8
3770 salt = salt || substr( itoa64, random( 0, 63 ) + 1, 1 )
3771 end
3772 password.CurUserNr = Crypt(VRGet("EF_upPassword","Value"), salt )
3773 call _UserRecWriteBackToStems
3774 call PB_Save_Click
3775 end
3776 end
3777 end
3778 end
3779 if pos("--fullname", newcommand) > 0 & Settings.!SyncFullName = 1 then do
3780 parse var newcommand dummy '--fullname="'NewGECOS'"' dummy
3781 GECOS.CurUserNr = NewGECOS
3782 SyncedFullName = 1
3783 end
3784 call UserProperties_Close
3785 end
3786return
3787
3788/*:VRX PB_UserAdd_Click
3789*/
3790PB_UserAdd_Click:
3791 call Contextmenu_UserAdd_Click
3792return
3793
3794/*:VRX PB_UserDel_Click
3795*/
3796PB_UserDel_Click:
3797 call Contextmenu_UserDel_Click
3798return
3799
3800/*:VRX PB_UserEdit_Click
3801*/
3802PB_UserEdit_Click:
3803 call Contextmenu_UserProperties_Click
3804return
3805
3806/*:VRX PB_UserJoinGroup_Click
3807*/
3808PB_UserJoinGroup_Click:
3809 call Contextmenu_UserJoinGroup_Click
3810return
3811
3812/*:VRX PB_UserLeaveGroup_Click
3813*/
3814PB_UserLeaveGroup_Click:
3815 call Contextmenu_UserLeaveGroup_Click
3816return
3817
3818/*:VRX Quit
3819*/
3820Quit:
3821 if VRGet("Main","WindowState") = "Maximized"|,
3822 VRGet("Main","WindowState") = "Minimized" then ok = VRMethod("Main", "Restore")
3823 call _IniWrite
3824 ok = VRREdirectStdio("OFF")
3825 call _SambaFinish
3826 ok = SysFileDelete(smbdoutput)
3827 if VRParseFileName(samba.!smbpasswd,"DP")||'\' = TempDir then do
3828 ok = SysFileDelete(samba.!smbpasswd)
3829 end
3830 window = VRWindow()
3831 call VRSet window, "Shutdown", 1
3832 drop window
3833return
3834
3835/*:VRX RB_NTGroupType_builtin_Click
3836*/
3837RB_NTGroupType_builtin_Click:
3838 NTGroupType = 'builtin'
3839return
3840
3841/*:VRX RB_NTGroupType_domain_Click
3842*/
3843RB_NTGroupType_domain_Click:
3844 NTGroupType = 'domain'
3845return
3846
3847/*:VRX RB_NTGroupType_local_Click
3848*/
3849RB_NTGroupType_local_Click:
3850 NTGroupType = 'local'
3851return
3852
3853/*:VRX SW_Groups_Close
3854*/
3855SW_Groups_Close:
3856 call SW_Groups_Fini
3857return
3858
3859/*:VRX SW_Groups_Create
3860*/
3861SW_Groups_Create:
3862 call SW_Groups_Init
3863return
3864
3865/*:VRX SW_Groups_Fini
3866*/
3867SW_Groups_Fini:
3868 window = VRInfo( "Window" )
3869 call VRDestroy window
3870 drop window
3871return
3872/*:VRX SW_Groups_Init
3873*/
3874SW_Groups_Init:
3875 window = VRInfo( "Object" )
3876 if( \VRIsChildOf( window, "Notebook" ) ) then do
3877 call VRMethod window, "CenterWindow"
3878 call VRSet window, "Visible", 1
3879 call VRMethod window, "Activate"
3880 end
3881 drop window
3882return
3883
3884/*:VRX SW_Login_Close
3885*/
3886SW_Login_Close:
3887 call SW_Login_Fini
3888return
3889
3890/*:VRX SW_Login_Create
3891*/
3892SW_Login_Create:
3893 call SW_Login_Init
3894 CALL NLVSetText 'SW_Login', 'Caption', 31
3895 CALL NLVSetText 'DT_LoginUser', 'Caption', 32
3896 CALL NLVSetText 'DT_LoginPassword','Caption', 33
3897 CALL NLVSetText 'PB_LOGIN_OK', 'Caption', 2
3898 CALL NLVSetText 'PB_LOGIN_CANCEL', 'Caption', 3
3899
3900 if Credentials.!Username = ""
3901 then ok = VRSet("EF_LoginUser","Value", value("USER",,"OS2ENVIRONMENT"))
3902 else ok = VRSet("EF_LoginUser","Value", Credentials.!Username)
3903
3904 if \_UserIsValid(VRGet("EF_LoginUser","Value")) & value("USER",,"OS2ENVIRONMENT") <> "" then do
3905 Msg.Title =VRGet("Main", "caption")
3906 Msg.Type = "E"
3907 Msg.Text = NLVGetMessage(111, VRGet("EF_LoginUser","Value"))
3908 call _ShowMsg
3909 ok = VRSet("EF_LoginUser","Value","root")
3910 end
3911
3912 if VRGet("EF_LoginUser","Value") <> "" then ok = VRMethod("EF_LoginPassword","Setfocus")
3913return
3914
3915/*:VRX SW_Login_Fini
3916*/
3917SW_Login_Fini:
3918 window = VRInfo( "Window" )
3919 call VRDestroy window
3920 drop window
3921return
3922/*:VRX SW_Login_Init
3923*/
3924SW_Login_Init:
3925 window = VRInfo( "Object" )
3926 if( \VRIsChildOf( window, "Notebook" ) ) then do
3927 call VRMethod window, "CenterWindow"
3928 call VRSet window, "Visible", 1
3929 call VRMethod window, "Activate"
3930 end
3931 drop window
3932return
3933
3934/*:VRX SW_Policies_Close
3935*/
3936SW_Policies_Close:
3937 call SW_Policies_Fini
3938return
3939
3940/*:VRX SW_Policies_Create
3941*/
3942SW_Policies_Create:
3943 call SW_Policies_Init
3944return
3945
3946/*:VRX SW_Policies_Fini
3947*/
3948SW_Policies_Fini:
3949 window = VRInfo( "Window" )
3950 call VRDestroy window
3951 drop window
3952return
3953/*:VRX SW_Policies_Init
3954*/
3955SW_Policies_Init:
3956 window = VRInfo( "Object" )
3957 if( \VRIsChildOf( window, "Notebook" ) ) then do
3958 call VRMethod window, "CenterWindow"
3959 call VRSet window, "Visible", 1
3960 call VRMethod window, "Activate"
3961 end
3962 drop window
3963return
3964
3965/*:VRX SW_Settings_Close
3966*/
3967SW_Settings_Close:
3968 call SW_Settings_Fini
3969return
3970
3971/*:VRX SW_Settings_Create
3972*/
3973SW_Settings_Create:
3974 call SW_Settings_Init
3975return
3976
3977/*:VRX SW_Settings_Fini
3978*/
3979SW_Settings_Fini:
3980 window = VRInfo( "Window" )
3981 call VRDestroy window
3982 drop window
3983return
3984/*:VRX SW_Settings_Init
3985*/
3986SW_Settings_Init:
3987 window = VRInfo( "Object" )
3988 if( \VRIsChildOf( window, "Notebook" ) ) then do
3989 call VRMethod window, "CenterWindow"
3990 call VRSet window, "Visible", 1
3991 call VRMethod window, "Activate"
3992 end
3993 drop window
3994return
3995
3996/*:VRX SW_Users_Close
3997*/
3998SW_Users_Close:
3999 call SW_Users_Fini
4000return
4001
4002/*:VRX SW_Users_Create
4003*/
4004SW_Users_Create:
4005 call SW_Users_Init
4006return
4007
4008/*:VRX SW_Users_Fini
4009*/
4010SW_Users_Fini:
4011 window = VRInfo( "Window" )
4012 call VRDestroy window
4013 drop window
4014return
4015/*:VRX SW_Users_Init
4016*/
4017SW_Users_Init:
4018 window = VRInfo( "Object" )
4019 if( \VRIsChildOf( window, "Notebook" ) ) then do
4020 call VRMethod window, "CenterWindow"
4021 call VRSet window, "Visible", 1
4022 call VRMethod window, "Activate"
4023 end
4024 drop window
4025return
4026
4027/*:VRX TDL_1_PageSelected
4028*/
4029TDL_1_PageSelected:
4030 page = VRInfo("Page")
4031 CurrentPageNr = page
4032
4033/* ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText")) */
4034
4035 select
4036 when page = 1 then do /* Users */
4037 ok = VRSet("Main","WindowIcon", "$2")
4038 end
4039 when page = 2 then do /* Groups */
4040 ok = VRSet("Main","WindowIcon", "$3")
4041 end
4042 when page = 3 then do /* Policies */
4043 ok = VRSet("Main","WindowIcon", "$4")
4044 end
4045 when page = 4 then do /* Settings */
4046 ok = VRSet("Main","WindowIcon", "$5")
4047 end
4048 otherwise nop
4049 end
4050return
4051
4052/*:VRX TDL_2_PageSelected
4053*/
4054TDL_2_PageSelected:
4055 uppage = VRInfo("Page")
4056
4057 select
4058 when uppage = 1 then do /* properties */
4059 ok = VRSet("UserProperties","WindowIcon", "$2")
4060 end
4061 when uppage = 2 then do /* profile */
4062 ok = VRSet("UserProperties","WindowIcon", "$5")
4063 end
4064 when uppage = 3 then do /* memberships */
4065 ok = VRSet("UserProperties","WindowIcon", "$3")
4066 end
4067 otherwise nop
4068 end
4069return
4070/*:VRX UP_Flags_Close
4071*/
4072UP_Flags_Close:
4073 call UP_Flags_Fini
4074return
4075
4076/*:VRX UP_Flags_Create
4077*/
4078UP_Flags_Create:
4079 call UP_Flags_Init
4080return
4081
4082/*:VRX UP_Flags_Fini
4083*/
4084UP_Flags_Fini:
4085 window = VRInfo( "Window" )
4086 call VRDestroy window
4087 drop window
4088return
4089/*:VRX UP_Flags_Init
4090*/
4091UP_Flags_Init:
4092 IF options.!debug == 1 THEN say time()' UP_Flags_Init started'
4093 window = VRInfo( "Object" )
4094 call VRMethod window, "CenterWindow"
4095 call VRSet window, "Visible", 1
4096 call VRMethod window, "Activate"
4097 drop window
4098 IF options.!debug == 1 THEN say time()' UP_Flags_Init done'
4099return
4100
4101/*:VRX UP_GroupMemberShips_Close
4102*/
4103UP_GroupMemberShips_Close:
4104 call UP_GroupMemberShips_Fini
4105return
4106
4107/*:VRX UP_GroupMemberShips_Create
4108*/
4109UP_GroupMemberShips_Create:
4110 call UP_GroupMemberShips_Init
4111return
4112
4113/*:VRX UP_GroupMemberShips_Fini
4114*/
4115UP_GroupMemberShips_Fini:
4116 window = VRInfo( "Window" )
4117 call VRDestroy window
4118 drop window
4119return
4120/*:VRX UP_GroupMemberShips_Init
4121*/
4122UP_GroupMemberShips_Init:
4123 IF options.!debug == 1 THEN say time()' UP_GroupMemberShips_Init started'
4124 window = VRInfo( "Object" )
4125 call VRMethod window, "CenterWindow"
4126 call VRSet window, "Visible", 1
4127 call VRMethod window, "Activate"
4128 drop window
4129 IF options.!debug == 1 THEN say time()' UP_GroupMemberShips_Init done'
4130return
4131
4132/*:VRX UP_Profile_Close
4133*/
4134UP_Profile_Close:
4135 call UP_Profile_Fini
4136return
4137
4138/*:VRX UP_Profile_Create
4139*/
4140UP_Profile_Create:
4141 call UP_Profile_Init
4142return
4143
4144/*:VRX UP_Profile_Fini
4145*/
4146UP_Profile_Fini:
4147 window = VRInfo( "Window" )
4148 call VRDestroy window
4149 drop window
4150return
4151/*:VRX UP_Profile_Init
4152*/
4153UP_Profile_Init:
4154 IF options.!debug == 1 THEN say time()' UP_Profile_Init started'
4155 window = VRInfo( "Object" )
4156 call VRMethod window, "CenterWindow"
4157 call VRSet window, "Visible", 1
4158 call VRMethod window, "Activate"
4159 drop window
4160 IF options.!debug == 1 THEN say time()' UP_Profile_Init done'
4161return
4162
4163/*:VRX UserProperties_Close
4164*/
4165UserProperties_Close:
4166 call UserProperties_Fini
4167 if SyncedFullName = 1 | SyncedPrimGID = 1 then call PB_Save_Click
4168 call PB_Refresh_Click
4169return
4170
4171/*:VRX UserProperties_Create
4172*/
4173UserProperties_Create:
4174 call UserProperties_Init
4175 CALL NLVSetText 'UserProperties', 'Caption', 120
4176
4177 upTabWidth = VRMethod( "Screen", "PixelsToTwips", 136 )
4178 upTabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
4179
4180 ok = VRSet("GB_Profile","Left", marginx2)
4181 ok = VRSet("GB_Profile","Top", margin)
4182 ok = VRSet("GB_Profile","Width", VRGet("TDL_2","Width") - marginx4*4)
4183 ok = VRSet("GB_Profile","Height",VRGet("TDL_2","Height") - marginx4*8+marginx2)
4184 ok = VRSet("CN_UserProperties","Width",VRGet("GB_Profile","Width")-marginx4)
4185
4186 ok = VRSet("GB_Flags","Left", marginx2)
4187 ok = VRSet("GB_Flags","Top", margin)
4188 ok = VRSet("GB_Flags","Width", VRGet("GB_Profile","Width"))
4189 ok = VRSet("GB_Flags","Height",VRGet("GB_Profile","Height"))
4190
4191 ok = VRSet("GB_GroupMemberShips","Left", marginx2)
4192 ok = VRSet("GB_GroupMemberShips","Top", margin)
4193 ok = VRSet("GB_GroupMemberShips","Width",VRGet("GB_Profile","Width") )
4194 ok = VRSet("GB_GroupMemberShips","Height",VRGet("GB_Profile","Height"))
4195
4196 ok = VRMethod("LB_upGroups","Reset")
4197 ok = VRSet("Main", 'Pointer', 'Wait' )
4198 address cmd samba.!netexe' rpc user info 'Username.CurUserNr' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg
4199 if RC <> 0 then call _SambaShowError
4200 else do
4201 ok = file2stem(samba.!msg,"memberships.")
4202 ok = VRMethod("LB_upGroups","AddStringList", "memberships.")
4203 end
4204 ok = VRSet("Main", 'Pointer', '<default>' )
4205
4206 CALL NLVSetText 'PB_upSave', 'Caption', 10
4207 CALL NLVSetText 'PB_upCancel', 'Caption', 3
4208 ok = VRSet("PB_pdbeditconsole",'Caption', "pdbedit "||word(NLVGetMessage(23),2))
4209
4210 CALL NLVSetText 'DT_upAccountType', 'Caption', 55
4211 CALL NLVSetText 'CB_upNoPassword', 'Caption', 20
4212 CALL NLVSetText 'DT_upPassword', 'Caption', 33
4213 CALL NLVSetText 'DT_upPassword_Repeat', 'Caption', 43
4214
4215 CALL NLVSetText 'CB_upMust_change_password', 'Caption', 46
4216 CALL NLVSetText 'CB_upCannot_change_password', 'Caption', 47
4217 CALL NLVSetText 'CB_upPassword_doesnt_expire', 'Caption', 48
4218 CALL NLVSetText 'CB_upDeactivated', 'Caption', 49
4219 CALL NLVSetText 'CB_upResetLogonHours', 'Caption', 54
4220 CALL NLVSetText 'CB_upSWAT_Allowed', 'Caption', 35
4221
4222 ok = VRSet('CB_upSWAT_Allowed',"Enabled",swatAuth)
4223
4224 CALL NLVSetText 'DT_upGroups', 'Caption', 56
4225 CALL NLVSetText 'CB_EditableFieldsOnly', 'Caption', 45
4226
4227 upNrFH = VRMethod( "CN_UserProperties", "AddField", "String", NLVGetMessage(130))
4228 upTypeFH = VRMethod( "CN_UserProperties", "AddField", "String", NLVGetMessage(57))
4229 upValueFH = VRMethod( "CN_UserProperties", "AddField", "String", NLVGetMessage(58))
4230 upCommandFH= VRMethod( "CN_UserProperties", "AddField", "String", NLVGetMessage(59))
4231
4232 ok = VRMethod( "CN_UserProperties", "SetFieldAttr", upNrFH, "Visible", 0)
4233 ok = VRMethod( "CN_UserProperties", "SetFieldAttr", upTypeFH, "ReadOnly", 1)
4234 ok = VRMethod( "CN_UserProperties", "SetFieldAttr", upValueFH, "ReadOnly", 0)
4235 ok = VRMethod( "CN_UserProperties", "SetFieldAttr", upCommandFH, "ReadOnly", 1)
4236 ok = VRMethod( "CN_UserProperties", "SetFieldAttr", upCommandFH, "Visible", 0)
4237
4238 ok = VRMethod( "CN_Users", "GetRecordList", "Selected", "Selected." )
4239 if Selected.0 = 0 then return
4240 CurUserNr = VRMethod("CN_Users","GetFieldData", Selected.1, NrFH)
4241
4242 ok = VRMethod("PB_upCancel", "SetFocus" )
4243
4244 SyncedPrimGID = 0
4245 SyncedFullName = 0
4246
4247 MinPWLength = _PolicyGet("min password length")
4248
4249 call _UserPropertiesGet Username.CurUserNr
4250 newcommand = ""
4251 call UserProperties_Resize
4252 ok = VRSet("UserProperties","Visible",1)
4253return
4254
4255/*:VRX UserProperties_Fini
4256*/
4257UserProperties_Fini:
4258 window = VRInfo( "Window" )
4259 call VRDestroy window
4260 drop window
4261return
4262/*:VRX UserProperties_Init
4263*/
4264UserProperties_Init:
4265 IF options.!debug == 1 THEN SAY time()' UserProperties_Init started'
4266 ok = VRSet("UserProperties","Visible",0)
4267 ok = VRMethod("UserProperties","CenterWindow")
4268
4269 w = VRLoad( "TDL_2", VRWindowPath(), "UP_Flags" )
4270 ok = VRMethod( "TDL_2", "InsertPage", w,"+ "NLVGetMessage(168)" ")
4271 w = VRLoad( "TDL_2", VRWindowPath(), "UP_Profile" )
4272 ok = VRMethod( "TDL_2", "InsertPage", w,"+ "NLVGetMessage(167)" ")
4273 w = VRLoad( "TDL_2", VRWindowPath(), "UP_GroupMemberShips" )
4274 ok = VRMethod( "TDL_2", "InsertPage", w,"+ "NLVGetMessage(169)" ")
4275
4276 IF options.!debug == 1 THEN SAY time()' UserProperties_Init done'
4277return
4278
4279/*:VRX UserProperties_Resize
4280*/
4281UserProperties_Resize:
4282 IF options.!debug == 1 THEN say time()' User_Properties_Resize() started.'
4283 upMain = "UserProperties"
4284 ok = VRSet(upMain,"Painting", 0)
4285
4286 /* Basic measurements */
4287 upMain_iwidth = VRGet(upMain,"InteriorWidth") /* Width of upMain client-area */
4288 upMain_iheight = VRGet(upMain,"InteriorHeight") /* Height of upMain client-area */
4289
4290 pbtn_dist = 1500
4291 pbtn_nr = 3
4292 pbtn_pos = max((upMain_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin
4293 pbtn_height = 400 /* Height of the panels' internal button areas */
4294 pbtn_width = 1460
4295
4296 pane_height = upMain_iheight- pbtn_height - margin * 7 /* Height of notebook */
4297 pane_width = upMain_iwidth - marginx2 /* Width of the notebook panel */
4298
4299 /* Tabbed Dialog */
4300 ok = VRset("TDL_2", "Top", marginx2 )
4301 ok = VRset("TDL_2", "Left", margin )
4302 ok = VRset("TDL_2", "Width", pane_width )
4303 ok = VRset("TDL_2", "Height", pane_height )
4304
4305 /* Buttons */
4306 ok = VRSet("PB_upSave", "top", VRGet("TDL_2","Height")+marginx4+margin)
4307 ok = VRSet("PB_pdbeditConsole", "top", VRGet("TDL_2","Height")+marginx4+margin)
4308 ok = VRSet("PB_upCancel", "top", VRGet("TDL_2","Height")+marginx4+margin)
4309
4310 ok = VRSet("PB_upSave", "left",pbtn_pos+pbtn_dist*(pbtn_nr-3))
4311 ok = VRSet("PB_pdbeditConsole", "left",pbtn_pos+pbtn_dist*(pbtn_nr-2))
4312 ok = VRSet("PB_upCancel", "left",pbtn_pos+pbtn_dist*(pbtn_nr-1))
4313
4314 ok = VRset("GB_Profile","Top", margin )
4315 ok = VRset("GB_Profile","Left", marginx2)
4316 ok = VRset("GB_Profile","Width", pane_width - 760)
4317 ok = VRset("GB_Profile","Height", pane_height- 1020)
4318
4319 ok = VRset("CN_UserProperties","Top", marginx2)
4320 ok = VRset("CN_UserProperties","Left", marginx2)
4321 ok = VRset("CN_UserProperties","Width", pane_width - 760 - marginx4-marginx2 )
4322 ok = VRset("CN_UserProperties","Height", pane_height- 1020- pbtn_height )
4323 ok = VRset("CB_EditableFieldsOnly","Top", pane_height- 1020- pbtn_height + margin*3)
4324
4325 ok = VRset("GB_Flags","Top", margin )
4326 ok = VRset("GB_Flags","Left", marginx2)
4327 ok = VRset("GB_Flags","Width", pane_width - 760)
4328 ok = VRset("GB_Flags","Height", pane_height- 1020)
4329
4330 ok = VRset("GB_GroupMemberships","Top", margin )
4331 ok = VRset("GB_GroupMemberships","Left", marginx2)
4332 ok = VRset("GB_GroupMemberships","Width", pane_width - 760)
4333 ok = VRset("GB_GroupMemberships","Height", pane_height- 1020)
4334
4335 ok = VRset("DT_upGroups", "Top", marginx2)
4336 ok = VRset("DT_upGroups", "Left", marginx2)
4337
4338 ok = VRset("LB_upGroups", "Top", marginx2*6)
4339 ok = VRset("LB_upGroups", "Left", marginx2)
4340 ok = VRset("LB_upGroups", "Width", pane_width - 760 - marginx4-marginx2 )
4341 ok = VRset("LB_upGroups", "Height",pane_height- 1020- VRGet("LB_upGroups","Top")- marginx2)
4342
4343
4344 /* check and empty event queue, trash spurious resize events */
4345 EventString = ''
4346 TrashedResize = 0
4347 do until EventString = 'nop'
4348 EventString = VREvent('N')
4349 if EventString <> 'nop' then do
4350 if EventString = 'CALL 'upMain'_Resize' then TrashedResize = 1
4351 else interpret eventString
4352 end
4353 end
4354 if TrashedResize then CALL Main_Resize
4355
4356 ok = VRSet(upMain,"Painting", 1)
4357 IF options.!debug == 1 THEN say time()' User_Properties_Resize() done.'
4358return
4359
Note: See TracBrowser for help on using the repository browser.