Project

General

Profile

Bug #7118 » mechglueP.h.diff

Richard PALO, 2016-06-18 09:28 AM

View differences:

usr/src/uts/common/gssapi/include/mechglueP.h
28 28
 */
29 29

  
30 30
#ifndef _GSS_MECHGLUEP_H
31
#define _GSS_MECHGLUEP_H
31
#define	_GSS_MECHGLUEP_H
32 32

  
33 33
#if 0 /* SUNW15resync - disable for sake of non-krb5 mechs */
34 34
#include "autoconf.h"
......
36 36

  
37 37
/* SUNW15resync */
38 38
#ifndef GSS_DLLIMP
39
#define GSS_DLLIMP
39
#define	GSS_DLLIMP
40 40
#endif
41 41

  
42 42
#include <gssapi/gssapi_ext.h>   /* SUNW15resync - mechglue.h in mit 1.5 */
......
46 46

  
47 47
#ifdef _KERNEL
48 48
#include <rpc/rpc.h>
49
#endif 
49
#endif
50 50

  
51 51
#ifndef g_OID_copy /* SUNW15resync */
52 52
#define	g_OID_copy(o1, o2)					\
......
135 135
 * pointer.
136 136
 */
137 137
#if 0 /* Solaris Kerberos - revisit for full 1.7/next resync */
138
#define GSSINT_CHK_LOOP(p) (!((p) != NULL && (p)->loopback == (p)))
138
#define	GSSINT_CHK_LOOP(p) (!((p) != NULL && (p)->loopback == (p)))
139 139
#else
140
#define GSSINT_CHK_LOOP(p) ((p) == NULL)
140
#define	GSSINT_CHK_LOOP(p) ((p) == NULL)
141 141
#endif
142 142

  
143 143

  
144
/********************************************************/
144
/* **************************************************** */
145 145
/* The Mechanism Dispatch Table -- a mechanism needs to */
146 146
/* define one of these and provide a function to return */
147
/* it to initialize the GSSAPI library                  */
147
/* it to initialize the GSSAPI library			*/
148 148

  
149 149
/*
150 150
 * This is the definition of the mechs_array struct, which is used to
......
154 154
 *
155 155
 * This contants all of the functions defined in gssapi.h except for
156 156
 * gss_release_buffer() and gss_release_oid_set(), which I am
157
 * assuming, for now, to be equal across mechanisms.  
157
 * assuming, for now, to be equal across mechanisms.
158 158
 */
159
 
159

  
160 160
typedef struct gss_config {
161 161
#if 0 /* Solaris Kerberos */
162 162
    OM_uint32	    priority;
163
    char *	    mechNameStr;
163
    char	   *mechNameStr;
164 164
#endif
165 165
    gss_OID_desc    mech_type;
166
    void *	    context;
166
    void	   *context;
167 167
#ifdef	_KERNEL
168 168
    struct gss_config *next;
169 169
    bool_t	    uses_kmod;
......
483 483

  
484 484
	/* GGF extensions */
485 485

  
486
        OM_uint32       (*gss_inquire_sec_context_by_oid)
487
        (
488
		OM_uint32 *,        /* minor_status */
489
		const gss_ctx_id_t, /* context_handle */
490
		const gss_OID,      /* OID */
491
		gss_buffer_set_t *  /* data_set */
486
	OM_uint32	(*gss_inquire_sec_context_by_oid)
487
	(
488
		OM_uint32 *,		/* minor_status */
489
		const gss_ctx_id_t,	/* context_handle */
490
		const gss_OID,		/* OID */
491
		gss_buffer_set_t *	/* data_set */
492 492
	/* */);
493 493

  
494 494
#endif
495 495
} *gss_mechanism;
496 496

  
497 497

  
498
	
498

  
499 499
#ifndef _KERNEL
500 500
/* This structure MUST NOT be used by any code outside libgss */
501 501
typedef struct gss_config_ext {
......
525 525
	struct gss_mech_config *next;	/* next element in the list */
526 526
} *gss_mech_info;
527 527

  
528
/********************************************************/
528
/* **************************************************** */
529 529
/* Internal mechglue routines */
530 530

  
531 531
/* SUNW15resync - Solaris versions - replace w/mit ones? */
......
536 536
char *__gss_get_kmodName(const gss_OID);
537 537
char *__gss_get_modOptions(const gss_OID);
538 538
OM_uint32 __gss_import_internal_name(OM_uint32 *, const gss_OID,
539
 	gss_union_name_t, gss_name_t *);
539
	gss_union_name_t, gss_name_t *);
