Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8194921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:58:12+00:00 2026-06-07T04:58:12+00:00

I try use gssapi32.dll in my application but I receive exception when app start

  • 0

I try use gssapi32.dll in my application but I receive
exception when app start

name like ‘HTTP/proxy.domain.com@domain.com’
I saw this name in Kerberos Ticket Tools

but I receive “No credentials cache found”

maybe anybody already has similar problem? and can help

Windows 7 (x64)
MSVS C++ 2010 Express

thank you for your advice & sorry for my English

char* cHttp::getNegotiateToken(const char *service, const char *server) {
    char *token = 0;
    OM_uint32 major, minor;
    gss_buffer_desc gss_buffer;
    gss_buffer_desc gss_buffer_user;
    gss_name_t gss_name;
    gss_name_t gss_user_name;
    gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
    gss_buffer_desc gss_input_token = GSS_C_EMPTY_BUFFER;
    gss_buffer_desc gss_output_token = GSS_C_EMPTY_BUFFER;

    OM_uint32 req_flags = GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG;

    static gss_OID_desc gss_krb5_mech_oid_desc =
        { 9, (void *) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" };


    if(!service || !server) {
        Logger.writeLogHead(llError) << "Service and server values cannot be NULL!" << EndOfLine;
        return 0;
    }

    gss_buffer.length = 28;//strln(service) + strln(server) + 2;
    gss_buffer.value = malloc(gss_buffer.length);

    gss_buffer_user.length = 26;
    gss_buffer_user.value = malloc(gss_buffer_user.length);

    Logger.writeLogHead(llError) << "service \"" << service << "\" server \"" << server << "\" length " <<  (int)gss_buffer.length << EndOfLine;

    if(!gss_buffer.value) {
        Logger.writeLogHead(llError) << "malloc failed" << EndOfLine;
        return 0;
    }

    sprintf((char *)gss_buffer.value, "%s", "HTTP/proxy.domain.com@domain.com");

    major = gss_import_name(&minor, &gss_buffer, GSS_C_NT_HOSTBASED_SERVICE, &gss_name);
    free(gss_buffer.value);

    if (major != GSS_S_COMPLETE) {
        logGssError(major, minor, "gss_import_name");
        return 0;
    }

    gss_buffer_desc out_name;

    major = gss_display_name(&minor, gss_name, &out_name, NULL);
    if (major != GSS_S_COMPLETE) {
        logGssError(major, minor, "gss_display_name");
        return 0;
    }

    Logger.writeLogHead(llWarning) << "Service name : " << (const char*)out_name.value << EndOfLine;

    major = gss_init_sec_context(
        &minor,
        GSS_C_NO_CREDENTIAL, 
        &gss_context,
        gss_name, 
        &gss_krb5_mech_oid_desc,
        req_flags,
        GSS_C_INDEFINITE,
        GSS_C_NO_CHANNEL_BINDINGS,
        &gss_input_token,
        NULL,
        &gss_output_token,
        NULL,
        NULL);

    if (major == GSS_S_NO_CRED) {
        Logger.writeLogHead(llError) << "gss_init_sec_context GSS_S_NO_CRED" << EndOfLine;
    }

    if (major != GSS_S_COMPLETE) {
        logGssError(major, minor, "gss_init_sec_context");
        return 0;
    }

    if (gss_output_token.length == 0) {
        Logger.writeLogHead(llError) << "Token don't need to be send." << EndOfLine;
        return 0;
    } 

    // TODO: Need to make SPNEGO token (spnegohelp)
    token = base64_encode((const char *)gss_output_token.value, gss_output_token.length);

    major = gss_delete_sec_context(&minor, &gss_context, GSS_C_NO_BUFFER);
    if (major != GSS_S_COMPLETE) {
        logGssError(major, minor, "gss_delete_sec_context");
        return 0;
    }

    major = gss_release_name(&minor,&gss_name);
    if (major != GSS_S_COMPLETE) {
        logGssError(major, minor, "gss_release_name");
        return 0;
    }

    return token;
}

— edited
thank you friend – I think that I will go on proposed way

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:58:14+00:00Added an answer on June 7, 2026 at 4:58 am

    In my case need using spnego mechanism instead of gss_krb5_mech_oid_desc

    static gss_OID_desc gss_spnego_mech_oid_desc =
            { 6, (void *) "\x2b\x06\x01\x05\x05\x02" };
            //{ 9, (void*) "\x06\x06\x2b\x06\x01\x05\x05\x02\xa0" };
    
    gss_OID mMechOID;
    
    mMechOID = &gss_krb5_mech_oid_desc;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try use string as a regular expression pattern but I've following errors PHP
I try to use a variable in my kshell script but can't get a
i try to use jquery .text() but not really work : Before <a id=group_name
I try to use the columnFilter add-on of jquery datatable but I couldn't make
When i try use a webservice i get the following exception. My main question
RegexBuddy shows the matches are OK, but in C# when I try use replace,
I have gotten some reports from users of crashes when try use my application
how to generate random number in this code? I try use $RANDOM, but the
I try use a integer array in java with the code below: public static
I try to use the great particle emitter which Michael Daley build for his

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.