Back to index

glibc  2.9
auth_des.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _RPC_AUTH_DES_H
00020 #define _RPC_AUTH_DES_H     1
00021 
00022 #include <sys/cdefs.h>
00023 #include <rpc/auth.h>
00024 
00025 __BEGIN_DECLS
00026 
00027 /* There are two kinds of "names": fullnames and nicknames */
00028 enum authdes_namekind
00029   {
00030     ADN_FULLNAME,
00031     ADN_NICKNAME
00032   };
00033 
00034 /* A fullname contains the network name of the client,
00035    a conversation key and the window */
00036 struct authdes_fullname
00037   {
00038     char *name;             /* network name of client, up to MAXNETNAMELEN */
00039     des_block key;   /* conversation key */
00040     uint32_t window; /* associated window */
00041   };
00042 
00043 /* A credential */
00044 struct authdes_cred
00045   {
00046     enum authdes_namekind adc_namekind;
00047     struct authdes_fullname adc_fullname;
00048     uint32_t adc_nickname;
00049   };
00050 
00051 /* A timeval replacement for !32bit platforms */
00052 struct rpc_timeval
00053   {
00054     uint32_t tv_sec;            /* Seconds.  */
00055     uint32_t tv_usec;           /* Microseconds.  */
00056   };
00057 
00058 /* A des authentication verifier */
00059 struct authdes_verf
00060   {
00061     union
00062       {
00063        struct rpc_timeval adv_ctime;      /* clear time */
00064        des_block adv_xtime;        /* crypt time */
00065       }
00066     adv_time_u;
00067     uint32_t adv_int_u;
00068   };
00069 
00070 /* des authentication verifier: client variety
00071 
00072    adv_timestamp is the current time.
00073    adv_winverf is the credential window + 1.
00074    Both are encrypted using the conversation key. */
00075 #define adv_timestamp  adv_time_u.adv_ctime
00076 #define adv_xtimestamp adv_time_u.adv_xtime
00077 #define adv_winverf    adv_int_u
00078 
00079 /* des authentication verifier: server variety
00080 
00081    adv_timeverf is the client's timestamp + client's window
00082    adv_nickname is the server's nickname for the client.
00083    adv_timeverf is encrypted using the conversation key. */
00084 #define adv_timeverf   adv_time_u.adv_ctime
00085 #define adv_xtimeverf  adv_time_u.adv_xtime
00086 #define adv_nickname   adv_int_u
00087 
00088 /* Map a des credential into a unix cred. */
00089 extern int authdes_getucred (__const struct authdes_cred * __adc,
00090                           uid_t * __uid, gid_t * __gid,
00091                           short *__grouplen, gid_t * __groups) __THROW;
00092 
00093 /* Get the public key for NAME and place it in KEY.  NAME can only be
00094    up to MAXNETNAMELEN bytes long and the destination buffer KEY should
00095    have HEXKEYBYTES + 1 bytes long to fit all characters from the key.  */
00096 extern int getpublickey (__const char *__name, char *__key) __THROW;
00097 
00098 /* Get the secret key for NAME and place it in KEY.  PASSWD is used to
00099    decrypt the encrypted key stored in the database.  NAME can only be
00100    up to MAXNETNAMELEN bytes long and the destination buffer KEY
00101    should have HEXKEYBYTES + 1 bytes long to fit all characters from
00102    the key.  */
00103 extern int getsecretkey (__const char *__name, char *__key,
00104                       __const char *__passwd) __THROW;
00105 
00106 extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
00107                 struct rpc_timeval *__timeout) __THROW;
00108 
00109 __END_DECLS
00110 
00111 
00112 #endif /* rpc/auth_des.h */