540 540
OM_uint32 __gss_export_internal_name(OM_uint32 *, const gss_OID,
541 541
	const gss_name_t, gss_buffer_t);
542 542
OM_uint32 __gss_display_internal_name(OM_uint32 *, const gss_OID,
543 543
	const gss_name_t, gss_buffer_t, gss_OID *);
544 544
OM_uint32 __gss_release_internal_name(OM_uint32 *, const gss_OID,
545 545
	gss_name_t *);
546
OM_uint32 gssint_delete_internal_sec_context (OM_uint32 *, gss_OID,
546
OM_uint32 gssint_delete_internal_sec_context(OM_uint32 *, gss_OID,
547 547
	gss_ctx_id_t *, gss_buffer_t);
548 548
OM_uint32 __gss_convert_name_to_union_name(
549 549
	OM_uint32 *,		/* minor_status */
......
552 552
	gss_name_t *		/* external_name */
553 553
);
554 554

  
555
 gss_cred_id_t __gss_get_mechanism_cred(
555
gss_cred_id_t __gss_get_mechanism_cred(
556 556
	const gss_union_cred_t,	/* union_cred */
557 557
	const gss_OID		/* mech_type */
558 558
);
......
564 564
int gssint_mechglue_init(void);
565 565
void gssint_mechglue_fini(void);
566 566

  
567
gss_mechanism gssint_get_mechanism (gss_OID);
568
OM_uint32 gssint_get_mech_type (gss_OID, gss_buffer_t);
567
gss_mechanism gssint_get_mechanism(gss_OID);
568
OM_uint32 gssint_get_mech_type(gss_OID, gss_buffer_t);
569 569
char *gssint_get_kmodName(const gss_OID);
570 570
char *gssint_get_modOptions(const gss_OID);
571
OM_uint32 gssint_import_internal_name (OM_uint32 *, gss_OID, gss_union_name_t,
572
				      gss_name_t *);
571
OM_uint32 gssint_import_internal_name(OM_uint32 *, gss_OID, gss_union_name_t,
572
	gss_name_t *);
573 573
OM_uint32 gssint_export_internal_name(OM_uint32 *, const gss_OID,
574 574
	const gss_name_t, gss_buffer_t);
575
OM_uint32 gssint_display_internal_name (OM_uint32 *, gss_OID, gss_name_t,
576
				       gss_buffer_t, gss_OID *);
577
OM_uint32 gssint_release_internal_name (OM_uint32 *, gss_OID, gss_name_t *);
578

  
579
OM_uint32 gssint_convert_name_to_union_name
580
	  (OM_uint32 *,		/* minor_status */
581
	   gss_mechanism,	/* mech */
582
	   gss_name_t,		/* internal_name */
583
	   gss_name_t *		/* external_name */
584
	   );
585
gss_cred_id_t gssint_get_mechanism_cred
586
	  (gss_union_cred_t,	/* union_cred */
587
	   gss_OID		/* mech_type */
588
	   );
575
OM_uint32 gssint_display_internal_name(OM_uint32 *, gss_OID, gss_name_t,
576
	gss_buffer_t, gss_OID *);
577
OM_uint32 gssint_release_internal_name(OM_uint32 *, gss_OID, gss_name_t *);
578

  
579
OM_uint32 gssint_convert_name_to_union_name(
580
	OM_uint32 *,	/* minor_status */
581
	gss_mechanism,	/* mech */
582
	gss_name_t,	/* internal_name */
583
	gss_name_t *	/* external_name */
584
);
585
gss_cred_id_t gssint_get_mechanism_cred(
586
	gss_union_cred_t,	/* union_cred */
587
	gss_OID			/* mech_type */
588
);
589 589

  
590 590
OM_uint32 gssint_create_copy_buffer(
591 591
	const gss_buffer_t,	/* src buffer */
......
608 608
);
609 609

  
610 610

  
611
gss_OID gss_find_mechanism_from_name_type (gss_OID); /* name_type */
611
gss_OID gss_find_mechanism_from_name_type(gss_OID); /* name_type */
612 612

  
613
OM_uint32 gss_add_mech_name_type
614
	   (OM_uint32 *,	/* minor_status */
615
	    gss_OID,		/* name_type */
616
	    gss_OID		/* mech */
617
	       );
613
OM_uint32 gss_add_mech_name_type(
614
	OM_uint32 *,	/* minor_status */
615
	gss_OID,	/* name_type */
616
	gss_OID		/* mech */
617
);
618 618

  
619 619
/*
620 620
 * Sun extensions to GSS-API v2
......
721 721
	(((ctx) == GSS_C_NO_CONTEXT) ? (gssd_ctx_id_t)(uintptr_t)(ctx) : \
722 722
	KCTX_TO_GSSD_CTX(ctx))
723 723
#define	KGSS_CTX_TO_GSSD_CTXV(ctx)	\
724
	(((ctx) == GSS_C_NO_CONTEXT) ? (NULL) : KCTX_TO_CTXV(ctx))
724
	(((ctx) == GSS_C_NO_CONTEXT) ? 0 : KCTX_TO_CTXV(ctx))
725 725

  
726 726
#ifdef _KERNEL
727 727
#define	KCTX_TO_I_CTX(ctx)	(KCTX_TO_KGSS_CTX(ctx)->gssd_i_ctx)
......
761 761
		KCTX_TO_CTX(ctx), msg, tkn, conf, qop, \
762 762
		KCTX_TO_CTXV(ctx))
763 763

  
764
#define KGSS_INIT_CONTEXT(ctx) krb5_init_context(ctx)
765
#define KGSS_RELEASE_OID(minor_st, oid) krb5_gss_release_oid(minor_st, oid)
764
#define	KGSS_INIT_CONTEXT(ctx) krb5_init_context(ctx)
765
#define	KGSS_RELEASE_OID(minor_st, oid) krb5_gss_release_oid(minor_st, oid)
766 766
extern OM_uint32 kgss_release_oid(OM_uint32 *, gss_OID *);
767 767

  
768 768
#else /* !_KERNEL */
769 769

  
770
#define KGSS_INIT_CONTEXT(ctx) krb5_gss_init_context(ctx)
771
#define KGSS_RELEASE_OID(minor_st, oid) gss_release_oid(minor_st, oid)
770
#define	KGSS_INIT_CONTEXT(ctx) krb5_gss_init_context(ctx)
771
#define	KGSS_RELEASE_OID(minor_st, oid) gss_release_oid(minor_st, oid)
772 772

  
773 773
#define	KCTX_TO_CTX(ctx)  (KCTX_TO_KGSS_CTX(ctx)->gssd_ctx)
774 774
#define	MALLOC(n) malloc(n)
......
799 799
#endif /* _KERNEL */
800 800

  
801 801
/* SUNW15resync - moved from gssapiP_generic.h for sake of non-krb5 mechs */
802
OM_uint32 generic_gss_release_buffer
803
(OM_uint32*,       /* minor_status */
804
            gss_buffer_t      /* buffer */
805
           );
806

  
807
OM_uint32 generic_gss_release_oid_set
808
(OM_uint32*,       /* minor_status */
809
            gss_OID_set*      /* set */
810
           );
811

  
812
OM_uint32 generic_gss_release_oid
813
(OM_uint32*,       /* minor_status */
814
            gss_OID*         /* set */
815
           );
816

  
817
OM_uint32 generic_gss_copy_oid
818
(OM_uint32 *,	/* minor_status */
819
            gss_OID_desc * const,   /* oid */ /* SUNW15resync */
820
	    gss_OID *		/* new_oid */
821
	    );
822

  
823
OM_uint32 generic_gss_create_empty_oid_set
824
(OM_uint32 *,	/* minor_status */
825
	    gss_OID_set *	/* oid_set */
826
	   );
827

  
828
OM_uint32 generic_gss_add_oid_set_member
829
(OM_uint32 *,	/* minor_status */
830
	    gss_OID_desc * const,		/* member_oid */
831
	    gss_OID_set *	/* oid_set */
832
	   );
833

  
834
OM_uint32 generic_gss_test_oid_set_member
835
(OM_uint32 *,	/* minor_status */
836
	    gss_OID_desc * const,		/* member */
837
	    gss_OID_set,	/* set */
838
	    int *		/* present */
839
	   );
840

  
841
OM_uint32 generic_gss_oid_to_str
842
(OM_uint32 *,	/* minor_status */
843
	    gss_OID_desc * const,		/* oid */
844
	    gss_buffer_t	/* oid_str */
845
	   );
846

  
847
OM_uint32 generic_gss_str_to_oid
848
(OM_uint32 *,	/* minor_status */
849
	    gss_buffer_t,	/* oid_str */
850
	    gss_OID *		/* oid */
851
	   );
802
OM_uint32 generic_gss_release_buffer(
803
	OM_uint32*,	/* minor_status */
804
	gss_buffer_t	/* buffer */
805
);
806

  
807
OM_uint32 generic_gss_release_oid_set(
808
	OM_uint32*,	/* minor_status */
809
	gss_OID_set*	/* set */
810
);
811

  
812
OM_uint32 generic_gss_release_oid(
813
	OM_uint32*,	/* minor_status */
814
	gss_OID*	/* set */
815
);
816

  
817
OM_uint32 generic_gss_copy_oid(
818
	OM_uint32 *,		/* minor_status */
819
	gss_OID_desc * const,	/* oid */ /* SUNW15resync */
820
	gss_OID *		/* new_oid */
821
);
822

  
823
OM_uint32 generic_gss_create_empty_oid_set(
824
	OM_uint32 *,	/* minor_status */
825
	gss_OID_set *	/* oid_set */
826
);
827

  
828
OM_uint32 generic_gss_add_oid_set_member(
829
	OM_uint32 *,		/* minor_status */
830
	gss_OID_desc * const,	/* member_oid */
831
	gss_OID_set *		/* oid_set */
832
);
833

  
834
OM_uint32 generic_gss_test_oid_set_member(
835
	OM_uint32 *,		/* minor_status */
836
	gss_OID_desc * const,		/* member */
837
	gss_OID_set,		/* set */
838
	int *			/* present */
839
);
840

  
841
OM_uint32 generic_gss_oid_to_str(
842
	OM_uint32 *,		/* minor_status */
843
	gss_OID_desc * const,	/* oid */
844
	gss_buffer_t		/* oid_str */
845
);
846

  
847
OM_uint32 generic_gss_str_to_oid(
848
	OM_uint32 *,	/* minor_status */
849
	gss_buffer_t,	/* oid_str */
850
	gss_OID *	/* oid */
851
);
852 852

  
853 853
OM_uint32
854 854
generic_gss_oid_compose(
855
    OM_uint32 *,        /* minor_status */
856
    const char *,       /* prefix */
857
    size_t,             /* prefix_len */
858
    int,                /* suffix */
859
    gss_OID_desc *);    /* oid */
855
	OM_uint32 *,	/* minor_status */
856
	const char *,	/* prefix */
857
	size_t,		/* prefix_len */
858
	int,		/* suffix */
859
	gss_OID_desc *	/* oid */
860
);
860 861

  
861 862
OM_uint32
862 863
generic_gss_oid_decompose(
863
    OM_uint32 *,        /* minor_status */
864
    const char *,       /*prefix */
865
    size_t,             /* prefix_len */
866
    gss_OID_desc *,     /* oid */
867
    int *);             /* suffix */
864
	OM_uint32 *,	/* minor_status */
865
	const char *,	/* prefix */
866
	size_t,		/* prefix_len */
867
	gss_OID_desc *,	/* oid */
868
	int *		/* suffix */
869
);
868 870

  
869
OM_uint32 generic_gss_create_empty_buffer_set
870
(OM_uint32 * /*minor_status*/,
871
            gss_buffer_set_t * /*buffer_set*/);
