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

Last change on this file since 990 was 990, checked in by Herwig Bauernfeind, 9 years ago

GUITools: All changes that have built over time.

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