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