Esempio n. 1
0
krb5_error_code
k5_asn1_full_encode(const void *rep, const struct atype_info *a,
                    krb5_data **code_out)
{
    size_t len;
    asn1_error_code ret;
    asn1buf *buf = NULL;
    krb5_data *d;

    *code_out = NULL;

    if (rep == NULL)
        return ASN1_MISSING_FIELD;
    ret = asn1buf_create(&buf);
    if (ret)
        return ret;
    ret = encode_atype_and_tag(buf, rep, a, &len);
    if (ret)
        goto cleanup;
    ret = asn12krb5_buf(buf, &d);
    if (ret)
        goto cleanup;
    *code_out = d;
cleanup:
    asn1buf_destroy(&buf);
    return ret;
}
Esempio n. 2
0
krb5_error_code
krb5int_asn1_do_full_encode(const void *rep, krb5_data **code,
                            const struct atype_info *a)
{
    unsigned int length;
    asn1_error_code retval;
    asn1buf *buf = NULL;
    krb5_data *d;

    *code = NULL;

    if (rep == NULL)
        return ASN1_MISSING_FIELD;

    retval = asn1buf_create(&buf);
    if (retval)
        return retval;

    retval = krb5int_asn1_encode_a_thing(buf, rep, a, &length);
    if (retval)
        goto cleanup;
    retval = asn12krb5_buf(buf, &d);
    if (retval)
        goto cleanup;
    *code = d;
cleanup:
    asn1buf_destroy(&buf);
    return retval;
}
Esempio n. 3
0
krb5_error_code encode_krb5_enc_kdc_rep_part(const krb5_enc_kdc_rep_part *rep, krb5_data **code)
{
  asn1_error_code retval;
  asn1buf *buf=NULL;
  unsigned int length, sum=0;

  if(rep == NULL) return ASN1_MISSING_FIELD;

  retval = asn1buf_create(&buf);
  if(retval) return retval;

  retval = asn1_encode_enc_kdc_rep_part(buf,rep,&length);
  if(retval) return retval;
  sum += length;

#ifdef KRB5_ENCKRB5KDCREPPART_COMPAT
  krb5_apptag(26);
#else
  /* XXX WRONG!!! Should use 25 || 26, not the outer KDC_REP tags! */
  if (rep->msg_type == KRB5_AS_REP) { krb5_apptag(ASN1_KRB_AS_REP); }
  else if (rep->msg_type == KRB5_TGS_REP) { krb5_apptag(ASN1_KRB_TGS_REP); }
  else return KRB5_BADMSGTYPE;
#endif
  krb5_cleanup();
}
Esempio n. 4
0
krb5_error_code encode_krb5_authdata(const krb5_authdata **rep, krb5_data **code)
{
  asn1_error_code retval;
  asn1buf *buf=NULL;
  unsigned int length;
  
  if(rep == NULL) return ASN1_MISSING_FIELD;

  retval = asn1buf_create(&buf);
  if(retval) return retval;

  retval = asn1_encode_authorization_data(buf,(const krb5_authdata**)rep,
					  &length);
  if(retval) return retval;

  krb5_cleanup();
}