コード例 #1
0
ファイル: kdcreq.c プロジェクト: Jactry/shishi
/**
 * shishi_kdcreq_add_padata:
 * @handle: shishi handle as allocated by shishi_init().
 * @kdcreq: KDC-REQ to add PA-DATA to.
 * @padatatype: type of PA-DATA, see Shishi_padata_type.
 * @data: input array with PA-DATA value.
 * @datalen: size of input array with PA-DATA value.
 *
 * Add new pre authentication data (PA-DATA) to KDC-REQ.  This is used
 * to pass various information to KDC, such as in case of a
 * SHISHI_PA_TGS_REQ padatatype the AP-REQ that authenticates the user
 * to get the ticket.  (But also see shishi_kdcreq_add_padata_tgs()
 * which takes an AP-REQ directly.)
 *
 * Return value: Returns SHISHI_OK iff successful.
 **/
int
shishi_kdcreq_add_padata (Shishi * handle,
                          Shishi_asn1 kdcreq,
                          int padatatype, const char *data, size_t datalen)
{
    char *format;
    int res;
    size_t i;

    res = shishi_asn1_write (handle, kdcreq, "padata", "NEW", 1);
    if (res != SHISHI_OK)
        return res;

    res = shishi_asn1_number_of_elements (handle, kdcreq, "padata", &i);
    if (res != SHISHI_OK)
        return res;

    asprintf (&format, "padata.?%zu.padata-value", i);
    res = shishi_asn1_write (handle, kdcreq, format, data, datalen);
    free (format);
    if (res != SHISHI_OK)
        return res;

    asprintf (&format, "padata.?%zu.padata-type", i);
    res = shishi_asn1_write_uint32 (handle, kdcreq, format, padatatype);
    free (format);
    if (res != SHISHI_OK)
        return res;

    return SHISHI_OK;
}
コード例 #2
0
ファイル: kdcreq.c プロジェクト: Jactry/shishi
/**
 * shishi_kdcreq_nonce_set:
 * @handle: shishi handle as allocated by shishi_init().
 * @kdcreq: KDC-REQ variable to set client name field in.
 * @nonce: integer nonce to store in KDC-REQ.
 *
 * Store nonce number field in KDC-REQ.
 *
 * Return value: Returns %SHISHI_OK iff successful.
 **/
int
shishi_kdcreq_nonce_set (Shishi * handle, Shishi_asn1 kdcreq, uint32_t nonce)
{
    int res;

    res = shishi_asn1_write_uint32 (handle, kdcreq, "req-body.nonce", nonce);
    if (res != SHISHI_OK)
        return res;

    return SHISHI_OK;
}
コード例 #3
0
ファイル: authenticator.c プロジェクト: Jactry/shishi
/**
 * shishi_authenticator_cusec_set:
 * @handle: shishi handle as allocated by shishi_init().
 * @authenticator: authenticator as allocated by shishi_authenticator().
 * @cusec: client microseconds to set in authenticator, 0-999999.
 *
 * Set the cusec field in the Authenticator.
 *
 * Return value: Returns SHISHI_OK iff successful.
 **/
int
shishi_authenticator_cusec_set (Shishi * handle,
                                Shishi_asn1 authenticator, uint32_t cusec)
{
    int res;

    res = shishi_asn1_write_uint32 (handle, authenticator, "cusec", cusec);
    if (res != SHISHI_OK)
        return res;

    return SHISHI_OK;
}
コード例 #4
0
ファイル: encapreppart.c プロジェクト: dmr0605/Kerberos
/**
 * shishi_encapreppart_seqnumber_set:
 * @handle: shishi handle as allocated by shishi_init().
 * @encapreppart: encapreppart as allocated by shishi_encapreppart().
 * @seqnumber: integer with sequence number field to store in encapreppart.
 *
 * Store sequence number field in EncAPRepPart.
 *
 * Return value: Returns %SHISHI_OK iff successful.
 **/
int
shishi_encapreppart_seqnumber_set (Shishi * handle,
				   Shishi_asn1 encapreppart,
				   uint32_t seqnumber)
{
  int res;

  res = shishi_asn1_write_uint32 (handle, encapreppart,
				  "seq-number", seqnumber);
  if (res != SHISHI_OK)
    return res;

  return SHISHI_OK;
}
コード例 #5
0
ファイル: authenticator.c プロジェクト: Jactry/shishi
/**
 * shishi_authenticator_seqnumber_set:
 * @handle: shishi handle as allocated by shishi_init().
 * @authenticator: authenticator as allocated by shishi_authenticator().
 * @seqnumber: integer with sequence number field to store in Authenticator.
 *
 * Store sequence number field in Authenticator.
 *
 * Return value: Returns %SHISHI_OK iff successful.
 **/
int
shishi_authenticator_seqnumber_set (Shishi * handle,
                                    Shishi_asn1 authenticator,
                                    uint32_t seqnumber)
{
    int res;

    res = shishi_asn1_write_uint32 (handle, authenticator,
                                    "seq-number", seqnumber);
    if (res != SHISHI_OK)
        return res;

    return SHISHI_OK;
}
コード例 #6
0
ファイル: encticketpart.c プロジェクト: Jactry/shishi
/**
 * shishi_encticketpart_cname_set:
 * @handle: shishi handle as allocated by shishi_init().
 * @encticketpart: input EncTicketPart variable.
 * @name_type: type of principial, see Shishi_name_type, usually
 *             SHISHI_NT_UNKNOWN.
 * @principal: input array with principal name.
 *
 * Set the client name field in the EncTicketPart.
 *
 * Return value: Returns SHISHI_OK iff successful.
 **/
int
shishi_encticketpart_cname_set (Shishi * handle,
				Shishi_asn1 encticketpart,
				Shishi_name_type name_type,
				const char *principal)
{
  int res;

  res = shishi_principal_set (handle, encticketpart, "cname", principal);
  if (res != SHISHI_OK)
    return res;

  res = shishi_asn1_write_uint32 (handle, encticketpart,
				  "cname.name-type", name_type);
  if (res != SHISHI_OK)
    return res;

  return SHISHI_OK;
}
コード例 #7
0
ファイル: encticketpart.c プロジェクト: Jactry/shishi
/**
 * shishi_encticketpart_key_set:
 * @handle: shishi handle as allocated by shishi_init().
 * @encticketpart: input EncTicketPart variable.
 * @key: key handle with information to store in encticketpart.
 *
 * Set the EncTicketPart.key field to key type and value of supplied
 * key.
 *
 * Return value: Returns %SHISHI_OK iff successful.
 **/
int
shishi_encticketpart_key_set (Shishi * handle,
			      Shishi_asn1 encticketpart, Shishi_key * key)
{
  int res;
  int keytype;

  keytype = shishi_key_type (key);
  res = shishi_asn1_write_uint32 (handle, encticketpart,
				  "key.keytype", keytype);
  if (res != SHISHI_OK)
    return res;

  res = shishi_asn1_write (handle, encticketpart, "key.keyvalue",
			   shishi_key_value (key), shishi_key_length (key));
  if (res != SHISHI_OK)
    return res;

  return SHISHI_OK;
}