Example #1
0
 void decode_header(NdrBuffer buf) throws NdrException {
   /* RPC major / minor version */
   if (buf.dec_ndr_small() != 5 || buf.dec_ndr_small() != 0)
     throw new NdrException("DCERPC version not supported");
   ptype = buf.dec_ndr_small();
   flags = buf.dec_ndr_small();
   if (buf.dec_ndr_long() != 0x00000010) /* Little-endian / ASCII / IEEE */
     throw new NdrException("Data representation not supported");
   length = buf.dec_ndr_short();
   if (buf.dec_ndr_short() != 0) throw new NdrException("DCERPC authentication not supported");
   call_id = buf.dec_ndr_long();
 }
Example #2
0
    public void decode(NdrBuffer _src) throws NdrException {
      _src.align(4);
      int _netnamep = _src.dec_ndr_long();
      type = (int) _src.dec_ndr_long();
      int _remarkp = _src.dec_ndr_long();
      permissions = (int) _src.dec_ndr_long();
      max_uses = (int) _src.dec_ndr_long();
      current_uses = (int) _src.dec_ndr_long();
      int _pathp = _src.dec_ndr_long();
      int _passwordp = _src.dec_ndr_long();
      sd_size = (int) _src.dec_ndr_long();
      int _security_descriptorp = _src.dec_ndr_long();

      if (_netnamep != 0) {
        _src = _src.deferred;
        netname = _src.dec_ndr_string();
      }
      if (_remarkp != 0) {
        _src = _src.deferred;
        remark = _src.dec_ndr_string();
      }
      if (_pathp != 0) {
        _src = _src.deferred;
        path = _src.dec_ndr_string();
      }
      if (_passwordp != 0) {
        _src = _src.deferred;
        password = _src.dec_ndr_string();
      }
      if (_security_descriptorp != 0) {
        _src = _src.deferred;
        int _security_descriptors = _src.dec_ndr_long();
        int _security_descriptori = _src.index;
        _src.advance(1 * _security_descriptors);

        if (security_descriptor == null) {
          if (_security_descriptors < 0 || _security_descriptors > 0xFFFF)
            throw new NdrException(NdrException.INVALID_CONFORMANCE);
          security_descriptor = new byte[_security_descriptors];
        }
        _src = _src.derive(_security_descriptori);
        for (int _i = 0; _i < _security_descriptors; _i++) {
          security_descriptor[_i] = (byte) _src.dec_ndr_small();
        }
      }
    }