Next: Cryptographic Functions, Previous: Authenticator Functions, Up: Programming Manual
The “KRB-ERROR” is an ASN.1 structure that can be returned, instead of, e.g., KDC-REP or AP-REP, to indicate various error conditions. Unfortunately, the semantics of several of the fields are ill specified, so the typically procedure is to extract “e-text” and/or “e-data” and show it to the user. The following illustrates the KRB-ERROR ASN.1 structure.
KRB-ERROR ::= [APPLICATION 30] SEQUENCE { pvno [0] INTEGER (5), msg-type [1] INTEGER (30), ctime [2] KerberosTime OPTIONAL, cusec [3] Microseconds OPTIONAL, stime [4] KerberosTime, susec [5] Microseconds, error-code [6] Int32, crealm [7] Realm OPTIONAL, cname [8] PrincipalName OPTIONAL, realm [9] Realm -- service realm --, sname [10] PrincipalName -- service name --, e-text [11] KerberosString OPTIONAL, e-data [12] OCTET STRING OPTIONAL }
handle: shishi handle as allocated by
shishi_init()
.This function creates a new KRB-ERROR, populated with some default values.
Return value: Returns the KRB-ERROR or NULL on failure.
handle: shishi handle as allocated by
shishi_init()
.fh: file handle open for writing.
krberror: KRB-ERROR to print.
Print ASCII armored DER encoding of KRB-ERROR to file.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.fh: file handle open for writing.
krberror: KRB-ERROR to save.
Save DER encoding of KRB-ERROR to file.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR to save.
filetype: input variable specifying type of file to be written, see Shishi_filetype.
filename: input variable with filename to write to.
Write KRB-ERROR to file in specified TYPE. The file will be truncated if it exists.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.fh: file handle open for reading.
krberror: output variable with newly allocated KRB-ERROR.
Read ASCII armored DER encoded KRB-ERROR from file and populate given variable.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.fh: file handle open for reading.
krberror: output variable with newly allocated KRB-ERROR.
Read DER encoded KRB-ERROR from file and populate given variable.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: output variable with newly allocated KRB-ERROR.
filetype: input variable specifying type of file to be read, see Shishi_filetype.
filename: input variable with filename to read from.
Read KRB-ERROR from file in specified TYPE.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.Finish KRB-ERROR, called before e.g. shishi_krberror_der. This function removes empty but OPTIONAL fields (such as cname), and
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.out: output array with newly allocated DER encoding of KRB-ERROR.
outlen: length of output array with DER encoding of KRB-ERROR.
DER encode KRB-ERROR. The caller must deallocate the OUT buffer.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.realm: output array with newly allocated name of realm in KRB-ERROR.
realmlen: size of output array.
Extract client realm from KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.Remove client realm field in KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.crealm: input array with realm.
Set realm field in krberror to specified value.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.client: pointer to newly allocated zero terminated string containing principal name. May be
NULL
(to only populateclientlen
).clientlen: pointer to length of
client
on output, excluding terminating zero. May beNULL
(to only populateclient
).Return client principal name in KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.name_type: type of principial, see Shishi_name_type, usually SHISHI_NT_UNKNOWN.
cname: input array with principal name.
Set principal field in krberror to specified value.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.Remove client realm field in KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror to set client name field in.
client: zero-terminated string with principal name on RFC 1964 form.
Set the client name field in the Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.realm: output array with newly allocated name of realm in KRB-ERROR.
realmlen: size of output array.
Extract (server) realm from KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.realm: input array with (server) realm.
Set (server) realm field in krberror to specified value.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.server: pointer to newly allocated zero terminated string containing server name. May be
NULL
(to only populateserverlen
).serverlen: pointer to length of
server
on output, excluding terminating zero. May beNULL
(to only populateserver
).Return server principal name in KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror to set server name field in.
Remove server name field in KRB-ERROR. (Since it is not marked OPTIONAL in the ASN.1 profile, what is done is to set the name-type to UNKNOWN and make sure the name-string sequence is empty.)
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.name_type: type of principial, see Shishi_name_type, usually SHISHI_NT_UNKNOWN.
sname: input array with principal name.
Set principal field in krberror to specified value.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror to set server name field in.
server: zero-terminated string with principal name on RFC 1964 form.
Set the server name field in the Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror to set client name field in.
t: newly allocated zero-terminated output array with client time.
Extract client time from KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror as allocated by
shishi_krberror()
.t: string with generalized time value to store in Krberror.
Store client time in Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror as allocated by
shishi_krberror()
.Remove client time field in Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror as allocated by
shishi_krberror()
.cusec: output integer with client microseconds field.
Extract client microseconds field from Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.cusec: client microseconds to set in krberror, 0-999999.
Set the cusec field in the Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror as allocated by
shishi_krberror()
.Remove client usec field in Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror to set client name field in.
t: newly allocated zero-terminated output array with server time.
Extract server time from KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror as allocated by
shishi_krberror()
.t: string with generalized time value to store in Krberror.
Store server time in Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: Krberror as allocated by
shishi_krberror()
.susec: output integer with server microseconds field.
Extract server microseconds field from Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.susec: server microseconds to set in krberror, 0-999999.
Set the susec field in the Krberror.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR structure with error code.
errorcode: output integer KRB-ERROR error code.
Extract error code from KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR structure with error code.
Get error code from KRB-ERROR, without error checking.
Return value: Return error code (see
shishi_krberror_errorcode()
) directly, or -1 on error.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR structure with error code to set.
errorcode: new error code to set in krberror.
Set the error-code field to a new error code.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR structure with error code.
etext: output array with newly allocated error text.
etextlen: output length of error text.
Extract additional error text from server (possibly empty).
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.etext: input array with error text to set.
Set error text (e-text) field in KRB-ERROR to specified value.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.Remove error text (e-text) field in KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR structure with error code.
edata: output array with newly allocated error data.
edatalen: output length of error data.
Extract additional error data from server (possibly empty).
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR structure with error code.
methoddata: output ASN.1 METHOD-DATA.
Extract METHOD-DATA ASN.1 object from the e-data field. The e-data field will only contain a METHOD-DATA if the krberror error code is
SHISHI_KDC_ERR_PREAUTH_REQUIRED
.Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.edata: input array with error text to set.
Set error text (e-data) field in KRB-ERROR to specified value.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.krberror: krberror as allocated by
shishi_krberror()
.Remove error text (e-data) field in KRB-ERROR.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.fh: file handle opened for writing.
krberror: KRB-ERROR structure with error code.
Print KRB-ERROR error condition and some explanatory text to file descriptor.
Return value: Returns SHISHI_OK iff successful.
handle: shishi handle as allocated by
shishi_init()
.errorcode: integer KRB-ERROR error code.
Get human readable string describing KRB-ERROR code.
Return value: Return a string describing error code. This function will always return a string even if the error code isn't known.
handle: shishi handle as allocated by
shishi_init()
.krberror: KRB-ERROR structure with error code.
Extract error code (see
shishi_krberror_errorcode_fast()
) and return error message (seeshishi_krberror_errorcode_message()
).Return value: Return a string describing error code. This function will always return a string even if the error code isn't known.