Annotation of embedaddon/strongswan/src/libcharon/plugins/xauth_noauth/xauth_noauth.c, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2013 Tobias Brunner
                      3:  * HSR Hochschule fuer Technik Rapperswil
                      4:  *
                      5:  * This program is free software; you can redistribute it and/or modify it
                      6:  * under the terms of the GNU General Public License as published by the
                      7:  * Free Software Foundation; either version 2 of the License, or (at your
                      8:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                      9:  *
                     10:  * This program is distributed in the hope that it will be useful, but
                     11:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     12:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     13:  * for more details.
                     14:  */
                     15: 
                     16: #include "xauth_noauth.h"
                     17: 
                     18: #include <daemon.h>
                     19: #include <library.h>
                     20: 
                     21: typedef struct private_xauth_noauth_t private_xauth_noauth_t;
                     22: 
                     23: /**
                     24:  * Private data of an xauth_noauth_t object.
                     25:  */
                     26: struct private_xauth_noauth_t {
                     27: 
                     28:        /**
                     29:         * Public interface.
                     30:         */
                     31:        xauth_noauth_t public;
                     32: 
                     33:        /**
                     34:         * ID of the peer (not really used here)
                     35:         */
                     36:        identification_t *peer;
                     37: 
                     38: };
                     39: 
                     40: METHOD(xauth_method_t, initiate, status_t,
                     41:        private_xauth_noauth_t *this, cp_payload_t **out)
                     42: {
                     43:        /* XAuth task handles the details for us */
                     44:        return SUCCESS;
                     45: }
                     46: 
                     47: METHOD(xauth_method_t, process, status_t,
                     48:        private_xauth_noauth_t *this, cp_payload_t *in, cp_payload_t **out)
                     49: {
                     50:        /* this should never be called */
                     51:        return FAILED;
                     52: }
                     53: 
                     54: METHOD(xauth_method_t, get_identity, identification_t*,
                     55:        private_xauth_noauth_t *this)
                     56: {
                     57:        /* this should never be called, but lets still return a valid ID */
                     58:        return this->peer;
                     59: }
                     60: 
                     61: METHOD(xauth_method_t, destroy, void,
                     62:        private_xauth_noauth_t *this)
                     63: {
                     64:        this->peer->destroy(this->peer);
                     65:        free(this);
                     66: }
                     67: 
                     68: /*
                     69:  * Described in header.
                     70:  */
                     71: xauth_noauth_t *xauth_noauth_create_server(identification_t *server,
                     72:                                                                                   identification_t *peer,
                     73:                                                                                   char *profile)
                     74: {
                     75:        private_xauth_noauth_t *this;
                     76: 
                     77:        INIT(this,
                     78:                .public = {
                     79:                        .xauth_method = {
                     80:                                .initiate = _initiate,
                     81:                                .process = _process,
                     82:                                .get_identity = _get_identity,
                     83:                                .destroy = _destroy,
                     84:                        },
                     85:                },
                     86:                .peer = identification_create_from_string("%any"),
                     87:        );
                     88: 
                     89:        return &this->public;
                     90: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>