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