pike.git / src / post_modules / GSSAPI / gssapi.cmod

version» Context lines:

pike.git/src/post_modules/GSSAPI/gssapi.cmod:25:    * gss_duplicate_name, gss_export_name, gss_release_buffer,    * gss_release_name, gss_release_oid_set, gss_test_oid_set_member    *    * /mast    */      /* #define GSSAPI_DEBUG */   /* #define GSSAPI_DEBUG_MORE */       - #include "global.h" + #include "module.h"   #include "gssapi_config.h"      #include "bignum.h"   #include "builtin_functions.h" - #include "dmalloc.h" +    #include "interpret.h" - #include "mapping.h" - #include "module.h" - #include "multiset.h" - #include "object.h" +    #include "operators.h"   #include "pike_error.h"   #include "pike_threadlib.h" - #include "port.h" +    #include "threads.h"   #include "version.h" -  + #include "module_support.h" + #include "sprintf.h"      #define DEFAULT_CMOD_STORAGE static      DECLARATIONS      #ifdef HAVE_GSSAPI    - #ifdef HAVE_GSSAPI_H - #include <gssapi.h> - #elif defined (HAVE_GSSAPI_GSSAPI_H) + #ifdef HAVE_GSSAPI_GSSAPI_H   #include <gssapi/gssapi.h> -  + #elif defined (HAVE_GSSAPI_H) + #include <gssapi.h>   #elif defined (HAVE_GSSGLUE_GSSAPI_GSSAPI_H)   #include <gssglue/gssapi/gssapi.h>   #endif      #define DEFINE_STATIC_OID(NAME, VALUE) \    static const unsigned char PIKE_CONCAT (NAME, _elements)[] = VALUE; \    static const gss_OID_desc PIKE_CONCAT (NAME, _desc) = { \    sizeof (PIKE_CONCAT (NAME, _elements)) - 1, &PIKE_CONCAT (NAME, _elements) \    }; \    static const gss_OID_desc * const NAME = &PIKE_CONCAT (NAME, _desc)    - #ifdef HAVE_GSSAPI_KRB5_H - #include <gssapi_krb5.h> - #elif defined (HAVE_GSSAPI_GSSAPI_KRB5_H) + #ifdef HAVE_GSSAPI_GSSAPI_KRB5_H   #include <gssapi/gssapi_krb5.h> -  + #elif defined (HAVE_GSSAPI_KRB5_H) + #include <gssapi_krb5.h>   #elif defined (HAVE_GSSGLUE_GSSAPI_GSSAPI_KRB5_H)   #include <gssglue/gssapi/gssapi_krb5.h>   #elif !defined(HAVE_GSS_KRB5_NT_PRINCIPAL_NAME)   /* Can't use #ifdef GSS_KRB5_NT_PRINCIPAL_NAME since it might not be a    * macro in gssapi_krb5.h or gssapi.h. */   DEFINE_STATIC_OID (GSS_KRB5_NT_PRINCIPAL_NAME,    "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01");   #define HAVE_GSS_KRB5_NT_PRINCIPAL_NAME   #endif   
pike.git/src/post_modules/GSSAPI/gssapi.cmod:171:   #endif         #define CHECK_NARROW_STRING(PIKESTR, FN, ARG) do { \    if ((PIKESTR)->size_shift) \    SIMPLE_ARG_ERROR (FN, ARG, "String cannot be wide."); \    } while (0)      static struct svalue int_pos_inf = SVALUE_INIT_FREE;    - static void resolve_syms(); + static void resolve_syms(void);      #define RESOLVE_SYMS() do { \    if (TYPEOF(int_pos_inf) == PIKE_T_FREE) resolve_syms(); \    } while (0)      #define PUSH_TIME(TIME) do { \    if (TIME == GSS_C_INDEFINITE) { \    RESOLVE_SYMS(); \    push_svalue (&int_pos_inf); \    } \
pike.git/src/post_modules/GSSAPI/gssapi.cmod:253:    DMALLOC_UNREGISTER (*oid_set);    maj = gss_release_oid_set (&min, oid_set);    MORE_STATUS_MSG (gss_release_oid_set, maj, min);    CHECK_UNEXPECTED_ERROR (gss_release_oid_set, maj, min);    *oid_set = GSS_C_NO_OID_SET;    }   }      #define IS_SAME_OID(A, B) \    (A == B || (A->length == B->length && \ -  !MEMCMP (A->elements, B->elements, A->length))) +  !memcmp (A->elements, B->elements, A->length)))      #define COPY_OID(DST, SRC) do { \    gss_OID dst_ = (DST), src_ = (SRC); \    size_t l_ = src_->length; \    dst_->length = l_; \    dst_->elements = xalloc (l_); \ -  MEMCPY (dst_->elements, src_->elements, l_); \ +  memcpy (dst_->elements, src_->elements, l_); \    } while (0)      /* Support code to map between gss_OID's and the dotted-decimal    * strings we prefer to use in pike. */      static struct svalue encode_der_oid = SVALUE_INIT_FREE;   static struct svalue decode_der_oid = SVALUE_INIT_FREE;      /* Cache mapping between DER encoded OIDs and dotted-decimal strings,    * both ways. */
pike.git/src/post_modules/GSSAPI/gssapi.cmod:419:   }      #define RESOLVE_AND_SET(IDENT, SVALUE) do { \    push_text (IDENT); \    SAFE_APPLY_MASTER ("resolv", 1); \    if (SAFE_IS_ZERO (Pike_sp - 1)) \    Pike_error ("GSSAPI: Failed to resolve %s.\n", IDENT); \    move_svalue (&SVALUE, --Pike_sp); \    } while (0)    - static void resolve_syms() + static void resolve_syms(void)   {    RESOLVE_AND_SET ("Int.inf", int_pos_inf);    RESOLVE_AND_SET ("Standards.ASN1.encode_der_oid", encode_der_oid);    RESOLVE_AND_SET ("Standards.ASN1.decode_der_oid", decode_der_oid);   }         /*! @module GSSAPI    *! -  *! This is pike glue for GSS-API ver 2 as specified in RFC 2743. +  *! This is pike glue for GSS-API ver 2 as specified in @rfc{2743@}.    *!    *! GSS-API is used to authenticate users and servers, and optionally    *! also to encrypt communication between them. The API is generic and    *! can be used without any knowledge of the actual implementation of    *! these security services, which is typically provided by the    *! operating system.    *!    *! The most common implementation at the time of writing is Kerberos,    *! which means that the main benefit of this API is to allow clients    *! and servers to authenticate each other using Kerberos, thereby
pike.git/src/post_modules/GSSAPI/gssapi.cmod:477:    *! @decl constant int CREDENTIALS_EXPIRED    *! @decl constant int CONTEXT_EXPIRED    *! @decl constant int FAILURE    *! @decl constant int BAD_QOP    *! @decl constant int UNAUTHORIZED    *! @decl constant int UNAVAILABLE    *! @decl constant int DUPLICATE_ELEMENT    *! @decl constant int NAME_NOT_MN    *!    *! Constants for routine errors in major status codes like -  *! @[GSSAPI.Error.major_status]. See RFC 2743 section 1.2.1.1. Note -  *! that major status codes have to be masked with -  *! @[GSSAPI.ERROR_MASK] before comparison with these. +  *! @[GSSAPI.Error.major_status]. See @rfc{2743:1.2.1.1@}. Note that +  *! major status codes have to be masked with @[GSSAPI.ERROR_MASK] +  *! before comparison with these.    *!    *! Brief descriptions of the flags:    *!    *! @dl    *! @item GSSAPI.BAD_BINDINGS    *! Channel binding mismatch.    *! @item GSSAPI.BAD_MECH    *! Unsupported mechanism requested.    *! @item GSSAPI.BAD_NAME    *! Invalid name provided.
pike.git/src/post_modules/GSSAPI/gssapi.cmod:537:    *! @[GSSAPI.Error.major_status].    */      /*! @decl constant int CONTINUE_NEEDED    *! @decl constant int DUPLICATE_TOKEN    *! @decl constant int OLD_TOKEN    *! @decl constant int UNSEQ_TOKEN    *! @decl constant int GAP_TOKEN    *!    *! Bitfield flags for informatory codes in major status codes like -  *! @[GSSAPI.Error.major_status]. See RFC 2743 section 1.2.1.1. Any +  *! @[GSSAPI.Error.major_status]. See @rfc{2743:1.2.1.1@}. Any    *! combination of these might optionally be combined with one routine    *! error constant to form a major status code.    *!    *! Brief descriptions of the flags:    *!    *! @dl    *! @item GSSAPI.CONTINUE_NEEDED    *! Continuation call to routine required.    *! @item GSSAPI.DUPLICATE_TOKEN    *! Duplicate per-message token detected.
pike.git/src/post_modules/GSSAPI/gssapi.cmod:564:    *! @enddl    */      /*! @decl array(string) major_status_messages (int major_status)    *!    *! Given a major status code like @[GSSAPI.Error.major_status] (or    *! more commonly @[GSSAPI.Context.last_major_status] in this case),    *! returns an array containing messages for all the status values in    *! it. The returned string(s) presumably don't end with linefeeds.    *! -  *! This wraps @tt{GSS_Display_status@} according to RFC 2743 section -  *! 2.4.1. +  *! This wraps @tt{GSS_Display_status@} according to +  *! @rfc{2743:2.4.1@}.    */   PIKEFUN array(string) major_status_messages (int major_status)   {    OM_uint32 msg_ctx = 0;    int n = 0;       pop_n_elems (args);       do {    WITH_GSS_BUFFER (msg) {
pike.git/src/post_modules/GSSAPI/gssapi.cmod:599:   }      /*! @decl array(string) minor_status_messages (int minor_status, @    *! void|string mech)    *!    *! Given a mechanism-specific minor status code like    *! @[GSSAPI.Error.minor_status], returns an array containing messages    *! for all the status values in it. The returned string(s) presumably    *! don't end with linefeeds.    *! -  *! This wraps @tt{GSS_Display_status@} according to RFC 2743 section -  *! 2.4.1. +  *! This wraps @tt{GSS_Display_status@} according to +  *! @rfc{2743:2.4.1@}.    *!    *! @param minor_status    *! The mechanism-specific minor status.    *!    *! @param mech    *! The mechanism that produced the status code. If this is zero or    *! left out, a system default mechanism is used.    */   PIKEFUN array(string) minor_status_messages (int minor_status, void|string mech)   {
pike.git/src/post_modules/GSSAPI/gssapi.cmod:705:    if (THIS->mech.elements) free (THIS->mech.elements);    break;    }   }      /*! @decl int major_status    *!    *! The major status code. This is a bitwise OR of one routine error    *! code and zero or more supplementary error info bits.    *! -  *! See RFC 2743 section 1.2.1.1 and RFC 2744 section 3.9.1. Note that -  *! the calling errors mentioned in RFC 2744 are never thrown. +  *! See @rfc{2743:1.2.1.1@} and @rfc{2744:3.9.1@}. Note that the +  *! calling errors mentioned in @rfc{2744@} are never thrown.    *!    *! @seealso    *! @[major_status_messages]    */      /*! @decl int minor_status    *!    *! The minor status code specific for the mechanism.    *!    *! @seealso
pike.git/src/post_modules/GSSAPI/gssapi.cmod:777:    string_builder_binary_strcat (&sb, msg.value, msg.length);    } END_GSS_BUFFER (msg);    }       string_builder_putchar (&sb, '\n');       UNSET_ONERROR (uwp);    return finish_string_builder (&sb);   }    - /*! @decl static void create (void|int major, @ + /*! @decl protected void create (void|int major, @    *! void|int minor, void|string mech, @    *! void|string message, void|array backtrace)    *!    *! @param major    *! Initial value for @[major_status].    *!    *! @param minor    *! Initial value for @[minor_status].    *!    *! @param mech
pike.git/src/post_modules/GSSAPI/gssapi.cmod:835:    }       {    gss_OID mech = THIS->mech.elements ? &THIS->mech : GSS_C_NO_OID;       if(args > 3 &&    (TYPEOF(Pike_sp[3-args]) != T_INT || Pike_sp[3-args].u.integer)) {    if(TYPEOF(Pike_sp[3-args]) != T_STRING)    SIMPLE_ARG_TYPE_ERROR ("create",4,"void|string");    ref_push_string (Pike_sp[3-args].u.string); -  push_constant_text (": "); +  push_static_text (": ");    push_string (make_gss_err_message (THIS->major_status, THIS->minor_status,    mech, NULL, NULL));    f_add (3);    do_free_string (GEN_ERR_THIS->error_message);    GEN_ERR_THIS->error_message = (--Pike_sp)->u.string;    }    else {    struct pike_string *msg =    make_gss_err_message (THIS->major_status, THIS->minor_status,    mech, NULL, NULL);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1056:    *! Bitfield of @tt{GSSAPI.*_FLAG@} flags for the missing services    *! that caused the error.    *!    *! @seealso    *! @[GSSAPI.describe_services]    */      static void describe_services_and_push (OM_uint32 services)   {    int n = 0; -  if (services & GSS_C_DELEG_FLAG) {push_constant_text ("DEL"); n++;} -  if (services & GSS_C_MUTUAL_FLAG) {push_constant_text ("MUT"); n++;} -  if (services & GSS_C_REPLAY_FLAG) {push_constant_text ("REPL"); n++;} -  if (services & GSS_C_SEQUENCE_FLAG) {push_constant_text ("SEQ"); n++;} -  if (services & GSS_C_CONF_FLAG) {push_constant_text ("CONF"); n++;} -  if (services & GSS_C_INTEG_FLAG) {push_constant_text ("INTEG"); n++;} -  if (services & GSS_C_ANON_FLAG) {push_constant_text ("ANON"); n++;} -  if (services & GSS_C_PROT_READY_FLAG) {push_constant_text ("READY"); n++;} -  if (services & GSS_C_TRANS_FLAG) {push_constant_text ("TRANS"); n++;} +  if (services & GSS_C_DELEG_FLAG) {push_static_text ("DEL"); n++;} +  if (services & GSS_C_MUTUAL_FLAG) {push_static_text ("MUT"); n++;} +  if (services & GSS_C_REPLAY_FLAG) {push_static_text ("REPL"); n++;} +  if (services & GSS_C_SEQUENCE_FLAG) {push_static_text ("SEQ"); n++;} +  if (services & GSS_C_CONF_FLAG) {push_static_text ("CONF"); n++;} +  if (services & GSS_C_INTEG_FLAG) {push_static_text ("INTEG"); n++;} +  if (services & GSS_C_ANON_FLAG) {push_static_text ("ANON"); n++;} +  if (services & GSS_C_PROT_READY_FLAG) {push_static_text ("READY"); n++;} +  if (services & GSS_C_TRANS_FLAG) {push_static_text ("TRANS"); n++;}    f_aggregate (n); -  push_constant_text ("|"); +  push_static_text ("|");    o_multiply();   }      static struct pike_string *make_missing_err_message (OM_uint32 missing)   {    int n = 0; -  push_text ("Required service(s) missing: "); +  push_static_text ("Required service(s) missing: ");    describe_services_and_push (missing); -  push_text ("\n"); +  push_static_text ("\n");    f_add (3);    assert (TYPEOF(Pike_sp[-1]) == T_STRING);    return (--Pike_sp)->u.string;   }    - /*! @decl static void create (void|int missing_services) + /*! @decl protected void create (void|int missing_services)    *!    *! @param missing_services    *! Initial value for @[services].    */   static void missing_err_create (INT32 args)   {    if (args > 1) wrong_number_of_args_error ("create", args, 1);       if (args) {    if (TYPEOF(Pike_sp[-1]) != T_INT)
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1131:    *! @decl constant string NT_EXPORT_NAME    *! @decl constant string KRB5_NT_PRINCIPAL_NAME    *!    *! OIDs on dotted-decimal form for the GSS-API mechanism-independent    *! name types, and some selected mechanism-specific ones:    *!    *! @dl    *! @item NT_HOSTBASED_SERVICE    *! Name type for a service associated with a host computer. The    *! syntax is @tt{service@@hostname@} where the @tt{@@hostname@} -  *! part may be omitted for the local host. See RFC 2743 section -  *! 4.1. +  *! part may be omitted for the local host. See @rfc{2743:4.1@}.    *! @item NT_USER_NAME    *! Name type for a named user on a local system. The syntax is -  *! @tt{username@}. See RFC 2743 section 4.2. +  *! @tt{username@}. See @rfc{2743:4.2@}.    *! @item NT_MACHINE_UID_NAME    *! Name type for a numeric user identifier corresponding to a user    *! on a local system. The string representing a name of this type    *! should contain a locally-significant user ID, represented in -  *! host byte order. See RFC 2743 section 4.3. +  *! host byte order. See @rfc{2743:4.3@}.    *! @item NT_STRING_UID_NAME    *! Name type for a string of digits representing the numeric user    *! identifier of a user on a local system. This name type is    *! similar to the Machine UID Form, except that the buffer contains -  *! a string representing the user ID. See RFC 2743 section 4.4. +  *! a string representing the user ID. See @rfc{2743:4.4@}.    *! @item NT_ANONYMOUS -  *! Name type to identify anonymous names. See RFC 2743 section 4.5. +  *! Name type to identify anonymous names. See @rfc{2743:4.5@}.    *! @item NT_EXPORT_NAME    *! Name type for the Mechanism-Independent Exported Name Object    *! type, which is the type of the names returned by -  *! @[GSSAPI.Name.export]. See RFC 2743 section 4.7. +  *! @[GSSAPI.Name.export]. See @rfc{2743:4.7@}.    *! @item KRB5_NT_PRINCIPAL_NAME -  *! Name type for a Kerberos principal. See RFC 1964 section 2.1.1. +  *! Name type for a Kerberos principal. See @rfc{1964:2.1.1@}.    *! @enddl    */      /*! @class Name    *!    *! An object of this class contains a name on the internal form which -  *! is required by the GSS-API functions. See RFC 2743, section 1.1.5. +  *! is required by the GSS-API functions. See @rfc{2743:1.1.5@}.    */   PIKECLASS Name   {    CVAR gss_name_t name;       static void cleanup_name (gss_name_t *name)    {    if (*name != GSS_C_NO_NAME) {    OM_uint32 maj, min;    DMALLOC_UNREGISTER (*name);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1232:    STATUS_MSG (gss_import_name, maj, min);       DMALLOC_REGISTER (name_tmp);    if (*name != GSS_C_NO_NAME)    cleanup_name (name); /* Cope with race after THREADS_ALLOW. */    *name = name_tmp;       CHECK_ERROR (gss_import_name, maj, min);    }    -  /*! @decl static void create (string name, void|string name_type) +  /*! @decl protected void create (string name, void|string name_type)    *! -  *! This wraps @tt{GSS_Import_name@} according to RFC 2743 section -  *! 2.4.5. +  *! This wraps @tt{GSS_Import_name@} according to @rfc{2743:2.4.5@}.    *!    *! @param name    *! A name on string form (a contiguous string name in GSS-API    *! parlance).    *!    *! @param name_type    *! The OID on dotted-decimal form for the type of the name in    *! @[name]. If left out, @[name] is parsed according to a    *! mechanism-specific default printable syntax.    *!    *! @note    *! If @[name] is the result of @[export] or a similar function    *! then @[name_type] should be @[GSSAPI.NT_EXPORT_NAME].    */    PIKEFUN void create (string name, void|string name_type) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    gss_OID_desc type_desc;    gss_OID type;      #ifndef PRECOMPILE_API_VERSION    /* Live with the pessimal precompile.pike in 7.4.. :P */    struct pike_string *_name_type;    CHECK_OPT_ARG (name_type, _name_type,    T_STRING, string, "string", "create", 2);   #define name_type _name_type
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1287:    /*! @decl string display_name()    *! @decl string display_name_type()    *!    *! @[display_name] returns a representation of the name for display    *! purposes, and @[display_name_type] returns an OID on    *! dotted-decimal form for the type of that name.    *!    *! If no type was given to @[create] then @[display_name_type]    *! might return zero.    *! -  *! This wraps @tt{GSS_Display_name@} according to RFC 2743 section -  *! 2.4.4. +  *! This wraps @tt{GSS_Display_name@} according to +  *! @rfc{2743:2.4.4@}.    *!    *! @seealso    *! The @tt{GSSAPI.NT_*@} constants.    */       PIKEFUN string display_name()    {    WITH_GSS_BUFFER (d_name) {    OM_uint32 maj, min;    maj = gss_display_name (&min, THIS->name, &d_name, NULL);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1366:    else if (IS_SAME_OID (type, GSS_C_NT_ANONYMOUS))    string_builder_strcat (sb, "anonymous: ");    else if (IS_SAME_OID (type, GSS_C_NT_EXPORT_NAME))    string_builder_strcat (sb, "export name: ");    else {    string_builder_shared_strcat (sb, get_dd_oid (type));    string_builder_strcat (sb, ": ");    }    }    -  push_text ("%O"); +  push_static_text ("%O");    push_string (make_shared_binary_string (d_name.value, d_name.length));    f_sprintf (2);    string_builder_shared_strcat (sb, Pike_sp[-1].u.string);    pop_stack();    break;    }    }    } END_GSS_BUFFER (d_name);    }       PIKEFUN string _sprintf (int flag, ...) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    pop_n_elems (args);       if (flag != 'O')    push_int (0);       else {    struct string_builder sb;    ONERROR uwp;    init_string_builder (&sb, 0);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1407:    push_string (finish_string_builder (&sb));    }    }       /*! @decl Name canonicalize (string mech)    *!    *! Returns a @[GSSAPI.Name] containing the canonical mechanism name    *! (MN) of this name. The mechanism is given as a dotted-decimal    *! OID in @[mech].    *! -  *! This wraps @tt{GSS_Canonicalize_name@} according to RFC 2743 -  *! section 2.4.14. +  *! This wraps @tt{GSS_Canonicalize_name@} according to +  *! @rfc{2743:2.4.14@}.    *!    *! @note    *! This function might block on network connections to remote    *! authentication servers.    */    PIKEFUN object(Name) canonicalize (string mech)    {    gss_name_t mn = GSS_C_NO_NAME;    ONERROR uwp;   
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1450:    UNSET_ONERROR (uwp);    }       /*! @decl string export (void|string mech)    *!    *! Returns the name on the exported format. If @[mech] isn't given    *! then the name has to be a mechanism name (MN). If @[mech] is    *! given then the name is canonicalized according to that mechanism    *! before being exported (see @[canonicalize]).    *! -  *! This wraps @tt{GSS_Export_name@} according to RFC 2743 section -  *! 2.4.15. +  *! This wraps @tt{GSS_Export_name@} according to +  *! @rfc{2743:2.4.15@}.    *!    *! @note    *! This function might block on network connections to remote    *! authentication servers if @[mech] is specified.    */    PIKEFUN string export (void|string mech)    {    gss_OID_desc mech_oid_desc;    gss_OID mech_oid;    gss_name_t mn = GSS_C_NO_NAME;
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1513:    push_string (make_shared_binary_string (exp.value, exp.length));    } END_GSS_BUFFER (exp);       if (mech)    CALL_AND_UNSET_ONERROR (uwp);       stack_pop_n_elems_keep_top (args);   #undef mech    }    -  /*! @decl static int `== (mixed other) +  /*! @decl protected int `== (mixed other)    *!    *! Returns true if @[other] is a @[GSSAPI.Name] which contains a    *! name that refers to the same identity as this one.    *! -  *! This wraps @tt{GSS_Compare_name@} according to RFC 2743 section -  *! 2.4.3. +  *! This wraps @tt{GSS_Compare_name@} according to +  *! @rfc{2743:2.4.3@}.    *!    *! If either @[GSSAPI.Name] object is uninitialized or contains an    *! anonymous identity then they are considered different, unless it    *! is the very same @[GSSAPI.Name] object (that is an inherent pike    *! behavior).    *!    *! @throws    *! An error is thrown if the names are incomparable, or if either    *! of them are ill-formed.    */    PIKEFUN int `== (mixed other) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    if (THIS->name != GSS_C_NO_NAME &&    TYPEOF(*other) == T_OBJECT) {    struct Name_struct *other_stor =    (struct Name_struct *) get_storage (other->u.object, Name_program);       if (other_stor && other_stor->name != GSS_C_NO_NAME) {    int equal;    OM_uint32 maj, min;    maj = gss_compare_name (&min, THIS->name, other_stor->name, &equal);    STATUS_MSG (gss_compare_name, maj, min);    CHECK_ERROR (gss_compare_name, maj, min);    RETURN equal;    }    }       RETURN 0;    }    -  /*! @decl static int __hash() +  /*! @decl protected int __hash()    *!    *! Tries to export the name (see @[export]) and if that succeeds    *! returns a hash made from the exported name string. Otherwise a    *! normal hash based on this object is returned.    *!    *! This means that mechanism names (MNs) can be used as indices in    *! mappings without getting duplicate entries for the same    *! identity.    */    PIKEFUN int __hash() -  flags ID_STATIC; +  flags ID_PROTECTED;    {    int got_hash = 0;       if (THIS->name != GSS_C_NO_NAME)    WITH_GSS_BUFFER (exp) {    OM_uint32 maj, min;    maj = gss_export_name (&min, THIS->name, &exp);    STATUS_MSG (gss_export_name, maj, min);       if (!GSS_ERROR (maj)) {    push_string (make_shared_binary_string (exp.value, exp.length)); -  f_hash (1); +  push_int64(hash_svalue(Pike_sp - 1));    got_hash = 1;    }    } END_GSS_BUFFER (exp);       if (!got_hash) { -  unsigned INT32 h; +  size_t h;   #if SIZEOF_CHAR_P > 4 -  h=DO_NOT_WARN((unsigned INT32)(PTR_TO_INT(Pike_fp->current_object) >> 2)); +  h=(size_t)(PTR_TO_INT(Pike_fp->current_object) >> 2);   #else -  h=DO_NOT_WARN((unsigned INT32)(PTR_TO_INT(Pike_fp->current_object))); +  h=(size_t)(PTR_TO_INT(Pike_fp->current_object));   #endif    RETURN h;    }    }      #ifdef HAVE_GSS_INQUIRE_MECHS_FOR_NAME    /*! @decl multiset(string) mechs()    *!    *! Returns the OIDs for the mechanisms that might be able to    *! process this name. The returned OID strings are on    *! dotted-decimal form.    *! -  *! This wraps @tt{GSS_Inquire_mechs_for_name@} according to RFC -  *! 2743 section 2.4.13. +  *! This wraps @tt{GSS_Inquire_mechs_for_name@} according to +  *! @rfc{2743:2.4.13@}.    *!    *! @note    *! Some older GSS-API v2 implementations lack this funcion.    */    PIKEFUN multiset(string) mechs()    {    gss_OID_set mechs = GSS_C_NO_OID_SET;    ONERROR uwp;       if (THIS->name == GSS_C_NO_NAME)
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1658:    *! (i.e. using @[GSSAPI.AcceptContext]).    *! @item BOTH    *! The credential may be used both to initiate or accept security    *! contexts.    *! @enddl    */      /*! @class Cred    *!    *! Objects of this class hold one or more credentials that the -  *! current process can use to assert identities; see RFC 2743 section -  *! 1.1.1. +  *! current process can use to assert identities; see +  *! @rfc{2743:1.1.1@}.    *!    *! @note    *! If a @[Cred] object is destructed, @tt{GSS_Release_cred@} -  *! (RFC 2743, section 2.1.2) is called. The RFC doesn't preclude -  *! that that function might do blocking network I/O, which due to -  *! pike's object management might occur essentially anytime in any -  *! thread if the object isn't explicitly destructed. To avoid that, -  *! it's recommended to call @[release] in credential objects that -  *! are no longer used. +  *! (@rfc{2743:2.1.2@}) is called. The RFC doesn't preclude that +  *! that function might do blocking network I/O, which due to pike's +  *! object management might occur essentially anytime in any thread +  *! if the object isn't explicitly destructed. To avoid that, it's +  *! recommended to call @[release] in credential objects that are no +  *! longer used.    */   PIKECLASS Cred   {    CVAR gss_cred_id_t cred;       static void cleanup_cred (gss_cred_id_t *cred)    /* Warning: This function uses THREADS_ALLOW/THREADS_DISALLOW. */    {    if (*cred != GSS_C_NO_CREDENTIAL) {    OM_uint32 maj, min;
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1708:    }       /*! @decl void acquire (Name|string name, @    *! int cred_usage, @    *! void|multiset(string) desired_mechs, @    *! void|int(0..) desired_time)    *!    *! Acquire initial credentials for this object. It is an error if    *! it already has some credentials.    *! -  *! This wraps @tt{GSS_Acquire_cred@} according to RFC 2743 section -  *! 2.1.1. +  *! This wraps @tt{GSS_Acquire_cred@} according to +  *! @rfc{2743:2.1.1@}.    *!    *! @param name    *! The name of the identity for which credentials should be    *! acquired. It is up to the GSS-API implementation to check    *! whether the running process is authorized to act on behalf of    *! this identity.    *!    *! This can be either a @[GSSAPI.Name] object or a string. In the    *! latter case, the string is converted to a GSS-API name    *! according to a mechanism-specific default printable syntax,
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1844:       /*! @decl void add (Name|string name, @    *! int cred_usage, @    *! string desired_mech, @    *! void|int(0..)|array(int(0..)) desired_time)    *!    *! Adds another credential element to this object. If this object    *! has no credentials already then it will get the default    *! credentials in addition to this specified one.    *! -  *! This wraps @tt{GSS_Add_cred@} according to RFC 2743 section -  *! 2.1.4. +  *! This wraps @tt{GSS_Add_cred@} according to @rfc{2743:2.1.4@}.    *!    *! @param name    *! The name of the identity for which a credential should be    *! acquired. It is up to the GSS-API implementation to check    *! whether the running process has sufficient privileges to act    *! on behalf of this identity.    *!    *! This can be either a @[GSSAPI.Name] object or a string. In the    *! latter case, the string is converted to a GSS-API name    *! according to a mechanism-specific default printable syntax,
pike.git/src/post_modules/GSSAPI/gssapi.cmod:1979:       /*! @decl GSSAPI.Name name (void|string mech)    *! @decl int cred_usage (void|string mech)    *! @decl multiset(string) mechs()    *! @decl int(0..)|Int.inf lifetime()    *! @decl int(0..)|Int.inf init_lifetime (string mech)    *! @decl int(0..)|Int.inf accept_lifetime (string mech)    *!    *! Functions to query various properties about the credentials.    *! -  *! These wrap @tt{GSS_Inquire_cred@} according to RFC 2743 section -  *! 2.1.3 if @[mech] is not given, and -  *! @tt{GSS_Inquire_cred_by_mech@} according to section 2.1.5 -  *! otherwise. +  *! These wrap @tt{GSS_Inquire_cred@} according to @rfc{2743:2.1.3@} +  *! if @[mech] is not given, and @tt{GSS_Inquire_cred_by_mech@} +  *! according to @rfc{2743:2.1.5@} otherwise.    *!    *! @param mech    *! If this is given then the credential for that specific    *! mechanism is queried. @[mech] contains the OID of the    *! mechanism on dotted-decimal form.    *!    *! Some of the query functions can only be used for a specific    *! mechanism, in which case @[mech] is required. Some can only be    *! used on the credentials in general, and the @[mech] argument    *! is not applicable. Some can be used both ways, and then
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2056:    *!    *! Returns zero if the credential has expired for this use or if    *! its usage is @[GSSAPI.INITIATE].    *!    *! Returns @[Int.inf] if there is no time limit (in older pikes    *! without @[Int.inf] a large positive integer is returned    *! instead).    *! @enddl    *!    *! @note -  *! RFC 2743 doesn't preclude that these functions might block on -  *! network connections to remote authentication servers. +  *! @rfc{2743@} doesn't preclude that these functions might block +  *! on network connections to remote authentication servers.    */       /* Perhaps we should hoard this data locally to reduce the number of    * calls (except the time values)? */       PIKEFUN object(Name) name (void|string mech)    {    gss_name_t name = GSS_C_NO_NAME;    ONERROR uwp;   
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2274:    THREADS_DISALLOW();       STATUS_MSG (gss_inquire_cred_by_mech, maj, min);    CHECK_ERROR_WITH_MECH (gss_inquire_cred_by_mech, maj, min, &mech_oid);    } END_GSS_OID (mech_oid);       PUSH_TIME (time);    }       PIKEFUN string _sprintf (int flag, ...) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    pop_n_elems (args);       if (flag != 'O')    push_int (0);       else {    struct string_builder sb;    ONERROR uwp;    init_string_builder (&sb, 0);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2348:       UNSET_ONERROR (uwp);    push_string (finish_string_builder (&sb));    }    }       /*! @decl void release()    *!    *! Frees the resources for the credential.    *! -  *! This wraps @tt{GSS_Release_cred@} according to RFC 2743 section -  *! 2.1.2. +  *! This wraps @tt{GSS_Release_cred@} according to +  *! @rfc{2743:2.1.2@}.    *!    *! @note    *! This function might block on network connections to remote    *! authentication servers.    */    PIKEFUN void release()    {    cleanup_cred (&THIS->cred);    THIS->cred = GSS_C_NO_CREDENTIAL;    }
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2382:    *! @decl constant int PROT_READY_FLAG    *! @decl constant int TRANS_FLAG    *!    *! Bitfield flags returned by e.g. @[GSSAPI.Context.services] to    *! denote various services that are available in the context.    *!    *! Brief descriptions of the flags:    *!    *! @dl    *! @item GSSAPI.DELEG_FLAG -  *! Delegation. See RFC 2743 section 1.2.9. +  *! Delegation. See @rfc{2743:1.2.9@}.    *! @item GSSAPI.MUTUAL_FLAG    *! Mutual authentication (actually, acceptor authentication). See -  *! RFC 2743 sections 1.1.1.3 and 1.2.5. +  *! @rfc{2743:1.1.1.3@} and @rfc{2743:1.2.5@}.    *! @item GSSAPI.REPLAY_FLAG -  *! Per-message replay detection. See RFC 2743 section 1.2.3. +  *! Per-message replay detection. See @rfc{2743:1.2.3@}.    *! @item GSSAPI.SEQUENCE_FLAG -  *! Per-message sequencing. See RFC 2743 section 1.2.3. +  *! Per-message sequencing. See @rfc{2743:1.2.3@}.    *! @item GSSAPI.CONF_FLAG -  *! Per-message confidentiality. See RFC 2743 section 1.2.2. +  *! Per-message confidentiality. See @rfc{2743:1.2.2@}.    *! @item GSSAPI.INTEG_FLAG -  *! Per-message integrity. See RFC 2743 section 1.2.2. +  *! Per-message integrity. See @rfc{2743:1.2.2@}.    *! @item GSSAPI.ANON_FLAG -  *! Anonymous authentication. See RFC 2743 section 1.2.5. +  *! Anonymous authentication. See @rfc{2743:1.2.5@}.    *! @item GSSAPI.PROT_READY_FLAG    *! Might be set before the context establishment has finished, to -  *! denote that per-message protection already is available. See RFC -  *! 2743 section 1.2.7. Is always set in @[GSSAPI.Context] and derived -  *! classes when the context is established. +  *! denote that per-message protection already is available. See +  *! @rfc{2743:1.2.7@}. Is always set in @[GSSAPI.Context] and +  *! derived classes when the context is established.    *! @item GSSAPI.TRANS_FLAG    *! The context can be transferred between processes using -  *! @[GSSAPI.Context.export]. See RFC 2743 section 1.2.10. +  *! @[GSSAPI.Context.export]. See @rfc{2743:1.2.10@}.    *! @enddl    */      /*! @decl string describe_services (int services)    *!    *! Returns a string that compactly describes the given @[services],    *! which is taken as a bitfield of @tt{GSSAPI.*_FLAG@} flags.    *!    *! The returned string contains capitalized names for the flags    *! reminiscent of the @[GSSAPI.*_FLAG] constants, separated by    *! @expr{"|"@}.    */   PIKEFUN string describe_services (int services)   {    pop_stack();    describe_services_and_push (services);   }      /*! @class Context    *! -  *! Class representing a security context; see RFC 2743 section 1.1.3. -  *! The user usually instantiates one of the two inheriting classes +  *! Class representing a security context; see @rfc{2743:1.1.3@} The +  *! user usually instantiates one of the two inheriting classes    *! @[GSSAPI.InitContext] or @[GSSAPI.AcceptContext], based on whether    *! the context should act as initiator or acceptor for the    *! connection. This class is instantiated directly for imported    *! contexts.    *!    *! @note    *! If a @[Context] object for a partly or completely established -  *! context is destructed, @tt{GSS_Delete_sec_context@} (RFC 2743, -  *! section 2.2.3) is called. That function might do blocking +  *! context is destructed, @tt{GSS_Delete_sec_context@} +  *! (@rfc{2743:2.2.3@}) is called. That function might do blocking    *! network I/O, which due to pike's object management might occur    *! essentially anytime in any thread if the object isn't explicitly    *! destructed. To avoid that, it's strongly recommended to call    *! @[delete] in contexts that are no longer used.    */   PIKECLASS Context   {    CVAR gss_ctx_id_t ctx;    CVAR OM_uint32 required_services, current_services;    CVAR OM_uint32 last_major, last_minor;
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2466:       static DECLSPEC(noreturn) void handle_context_error (    int line, const char *gss_func, OM_uint32 major, OM_uint32 minor)    /* This function can be used directly in inheriting classes too. */    {    gss_OID mech = GSS_C_NO_OID;    char *ctx_stor =    Pike_fp->current_object ?    get_storage (Pike_fp->current_object, Context_program) : NULL;    if (!ctx_stor) { - #ifdef PIKE_DEBUG -  fprintf (stderr, "Failed to get object storage - are we being called " +  DWERR("Failed to get object storage - are we being called "    "from a Context method?\n"    "Anyway, can't get the context mech - minor status messages "    "might be wrong below.\n"); - #endif +     }    else if (((struct Context_struct *) ctx_stor)->ctx != GSS_C_NO_CONTEXT) {    OM_uint32 maj, min;    maj = gss_inquire_context (&min,    ((struct Context_struct *) ctx_stor)->ctx,    NULL, NULL, NULL, &mech, NULL, NULL, NULL);   #ifdef PIKE_DEBUG    if (GSS_ERROR (maj) && mech == GSS_C_NO_OID)    fprintf (stderr, "Failed to get mech for context - "    "gss_inquire_context returned %x/%x.\n"
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2546:    THIS->last_confidential = 0;    }       EXIT    gc_trivial;    {    if (THIS->ctx != GSS_C_NO_CONTEXT)    cleanup_context (&THIS->ctx);    }    -  /*! @decl static void create (string interprocess_token, @ +  /*! @decl protected void create (string interprocess_token, @    *! void|int required_services)    *!    *! Creates a context by importing an inter-process token.    *! -  *! This wraps @tt{GSS_Import_sec_context@} according to RFC 2743 -  *! section 2.2.9. +  *! This wraps @tt{GSS_Import_sec_context@} according to +  *! @rfc{2743:2.2.9@}.    *!    *! @param interprocess_token    *! The inter-process token which has been created by @[export] or    *! some other @tt{GSS_Export_sec_context@} wrapper.    *!    *! @param required_services    *! Bitfield of @tt{GSSAPI.*_FLAG@} flags specifying all services    *! that must be provided in the context. If the context fail to    *! provide any of them then it is closed and a    *! @[GSSAPI.MissingServicesError] is thrown.
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2575:    *! that a user calls a per-message function indicates that this    *! service is required at that point, and a    *! @[GSSAPI.MissingServicesError] is thrown if it isn't.    *!    *! @note    *! It is not possible to retrieve delegated credentials from an    *! imported context. That is a GSS-API limitation.    */    PIKEFUN void create (string interprocess_token,    void|zero|int required_services) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    gss_buffer_desc input_token;      #ifndef PRECOMPILE_API_VERSION    /* Live with the pessimal precompile.pike in 7.4.. :P */    INT_TYPE _required_services;    CHECK_OPT_ARG (required_services, _required_services,    T_INT, integer, "int", "create", 4);   #define REQUIRED_SERVICES _required_services   #else
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2715:    /*! @decl int is_established()    *! @decl int services()    *! @decl int locally_initiated()    *! @decl Name source_name()    *! @decl Name target_name()    *! @decl int(0..) lifetime()    *! @decl string mech()    *!    *! Functions to query various properties about the context.    *! -  *! These wrap @tt{GSS_Inquire_context@} according to RFC 2743 -  *! section 2.2.6. +  *! These wrap @tt{GSS_Inquire_context@} according to +  *! @rfc{2743:2.2.6@}.    *!    *! @dl    *! @item is_established()    *! Returns nonzero as soon as the context has been established.    *! That means no further rounds through    *! @[GSSAPI.InitContext.init] or @[GSSAPI.AcceptContext.accept],    *! that the remote peer is authenticated as required, and that    *! the set of available services is complete (see @[services]).    *!    *! @item services()
pike.git/src/post_modules/GSSAPI/gssapi.cmod:2935:    *!    *! Returns nonzero if the last call to @[wrap] or @[unwrap] provided    *! confidentiality for the message, i.e. if @[wrap] encrypted it or    *! if @[unwrap] decrypted it. Zero is returned otherwise.    */    PIKEFUN int last_confidential()    {    RETURN THIS->last_confidential;    }    -  static struct program *InitContext_program, *AcceptContext_program; -  +     PIKEFUN string _sprintf (int flag, ...) -  flags ID_STATIC; +  flags ID_PROTECTED;    {    pop_n_elems (args);       if (flag != 'O')    push_int (0);       else {    struct string_builder sb;    ONERROR uwp;    init_string_builder (&sb, 0);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3050:       UNSET_ONERROR (uwp);    push_string (finish_string_builder (&sb));    }    }       /*! @decl void process_token (string remote_token)    *!    *! Passes the given @[remote_token] to the mechanism.    *! -  *! This wraps @tt{GSS_Process_context_token@} according to RFC 2743 -  *! section 2.2.4. +  *! This wraps @tt{GSS_Process_context_token@} according to +  *! @rfc{2743:2.2.4@}.    *!    *! This is used for tokens that are received outside the    *! handshaking between @tt{GSS_Init_sec_context@}    *! (@[GSSAPI.InitContext.init]) and @tt{GSS_Accept_sec_context@}    *! (@[GSSAPI.AcceptContext.accept]).    *!    *! An example is when @[GSSAPI.InitContext.init] returns a final    *! token and flags the context as established, but the acceptor    *! context detects an error and sends a failure token back. That    *! token is processed using this function since
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3115:    THIS->current_services = ctx_flags;    }    }       /*! @decl string export()    *!    *! Exports this context so that it can be imported in another    *! process, providing the inter-process context transfer service is    *! available (c.f. @[GSSAPI.TRANS_FLAG]).    *! -  *! This wraps @tt{GSS_Export_sec_context@} according to RFC 2743 -  *! section 2.2.8. +  *! This wraps @tt{GSS_Export_sec_context@} according to +  *! @rfc{2743:2.2.8@}.    *!    *! The returned string is intended to be fed to    *! @[GSSAPI.Context.create] (or some other    *! @tt{GSS_Import_sec_context@} wrapper) in the receiving process.    *!    *! This operation frees the context in this object.    */    PIKEFUN string export()    {    CHECK_GOT_CONTEXT();
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3151:    } END_GSS_BUFFER (interprocess_token);    }       /*! @decl string get_mic (string message, void|int qop)    *!    *! Calculates and returns a MIC (message integrity checksum) for    *! the given message that allows the receiver to verify its origin    *! and integrity through @[verify_mic] or some other    *! @tt{GSS_VerifyMIC@} wrapper.    *! -  *! This wraps @tt{GSS_GetMIC@} according to RFC 2743 section 2.3.1. +  *! This wraps @tt{GSS_GetMIC@} according to @rfc{2743:2.3.1@}.    *!    *! This function requires that the context is established, or that    *! the early per-message protection service is available (c.f.    *! @[GSSAPI.PROT_READY_FLAG]. If not, a    *! @[GSSAPI.MissingServicesError] is thrown (but the context is not    *! closed).    *!    *! @param message    *! The message for which the MIC is to be calculated. It may be    *! of zero length.    *!    *! @param qop    *! The quality of protection. This is a mechanism-specific value    *! that lets the user direct how the underlying mechanism -  *! calculates the MIC. See RFC 2743, section 1.2.4. +  *! calculates the MIC. See @rfc{2743:1.2.4@}.    *!    *! Zero or left out means use the default method.    */    PIKEFUN string get_mic (string message, void|zero|int qop)    {    gss_buffer_desc msg;      #ifndef PRECOMPILE_API_VERSION    /* Live with the pessimal precompile.pike in 7.4.. :P */    INT_TYPE _qop;
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3215:      #undef qop    }       /*! @decl int verify_mic (string message, string mic)    *!    *! Verifies the origin and integrity of the given @[message] using    *! the given @[mic], which has been calculated by the sender using    *! @[get_mic] or some other @tt{GSS_GetMIC@} wrapper.    *! -  *! This wraps @tt{GSS_VerifyMIC@} according to RFC 2743 section -  *! 2.3.2. +  *! This wraps @tt{GSS_VerifyMIC@} according to @rfc{2743:2.3.2@}.    *!    *! This function requires that the context is established, or that    *! the early per-message protection service is available (c.f.    *! @[GSSAPI.PROT_READY_FLAG]. If not, a    *! @[GSSAPI.MissingServicesError] is thrown (but the context is not    *! closed).    *!    *! @returns    *! Zero is returned if the verification fails with    *! @[GSSAPI.DEFECTIVE_TOKEN] or @[GSSAPI.BAD_MIC].
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3317:    }    }       /*! @decl int(0..) wrap_size_limit (int(0..) output_size, int encrypt, @    *! void|int qop)    *!    *! Returns the maximum size of an input string to @[wrap] that    *! would produce no more than @[output_size] bytes in the resulting    *! output.    *! -  *! This wraps @tt{GSS_Wrap_size_limit@} according to RFC 2743 -  *! section 2.2.7. +  *! This wraps @tt{GSS_Wrap_size_limit@} according to +  *! @rfc{2743:2.2.7@}.    *!    *! @[with_confidentiality] and @[qop] are the same as in the call    *! to @[wrap].    */    PIKEFUN int(0..) wrap_size_limit (int(0..) output_size,    void|int encrypt,    void|zero|int qop)    {    OM_uint32 max_input_size = 0;    int conf;
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3367:    }       /*! @decl string wrap (string message, void|int encrypt, void|int qop)    *!    *! Calculates a MIC (message integrity checksum) for the given    *! message, and returns it together with the message, which is    *! optionally encrypted. The returned value can be verified and (if    *! applicable) decrypted by the receiver using @[unwrap] or some    *! other @tt{GSS_Unwrap@} wrapper.    *! -  *! This wraps @tt{GSS_Wrap@} according to RFC 2743 section 2.3.3. +  *! This wraps @tt{GSS_Wrap@} according to @rfc{2743:2.3.3@}.    *!    *! This function requires that the context is established, or that    *! the early per-message protection service is available (c.f.    *! @[GSSAPI.PROT_READY_FLAG]. If not, a    *! @[GSSAPI.MissingServicesError] is thrown (but the context is not    *! closed).    *!    *! @param message    *! The message to be wrapped. It may be of zero length.    *!
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3391:    *! contains the unencrypted message.    *!    *! If this is set and the confidentiality service (c.f.    *! @[GSSAPI.CONF_FLAG]) is required then the returned value is    *! always encrypted. Otherwise it might not be encrypted anyway,    *! and a call to @[last_confidential] will tell if it is or not.    *!    *! @param qop    *! The quality of protection. This is a mechanism-specific value    *! that lets the user direct how the underlying mechanism -  *! calculates the MIC. See RFC 2743, section 1.2.4. +  *! calculates the MIC. See @rfc{2743:1.2.4@}.    *!    *! Zero or left out means use the default method.    *!    *! @note    *! This function sets the value returned by @[last_confidential].    *!    *! @seealso    *! @[wrap_size_limit]    */    PIKEFUN string wrap (string message, void|zero|int encrypt, void|zero|int qop)
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3461:   #undef qop    }       /*! @decl string unwrap (string message, void|int accept_encrypted_only)    *!    *! Verifies the origin and integrity of the given message using the    *! MIC included in it, and also decrypts the message if it was    *! encrypted. The message has been calculated by the sender using    *! @[wrap] or some other @tt{GSS_Wrap@} wrapper.    *! -  *! This wraps @tt{GSS_Unwrap@} according to RFC 2743 section -  *! 2.3.4. +  *! This wraps @tt{GSS_Unwrap@} according to @rfc{2743:2.3.4@}.    *!    *! This function requires that the context is established, or that    *! the early per-message protection service is available (c.f.    *! @[GSSAPI.PROT_READY_FLAG]. If not, a    *! @[GSSAPI.MissingServicesError] is thrown (but the context is not    *! closed).    *!    *! @param message    *! The message to be unwrapped.    *!
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3598:    } END_GSS_BUFFER (output_msg);      #undef accept_encrypted_only    }       /*! @decl void delete()    *!    *! Frees the resources for the context, provided it is in use. Does    *! nothing otherwise.    *! -  *! This wraps @tt{GSS_Delete_sec_context@} according to RFC 2743 -  *! section 2.2.3. +  *! This wraps @tt{GSS_Delete_sec_context@} according to +  *! @rfc{2743:2.2.3@}.    *!    *! @note    *! This function might block on network connections to remote    *! authentication servers.    *!    *! @note    *! In compliance with recommendations in GSS-API v2, the optional    *! output token is never used in the call to    *! @tt{GSS_Delete_sec_context@}.    */
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3663:    gc_trivial;    {    if (THIS->cred)    free_object (THIS->cred);    if (THIS->target_name)    free_object (debug_malloc_pass (THIS->target_name));    if (THIS->mech.elements)    free (THIS->mech.elements);    }    -  /*! @decl static void create (void|Cred cred, @ +  /*! @decl protected void create (void|Cred cred, @    *! void|Name|string target_name, @    *! void|string mech, @    *! void|int required_services, @    *! void|int desired_services, @    *! void|int(0..) desired_time)    *!    *! Creates a context for initiator use. This function only accepts    *! parameters to be used later during the @[init] call. If there    *! are semantic problems with them, such as if the credentials are    *! stale or the mechanism isn't supported, then they will be
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3723:    *! specified in @[required_services] are implicit, so they need    *! not be repeated here.    *!    *! @[GSSAPI.PROT_READY_FLAG] is ignored in this parameter.    *!    *! @param desired_time    *! The desired context validity time in seconds. Zero or left out    *! means use the default.    *!    *! @note -  *! Channel bindings (RFC 2743, section 1.1.6) are not yet -  *! implemented since that feature appear to not be in much active -  *! use, and its format is not completely specified (RFC 2744, -  *! section 3.11). +  *! Channel bindings (@rfc{2743:1.1.6@}) are not yet implemented +  *! since that feature appear to not be in much active use, and +  *! its format is not completely specified (@rfc{2744:3.11@}).    */    PIKEFUN void create (void|object(Cred) cred,    void|object(Name)|string target_name,    void|string mech,    void|zero|int required_services,    void|zero|int desired_services,    void|zero|int(0..) desired_time) -  flags ID_STATIC; +  flags ID_PROTECTED;    {   #ifndef PRECOMPILE_API_VERSION    /* Live with the pessimal precompile.pike in 7.4.. :P */    struct object *_cred;    struct pike_string *_mech;    INT_TYPE _required_services;    INT_TYPE _desired_services;    INT_TYPE _desired_time;    CHECK_OPT_ARG (cred, _cred, T_OBJECT, object, "Cred", "create", 1);    CHECK_OPT_ARG (mech, _mech, T_STRING, string, "string", "create", 3);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:3842:   #undef MECH   #undef REQUIRED_SERVICES   #undef DESIRED_SERVICES   #undef DESIRED_TIME    }       /*! @decl string init (void|string remote_token)    *!    *! Initiates a security context to send to a remote peer.    *! -  *! This wraps @tt{GSS_Init_sec_context@} according to RFC 2743 -  *! section 2.2.1. +  *! This wraps @tt{GSS_Init_sec_context@} according to +  *! @rfc{2743:2.2.1@}.    *!    *! The underlying mechanism might require several tokens to be    *! passed back and forth to establish the context. If    *! @[is_established] returns zero after a call to this function    *! then the caller must wait for a token from the remote peer to    *! feed as @[remote_token] in another call to this function.    *!    *! @param remote_token    *! A token from the remote peer, as returned by a call to    *! @[GSSAPI.AcceptContext.accept] (or some other
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4056:       EXIT    gc_trivial;    {    if (THIS->delegated_cred)    free_object (THIS->delegated_cred);    if (THIS->cred)    free_object (THIS->cred);    }    -  /*! @decl static void create (void|Cred cred, @ +  /*! @decl protected void create (void|Cred cred, @    *! void|int required_services)    *!    *! Creates a context for acceptor use. This function only accepts    *! parameters to be used later during the @[accept] call. If there    *! are semantic problems with them, such as if the credentials are    *! stale, then they will be signalled later by @[accept].    *!    *! @param cred    *! Credentials for the identity this context claims. The    *! credentials for the default principal (if any) is used if zero
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4081:    *! that must be provided in the context. If the context fail to    *! provide any of them then it is closed and a    *! @[GSSAPI.MissingServicesError] is thrown.    *!    *! @[GSSAPI.PROT_READY_FLAG] is ignored in this parameter. The fact    *! that a user calls a per-message function indicates that this    *! service is required at that point, and a    *! @[GSSAPI.MissingServicesError] is thrown if it isn't.    *!    *! @note -  *! Channel bindings (RFC 2743, section 1.1.6) are not yet -  *! implemented since that feature appear to not be in much active -  *! use, and its format is not completely specified (RFC 2744, -  *! section 3.11). +  *! Channel bindings (@rfc{2743:1.1.6@}) are not yet implemented +  *! since that feature appear to not be in much active use, and +  *! its format is not completely specified (@rfc{2744:3.11@}).    */    PIKEFUN void create (void|object(Cred) cred,    void|zero|int required_services) -  flags ID_STATIC; +  flags ID_PROTECTED;    {   #ifndef PRECOMPILE_API_VERSION    /* Live with the pessimal precompile.pike in 7.4.. :P */    struct object *_cred;    INT_TYPE _required_services;    CHECK_OPT_ARG (cred, _cred, T_OBJECT, object, "Cred", "create", 1);    CHECK_OPT_ARG (required_services, _required_services,    T_INT, integer, "int", "create", 2);   #define CRED _cred   #define REQUIRED_SERVICES _required_services
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4127:    (REQUIRED_SERVICES & ~GSS_C_PROT_READY_FLAG);      #undef CRED   #undef REQUIRED_SERVICES    }       /*! @decl string accept (string remote_token)    *!    *! Accepts a remotely initiated security context.    *! -  *! This wraps @tt{GSS_Accept_sec_context@} according to RFC 2743 -  *! section 2.2.2. +  *! This wraps @tt{GSS_Accept_sec_context@} according to +  *! @rfc{2743:2.2.2@}.    *!    *! The underlying mechanism might require several tokens to be    *! passed back and forth to establish the context. If    *! @[is_established] returns zero after a call to this function    *! then the caller must wait for a token from the remote peer to    *! feed as @[remote_token] in another call to this function.    *!    *! @param remote_token    *! A token from the remote peer, as returned by a call to    *! @[GSSAPI.InitContext.init] or some other
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4276:   }      /*! @endclass */         /*! @decl multiset(string) indicate_mechs()    *!    *! Returns the OIDs for the available mechanism in the GSS-API    *! implementation. The OIDs are returned on dotted-decimal form.    *! -  *! This wraps @tt{GSS_Indicate_mechs@} according to RFC 2743 section -  *! 2.4.2. +  *! This wraps @tt{GSS_Indicate_mechs@} according to +  *! @rfc{2743:2.4.2@}.    */   PIKEFUN multiset(string) indicate_mechs()   {    gss_OID_set mechs = GSS_C_NO_OID_SET;    OM_uint32 maj, min;    ONERROR uwp;       SET_ONERROR (uwp, cleanup_oid_set, &mechs);       THREADS_ALLOW();
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4307:       CALL_AND_UNSET_ONERROR (uwp);   }      /*! @decl multiset(string) names_for_mech (string mech)    *!    *! Returns the OIDs for the name types that the given @[mech]    *! supports. Both @[mech] and the returned OID strings are on    *! dotted-decimal form.    *! -  *! This wraps @tt{GSS_Inquire_names_for_mech@} according to RFC 2743 -  *! section 2.4.12. +  *! This wraps @tt{GSS_Inquire_names_for_mech@} according to +  *! @rfc{2743:2.4.12@}.    */   PIKEFUN multiset(string) names_for_mech (string mech)   {    gss_OID_set name_types = GSS_C_NO_OID_SET;    ONERROR uwp;       SET_ONERROR (uwp, cleanup_oid_set, &name_types);       WITH_PUSHED_GSS_OID (mech_oid, mech) {    OM_uint32 maj, min;
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4363:    (gssapi_err_struct_offset +    OFFSETOF (gssapi_err_struct, minor_status)),    tInt, T_INT, 0);    pike_set_prog_event_callback (gssapi_err_events);   #ifdef PROGRAM_LIVE_OBJ    Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;   #endif    ADD_FUNCTION ("create", gssapi_err_create,    tFunc(tOr(tVoid,tInt) tOr(tVoid,tInt) tOr(tVoid,tString)    tOr(tVoid,tString) tOr(tVoid,tArray), -  tVoid), ID_STATIC); +  tVoid), ID_PROTECTED);    ADD_FUNCTION ("major_status_messages", gssapi_err_major_msgs,    tFunc(tVoid,tArr(tString)), 0);    ADD_FUNCTION ("minor_status_messages", gssapi_err_minor_msgs,    tFunc(tVoid,tArr(tString)), 0);    ADD_FUNCTION ("minor_status_mech", gssapi_err_minor_mech,    tFunc(tVoid,tString), 0);    gssapi_err_program = end_program();    add_program_constant ("Error", gssapi_err_program, 0);       start_new_program();
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4387:    add_integer_constant ("is_gssapi_missing_services_error", 1, 0);    PIKE_MAP_VARIABLE ("services",    (missing_err_struct_offset +    OFFSETOF (missing_err_struct, services)),    tInt, T_INT, 0);    pike_set_prog_event_callback (missing_err_events);   #ifdef PROGRAM_LIVE_OBJ    Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;   #endif    ADD_FUNCTION ("create", missing_err_create, -  tFunc(tOr(tVoid,tInt), tVoid), ID_STATIC); +  tFunc(tOr(tVoid,tInt), tVoid), ID_PROTECTED);    missing_err_program = end_program();    add_program_constant ("MissingServicesError", missing_err_program, 0);       /* As it happens, none of the currently defined errors and flags in    * the GSS-API spec conflicts with the sign bit if INT_TYPE is 32    * bits, so we can assume native ints for all of the following. */       add_integer_constant ("ERROR_MASK",    GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET,    0);
pike.git/src/post_modules/GSSAPI/gssapi.cmod:4470:      #endif /* HAVE_GSSAPI */       INIT;      #ifdef HAVE_GSSAPI    InitContext_Context_storage_offset =    low_get_storage (InitContext_program, Context_program);    AcceptContext_Context_storage_offset =    low_get_storage (AcceptContext_program, Context_program); + #else +  HIDE_MODULE();   #endif   }      PIKE_MODULE_EXIT   {   #ifdef HAVE_GSSAPI    if (der_dd_map) free_mapping (der_dd_map);    free_svalue (&int_pos_inf);    free_svalue (&encode_der_oid);    free_svalue (&decode_der_oid);    if (gssapi_err_program) free_program (gssapi_err_program);    if (missing_err_program) free_program (missing_err_program);   #endif       EXIT;   }