auth_des.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. #if 0
  21. /* There are two kinds of "names": fullnames and nicknames */
  22. enum authdes_namekind
  23. {
  24. ADN_FULLNAME,
  25. ADN_NICKNAME
  26. };
  27. /* A fullname contains the network name of the client,
  28. a conversation key and the window */
  29. struct authdes_fullname
  30. {
  31. char *name; /* network name of client, up to MAXNETNAMELEN */
  32. des_block key; /* conversation key */
  33. uint32_t window; /* associated window */
  34. };
  35. /* A credential */
  36. struct authdes_cred
  37. {
  38. enum authdes_namekind adc_namekind;
  39. struct authdes_fullname adc_fullname;
  40. uint32_t adc_nickname;
  41. };
  42. #endif
  43. /* A timeval replacement for !32bit platforms */
  44. struct rpc_timeval
  45. {
  46. uint32_t tv_sec; /* Seconds. */
  47. uint32_t tv_usec; /* Microseconds. */
  48. };
  49. #if 0
  50. /* A des authentication verifier */
  51. struct authdes_verf
  52. {
  53. union
  54. {
  55. struct rpc_timeval adv_ctime; /* clear time */
  56. des_block adv_xtime; /* crypt time */
  57. }
  58. adv_time_u;
  59. uint32_t adv_int_u;
  60. };
  61. /* des authentication verifier: client variety
  62. adv_timestamp is the current time.
  63. adv_winverf is the credential window + 1.
  64. Both are encrypted using the conversation key. */
  65. #define adv_timestamp adv_time_u.adv_ctime
  66. #define adv_xtimestamp adv_time_u.adv_xtime
  67. #define adv_winverf adv_int_u
  68. /* des authentication verifier: server variety
  69. adv_timeverf is the client's timestamp + client's window
  70. adv_nickname is the server's nickname for the client.
  71. adv_timeverf is encrypted using the conversation key. */
  72. #define adv_timeverf adv_time_u.adv_ctime
  73. #define adv_xtimeverf adv_time_u.adv_xtime
  74. #define adv_nickname adv_int_u
  75. /* Map a des credential into a unix cred. */
  76. extern int authdes_getucred (__const struct authdes_cred * __adc,
  77. uid_t * __uid, gid_t * __gid,
  78. short *__grouplen, gid_t * __groups) __THROW;
  79. /* Get the public key for NAME and place it in KEY. NAME can only be
  80. up to MAXNETNAMELEN bytes long and the destination buffer KEY should
  81. have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
  82. extern int getpublickey (__const char *__name, char *__key) __THROW;
  83. /* Get the secret key for NAME and place it in KEY. PASSWD is used to
  84. decrypt the encrypted key stored in the database. NAME can only be
  85. up to MAXNETNAMELEN bytes long and the destination buffer KEY
  86. should have HEXKEYBYTES + 1 bytes long to fit all characters from
  87. the key. */
  88. extern int getsecretkey (__const char *__name, char *__key,
  89. __const char *__passwd) __THROW;
  90. #endif
  91. extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
  92. struct rpc_timeval *__timeout) __THROW;
  93. __END_DECLS
  94. #endif /* rpc/auth_des.h */