871
OM_uint32 generic_gss_create_empty_buffer_set(
872
	OM_uint32 *		/* minor_status */,
873
	gss_buffer_set_t *	/* buffer_set */
874
);
872 875

  
873
OM_uint32 generic_gss_add_buffer_set_member
874
(OM_uint32 * /*minor_status*/,
875
            const gss_buffer_t /*member_buffer*/,
876
            gss_buffer_set_t * /*buffer_set*/);
876
OM_uint32 generic_gss_add_buffer_set_member(
877
	OM_uint32 *		/* minor_status */,
878
	const gss_buffer_t	/* member_buffer */,
879
	gss_buffer_set_t *	/* buffer_set */
880
);
877 881

  
878
OM_uint32 generic_gss_release_buffer_set
879
(OM_uint32 * /*minor_status*/,
880
            gss_buffer_set_t * /*buffer_set*/);
882
OM_uint32 generic_gss_release_buffer_set(
883
	OM_uint32 *		/* minor_status */,
884
	gss_buffer_set_t *	/* buffer_set */
885
);
881 886

  
882 887
/*
883 888
 * SUNW17PACresync
......
885 890
 * Solaris does not gen the errors at build time so we just stub these
886 891
 * for now, need to revisit.
887 892
 * See mglueP.h and util_errmap.c in MIT 1.7.
888
*/
893
 */
