auth_des.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. #ifndef _RPC_AUTH_DES_H
  16. #define _RPC_AUTH_DES_H 1
  17. #include <sys/cdefs.h>
  18. #include <rpc/auth.h>
  19. __BEGIN_DECLS
  20. /* There are two kinds of "names": fullnames and nicknames */
  21. enum authdes_namekind
  22. {
  23. ADN_FULLNAME,
  24. ADN_NICKNAME
  25. };
  26. /* A fullname contains the network name of the client,
  27. a conversation key and the window */
  28. struct authdes_fullname
  29. {
  30. char *name; /* network name of client, up to MAXNETNAMELEN */
  31. des_block key; /* conversation key */
  32. uint32_t window; /* associated window */
  33. };
  34. /* A credential */
  35. struct authdes_cred
  36. {
  37. enum authdes_namekind adc_namekind;
  38. struct authdes_fullname adc_fullname;
  39. uint32_t adc_nickname;
  40. };
  41. /* A timeval replacement for !32bit platforms */
  42. struct rpc_timeval
  43. {
  44. uint32_t tv_sec; /* Seconds. */
  45. uint32_t tv_usec; /* Microseconds. */
  46. };
  47. /* A des authentication verifier */
  48. struct authdes_verf
  49. {
  50. union
  51. {
  52. struct rpc_timeval adv_ctime; /* clear time */
  53. des_block adv_xtime; /* crypt time */
  54. }
  55. adv_time_u;
  56. uint32_t adv_int_u;
  57. };
  58. /* des authentication verifier: client variety
  59. adv_timestamp is the current time.
  60. adv_winverf is the credential window + 1.
  61. Both are encrypted using the conversation key. */
  62. #define adv_timestamp adv_time_u.adv_ctime
  63. #define adv_xtimestamp adv_time_u.adv_xtime
  64. #define adv_winverf adv_int_u
  65. /* des authentication verifier: server variety
  66. adv_timeverf is the client's timestamp + client's window
  67. adv_nickname is the server's nickname for the client.
  68. adv_timeverf is encrypted using the conversation key. */
  69. #define adv_timeverf adv_time_u.adv_ctime
  70. #define adv_xtimeverf adv_time_u.adv_xtime
  71. #define adv_nickname adv_int_u
  72. /* Map a des credential into a unix cred. */
  73. extern int authdes_getucred __P ((__const struct authdes_cred * __adc,
  74. uid_t * __uid, gid_t * __gid,
  75. short *__grouplen, gid_t * __groups));
  76. /* Get the public key for NAME and place it in KEY. NAME can only be
  77. up to MAXNETNAMELEN bytes long and the destination buffer KEY should
  78. have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
  79. extern int getpublickey __P ((__const char *__name, char *__key));
  80. /* Get the secret key for NAME and place it in KEY. PASSWD is used to
  81. decrypt the encrypted key stored in the database. NAME can only be
  82. up to MAXNETNAMELEN bytes long and the destination buffer KEY
  83. should have HEXKEYBYTES + 1 bytes long to fit all characters from
  84. the key. */
  85. extern int getsecretkey __P ((__const char *__name, char *__key,
  86. __const char *__passwd));
  87. extern int rtime __P ((struct sockaddr_in *__addrp,
  88. struct rpc_timeval *__timep,
  89. struct rpc_timeval *__timeout));
  90. __END_DECLS
  91. #endif /* rpc/auth_des.h */