Blame tirpc/rpc/auth_des.h

Packit 00408a
/*	@(#)auth_des.h	2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */
Packit 00408a
/*	$FreeBSD: src/include/rpc/auth_des.h,v 1.3 2002/03/23 17:24:55 imp Exp $ */
Packit 00408a
/*
Packit 00408a
 * Copyright (c) 2009, Sun Microsystems, Inc.
Packit 00408a
 * All rights reserved.
Packit 00408a
 *
Packit 00408a
 * Redistribution and use in source and binary forms, with or without
Packit 00408a
 * modification, are permitted provided that the following conditions are met:
Packit 00408a
 * - Redistributions of source code must retain the above copyright notice,
Packit 00408a
 *   this list of conditions and the following disclaimer.
Packit 00408a
 * - Redistributions in binary form must reproduce the above copyright notice,
Packit 00408a
 *   this list of conditions and the following disclaimer in the documentation
Packit 00408a
 *   and/or other materials provided with the distribution.
Packit 00408a
 * - Neither the name of Sun Microsystems, Inc. nor the names of its
Packit 00408a
 *   contributors may be used to endorse or promote products derived
Packit 00408a
 *   from this software without specific prior written permission.
Packit 00408a
 *
Packit 00408a
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 00408a
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 00408a
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 00408a
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
Packit 00408a
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Packit 00408a
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Packit 00408a
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit 00408a
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Packit 00408a
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Packit 00408a
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Packit 00408a
 * POSSIBILITY OF SUCH DAMAGE.
Packit 00408a
 * 
Packit 00408a
 *	from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC
Packit 00408a
 *	from: @(#)auth_des.h 1.14    94/04/25 SMI
Packit 00408a
 */
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
Packit 00408a
 */
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * auth_des.h, Protocol for DES style authentication for RPC
Packit 00408a
 */
Packit 00408a
Packit 00408a
#ifndef _TI_AUTH_DES_
Packit 00408a
#define _TI_AUTH_DES_
Packit 00408a
Packit 00408a
#include <rpc/auth.h>
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * There are two kinds of "names": fullnames and nicknames
Packit 00408a
 */
Packit 00408a
enum authdes_namekind {
Packit 00408a
	ADN_FULLNAME, 
Packit 00408a
	ADN_NICKNAME
Packit 00408a
};
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * A fullname contains the network name of the client, 
Packit 00408a
 * a conversation key and the window
Packit 00408a
 */
Packit 00408a
struct authdes_fullname {
Packit 00408a
  char *name;		/* network name of client, up to MAXNETNAMELEN */
Packit 00408a
  union des_block key;		/* conversation key */
Packit 00408a
  /* u_long window;	*/ 
Packit 00408a
  u_int32_t window;	/* associated window */
Packit 00408a
};
Packit 00408a
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * A credential 
Packit 00408a
 */
Packit 00408a
struct authdes_cred {
Packit 00408a
	enum authdes_namekind adc_namekind;
Packit 00408a
  	struct authdes_fullname adc_fullname;
Packit 00408a
  /*u_long adc_nickname;*/
Packit 00408a
 u_int32_t adc_nickname;
Packit 00408a
}; 
Packit 00408a
Packit 00408a
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * A des authentication verifier 
Packit 00408a
 */
Packit 00408a
struct authdes_verf {
Packit 00408a
	union {
Packit 00408a
		struct timeval adv_ctime;	/* clear time */
Packit 00408a
	  	des_block adv_xtime;		/* crypt time */
Packit 00408a
	} adv_time_u;
Packit 00408a
  /*u_long adv_int_u;*/
Packit 00408a
  u_int32_t adv_int_u;
Packit 00408a
};
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * des authentication verifier: client variety
Packit 00408a
 *
Packit 00408a
 * adv_timestamp is the current time.
Packit 00408a
 * adv_winverf is the credential window + 1.
Packit 00408a
 * Both are encrypted using the conversation key.
Packit 00408a
 */
Packit 00408a
#define adv_timestamp	adv_time_u.adv_ctime
Packit 00408a
#define adv_xtimestamp	adv_time_u.adv_xtime
Packit 00408a
#define adv_winverf	adv_int_u
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * des authentication verifier: server variety
Packit 00408a
 *
Packit 00408a
 * adv_timeverf is the client's timestamp + client's window
Packit 00408a
 * adv_nickname is the server's nickname for the client.
Packit 00408a
 * adv_timeverf is encrypted using the conversation key.
Packit 00408a
 */
Packit 00408a
#define adv_timeverf	adv_time_u.adv_ctime
Packit 00408a
#define adv_xtimeverf	adv_time_u.adv_xtime
Packit 00408a
#define adv_nickname	adv_int_u
Packit 00408a
Packit 00408a
/*
Packit 00408a
 * Map a des credential into a unix cred.
Packit 00408a
 *
Packit 00408a
 */
Packit 00408a
#ifdef __cplusplus
Packit 00408a
extern "C" {
Packit 00408a
#endif
Packit 00408a
extern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * );
Packit 00408a
#ifdef __cplusplus
Packit 00408a
}
Packit 00408a
#endif
Packit 00408a
Packit 00408a
#ifdef __cplusplus
Packit 00408a
extern "C" {
Packit 00408a
#endif
Packit 00408a
extern bool_t	xdr_authdes_cred(XDR *, struct authdes_cred *);
Packit 00408a
extern bool_t	xdr_authdes_verf(XDR *, struct authdes_verf *);
Packit 00408a
extern int	rtime(struct sockaddr_in *, struct timeval *,
Packit 00408a
		    struct timeval *);
Packit 00408a
extern void	kgetnetname(char *);
Packit 00408a
extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *);
Packit 00408a
#ifdef __cplusplus
Packit 00408a
}
Packit 00408a
#endif
Packit 00408a
Packit 00408a
#endif /* ndef _TI_AUTH_DES_ */