53 * gss_log & 8 will cause informational messages to be
54 * printed on both client and server side of kgssd.
55 */
56
57 uint_t gss_log = 1;
58
59 #endif /* GSSDEBUG */
60
61 #ifdef DEBUG
62 extern void prom_printf(const char *, ...);
63 #endif
64
65 char *server = "localhost";
66
67 static OM_uint32 kgss_sign_wrapped(void *, OM_uint32 *, gss_ctx_id_t, int,
68 gss_buffer_t, gss_buffer_t, OM_uint32);
69
70 static OM_uint32 kgss_verify_wrapped(void *, OM_uint32 *, gss_ctx_id_t,
71 gss_buffer_t, gss_buffer_t, int *qop_state, OM_uint32);
72
73 /* EXPORT DELETE START */
74 static OM_uint32 kgss_seal_wrapped(void *, OM_uint32 *, gss_ctx_id_t,
75 int, int, gss_buffer_t, int *, gss_buffer_t, OM_uint32);
76
77 static OM_uint32 kgss_unseal_wrapped(void *, OM_uint32 *, gss_ctx_id_t,
78 gss_buffer_t, gss_buffer_t, int *conf_state, int *qop_state,
79 OM_uint32);
80 /* EXPORT DELETE END */
81
82 static OM_uint32 kgss_delete_sec_context_wrapped(void *, OM_uint32 *,
83 gssd_ctx_id_t *, gss_buffer_t, OM_uint32);
84
85 static void __kgss_reset_mech(gss_mechanism *, gss_OID);
86
87 #define DEFAULT_MINOR_STAT ((OM_uint32) ~0)
88
89 OM_uint32
90 kgss_acquire_cred_wrapped(minor_status,
91 desired_name,
92 time_req,
93 desired_mechs,
94 cred_usage,
95 output_cred_handle,
96 actual_mechs,
97 time_rec,
98 uid,
99 gssd_cred_verifier)
100 OM_uint32 *minor_status;
804 *time_rec = res.time_rec;
805 }
806 }
807
808 /*
809 * free the memory allocated for the results and return with the status
810 * received in the rpc call
811 */
812
813 clnt_freeres(clnt, xdr_gss_init_sec_context_res, (caddr_t)&res);
814 killgssd_handle(clnt);
815 return (res.status);
816
817 }
818
819 static struct gss_config default_gc = {
820 { 0, NULL},
821 NULL,
822 NULL,
823 0,
824 /* EXPORT DELETE START */ /* CRYPT DELETE START */
825 kgss_unseal_wrapped,
826 /* EXPORT DELETE END */ /* CRYPT DELETE END */
827 NULL, /* kgss_delete_sec_context_wrapped */
828 /* EXPORT DELETE START */ /* CRYPT DELETE START */
829 kgss_seal_wrapped,
830 /* EXPORT DELETE END */ /* CRYPT DELETE END */
831 NULL, /* kgss_import_sec_context */
832 /* EXPORT DELETE START */
833 /* CRYPT DELETE START */
834 #if 0
835 /* CRYPT DELETE END */
836 kgss_seal_wrapped,
837 kgss_unseal_wrapped,
838 /* CRYPT DELETE START */
839 #endif
840 /* CRYPT DELETE END */
841 /* EXPORT DELETE END */
842 kgss_sign_wrapped,
843 kgss_verify_wrapped
844 };
845
846 void
847 kgss_free_oid(gss_OID oid)
848 {
849 FREE(oid->elements, oid->length);
850 FREE(oid, sizeof (gss_OID_desc));
851 }
852
853 OM_uint32
854 kgss_init_sec_context(
855 OM_uint32 *minor_status,
856 const gss_cred_id_t claimant_cred_handle,
857 gss_ctx_id_t *context_handle,
858 const gss_name_t target_name,
859 const gss_OID mech_type,
860 int req_flags,
861 OM_uint32 time_req,
1772 /* return with status returned in rpc call */
1773
1774 killgssd_handle(clnt);
1775 return (res.status);
1776
1777 }
1778
1779 OM_uint32
1780 kgss_verify(OM_uint32 *minor_status,
1781 const gss_ctx_id_t context_handle,
1782 const gss_buffer_t message_buffer,
1783 const gss_buffer_t token_buffer,
1784 int *qop_state)
1785 {
1786 if (context_handle == GSS_C_NO_CONTEXT)
1787 return (GSS_S_FAILURE);
1788 return (KGSS_VERIFY(minor_status, context_handle,
1789 message_buffer, token_buffer, qop_state));
1790 }
1791
1792 /* EXPORT DELETE START */
1793
1794 /*ARGSUSED*/
1795 static OM_uint32
1796 kgss_seal_wrapped(void *private,
1797 OM_uint32 *minor_status,
1798 const gss_ctx_id_t ctx_handle,
1799 int conf_req_flag,
1800 int qop_req,
1801 const gss_buffer_t input_message_buffer,
1802 int *conf_state,
1803 gss_buffer_t output_message_buffer,
1804 OM_uint32 gssd_context_verifier)
1805 {
1806 CLIENT *clnt;
1807 gssd_ctx_id_t context_handle;
1808
1809 gss_seal_arg arg;
1810 gss_seal_res res;
1811
1812 context_handle = (gssd_ctx_id_t)KCTX_TO_GSSD_CTX(ctx_handle);
1813
2004 killgssd_handle(clnt);
2005 return (res.status);
2006 }
2007
2008 OM_uint32
2009 kgss_unseal(OM_uint32 *minor_status,
2010 const gss_ctx_id_t context_handle,
2011 const gss_buffer_t input_message_buffer,
2012 const gss_buffer_t output_message_buffer,
2013 int *conf_state,
2014 int *qop_state)
2015 {
2016
2017 if (context_handle == GSS_C_NO_CONTEXT)
2018 return (GSS_S_FAILURE);
2019
2020 return (KGSS_UNSEAL(minor_status, context_handle, input_message_buffer,
2021 output_message_buffer, conf_state, qop_state));
2022 }
2023
2024 /* EXPORT DELETE END */
2025
2026 OM_uint32
2027 kgss_display_status(minor_status,
2028 status_value,
2029 status_type,
2030 mech_type,
2031 message_context,
2032 status_string,
2033 uid)
2034 OM_uint32 *minor_status;
2035 OM_uint32 status_value;
2036 int status_type;
2037 const gss_OID mech_type;
2038 int *message_context;
2039 gss_buffer_t status_string;
2040 uid_t uid;
2041 {
2042 CLIENT *clnt;
2043
2044 gss_display_status_arg arg;
2045 gss_display_status_res res;
|
53 * gss_log & 8 will cause informational messages to be
54 * printed on both client and server side of kgssd.
55 */
56
57 uint_t gss_log = 1;
58
59 #endif /* GSSDEBUG */
60
61 #ifdef DEBUG
62 extern void prom_printf(const char *, ...);
63 #endif
64
65 char *server = "localhost";
66
67 static OM_uint32 kgss_sign_wrapped(void *, OM_uint32 *, gss_ctx_id_t, int,
68 gss_buffer_t, gss_buffer_t, OM_uint32);
69
70 static OM_uint32 kgss_verify_wrapped(void *, OM_uint32 *, gss_ctx_id_t,
71 gss_buffer_t, gss_buffer_t, int *qop_state, OM_uint32);
72
73 static OM_uint32 kgss_seal_wrapped(void *, OM_uint32 *, gss_ctx_id_t,
74 int, int, gss_buffer_t, int *, gss_buffer_t, OM_uint32);
75
76 static OM_uint32 kgss_unseal_wrapped(void *, OM_uint32 *, gss_ctx_id_t,
77 gss_buffer_t, gss_buffer_t, int *conf_state, int *qop_state,
78 OM_uint32);
79
80 static OM_uint32 kgss_delete_sec_context_wrapped(void *, OM_uint32 *,
81 gssd_ctx_id_t *, gss_buffer_t, OM_uint32);
82
83 static void __kgss_reset_mech(gss_mechanism *, gss_OID);
84
85 #define DEFAULT_MINOR_STAT ((OM_uint32) ~0)
86
87 OM_uint32
88 kgss_acquire_cred_wrapped(minor_status,
89 desired_name,
90 time_req,
91 desired_mechs,
92 cred_usage,
93 output_cred_handle,
94 actual_mechs,
95 time_rec,
96 uid,
97 gssd_cred_verifier)
98 OM_uint32 *minor_status;
802 *time_rec = res.time_rec;
803 }
804 }
805
806 /*
807 * free the memory allocated for the results and return with the status
808 * received in the rpc call
809 */
810
811 clnt_freeres(clnt, xdr_gss_init_sec_context_res, (caddr_t)&res);
812 killgssd_handle(clnt);
813 return (res.status);
814
815 }
816
817 static struct gss_config default_gc = {
818 { 0, NULL},
819 NULL,
820 NULL,
821 0,
822 kgss_unseal_wrapped,
823 NULL, /* kgss_delete_sec_context_wrapped */
824 kgss_seal_wrapped,
825 NULL, /* kgss_import_sec_context */
826 kgss_sign_wrapped,
827 kgss_verify_wrapped
828 };
829
830 void
831 kgss_free_oid(gss_OID oid)
832 {
833 FREE(oid->elements, oid->length);
834 FREE(oid, sizeof (gss_OID_desc));
835 }
836
837 OM_uint32
838 kgss_init_sec_context(
839 OM_uint32 *minor_status,
840 const gss_cred_id_t claimant_cred_handle,
841 gss_ctx_id_t *context_handle,
842 const gss_name_t target_name,
843 const gss_OID mech_type,
844 int req_flags,
845 OM_uint32 time_req,
1756 /* return with status returned in rpc call */
1757
1758 killgssd_handle(clnt);
1759 return (res.status);
1760
1761 }
1762
1763 OM_uint32
1764 kgss_verify(OM_uint32 *minor_status,
1765 const gss_ctx_id_t context_handle,
1766 const gss_buffer_t message_buffer,
1767 const gss_buffer_t token_buffer,
1768 int *qop_state)
1769 {
1770 if (context_handle == GSS_C_NO_CONTEXT)
1771 return (GSS_S_FAILURE);
1772 return (KGSS_VERIFY(minor_status, context_handle,
1773 message_buffer, token_buffer, qop_state));
1774 }
1775
1776 /*ARGSUSED*/
1777 static OM_uint32
1778 kgss_seal_wrapped(void *private,
1779 OM_uint32 *minor_status,
1780 const gss_ctx_id_t ctx_handle,
1781 int conf_req_flag,
1782 int qop_req,
1783 const gss_buffer_t input_message_buffer,
1784 int *conf_state,
1785 gss_buffer_t output_message_buffer,
1786 OM_uint32 gssd_context_verifier)
1787 {
1788 CLIENT *clnt;
1789 gssd_ctx_id_t context_handle;
1790
1791 gss_seal_arg arg;
1792 gss_seal_res res;
1793
1794 context_handle = (gssd_ctx_id_t)KCTX_TO_GSSD_CTX(ctx_handle);
1795
1986 killgssd_handle(clnt);
1987 return (res.status);
1988 }
1989
1990 OM_uint32
1991 kgss_unseal(OM_uint32 *minor_status,
1992 const gss_ctx_id_t context_handle,
1993 const gss_buffer_t input_message_buffer,
1994 const gss_buffer_t output_message_buffer,
1995 int *conf_state,
1996 int *qop_state)
1997 {
1998
1999 if (context_handle == GSS_C_NO_CONTEXT)
2000 return (GSS_S_FAILURE);
2001
2002 return (KGSS_UNSEAL(minor_status, context_handle, input_message_buffer,
2003 output_message_buffer, conf_state, qop_state));
2004 }
2005
2006 OM_uint32
2007 kgss_display_status(minor_status,
2008 status_value,
2009 status_type,
2010 mech_type,
2011 message_context,
2012 status_string,
2013 uid)
2014 OM_uint32 *minor_status;
2015 OM_uint32 status_value;
2016 int status_type;
2017 const gss_OID mech_type;
2018 int *message_context;
2019 gss_buffer_t status_string;
2020 uid_t uid;
2021 {
2022 CLIENT *clnt;
2023
2024 gss_display_status_arg arg;
2025 gss_display_status_res res;
|