|
Packit Service |
99d1c0 |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
Packit Service |
99d1c0 |
/* src/tests/gssapi/t_accname_authind.c - test harness for auth indicators */
|
|
Packit Service |
99d1c0 |
/*
|
|
Packit Service |
99d1c0 |
* Copyright (C) 2016 by Red Hat, Inc.
|
|
Packit Service |
99d1c0 |
* All rights reserved.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
99d1c0 |
* modification, are permitted provided that the following conditions
|
|
Packit Service |
99d1c0 |
* are met:
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* * Redistributions of source code must retain the above copyright
|
|
Packit Service |
99d1c0 |
* notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* * Redistributions in binary form must reproduce the above copyright
|
|
Packit Service |
99d1c0 |
* notice, this list of conditions and the following disclaimer in
|
|
Packit Service |
99d1c0 |
* the documentation and/or other materials provided with the
|
|
Packit Service |
99d1c0 |
* distribution.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit Service |
99d1c0 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit Service |
99d1c0 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
Packit Service |
99d1c0 |
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
Packit Service |
99d1c0 |
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
Packit Service |
99d1c0 |
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
Packit Service |
99d1c0 |
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit Service |
99d1c0 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
Packit Service |
99d1c0 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
Packit Service |
99d1c0 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
Packit Service |
99d1c0 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
Packit Service |
99d1c0 |
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit Service |
99d1c0 |
*/
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
#include <stdio.h>
|
|
Packit Service |
99d1c0 |
#include <stdlib.h>
|
|
Packit Service |
99d1c0 |
#include "common.h"
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
/* Establish a context to the given target name and enumerate the attributes of
|
|
Packit Service |
99d1c0 |
* the source name. */
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
int
|
|
Packit Service |
99d1c0 |
main(int argc, char *argv[])
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
OM_uint32 minor, flags;
|
|
Packit Service |
99d1c0 |
gss_name_t tname, sname;
|
|
Packit Service |
99d1c0 |
gss_ctx_id_t ictx, actx;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if (argc != 2) {
|
|
Packit Service |
99d1c0 |
fprintf(stderr, "Usage: %s targetname\n", argv[0]);
|
|
Packit Service |
99d1c0 |
return 1;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
tname = import_name(argv[1]);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
flags = GSS_C_REPLAY_FLAG | GSS_C_SEQUENCE_FLAG;
|
|
Packit Service |
99d1c0 |
establish_contexts(&mech_krb5, GSS_C_NO_CREDENTIAL, GSS_C_NO_CREDENTIAL,
|
|
Packit Service |
99d1c0 |
tname, flags, &ictx, &actx, &sname, NULL, NULL);
|
|
Packit Service |
99d1c0 |
enumerate_attributes(sname, 1);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
(void)gss_release_name(&minor, &tname);
|
|
Packit Service |
99d1c0 |
(void)gss_release_name(&minor, &sname);
|
|
Packit Service |
99d1c0 |
(void)gss_delete_sec_context(&minor, &ictx, NULL);
|
|
Packit Service |
99d1c0 |
(void)gss_delete_sec_context(&minor, &actx, NULL);
|
|
Packit Service |
99d1c0 |
return 0;
|
|
Packit Service |
99d1c0 |
}
|