예제 #1
0
    int BlockWriteCompleteMessage::build(char* data, int32_t len)
    {
      if (block_info_ == NULL)
      {
        return TFS_ERROR;
      }

      if (set_int64(&data, &len, server_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_object(&data, &len, block_info_, BLOCKINFO_SIZE) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, lease_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, write_complete_status_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, unlink_flag_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      return TFS_SUCCESS;
    }
 int AccessStatInfoMessage::set_counter_map(char** data, int32_t* len, const COUNTER_TYPE & map, int32_t from_row,
     int32_t return_row, int32_t size)
 {
   if (set_int32(data, len, size) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (size <= 0)
   {
     return TFS_SUCCESS;
   }
   int count = 0;
   COUNTER_TYPE::const_iterator it = map.begin();
   for (; it != map.end(); ++it)
   {
     count++;
     if (count <= from_row)
     {
       continue;
     }
     if (count > from_row + return_row)
     {
       break;
     }
     if (set_int32(data, len, static_cast<int32_t> (it->first)) == TFS_ERROR)
     {
       return TFS_ERROR;
     }
     if (set_object(data, len, reinterpret_cast<void*> (const_cast<Throughput*>(&it->second)), sizeof(Throughput)) == TFS_ERROR)
     {
       return TFS_ERROR;
     }
   }
   return TFS_SUCCESS;
 }
예제 #3
0
    int SetDataserverMessage::build(char* data, int32_t len)
    {
      if (ds_ == NULL)
      {
        return TFS_ERROR;
      }

      if (set_object(&data, &len, reinterpret_cast<void**> (ds_), sizeof(DataServerStatInfo))
          == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, has_block_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (has_block_)
      {
        // size
        int32_t size = blocks_.size();
        if (set_int32(&data, &len, size) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
        for (int32_t i = 0; i < size; i++)
        {
          if (set_object(&data, &len, &(blocks_.at(i)), BLOCKINFO_SIZE) == TFS_ERROR)
          {
            return TFS_ERROR;
          }
        }
      }
      return TFS_SUCCESS;
    }
 int CompactBlockCompleteMessage::build(char* data, int32_t len)
 {
   if (block_info_ == NULL)
   {
     return TFS_ERROR;
   }
   if (set_int32(&data, &len, block_id_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_int32(&data, &len, success_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_int64(&data, &len, server_id_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_int32(&data, &len, flag_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_vint64(&data, &len, ds_list_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_object(&data, &len, block_info_, BLOCKINFO_SIZE) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   return TFS_SUCCESS;
 }
    int ReplicateInfoMessage::set_counter_map(char** data, int32_t* len, const COUNTER_TYPE & map, int32_t size)
    {

      if (set_int32(data, len, size) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      for (COUNTER_TYPE::const_iterator it = map.begin(); it != map.end(); ++it)
      {
        if (set_int64(data, len, static_cast<int64_t> (it->first)) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
        if (set_int32(data, len, static_cast<int32_t> (it->second)) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
        size--;
        if (size <= 0)
        {
          break;
        }
      }
      return TFS_SUCCESS;
    }
    int ReplicateInfoMessage::build(char* data, int32_t len)
    {
      int32_t size = replicating_map_.size();
      if (set_int32(&data, &len, size) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      for (REPL_BLOCK_MAP::const_iterator it = replicating_map_.begin(); it != replicating_map_.end(); ++it)
      {
        if (set_int32(&data, &len, static_cast<int32_t> (it->first)) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
        if (set_object(&data, &len, reinterpret_cast<void*> (const_cast<ReplBlock*>(&it->second)), sizeof(ReplBlock)) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }
      if (set_counter_map(&data, &len, source_ds_counter_, source_ds_counter_.size()))
      {
        return TFS_ERROR;
      }
      if (set_counter_map(&data, &len, dest_ds_counter_, dest_ds_counter_.size()))
      {
        return TFS_ERROR;
      }
      return TFS_SUCCESS;
    }
예제 #7
0
    int RespListBlockMessage::build(char* data, int32_t len)
    {
      int32_t size;
      if (set_int32(&data, &len, status_type_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      if (status_type_ & LB_BLOCK)
      {
        if (set_vint32(&data, &len, blocks_) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }

      if (status_type_ & LB_PAIRS)
      {
        map<uint32_t, vector<uint32_t> >::iterator mit;
        size = block_pairs_.size();
        if (set_int32(&data, &len, size) == TFS_ERROR)
        {
          return TFS_ERROR;
        }

        for (mit = block_pairs_.begin(); mit != block_pairs_.end(); mit++)
        {
          if (set_int32(&data, &len, mit->first) == TFS_ERROR)
          {
            return TFS_ERROR;
          }
          if (set_vint32(&data, &len, mit->second) == TFS_ERROR)
          {
            return TFS_ERROR;
          }
        }
      }

      if (status_type_ & LB_INFOS)
      {
        map<uint32_t, BlockInfo*>::iterator mit;
        size = block_infos_.size();
        if (set_int32(&data, &len, size) == TFS_ERROR)
        {
          return TFS_ERROR;
        }

        for (mit = block_infos_.begin(); mit != block_infos_.end(); mit++)
        {
          if (set_object(&data, &len, mit->second, BLOCKINFO_SIZE) == TFS_ERROR)
          {
            return TFS_ERROR;
          }
        }
      }

      return TFS_SUCCESS;
    }
예제 #8
0
    int UpdateBlockInfoMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, block_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      if (set_int64(&data, &len, server_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      int32_t have_block = 0;
      if (block_info_ != NULL)
      {
        have_block = 1;
      }
      if (set_int32(&data, &len, have_block) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (block_info_ != NULL)
      {
        if (set_object(&data, &len, block_info_, BLOCKINFO_SIZE) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }

      if (set_int32(&data, &len, repair_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      // SdbmStat
      int32_t have_sdbm = 0;
      if (db_stat_ != NULL)
      {
        have_sdbm = 1;
      }
      if (set_int32(&data, &len, have_sdbm) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (db_stat_ != NULL)
      {
        if (set_object(&data, &len, db_stat_, sizeof(SdbmStat)) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }

      return TFS_SUCCESS;
    }
    int RenameFileMessage::build(char* data, int32_t len)
    {
      if (has_lease_ == true)
      {
        ds_.push_back(ULONG_LONG_MAX);
        ds_.push_back(static_cast<uint64_t> (version_));
        ds_.push_back(static_cast<uint64_t> (lease_id_));
      }

      if (set_object(&data, &len, &rename_file_info_, sizeof(RenameFileInfo)) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_vint64(&data, &len, ds_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, option_flag_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      has_lease_ = parse_special_ds(ds_, version_, lease_id_);

      return TFS_SUCCESS;
    }
예제 #10
0
파일: vlsctlc.c 프로젝트: stiartsly/vdht
static
int _vlsctlc_pack_cmd_bogus_query(struct vlsctlc* lsctlc, void* buf, int len)
{
    struct bogus_query_args* args = &lsctlc->args.bogus_query_args;
    void* len_addr = NULL;
    int tsz = 0;
    int bsz = 0;
    int ret = 0;

    vassert(lsctlc);
    vassert(buf);
    vassert(len > 0);

    if (lsctlc->bound_cmd != VLSCTL_BOGUS_QUERY) {
        return 0;
    }
    set_uint16(buf + tsz, lsctlc->bound_cmd);
    tsz += sizeof(uint16_t);
    set_uint16(len_addr = buf + tsz, 0);
    tsz += sizeof(uint16_t);

    set_int32(buf + tsz, args->queryId);
    bsz += sizeof(int32_t);
    tsz += sizeof(int32_t);

    ret = _aux_vlsctlc_pack_addr(buf + tsz, len - tsz, &args->addr);
    bsz += ret;
    tsz += ret;

    set_uint16(len_addr, bsz);
    return tsz;
}
 int GetServerStatusMessage::build(char* data, int32_t len)
 {
   if (set_int32(&data, &len, status_type_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_int32(&data, &len, from_row_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_int32(&data, &len, return_row_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   return TFS_SUCCESS;
 }
예제 #12
0
/*
 * bus-local address, i.e. "$slot" or "$slot.$fn"
 */
static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
                          const char *name, Error **errp)
{
    DeviceState *dev = DEVICE(obj);
    Property *prop = opaque;
    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
    unsigned int slot, fn, n;
    Error *local_err = NULL;
    char *str = (char *)"";

    if (dev->state != DEV_STATE_CREATED) {
        error_set(errp, QERR_PERMISSION_DENIED);
        return;
    }

    visit_type_str(v, &str, name, &local_err);
    if (local_err) {
        return set_int32(obj, v, opaque, name, errp);
    }

    if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) {
        fn = 0;
        if (sscanf(str, "%x%n", &slot, &n) != 1) {
            goto invalid;
        }
    }
    if (str[n] != '\0' || fn > 7 || slot > 31) {
        goto invalid;
    }
    *ptr = slot << 3 | fn;
    return;

invalid:
    error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
}
예제 #13
0
 int ListBlockMessage::build(char* data, int32_t len)
 {
   if (set_int32(&data, &len, type_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   return TFS_SUCCESS;
 }
    int CompactBlockMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, preserve_time_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, block_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, is_owner_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      return TFS_SUCCESS;
    }
예제 #15
0
    int GetBlockInfoMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, mode_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, block_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_vint64(&data, &len, fail_server_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      return TFS_SUCCESS;
    }
예제 #16
0
    int WriteInfoBatchMessage::build(char* data, int32_t len)
    {
      if (set_object(&data, &len, &write_data_info_, sizeof(WriteDataInfo)) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      int32_t have_block = 0;
      if (block_info_ != NULL)
      {
        have_block = 1;
      }

      if (set_int32(&data, &len, have_block) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (block_info_ != NULL)
      {
        if (set_object(&data, &len, block_info_, BLOCKINFO_SIZE) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }

      int32_t size = meta_list_.size();
      if (set_int32(&data, &len, size) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      int32_t i = 0;
      for (i = 0; i < size; i++)
      {
        if (set_object(&data, &len, &(meta_list_.at(i)), RAW_META_SIZE) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }

      if (set_int32(&data, &len, cluster_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      return TFS_SUCCESS;
    }
예제 #17
0
void
test_int32_to_geo_point_invalid(void)
{
  grn_obj_reinit(&context, &dest, GRN_DB_WGS84_GEO_POINT, 0);
  set_int32(1);
  grn_test_assert_equal_rc(GRN_INVALID_ARGUMENT,
                           grn_obj_cast(&context, &src, &dest, GRN_FALSE));
}
예제 #18
0
    int RespWriteDataMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, length_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      return TFS_SUCCESS;
    }
예제 #19
0
    int ResetBlockVersionMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, block_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      return TFS_SUCCESS;
    }
 int SetServerStatusMessage::set_int_map(char** data, int32_t* len, std::set<uint32_t>* map, int32_t size)
 {
   if (set_int32(data, len, size) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   std::set<uint32_t>::iterator it = map->begin();
   for ( ;it != map->end(); it++)
   {
     if (set_int32(data, len, *it) == TFS_ERROR)
     {
       return TFS_ERROR;
     }
     size--;
     if (size <= 0)
     {
       break;
     }
   }
   return TFS_SUCCESS;
 }
예제 #21
0
    int RespHeartMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, status_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_int32(&data, &len, sync_mirror_status_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_vint32(&data, &len, expire_blocks_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_vint32(&data, &len, new_blocks_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      return TFS_SUCCESS;
    }
예제 #22
0
    int RespListBitMapMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, uuse_len_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      if (set_int32(&data, &len, ubitmap_len_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      if (ubitmap_len_ > 0)
      {
        if (set_object(&data, &len, data_, ubitmap_len_) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }
      return TFS_SUCCESS;
    }
예제 #23
0
 int BlockFileInfoMessage::build(char* data, int32_t len)
 {
   if (set_int32(&data, &len, block_id_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   int32_t size = fileinfo_list_.size();
   if (set_int32(&data, &len, size) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   int32_t i = 0;
   for (i = 0; i < size; i++)
   {
     FileInfo* file_info = fileinfo_list_[i];
     if (set_object(&data, &len, reinterpret_cast<void*> (file_info), FILEINFO_SIZE) == TFS_ERROR)
     {
       return TFS_ERROR;
     }
   }
   return TFS_SUCCESS;
 }
예제 #24
0
    int BlockRawMetaMessage::build(char* data, int32_t len)
    {
      if (set_int32(&data, &len, block_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      int32_t size = raw_meta_list_.size();
      if (set_int32(&data, &len, size) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      int32_t i = 0;
      for (i = 0; i < size; i++)
      {
        RawMeta raw_meta = raw_meta_list_[i];
        if (set_object(&data, &len, reinterpret_cast<void*> (&raw_meta), RAW_META_SIZE) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }

      return TFS_SUCCESS;
    }
예제 #25
0
    int WriteRawDataMessage::build(char* data, int32_t len)
    {
      if (set_object(&data, &len, &write_data_info_, sizeof(WriteDataInfo)) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      if (write_data_info_.length_ > 0)
      {
        if (set_object(&data, &len, data_, write_data_info_.length_) == TFS_ERROR)
        {
          return TFS_ERROR;
        }
      }

      if (set_int32(&data, &len, flag_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      return TFS_SUCCESS;
    }
예제 #26
0
    int SetBlockInfoMessage::build(char* data, int32_t len)
    {
      if ((has_lease_ == true) && (ds_.size() > 0))
      {
        ds_.push_back(ULONG_LONG_MAX);
        ds_.push_back(static_cast<uint64_t> (version_));
        ds_.push_back(static_cast<uint64_t> (lease_));
      }

      if (set_int32(&data, &len, block_id_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }
      if (set_vint64(&data, &len, ds_) == TFS_ERROR)
      {
        return TFS_ERROR;
      }

      // reparse, avoid push verion&lease again when clone twice;
      has_lease_ = parse_special_ds(ds_, version_, lease_);
      return TFS_SUCCESS;
    }
예제 #27
0
파일: vlsctlc.c 프로젝트: stiartsly/vdht
static
int _vlsctlc_pack_cmd_post_service(struct vlsctlc* lsctlc, void* buf, int len)
{
    struct post_service_args* args = &lsctlc->args.post_service_args;
    void* len_addr = NULL;
    int tsz = 0;
    int bsz = 0;
    int ret = 0;
    int i = 0;

    vassert(lsctlc);
    vassert(buf);
    vassert(len > 0);

    if (lsctlc->bound_cmd != VLSCTL_POST_SERVICE) {
        return 0;
    }
    set_uint16(buf + tsz, lsctlc->bound_cmd);
    tsz += sizeof(uint16_t);
    set_uint16(len_addr = buf + tsz, 0);
    tsz += sizeof(uint16_t);

    memcpy(buf + tsz, &args->hash, sizeof(vsrvcHash));
    bsz += sizeof(vsrvcHash);
    tsz += sizeof(vsrvcHash);

    set_int32(buf + tsz, args->proto);
    bsz += sizeof(int32_t);
    tsz += sizeof(int32_t);

    for (i = 0; i < args->naddrs; i++) {
        ret = _aux_vlsctlc_pack_vaddr(buf + tsz, len - tsz, &args->addrs[i]);
        bsz += ret;
        tsz += ret;
    }
    set_uint16(len_addr, bsz);
    return tsz;
}
 int AccessStatInfoMessage::build(char* data, int32_t len)
 {
   int32_t size = stats_.size();
   size -= from_row_;
   if (size < 0)
   {
     size = 0;
   }
   if (size > return_row_)
   {
     has_next_ = 1;
     size = return_row_;
   }
   if (set_int32(&data, &len, has_next_) == TFS_ERROR)
   {
     return TFS_ERROR;
   }
   if (set_counter_map(&data, &len, stats_, from_row_, return_row_, size))
   {
     return TFS_ERROR;
   }
   return TFS_SUCCESS;
 }
예제 #29
0
OM_uint32 GSSAPI_CALLCONV
_gsskrb5_set_sec_context_option
           (OM_uint32 *minor_status,
            gss_ctx_id_t *context_handle,
            const gss_OID desired_object,
            const gss_buffer_t value)
{
    krb5_context context;
    OM_uint32 maj_stat;

    GSSAPI_KRB5_INIT (&context);

    if (value == GSS_C_NO_BUFFER) {
	*minor_status = EINVAL;
	return GSS_S_FAILURE;
    }

    if (gss_oid_equal(desired_object, GSS_KRB5_COMPAT_DES3_MIC_X)) {
	gsskrb5_ctx ctx;
	int flag;

	if (*context_handle == GSS_C_NO_CONTEXT) {
	    *minor_status = EINVAL;
	    return GSS_S_NO_CONTEXT;
	}

	maj_stat = get_bool(minor_status, value, &flag);
	if (maj_stat != GSS_S_COMPLETE)
	    return maj_stat;

	ctx = (gsskrb5_ctx)*context_handle;
	HEIMDAL_MUTEX_lock(&ctx->ctx_id_mutex);
	if (flag)
	    ctx->more_flags |= COMPAT_OLD_DES3;
	else
	    ctx->more_flags &= ~COMPAT_OLD_DES3;
	ctx->more_flags |= COMPAT_OLD_DES3_SELECTED;
	HEIMDAL_MUTEX_unlock(&ctx->ctx_id_mutex);
	return GSS_S_COMPLETE;
    } else if (gss_oid_equal(desired_object, GSS_KRB5_SET_DNS_CANONICALIZE_X)) {
	int flag;

	maj_stat = get_bool(minor_status, value, &flag);
	if (maj_stat != GSS_S_COMPLETE)
	    return maj_stat;

	krb5_set_dns_canonicalize_hostname(context, flag);
	return GSS_S_COMPLETE;

    } else if (gss_oid_equal(desired_object, GSS_KRB5_REGISTER_ACCEPTOR_IDENTITY_X)) {
	char *str;

	maj_stat = get_string(minor_status, value, &str);
	if (maj_stat != GSS_S_COMPLETE)
	    return maj_stat;

	maj_stat = _gsskrb5_register_acceptor_identity(minor_status, str);
	free(str);

	return maj_stat;

    } else if (gss_oid_equal(desired_object, GSS_KRB5_SET_DEFAULT_REALM_X)) {
	char *str;

	maj_stat = get_string(minor_status, value, &str);
	if (maj_stat != GSS_S_COMPLETE)
	    return maj_stat;
	if (str == NULL) {
	    *minor_status = 0;
	    return GSS_S_CALL_INACCESSIBLE_READ;
	}

	krb5_set_default_realm(context, str);
	free(str);

	*minor_status = 0;
	return GSS_S_COMPLETE;

    } else if (gss_oid_equal(desired_object, GSS_KRB5_SEND_TO_KDC_X)) {

	*minor_status = EINVAL;
	return GSS_S_FAILURE;

    } else if (gss_oid_equal(desired_object, GSS_KRB5_CCACHE_NAME_X)) {
	char *str;

	maj_stat = get_string(minor_status, value, &str);
	if (maj_stat != GSS_S_COMPLETE)
	    return maj_stat;
	if (str == NULL) {
	    *minor_status = 0;
	    return GSS_S_CALL_INACCESSIBLE_READ;
	}

	*minor_status = krb5_cc_set_default_name(context, str);
	free(str);
	if (*minor_status)
	    return GSS_S_FAILURE;

	return GSS_S_COMPLETE;
    } else if (gss_oid_equal(desired_object, GSS_KRB5_SET_TIME_OFFSET_X)) {
	OM_uint32 offset;
	time_t t;

	maj_stat = get_int32(minor_status, value, &offset);
	if (maj_stat != GSS_S_COMPLETE)
	    return maj_stat;

	t = time(NULL) + offset;

	krb5_set_real_time(context, t, 0);

	*minor_status = 0;
	return GSS_S_COMPLETE;
    } else if (gss_oid_equal(desired_object, GSS_KRB5_GET_TIME_OFFSET_X)) {
	krb5_timestamp sec;
	int32_t usec;
	time_t t;

	t = time(NULL);

	krb5_us_timeofday (context, &sec, &usec);

	maj_stat = set_int32(minor_status, value, sec - t);
	if (maj_stat != GSS_S_COMPLETE)
	    return maj_stat;

	*minor_status = 0;
	return GSS_S_COMPLETE;
    } else if (gss_oid_equal(desired_object, GSS_KRB5_PLUGIN_REGISTER_X)) {
	struct gsskrb5_krb5_plugin c;

	if (value->length != sizeof(c)) {
	    *minor_status = EINVAL;
	    return GSS_S_FAILURE;
	}
	memcpy(&c, value->value, sizeof(c));
	krb5_plugin_register(context, c.type, c.name, c.symbol);

	*minor_status = 0;
	return GSS_S_COMPLETE;
    }

    *minor_status = EINVAL;
    return GSS_S_FAILURE;
}
예제 #30
0
 int HeartBeatAndNSHeartMessage::build(char* data, int32_t len)
 {
   return set_int32(&data, &len, flags_);
 }