Path: blob/main/crypto/krb5/src/tests/gssapi/t_srcattrs.c
34889 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* src/tests/gssapi/t_accname_authind.c - test harness for auth indicators */2/*3* Copyright (C) 2016 by Red Hat, Inc.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9*10* * Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12*13* * Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in15* the documentation and/or other materials provided with the16* distribution.17*18* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS21* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE22* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,23* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES24* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR25* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,27* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)28* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED29* OF THE POSSIBILITY OF SUCH DAMAGE.30*/3132#include <stdio.h>33#include <stdlib.h>34#include "common.h"3536/* Establish a context to the given target name and enumerate the attributes of37* the source name. */3839int40main(int argc, char *argv[])41{42OM_uint32 minor, flags;43gss_name_t tname, sname;44gss_ctx_id_t ictx, actx;4546if (argc != 2) {47fprintf(stderr, "Usage: %s targetname\n", argv[0]);48return 1;49}50tname = import_name(argv[1]);5152flags = GSS_C_REPLAY_FLAG | GSS_C_SEQUENCE_FLAG;53establish_contexts(&mech_krb5, GSS_C_NO_CREDENTIAL, GSS_C_NO_CREDENTIAL,54tname, flags, &ictx, &actx, &sname, NULL, NULL);55enumerate_attributes(sname, 1);5657(void)gss_release_name(&minor, &tname);58(void)gss_release_name(&minor, &sname);59(void)gss_delete_sec_context(&minor, &ictx, NULL);60(void)gss_delete_sec_context(&minor, &actx, NULL);61return 0;62}636465