auth_des.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _RPC_AUTH_DES_H
  15. #define _RPC_AUTH_DES_H 1
  16. #include <sys/cdefs.h>
  17. #include <rpc/auth.h>
  18. __BEGIN_DECLS
  19. #if 0
  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. #endif
  42. /* A timeval replacement for !32bit platforms */
  43. struct rpc_timeval
  44. {
  45. uint32_t tv_sec; /* Seconds. */
  46. uint32_t tv_usec; /* Microseconds. */
  47. };
  48. #if 0
  49. /* A des authentication verifier */
  50. struct authdes_verf
  51. {
  52. union
  53. {
  54. struct rpc_timeval adv_ctime; /* clear time */
  55. des_block adv_xtime; /* crypt time */
  56. }
  57. adv_time_u;
  58. uint32_t adv_int_u;
  59. };
  60. /* des authentication verifier: client variety
  61. adv_timestamp is the current time.
  62. adv_winverf is the credential window + 1.
  63. Both are encrypted using the conversation key. */
  64. #define adv_timestamp adv_time_u.adv_ctime
  65. #define adv_xtimestamp adv_time_u.adv_xtime
  66. #define adv_winverf adv_int_u
  67. /* des authentication verifier: server variety
  68. adv_timeverf is the client's timestamp + client's window
  69. adv_nickname is the server's nickname for the client.
  70. adv_timeverf is encrypted using the conversation key. */
  71. #define adv_timeverf adv_time_u.adv_ctime
  72. #define adv_xtimeverf adv_time_u.adv_xtime
  73. #define adv_nickname adv_int_u
  74. /* Map a des credential into a unix cred. */
  75. extern int authdes_getucred (__const struct authdes_cred * __adc,
  76. uid_t * __uid, gid_t * __gid,
  77. short *__grouplen, gid_t * __groups) __THROW;
  78. /* Get the public key for NAME and place it in KEY. NAME can only be
  79. up to MAXNETNAMELEN bytes long and the destination buffer KEY should
  80. have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
  81. extern int getpublickey (__const char *__name, char *__key) __THROW;
  82. /* Get the secret key for NAME and place it in KEY. PASSWD is used to
  83. decrypt the encrypted key stored in the database. NAME can only be
  84. up to MAXNETNAMELEN bytes long and the destination buffer KEY
  85. should have HEXKEYBYTES + 1 bytes long to fit all characters from
  86. the key. */
  87. extern int getsecretkey (__const char *__name, char *__key,
  88. __const char *__passwd) __THROW;
  89. #endif
  90. extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
  91. struct rpc_timeval *__timeout) __THROW;
  92. __END_DECLS
  93. #endif /* rpc/auth_des.h */