889 894
#ifdef _KERNEL
890 895

  
891
#define map_error(MINORP, MECH)
892
#define map_errcode(MINORP)
896
#define	map_error(MINORP, MECH)
897
#define	map_errcode(MINORP)
893 898

  
894 899
#else  /* _KERNEL */
895 900

  
896
/* Use this to map an error code that was returned from a mech
897
   operation; the mech will be asked to produce the associated error
898
   messages.
899

  
900
   Remember that if the minor status code cannot be returned to the
901
   caller (e.g., if it's stuffed in an automatic variable and then
902
   ignored), then we don't care about producing a mapping.  */
903
#define map_error(MINORP, MECH) \
904
    (*(MINORP) = gssint_mecherrmap_map(*(MINORP), &(MECH)->mech_type))
905
#define map_error_oid(MINORP, MECHOID) \
906
    (*(MINORP) = gssint_mecherrmap_map(*(MINORP), (MECHOID)))
907

  
908
/* Use this to map an errno value or com_err error code being
909
   generated within the mechglue code (e.g., by calling generic oid
910
   ops).  Any errno or com_err values produced by mech operations
911
   should be processed with map_error.  This means they'll be stored
912
   separately even if the mech uses com_err, because we can't assume
913
   that it will use com_err.  */
914
#define map_errcode(MINORP) \
915
    (*(MINORP) = gssint_mecherrmap_map_errcode(*(MINORP)))
901
/*
902
 * Use this to map an error code that was returned from a mech
903
 * operation; the mech will be asked to produce the associated error
904
 * messages.
905
 *
906
 * Remember that if the minor status code cannot be returned to the
907
 * caller (e.g., if it's stuffed in an automatic variable and then
908
 * ignored), then we don't care about producing a mapping.
909
 */
910
#define	map_error(MINORP, MECH) \
911
	(*(MINORP) = gssint_mecherrmap_map(*(MINORP), &(MECH)->mech_type))
912
#define	map_error_oid(MINORP, MECHOID) \
913
	(*(MINORP) = gssint_mecherrmap_map(*(MINORP), (MECHOID)))
914

  
915
/*
916
 * Use this to map an errno value or com_err error code being
917
 * generated within the mechglue code (e.g., by calling generic oid
918
 * ops).  Any errno or com_err values produced by mech operations
919
 * should be processed with map_error.  This means they'll be stored
920
 * separately even if the mech uses com_err, because we can't assume
921
 * that it will use com_err.
922
 */
923
#define	map_errcode(MINORP) \
924
	(*(MINORP) = gssint_mecherrmap_map_errcode(*(MINORP)))
916 925

  
917 926
#endif /* _KERNEL */
918 927

  
(2-2/2)