Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 582215 Details for
Bug 819115
Client library performance is bad (with default SELinux patch applied)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
TGT request loop code
gettgtloop.c (text/x-csrc), 3.05 KB, created by
Petr Spacek
on 2012-05-04 21:56:42 UTC
(
hide
)
Description:
TGT request loop code
Filename:
MIME Type:
Creator:
Petr Spacek
Created:
2012-05-04 21:56:42 UTC
Size:
3.05 KB
patch
obsolete
>#include <stdio.h> >#include <string.h> >#include <krb5/krb5.h> >#include <assert.h> >#include <stdlib.h> > >//#include "result.h" >#define ISC_R_SUCCESS 0 /*%< success */ >#define ISC_R_FAILURE 25 /*%< generic failure */ > >#define CHECK_KRB5(ctx, err, msg, ...) \ > do { \ > if (err) { \ > const char * errmsg = krb5_get_error_message(ctx, err); \ > log_error(msg " (%s)", ##__VA_ARGS__, errmsg); \ > krb5_free_error_message(ctx, errmsg); \ > result = ISC_R_FAILURE; \ > goto cleanup; \ > } \ > } while(0) > > >#define CHECK(op) \ > do { \ > result = (op); \ > if (result != ISC_R_SUCCESS) \ > goto cleanup; \ > } while (0) > > >#define REQUIRE(cond) assert(cond) > >void >log_debug(int level, const char *format, ...) >{ > va_list args; > > va_start(args, format); > level = 0; // ignore it > fprintf(stderr, format, args); > fprintf(stderr,"\n"); > > va_end(args); >} > >void >log_error(const char *format, ...) >{ > va_list args; > > va_start(args, format); > fprintf(stderr, format, args); > fprintf(stderr,"\n"); > va_end(args); > >} > >int >get_krb5_tgt(const char *principal, const char *keyfile) >{ > char ccname[1024] = ""; > krb5_context context = NULL; > krb5_keytab keytab = NULL; > krb5_ccache ccache = NULL; > krb5_principal kprincpw = NULL; > krb5_creds my_creds; > krb5_creds * my_creds_ptr = NULL; > krb5_get_init_creds_opt options; > krb5_error_code krberr; > int result; > int ret; > > REQUIRE(principal != NULL && principal[0] != '\0'); > > if (keyfile == NULL || keyfile[0] == '\0') { > return ISC_R_FAILURE; > } else { > if (strncmp(keyfile, "FILE:", 5) != 0) { > log_error("Unknown keytab file name format, " > "missing leading 'FILE:' prefix"); > return ISC_R_FAILURE; > } > } > > krberr = krb5_init_context(&context); > if (krberr) { > log_error("Failed to init kerberos context"); > return ISC_R_FAILURE; > } > > /* get krb5_principal from string */ > krberr = krb5_parse_name(context, principal, &kprincpw); > CHECK_KRB5(context, krberr, > "Failed to parse the principal name %s", principal); > > /* open keytab */ > krberr = krb5_kt_resolve(context, keyfile, &keytab); > CHECK_KRB5(context, krberr, > "Failed to resolve keytab file %s", keyfile); > > memset(&my_creds, 0, sizeof(my_creds)); > memset(&options, 0, sizeof(options)); > > krb5_get_init_creds_opt_set_address_list(&options, NULL); > krb5_get_init_creds_opt_set_forwardable(&options, 0); > krb5_get_init_creds_opt_set_proxiable(&options, 0); > > /* get tgt */ >for (int i=0; i < 10000; i++) { > krberr = krb5_get_init_creds_keytab(context, &my_creds, kprincpw, > keytab, 0, NULL, &options); > CHECK_KRB5(context, krberr, "Failed to init credentials"); > } > my_creds_ptr = &my_creds; > > result = ISC_R_SUCCESS; > >cleanup: > if (ccache) krb5_cc_close(context, ccache); > if (keytab) krb5_kt_close(context, keytab); > if (kprincpw) krb5_free_principal(context, kprincpw); > if (my_creds_ptr) krb5_free_cred_contents(context, my_creds_ptr); > if (context) krb5_free_context(context); > return result; >} > >int main(int argc, char ** argv) { > get_krb5_tgt("admin@FC162","FILE:/root/krbperf/admin.keytab"); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 819115
: 582215