svc_auth.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */
  2. /*
  3. * Copyright (c) 2010, Oracle America, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. *
  13. * * Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in
  15. * the documentation and/or other materials provided with the
  16. * distribution.
  17. *
  18. * * Neither the name of the "Oracle America, Inc." nor the names of
  19. * its contributors may be used to endorse or promote products
  20. * derived from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  23. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  24. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  25. * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  28. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  29. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  30. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  31. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. /* @(#)svc_auth.h 1.6 86/07/16 SMI */
  35. /*
  36. * svc_auth.h, Service side of rpc authentication.
  37. */
  38. /*
  39. * Interface to server-side authentication flavors.
  40. */
  41. #ifndef GSSRPC_SVC_AUTH_H
  42. #define GSSRPC_SVC_AUTH_H
  43. #include <gssapi/gssapi.h>
  44. GSSRPC__BEGIN_DECLS
  45. struct svc_req;
  46. typedef struct SVCAUTH {
  47. struct svc_auth_ops {
  48. int (*svc_ah_wrap)(struct SVCAUTH *, XDR *, xdrproc_t,
  49. caddr_t);
  50. int (*svc_ah_unwrap)(struct SVCAUTH *, XDR *, xdrproc_t,
  51. caddr_t);
  52. int (*svc_ah_destroy)(struct SVCAUTH *);
  53. } *svc_ah_ops;
  54. void * svc_ah_private;
  55. } SVCAUTH;
  56. #ifdef GSSRPC__IMPL
  57. extern SVCAUTH svc_auth_none;
  58. extern struct svc_auth_ops svc_auth_none_ops;
  59. extern struct svc_auth_ops svc_auth_gssapi_ops;
  60. extern struct svc_auth_ops svc_auth_gss_ops;
  61. /*
  62. * Server side authenticator
  63. */
  64. /* RENAMED: should be _authenticate. */
  65. extern enum auth_stat gssrpc__authenticate(struct svc_req *rqst,
  66. struct rpc_msg *msg, bool_t *no_dispatch);
  67. #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \
  68. ((*((auth)->svc_ah_ops->svc_ah_wrap))(auth, xdrs, xfunc, xwhere))
  69. #define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \
  70. ((*((auth)->svc_ah_ops->svc_ah_unwrap))(auth, xdrs, xfunc, xwhere))
  71. #define SVCAUTH_DESTROY(auth) \
  72. ((*((auth)->svc_ah_ops->svc_ah_destroy))(auth))
  73. /* no authentication */
  74. /* RENAMED: should be _svcauth_none. */
  75. enum auth_stat gssrpc__svcauth_none(struct svc_req *,
  76. struct rpc_msg *, bool_t *);
  77. /* unix style (uid, gids) */
  78. /* RENAMED: shoudl be _svcauth_unix. */
  79. enum auth_stat gssrpc__svcauth_unix(struct svc_req *,
  80. struct rpc_msg *, bool_t *);
  81. /* short hand unix style */
  82. /* RENAMED: should be _svcauth_short. */
  83. enum auth_stat gssrpc__svcauth_short(struct svc_req *,
  84. struct rpc_msg *, bool_t *);
  85. /* GSS-API style */
  86. /* RENAMED: should be _svcauth_gssapi. */
  87. enum auth_stat gssrpc__svcauth_gssapi(struct svc_req *,
  88. struct rpc_msg *, bool_t *);
  89. /* RPCSEC_GSS */
  90. enum auth_stat gssrpc__svcauth_gss(struct svc_req *,
  91. struct rpc_msg *, bool_t *);
  92. #endif /* defined(GSSRPC__IMPL) */
  93. /*
  94. * Approved way of getting principal of caller
  95. */
  96. char *svcauth_gss_get_principal(SVCAUTH *auth);
  97. /*
  98. * Approved way of setting server principal
  99. */
  100. bool_t svcauth_gss_set_svc_name(gss_name_t name);
  101. GSSRPC__END_DECLS
  102. #endif /* !defined(GSSRPC_SVC_AUTH_H) */