@@ -18,13 +18,20 @@ const (
18
18
ControlTypeVChuPasswordWarning = "2.16.840.1.113730.3.4.5"
19
19
// ControlTypeManageDsaIT - https://tools.ietf.org/html/rfc3296
20
20
ControlTypeManageDsaIT = "2.16.840.1.113730.3.4.2"
21
+
22
+ // ControlTypeMicrosoftNotification - https://msdn.microsoft.com/en-us/library/aa366983(v=vs.85).aspx
23
+ ControlTypeMicrosoftNotification = "1.2.840.113556.1.4.528"
24
+ // ControlTypeMicrosoftShowDeleted - https://msdn.microsoft.com/en-us/library/aa366989(v=vs.85).aspx
25
+ ControlTypeMicrosoftShowDeleted = "1.2.840.113556.1.4.417"
21
26
)
22
27
23
28
// ControlTypeMap maps controls to text descriptions
24
29
var ControlTypeMap = map [string ]string {
25
- ControlTypePaging : "Paging" ,
26
- ControlTypeBeheraPasswordPolicy : "Password Policy - Behera Draft" ,
27
- ControlTypeManageDsaIT : "Manage DSA IT" ,
30
+ ControlTypePaging : "Paging" ,
31
+ ControlTypeBeheraPasswordPolicy : "Password Policy - Behera Draft" ,
32
+ ControlTypeManageDsaIT : "Manage DSA IT" ,
33
+ ControlTypeMicrosoftNotification : "Change Notification - Microsoft" ,
34
+ ControlTypeMicrosoftShowDeleted : "Show Deleted Objects - Microsoft" ,
28
35
}
29
36
30
37
// Control defines an interface controls provide to encode and describe themselves
@@ -238,6 +245,64 @@ func NewControlManageDsaIT(Criticality bool) *ControlManageDsaIT {
238
245
return & ControlManageDsaIT {Criticality : Criticality }
239
246
}
240
247
248
+ // ControlMicrosoftNotification implements the control described in https://msdn.microsoft.com/en-us/library/aa366983(v=vs.85).aspx
249
+ type ControlMicrosoftNotification struct {}
250
+
251
+ // GetControlType returns the OID
252
+ func (c * ControlMicrosoftNotification ) GetControlType () string {
253
+ return ControlTypeMicrosoftNotification
254
+ }
255
+
256
+ // Encode returns the ber packet representation
257
+ func (c * ControlMicrosoftNotification ) Encode () * ber.Packet {
258
+ packet := ber .Encode (ber .ClassUniversal , ber .TypeConstructed , ber .TagSequence , nil , "Control" )
259
+ packet .AppendChild (ber .NewString (ber .ClassUniversal , ber .TypePrimitive , ber .TagOctetString , ControlTypeMicrosoftNotification , "Control Type (" + ControlTypeMap [ControlTypeMicrosoftNotification ]+ ")" ))
260
+
261
+ return packet
262
+ }
263
+
264
+ // String returns a human-readable description
265
+ func (c * ControlMicrosoftNotification ) String () string {
266
+ return fmt .Sprintf (
267
+ "Control Type: %s (%q)" ,
268
+ ControlTypeMap [ControlTypeMicrosoftNotification ],
269
+ ControlTypeMicrosoftNotification )
270
+ }
271
+
272
+ // NewControlMicrosoftNotification returns a ControlMicrosoftNotification control
273
+ func NewControlMicrosoftNotification () * ControlMicrosoftNotification {
274
+ return & ControlMicrosoftNotification {}
275
+ }
276
+
277
+ // ControlMicrosoftShowDeleted implements the control described in https://msdn.microsoft.com/en-us/library/aa366989(v=vs.85).aspx
278
+ type ControlMicrosoftShowDeleted struct {}
279
+
280
+ // GetControlType returns the OID
281
+ func (c * ControlMicrosoftShowDeleted ) GetControlType () string {
282
+ return ControlTypeMicrosoftShowDeleted
283
+ }
284
+
285
+ // Encode returns the ber packet representation
286
+ func (c * ControlMicrosoftShowDeleted ) Encode () * ber.Packet {
287
+ packet := ber .Encode (ber .ClassUniversal , ber .TypeConstructed , ber .TagSequence , nil , "Control" )
288
+ packet .AppendChild (ber .NewString (ber .ClassUniversal , ber .TypePrimitive , ber .TagOctetString , ControlTypeMicrosoftShowDeleted , "Control Type (" + ControlTypeMap [ControlTypeMicrosoftShowDeleted ]+ ")" ))
289
+
290
+ return packet
291
+ }
292
+
293
+ // String returns a human-readable description
294
+ func (c * ControlMicrosoftShowDeleted ) String () string {
295
+ return fmt .Sprintf (
296
+ "Control Type: %s (%q)" ,
297
+ ControlTypeMap [ControlTypeMicrosoftShowDeleted ],
298
+ ControlTypeMicrosoftShowDeleted )
299
+ }
300
+
301
+ // NewControlMicrosoftShowDeleted returns a ControlMicrosoftShowDeleted control
302
+ func NewControlMicrosoftShowDeleted () * ControlMicrosoftShowDeleted {
303
+ return & ControlMicrosoftShowDeleted {}
304
+ }
305
+
241
306
// FindControl returns the first control of the given type in the list, or nil
242
307
func FindControl (controls []Control , controlType string ) Control {
243
308
for _ , c := range controls {
@@ -385,6 +450,10 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
385
450
value .Value = c .Expire
386
451
387
452
return c , nil
453
+ case ControlTypeMicrosoftNotification :
454
+ return NewControlMicrosoftNotification (), nil
455
+ case ControlTypeMicrosoftShowDeleted :
456
+ return NewControlMicrosoftShowDeleted (), nil
388
457
default :
389
458
c := new (ControlString )
390
459
c .ControlType = ControlType
0 commit comments