auth_des.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the 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. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 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 (__const struct authdes_cred * __adc,
  74. uid_t * __uid, gid_t * __gid,
  75. short *__grouplen, gid_t * __groups) __THROW;
  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 (__const char *__name, char *__key) __THROW;
  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 (__const char *__name, char *__key,
  86. __const char *__passwd) __THROW;
  87. extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
  88. struct rpc_timeval *__timeout) __THROW;
  89. __END_DECLS
  90. #endif /* rpc/auth_des.h */