kerberosgss.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * Copyright (c) 2006-2009 Apple Inc. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. **/
  16. #include <gssapi/gssapi.h>
  17. #include <gssapi/gssapi_generic.h>
  18. #include <gssapi/gssapi_krb5.h>
  19. #define krb5_get_err_text(context,code) error_message(code)
  20. #define AUTH_GSS_ERROR -1
  21. #define AUTH_GSS_COMPLETE 1
  22. #define AUTH_GSS_CONTINUE 0
  23. #define GSS_AUTH_P_NONE 1
  24. #define GSS_AUTH_P_INTEGRITY 2
  25. #define GSS_AUTH_P_PRIVACY 4
  26. typedef struct {
  27. gss_ctx_id_t context;
  28. gss_name_t server_name;
  29. long int gss_flags;
  30. char* username;
  31. char* response;
  32. } gss_client_state;
  33. typedef struct {
  34. gss_ctx_id_t context;
  35. gss_name_t server_name;
  36. gss_name_t client_name;
  37. gss_cred_id_t server_creds;
  38. gss_cred_id_t client_creds;
  39. char* username;
  40. char* targetname;
  41. char* response;
  42. } gss_server_state;
  43. char* server_principal_details(const char* service, const char* hostname);
  44. int authenticate_gss_client_init(const char* service, long int gss_flags, gss_client_state* state);
  45. int authenticate_gss_client_clean(gss_client_state *state);
  46. int authenticate_gss_client_step(gss_client_state *state, const char *challenge);
  47. int authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge);
  48. int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user);
  49. int authenticate_gss_server_init(const char* service, gss_server_state* state);
  50. int authenticate_gss_server_clean(gss_server_state *state);
  51. int authenticate_gss_server_step(gss_server_state *state, const char *challenge);