Debian Codegraph @

mstypes/kerb_sid_and_attributes.go

raw symbols SCIP
1 package mstypes
2
3 import (
4 "encoding/binary"
5
6 "gopkg.in/jcmturner/rpc.v0/ndr"
7 )
8
9 // Attributes of a security group membership and can be combined by using the bitwise OR operation.
10 // They are used by an access check mechanism to specify whether the membership is to be used in an access check decision.
11 const (
12 SEGroupMandatory = 31
13 SEGroupEnabledByDefault = 30
14 SEGroupEnabled = 29
15 SEGroupOwner = 28
16 SEGroupResource = 2
17 //All other bits MUST be set to zero and MUST be ignored on receipt.
18 )
19
20 // KerbSidAndAttributes implements https://msdn.microsoft.com/en-us/library/cc237947.aspx
21 type KerbSidAndAttributes struct {
22 SID RPCSID // A pointer to an RPC_SID structure.
23 Attributes uint32
24 }
25
26 // ReadKerbSidAndAttributes reads a KerbSidAndAttribute from the bytes slice.
27 func ReadKerbSidAndAttributes(b *[]byte, p *int, e *binary.ByteOrder) (KerbSidAndAttributes, error) {
28 s, err := ReadRPCSID(b, p, e)
29 if err != nil {
30 return KerbSidAndAttributes{}, err
31 }
32 a := ndr.ReadUint32(b, p, e)
33 return KerbSidAndAttributes{
34 SID: s,
35 Attributes: a,
36 }, nil
37 }
38
39 // SetFlag sets a flag in a uint32 attribute value.
40 func SetFlag(a *uint32, i uint) {
41 *a = *a | (1 << (31 - i))
42 }