/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*
* Copyright 1990,1991,2007,2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
*/
/*
* krb5_rd_safe()
*/
#include "k5-int.h"
#include "cleanup.h"
#include "auth_con.h"
/* Solaris Kerberos */
#include "kerberos_dtrace.h"
/*
parses a KRB_SAFE message from inbuf, placing the integrity-protected user
data in *outbuf.
key specifies the key to be used for decryption of the message.
sender_addr and recv_addr specify the full addresses (host and port) of
the sender and receiver.
outbuf points to allocated storage which the caller should free when finished.
returns system errors, integrity errors
*/
static krb5_error_code
const krb5_address *recv_addr,
const krb5_address *sender_addr,
{
if (!krb5_is_krb_safe(inbuf))
return KRB5KRB_AP_ERR_MSG_TYPE;
return retval;
/* Solaris Kerberos */
goto cleanup;
}
goto cleanup;
}
goto cleanup;
}
if (recv_addr) {
goto cleanup;
}
} else {
goto cleanup;
goto cleanup;
}
}
}
/* verify the checksum */
/*
* In order to recreate what was checksummed, we regenerate the message
* without checksum and then have the cryptographic subsystem verify
* the checksum for us. This is because some checksum methods have
* a confounder encrypted as part of the checksum.
*/
our_cksum.checksum_type = 0;
if (retval)
goto cleanup;
if (!valid) {
/*
* Checksum over only the KRB-SAFE-BODY, like RFC 1510 says, in
* case someone actually implements it correctly.
*/
if (!valid) {
goto cleanup;
}
}
retval = 0;
return retval;
}
{
/* Need a better error */
return KRB5_RC_REQUIRED;
return KRB5_RC_REQUIRED;
if (!auth_context->remote_addr)
return KRB5_REMOTE_ADDR_REQUIRED;
/* Get key */
{
CLEANUP_INIT(2);
if (auth_context->local_addr) {
if (auth_context->local_port) {
&local_fulladdr))){
} else {
return retval;
}
} else {
}
}
if (auth_context->remote_port) {
&remote_fulladdr))){
} else {
return retval;
}
} else {
}
&replaydata, outbuf))) {
CLEANUP_DONE();
return retval;
}
CLEANUP_DONE();
}
goto error;
goto error;
goto error;
}
}
replaydata.seq)) {
goto error;
}
}
}
/* everything is ok - return data to the user */
return 0;
return retval;
}