FileDocCategorySizeDatePackage
SecurityDescriptor.javaAPI DocJCIFS 1.3.17 API2934Tue Oct 18 15:26:24 BST 2011jcifs.smb

SecurityDescriptor

public class SecurityDescriptor extends Object

Fields Summary
public int
type
public ACE[]
aces
Constructors Summary
public SecurityDescriptor()

    
public SecurityDescriptor(byte[] buffer, int bufferIndex, int len)

        this.decode(buffer, bufferIndex, len);
    
Methods Summary
public intdecode(byte[] buffer, int bufferIndex, int len)

        int start = bufferIndex;

        bufferIndex++; // revision
        bufferIndex++;
        type = ServerMessageBlock.readInt2(buffer, bufferIndex);
        bufferIndex += 2;
        ServerMessageBlock.readInt4(buffer, bufferIndex); // offset to owner sid
        bufferIndex += 4;
        ServerMessageBlock.readInt4(buffer, bufferIndex); // offset to group sid
        bufferIndex += 4;
        ServerMessageBlock.readInt4(buffer, bufferIndex); // offset to sacl
        bufferIndex += 4;
        int daclOffset = ServerMessageBlock.readInt4(buffer, bufferIndex);

        bufferIndex = start + daclOffset;

        bufferIndex++; // revision
        bufferIndex++;
        int size = ServerMessageBlock.readInt2(buffer, bufferIndex);
        bufferIndex += 2;
        int numAces = ServerMessageBlock.readInt4(buffer, bufferIndex);
        bufferIndex += 4;

        if (numAces > 4096)
            throw new IOException( "Invalid SecurityDescriptor" );

        if (daclOffset != 0) {
            aces = new ACE[numAces];
            for (int i = 0; i < numAces; i++) {
                aces[i] = new ACE();
                bufferIndex += aces[i].decode(buffer, bufferIndex);
            }
        } else {
            aces = null;
        }

        return bufferIndex - start;
    
public java.lang.StringtoString()

        String ret = "SecurityDescriptor:\n";
        if (aces != null) {
            for (int ai = 0; ai < aces.length; ai++) {
                ret += aces[ai].toString() + "\n";
            }
        } else {
            ret += "NULL";
        }
        return ret;