@Override public String getDomainName () { if ( this.origin_server != null ) resolveWeak(); if ( this.type == SID_TYPE_UNKNOWN ) { String full = toString(); return full.substring(0, full.length() - getAccountName().length() - 1); } return this.domainName; }
void resolveWeak() { if (origin_server != null) { try { resolve(origin_server, origin_auth); } catch(IOException ioe) { } finally { origin_server = null; origin_auth = null; } } }
@Override public String toDisplayString () { if ( this.origin_server != null ) resolveWeak(); if ( this.domainName != null ) { String str; if ( this.type == SID_TYPE_DOMAIN ) { str = this.domainName; } else if ( this.type == SID_TYPE_WKN_GRP || this.domainName.equals("BUILTIN") ) { if ( this.type == SID_TYPE_UNKNOWN ) { str = toString(); } else { str = this.acctName; } } else { str = this.domainName + "\\" + this.acctName; } return str; } return toString(); }
NtlmPasswordAuthentication auth, int flags) throws IOException { SID domsid = SID.getServerSid(authorityServerName, auth); DcerpcHandle handle = null; SamrPolicyHandle policyHandle = null; samr.SamrSamEntry entry = rpc.sam.entries[ei]; SID[] mems = SID.getGroupMemberSids0(handle, domainHandle, domsid, entry.idx, flags); SID groupSid = new SID(domsid, entry.idx); groupSid.type = SID_TYPE_ALIAS; groupSid.domainName = domsid.getDomainName(); groupSid.acctName = (new UnicodeString(entry.name, false)).toString();
SamrPolicyHandle policyHandle = null; SamrDomainHandle domainHandle = null; SID domsid = getDomainSid(); policyHandle = new SamrPolicyHandle(handle, authorityServerName, 0x00000030); domainHandle = new SamrDomainHandle(handle, policyHandle, 0x00000200, domsid); return SID.getGroupMemberSids0(handle, domainHandle, domsid, getRid(), flags); } finally {
public SID readId () throws IOException, PACDecodingException { byte[] bytes = new byte[4]; readFully(bytes); byte[] sidBytes = new byte[8 + bytes.length]; sidBytes[ 0 ] = 1; sidBytes[ 1 ] = (byte) ( bytes.length / 4 ); System.arraycopy(new byte[] { 0, 0, 0, 0, 0, 5 }, 0, sidBytes, 2, 6); System.arraycopy(bytes, 0, sidBytes, 8, bytes.length); return new SID(sidBytes, 0); }
@Override public String getTypeText () { if ( this.origin_server != null ) resolveWeak(); return SID_TYPE_NAMES[ this.type ]; }
sids[i] = new SID(rpc.sids.sids[i].sid, 0, null, SID.resolveSids(origin_server, origin_auth, sids);
/** * Get members of the group represented by this SID, if it is one. * * @param authorityServerName * @param tc * @param flags * @return the members of the group * @throws IOException */ public jcifs.SID[] getGroupMemberSids ( String authorityServerName, CIFSContext tc, int flags ) throws IOException { if ( this.type != SID_TYPE_DOM_GRP && this.type != SID_TYPE_ALIAS ) return new SID[0]; return tc.getSIDResolver().getGroupMemberSids(tc, authorityServerName, getDomainSid(), getRid(), flags); }
SID groupSid = new SID(domSid, entry.idx); groupSid.type = jcifs.SID.SID_TYPE_ALIAS; groupSid.domainName = domSid.getDomainName(); groupSid.acctName = ( new UnicodeString(entry.name, false) ).toString();
@Override public SID getOwnerGroup ( boolean resolve ) throws IOException { try ( SmbTreeHandleImpl th = ensureTreeConnected() ) { SecurityDescriptor desc = querySecurity(th, SecurityInfo.GROUP_SECURITY_INFO); SID ownerGroup = desc.getOwnerGroupSid(); if ( ownerGroup == null ) { return null; } String server = this.fileLocator.getServerWithDfs(); if ( resolve ) { ownerGroup.resolve(server, getContext()); } else { ownerGroup.initContext(server, getContext()); } return ownerGroup; } }
public int getRid() { if (getType() == SID_TYPE_DOMAIN) throw new IllegalArgumentException("This SID is a domain sid"); return sub_authority[sub_authority_count - 1]; }
/** * Return a string represeting this ACE. * <p> * Note: This function should probably be changed to return SDDL * fragments but currently it does not. */ @Override public String toString () { StringBuffer sb = new StringBuffer(); sb.append(isAllow() ? "Allow " : "Deny "); appendCol(sb, this.sid.toDisplayString(), 25); sb.append(" 0x").append(Hexdump.toHexString(this.access, 8)).append(' '); sb.append(isInherited() ? "Inherited " : "Direct "); appendCol(sb, getApplyToText(), 34); return sb.toString(); } }
NtlmPasswordAuthentication auth, int flags) throws IOException { SID domsid = SID.getServerSid(authorityServerName, auth); DcerpcHandle handle = null; SamrPolicyHandle policyHandle = null; samr.SamrSamEntry entry = rpc.sam.entries[ei]; SID[] mems = SID.getGroupMemberSids0(handle, domainHandle, domsid, entry.idx, flags); SID groupSid = new SID(domsid, entry.idx); groupSid.type = SID_TYPE_ALIAS; groupSid.domainName = domsid.getDomainName(); groupSid.acctName = (new UnicodeString(entry.name, false)).toString();
SamrPolicyHandle policyHandle = null; SamrDomainHandle domainHandle = null; SID domsid = getDomainSid(); policyHandle = new SamrPolicyHandle(handle, authorityServerName, 0x00000030); domainHandle = new SamrDomainHandle(handle, policyHandle, 0x00000200, domsid); return SID.getGroupMemberSids0(handle, domainHandle, domsid, getRid(), flags); } finally {
@Override public String toDisplayString () { if ( this.origin_server != null ) resolveWeak(); if ( this.domainName != null ) { String str; if ( this.type == SID_TYPE_DOMAIN ) { str = this.domainName; } else if ( this.type == SID_TYPE_WKN_GRP || this.domainName.equals("BUILTIN") ) { if ( this.type == SID_TYPE_UNKNOWN ) { str = toString(); } else { str = this.acctName; } } else { str = this.domainName + "\\" + this.acctName; } return str; } return toString(); }
public SID readId () throws IOException, PACDecodingException { byte[] bytes = new byte[4]; readFully(bytes); byte[] sidBytes = new byte[8 + bytes.length]; sidBytes[ 0 ] = 1; sidBytes[ 1 ] = (byte) ( bytes.length / 4 ); System.arraycopy(new byte[] { 0, 0, 0, 0, 0, 5 }, 0, sidBytes, 2, 6); System.arraycopy(bytes, 0, sidBytes, 8, bytes.length); return new SID(sidBytes, 0); }
/** * Return text represeting the SID type suitable for display to * users. Text includes 'User', 'Domain group', 'Local group', etc. */ public String getTypeText() { if (origin_server != null) resolveWeak(); return SID_TYPE_NAMES[type]; }