2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
4 /* Copyright 1993 by OpenVision Technologies, Inc.
6 * Permission to use, copy, modify, distribute, and sell this software
7 * and its documentation for any purpose is hereby granted without fee,
8 * provided that the above copyright notice appears in all copies and
9 * that both that copyright notice and this permission notice appear in
10 * supporting documentation, and that the name of OpenVision not be used
11 * in advertising or publicity pertaining to distribution of the software
12 * without specific, written prior permission. OpenVision makes no
13 * representations about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied warranty.
16 * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
20 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
25 #include "gssapiP_krb5.h"
28 * $Id: context_time.c 16187 2004-03-19 09:33:57Z raeburn $
32 krb5_gss_context_time(minor_status
, context_handle
, time_rec
)
33 OM_uint32
*minor_status
;
34 gss_ctx_id_t context_handle
;
38 krb5_gss_ctx_id_rec
*ctx
;
42 /* validate the context handle */
43 if (! kg_validate_ctx_id(context_handle
)) {
44 *minor_status
= (OM_uint32
) G_VALIDATE_FAILED
;
45 return(GSS_S_NO_CONTEXT
);
48 ctx
= (krb5_gss_ctx_id_rec
*) context_handle
;
50 if (! ctx
->established
) {
51 *minor_status
= KG_CTX_INCOMPLETE
;
52 return(GSS_S_NO_CONTEXT
);
55 if ((code
= krb5_timeofday(ctx
->k5_context
, &now
))) {
57 save_error_info(*minor_status
, ctx
->k5_context
);
58 return(GSS_S_FAILURE
);
61 if ((lifetime
= ctx
->endtime
- now
) <= 0) {
64 return(GSS_S_CONTEXT_EXPIRED
);
68 return(GSS_S_COMPLETE
);