diff options
| author | Tom Yu <tlyu@mit.edu> | 2009-11-30 23:09:36 +0000 |
|---|---|---|
| committer | Tom Yu <tlyu@mit.edu> | 2009-11-30 23:09:36 +0000 |
| commit | b6a2bb106c67280824362a64b1b04e62aabf3646 (patch) | |
| tree | 768c0ace37786a9613245c98633181a37e145c4d /src/tests/gssapi | |
| parent | bbb952ae5f5b7b8803de125b35dda3395155ddbb (diff) | |
| download | krb5-b6a2bb106c67280824362a64b1b04e62aabf3646.tar.gz krb5-b6a2bb106c67280824362a64b1b04e62aabf3646.tar.xz krb5-b6a2bb106c67280824362a64b1b04e62aabf3646.zip | |
Mark and reindent tests, with some exclusions
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23394 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/tests/gssapi')
| -rw-r--r-- | src/tests/gssapi/t_imp_name.c | 149 | ||||
| -rw-r--r-- | src/tests/gssapi/t_namingexts.c | 56 | ||||
| -rw-r--r-- | src/tests/gssapi/t_s4u.c | 56 |
3 files changed, 131 insertions, 130 deletions
diff --git a/src/tests/gssapi/t_imp_name.c b/src/tests/gssapi/t_imp_name.c index e64a1f559..a51c98046 100644 --- a/src/tests/gssapi/t_imp_name.c +++ b/src/tests/gssapi/t_imp_name.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 1996, Massachusetts Institute of Technology. * All Rights Reserved. @@ -42,68 +43,68 @@ static int test_import_name (char *); FILE *display_file; int main(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { - int retval; + int retval; - display_file = stdout; + display_file = stdout; - retval = test_import_name("host@dcl.mit.edu"); + retval = test_import_name("host@dcl.mit.edu"); - return retval; + return retval; } static int test_import_name(name) - char *name; + char *name; { - OM_uint32 maj_stat, min_stat; - gss_name_t gss_name; - gss_buffer_desc buffer_name; - gss_OID name_oid; - - buffer_name.value = name; - buffer_name.length = strlen(name) + 1; - maj_stat = gss_import_name(&min_stat, &buffer_name, - (gss_OID) gss_nt_service_name, - &gss_name); - if (maj_stat != GSS_S_COMPLETE) { - display_status("parsing name", maj_stat, min_stat); - return -1; - } - - maj_stat = gss_display_name(&min_stat, gss_name, &buffer_name, - &name_oid); - if (maj_stat != GSS_S_COMPLETE) { - display_status("displaying context", maj_stat, min_stat); - return -1; - } - printf("name is: "); - display_buffer(buffer_name); - printf("\n"); - (void) gss_release_buffer(&min_stat, &buffer_name); - - gss_oid_to_str(&min_stat, name_oid, &buffer_name); - printf("name type is: "); - display_buffer(buffer_name); - printf("\n"); - (void) gss_release_buffer(&min_stat, &buffer_name); -#ifdef GSSAPI_V2 - (void) gss_release_oid(&min_stat, &name_oid); + OM_uint32 maj_stat, min_stat; + gss_name_t gss_name; + gss_buffer_desc buffer_name; + gss_OID name_oid; + + buffer_name.value = name; + buffer_name.length = strlen(name) + 1; + maj_stat = gss_import_name(&min_stat, &buffer_name, + (gss_OID) gss_nt_service_name, + &gss_name); + if (maj_stat != GSS_S_COMPLETE) { + display_status("parsing name", maj_stat, min_stat); + return -1; + } + + maj_stat = gss_display_name(&min_stat, gss_name, &buffer_name, + &name_oid); + if (maj_stat != GSS_S_COMPLETE) { + display_status("displaying context", maj_stat, min_stat); + return -1; + } + printf("name is: "); + display_buffer(buffer_name); + printf("\n"); + (void) gss_release_buffer(&min_stat, &buffer_name); + + gss_oid_to_str(&min_stat, name_oid, &buffer_name); + printf("name type is: "); + display_buffer(buffer_name); + printf("\n"); + (void) gss_release_buffer(&min_stat, &buffer_name); +#ifdef GSSAPI_V2 + (void) gss_release_oid(&min_stat, &name_oid); #endif - (void) gss_release_name(&min_stat, &gss_name); - return 0; + (void) gss_release_name(&min_stat, &gss_name); + return 0; } static void display_buffer(buffer) - gss_buffer_desc buffer; + gss_buffer_desc buffer; { char *namebuf; namebuf = malloc(buffer.length+1); if (!namebuf) { - fprintf(stderr, "display_buffer: couldn't allocate buffer!\n"); - exit(1); + fprintf(stderr, "display_buffer: couldn't allocate buffer!\n"); + exit(1); } strncpy(namebuf, buffer.value, buffer.length); namebuf[buffer.length] = '\0'; @@ -112,38 +113,38 @@ static void display_buffer(buffer) } void display_status(msg, maj_stat, min_stat) - char *msg; - OM_uint32 maj_stat; - OM_uint32 min_stat; + char *msg; + OM_uint32 maj_stat; + OM_uint32 min_stat; { - display_status_1(msg, maj_stat, GSS_C_GSS_CODE); - display_status_1(msg, min_stat, GSS_C_MECH_CODE); + display_status_1(msg, maj_stat, GSS_C_GSS_CODE); + display_status_1(msg, min_stat, GSS_C_MECH_CODE); } static void display_status_1(m, code, type) - char *m; - OM_uint32 code; - int type; + char *m; + OM_uint32 code; + int type; { - OM_uint32 min_stat; - gss_buffer_desc msg; -#ifdef GSSAPI_V2 - OM_uint32 msg_ctx; -#else /* GSSAPI_V2 */ - int msg_ctx; -#endif /* GSSAPI_V2 */ - - msg_ctx = 0; - while (1) { - (void) gss_display_status(&min_stat, code, - type, GSS_C_NULL_OID, - &msg_ctx, &msg); - if (display_file) - fprintf(display_file, "GSS-API error %s: %s\n", m, - (char *)msg.value); - (void) gss_release_buffer(&min_stat, &msg); - - if (!msg_ctx) - break; - } + OM_uint32 min_stat; + gss_buffer_desc msg; +#ifdef GSSAPI_V2 + OM_uint32 msg_ctx; +#else /* GSSAPI_V2 */ + int msg_ctx; +#endif /* GSSAPI_V2 */ + + msg_ctx = 0; + while (1) { + (void) gss_display_status(&min_stat, code, + type, GSS_C_NULL_OID, + &msg_ctx, &msg); + if (display_file) + fprintf(display_file, "GSS-API error %s: %s\n", m, + (char *)msg.value); + (void) gss_release_buffer(&min_stat, &msg); + + if (!msg_ctx) + break; + } } diff --git a/src/tests/gssapi/t_namingexts.c b/src/tests/gssapi/t_namingexts.c index 1f771c44b..a75be958e 100644 --- a/src/tests/gssapi/t_namingexts.c +++ b/src/tests/gssapi/t_namingexts.c @@ -1,4 +1,4 @@ -/* -*- mode: c; indent-tabs-mode: nil -*- */ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2009 by the Massachusetts Institute of Technology. * All Rights Reserved. @@ -36,34 +36,34 @@ static gss_OID_desc spnego_mech = { 6, "\053\006\001\005\005\002" }; static int use_spnego = 0; static void displayStatus_1(m, code, type) - char *m; - OM_uint32 code; - int type; + char *m; + OM_uint32 code; + int type; { - OM_uint32 maj_stat, min_stat; - gss_buffer_desc msg; - OM_uint32 msg_ctx; - - msg_ctx = 0; - while (1) { - maj_stat = gss_display_status(&min_stat, code, - type, GSS_C_NULL_OID, - &msg_ctx, &msg); - fprintf(stderr, "%s: %s\n", m, (char *)msg.value); - (void) gss_release_buffer(&min_stat, &msg); - - if (!msg_ctx) - break; - } + OM_uint32 maj_stat, min_stat; + gss_buffer_desc msg; + OM_uint32 msg_ctx; + + msg_ctx = 0; + while (1) { + maj_stat = gss_display_status(&min_stat, code, + type, GSS_C_NULL_OID, + &msg_ctx, &msg); + fprintf(stderr, "%s: %s\n", m, (char *)msg.value); + (void) gss_release_buffer(&min_stat, &msg); + + if (!msg_ctx) + break; + } } static void displayStatus(msg, maj_stat, min_stat) - char *msg; - OM_uint32 maj_stat; - OM_uint32 min_stat; + char *msg; + OM_uint32 maj_stat; + OM_uint32 min_stat; { - displayStatus_1(msg, maj_stat, GSS_C_GSS_CODE); - displayStatus_1(msg, min_stat, GSS_C_MECH_CODE); + displayStatus_1(msg, maj_stat, GSS_C_GSS_CODE); + displayStatus_1(msg, min_stat, GSS_C_MECH_CODE); } static OM_uint32 @@ -128,7 +128,7 @@ dumpAttribute(OM_uint32 *minor, printf("Attribute %.*s %s %s\n\n%.*s\n", (int)attribute->length, (char *)attribute->value, authenticated ? "Authenticated" : "", - complete ? "Complete" : "", + complete ? "Complete" : "", (int)display_value.length, (char *)display_value.value); if (noisy) { @@ -347,8 +347,8 @@ initAcceptSecContext(OM_uint32 *minor, &initiator_context, target_name, use_spnego ? - (gss_OID)&spnego_mech : - (gss_OID)gss_mech_krb5, + (gss_OID)&spnego_mech : + (gss_OID)gss_mech_krb5, GSS_C_REPLAY_FLAG | GSS_C_SEQUENCE_FLAG, GSS_C_INDEFINITE, GSS_C_NO_CHANNEL_BINDINGS, @@ -453,7 +453,7 @@ int main(int argc, char *argv[]) mechs.elements = use_spnego ? (gss_OID)&spnego_mech : - (gss_OID)gss_mech_krb5; + (gss_OID)gss_mech_krb5; mechs.count = 1; /* get default cred */ diff --git a/src/tests/gssapi/t_s4u.c b/src/tests/gssapi/t_s4u.c index 08cf84f18..2e2304429 100644 --- a/src/tests/gssapi/t_s4u.c +++ b/src/tests/gssapi/t_s4u.c @@ -1,4 +1,4 @@ -/* -*- mode: c; indent-tabs-mode: nil -*- */ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2009 by the Massachusetts Institute of Technology. * All Rights Reserved. @@ -62,34 +62,34 @@ static gss_OID_desc spnego_mech = { 6, "\053\006\001\005\005\002" }; static int use_spnego = 0; static void displayStatus_1(m, code, type) - char *m; - OM_uint32 code; - int type; + char *m; + OM_uint32 code; + int type; { - OM_uint32 maj_stat, min_stat; - gss_buffer_desc msg; - OM_uint32 msg_ctx; - - msg_ctx = 0; - while (1) { - maj_stat = gss_display_status(&min_stat, code, - type, GSS_C_NULL_OID, - &msg_ctx, &msg); - fprintf(stderr, "%s: %s\n", m, (char *)msg.value); - (void) gss_release_buffer(&min_stat, &msg); - - if (!msg_ctx) - break; - } + OM_uint32 maj_stat, min_stat; + gss_buffer_desc msg; + OM_uint32 msg_ctx; + + msg_ctx = 0; + while (1) { + maj_stat = gss_display_status(&min_stat, code, + type, GSS_C_NULL_OID, + &msg_ctx, &msg); + fprintf(stderr, "%s: %s\n", m, (char *)msg.value); + (void) gss_release_buffer(&min_stat, &msg); + + if (!msg_ctx) + break; + } } static void displayStatus(msg, maj_stat, min_stat) - char *msg; - OM_uint32 maj_stat; - OM_uint32 min_stat; + char *msg; + OM_uint32 maj_stat; + OM_uint32 min_stat; { - displayStatus_1(msg, maj_stat, GSS_C_GSS_CODE); - displayStatus_1(msg, min_stat, GSS_C_MECH_CODE); + displayStatus_1(msg, maj_stat, GSS_C_GSS_CODE); + displayStatus_1(msg, min_stat, GSS_C_MECH_CODE); } static OM_uint32 @@ -174,7 +174,7 @@ dumpAttribute(OM_uint32 *minor, printf("Attribute %.*s %s %s\n\n%.*s\n", (int)attribute->length, (char *)attribute->value, authenticated ? "Authenticated" : "", - complete ? "Complete" : "", + complete ? "Complete" : "", (int)display_value.length, (char *)display_value.value); if (noisy) { @@ -395,7 +395,7 @@ constrainedDelegate(OM_uint32 *minor, &initiator_context, target, mechs ? &mechs->elements[0] : - (gss_OID)gss_mech_krb5, + (gss_OID)gss_mech_krb5, GSS_C_REPLAY_FLAG | GSS_C_SEQUENCE_FLAG, GSS_C_INDEFINITE, GSS_C_NO_CHANNEL_BINDINGS, @@ -427,7 +427,7 @@ int main(int argc, char *argv[]) if (argc < 2 || argc > 5) { fprintf(stderr, "Usage: %s [--spnego] [user] " - "[proxy-target] [keytab]\n", argv[0]); + "[proxy-target] [keytab]\n", argv[0]); fprintf(stderr, " proxy-target and keytab are optional\n"); exit(1); } @@ -474,7 +474,7 @@ int main(int argc, char *argv[]) } mechs.elements = use_spnego ? (gss_OID)&spnego_mech : - (gss_OID)gss_mech_krb5; + (gss_OID)gss_mech_krb5; mechs.count = 1; /* get default cred */ |
