Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include
File: krad.h
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
[0] Fix | Delete
/*
[1] Fix | Delete
* Copyright 2013 Red Hat, Inc. All rights reserved.
[2] Fix | Delete
*
[3] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[4] Fix | Delete
* modification, are permitted provided that the following conditions are met:
[5] Fix | Delete
*
[6] Fix | Delete
* 1. Redistributions of source code must retain the above copyright
[7] Fix | Delete
* notice, this list of conditions and the following disclaimer.
[8] Fix | Delete
*
[9] Fix | Delete
* 2. Redistributions in binary form must reproduce the above copyright
[10] Fix | Delete
* notice, this list of conditions and the following disclaimer in
[11] Fix | Delete
* the documentation and/or other materials provided with the
[12] Fix | Delete
* distribution.
[13] Fix | Delete
*
[14] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
[15] Fix | Delete
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
[16] Fix | Delete
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
[17] Fix | Delete
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
[18] Fix | Delete
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
[19] Fix | Delete
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
[20] Fix | Delete
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
[21] Fix | Delete
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
[22] Fix | Delete
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
[23] Fix | Delete
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
[24] Fix | Delete
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[25] Fix | Delete
*/
[26] Fix | Delete
[27] Fix | Delete
/*
[28] Fix | Delete
* This API is not considered as stable as the main krb5 API.
[29] Fix | Delete
*
[30] Fix | Delete
* - We may make arbitrary incompatible changes between feature releases
[31] Fix | Delete
* (e.g. from 1.12 to 1.13).
[32] Fix | Delete
* - We will make some effort to avoid making incompatible changes for
[33] Fix | Delete
* bugfix releases, but will make them if necessary.
[34] Fix | Delete
*/
[35] Fix | Delete
[36] Fix | Delete
#ifndef KRAD_H_
[37] Fix | Delete
#define KRAD_H_
[38] Fix | Delete
[39] Fix | Delete
#include <krb5.h>
[40] Fix | Delete
#include <verto.h>
[41] Fix | Delete
#include <stddef.h>
[42] Fix | Delete
#include <stdio.h>
[43] Fix | Delete
[44] Fix | Delete
#define KRAD_PACKET_SIZE_MAX 4096
[45] Fix | Delete
[46] Fix | Delete
#define KRAD_SERVICE_TYPE_LOGIN 1
[47] Fix | Delete
#define KRAD_SERVICE_TYPE_FRAMED 2
[48] Fix | Delete
#define KRAD_SERVICE_TYPE_CALLBACK_LOGIN 3
[49] Fix | Delete
#define KRAD_SERVICE_TYPE_CALLBACK_FRAMED 4
[50] Fix | Delete
#define KRAD_SERVICE_TYPE_OUTBOUND 5
[51] Fix | Delete
#define KRAD_SERVICE_TYPE_ADMINISTRATIVE 6
[52] Fix | Delete
#define KRAD_SERVICE_TYPE_NAS_PROMPT 7
[53] Fix | Delete
#define KRAD_SERVICE_TYPE_AUTHENTICATE_ONLY 8
[54] Fix | Delete
#define KRAD_SERVICE_TYPE_CALLBACK_NAS_PROMPT 9
[55] Fix | Delete
#define KRAD_SERVICE_TYPE_CALL_CHECK 10
[56] Fix | Delete
#define KRAD_SERVICE_TYPE_CALLBACK_ADMINISTRATIVE 11
[57] Fix | Delete
[58] Fix | Delete
typedef struct krad_attrset_st krad_attrset;
[59] Fix | Delete
typedef struct krad_packet_st krad_packet;
[60] Fix | Delete
typedef struct krad_client_st krad_client;
[61] Fix | Delete
typedef unsigned char krad_code;
[62] Fix | Delete
typedef unsigned char krad_attr;
[63] Fix | Delete
[64] Fix | Delete
/* Called when a response is received or the request times out. */
[65] Fix | Delete
typedef void
[66] Fix | Delete
(*krad_cb)(krb5_error_code retval, const krad_packet *request,
[67] Fix | Delete
const krad_packet *response, void *data);
[68] Fix | Delete
[69] Fix | Delete
/*
[70] Fix | Delete
* Called to iterate over a set of requests. Either the callback will be
[71] Fix | Delete
* called until it returns NULL, or it will be called with cancel = TRUE to
[72] Fix | Delete
* terminate in the middle of an iteration.
[73] Fix | Delete
*/
[74] Fix | Delete
typedef const krad_packet *
[75] Fix | Delete
(*krad_packet_iter_cb)(void *data, krb5_boolean cancel);
[76] Fix | Delete
[77] Fix | Delete
/*
[78] Fix | Delete
* Code
[79] Fix | Delete
*/
[80] Fix | Delete
[81] Fix | Delete
/* Convert a code name to its number. Only works for codes defined
[82] Fix | Delete
* by RFC 2875 or 2882. Returns 0 if the name was not found. */
[83] Fix | Delete
krad_code
[84] Fix | Delete
krad_code_name2num(const char *name);
[85] Fix | Delete
[86] Fix | Delete
/* Convert a code number to its name. Only works for attributes defined
[87] Fix | Delete
* by RFC 2865 or 2882. Returns NULL if the name was not found. */
[88] Fix | Delete
const char *
[89] Fix | Delete
krad_code_num2name(krad_code code);
[90] Fix | Delete
[91] Fix | Delete
/*
[92] Fix | Delete
* Attribute
[93] Fix | Delete
*/
[94] Fix | Delete
[95] Fix | Delete
/* Convert an attribute name to its number. Only works for attributes defined
[96] Fix | Delete
* by RFC 2865. Returns 0 if the name was not found. */
[97] Fix | Delete
krad_attr
[98] Fix | Delete
krad_attr_name2num(const char *name);
[99] Fix | Delete
[100] Fix | Delete
/* Convert an attribute number to its name. Only works for attributes defined
[101] Fix | Delete
* by RFC 2865. Returns NULL if the name was not found. */
[102] Fix | Delete
const char *
[103] Fix | Delete
krad_attr_num2name(krad_attr type);
[104] Fix | Delete
[105] Fix | Delete
/*
[106] Fix | Delete
* Attribute set
[107] Fix | Delete
*/
[108] Fix | Delete
[109] Fix | Delete
/* Create a new attribute set. */
[110] Fix | Delete
krb5_error_code
[111] Fix | Delete
krad_attrset_new(krb5_context ctx, krad_attrset **set);
[112] Fix | Delete
[113] Fix | Delete
/* Create a deep copy of an attribute set. */
[114] Fix | Delete
krb5_error_code
[115] Fix | Delete
krad_attrset_copy(const krad_attrset *set, krad_attrset **copy);
[116] Fix | Delete
[117] Fix | Delete
/* Free an attribute set. */
[118] Fix | Delete
void
[119] Fix | Delete
krad_attrset_free(krad_attrset *set);
[120] Fix | Delete
[121] Fix | Delete
/* Add an attribute to a set. */
[122] Fix | Delete
krb5_error_code
[123] Fix | Delete
krad_attrset_add(krad_attrset *set, krad_attr type, const krb5_data *data);
[124] Fix | Delete
[125] Fix | Delete
/* Add a four-octet unsigned number attribute to the given set. */
[126] Fix | Delete
krb5_error_code
[127] Fix | Delete
krad_attrset_add_number(krad_attrset *set, krad_attr type, krb5_ui_4 num);
[128] Fix | Delete
[129] Fix | Delete
/* Delete the specified attribute. */
[130] Fix | Delete
void
[131] Fix | Delete
krad_attrset_del(krad_attrset *set, krad_attr type, size_t indx);
[132] Fix | Delete
[133] Fix | Delete
/* Get the specified attribute. */
[134] Fix | Delete
const krb5_data *
[135] Fix | Delete
krad_attrset_get(const krad_attrset *set, krad_attr type, size_t indx);
[136] Fix | Delete
[137] Fix | Delete
/*
[138] Fix | Delete
* Packet
[139] Fix | Delete
*/
[140] Fix | Delete
[141] Fix | Delete
/* Determine the bytes needed from the socket to get the whole packet. Don't
[142] Fix | Delete
* cache the return value as it can change! Returns -1 on EBADMSG. */
[143] Fix | Delete
ssize_t
[144] Fix | Delete
krad_packet_bytes_needed(const krb5_data *buffer);
[145] Fix | Delete
[146] Fix | Delete
/* Free a packet. */
[147] Fix | Delete
void
[148] Fix | Delete
krad_packet_free(krad_packet *pkt);
[149] Fix | Delete
[150] Fix | Delete
/*
[151] Fix | Delete
* Create a new request packet.
[152] Fix | Delete
*
[153] Fix | Delete
* This function takes the attributes specified in set and converts them into a
[154] Fix | Delete
* radius packet. The packet will have a randomized id. If cb is not NULL, it
[155] Fix | Delete
* will be called passing data as the argument to iterate over a set of
[156] Fix | Delete
* outstanding requests. In this case, the id will be both random and unique
[157] Fix | Delete
* across the set of requests.
[158] Fix | Delete
*/
[159] Fix | Delete
krb5_error_code
[160] Fix | Delete
krad_packet_new_request(krb5_context ctx, const char *secret, krad_code code,
[161] Fix | Delete
const krad_attrset *set, krad_packet_iter_cb cb,
[162] Fix | Delete
void *data, krad_packet **request);
[163] Fix | Delete
[164] Fix | Delete
/*
[165] Fix | Delete
* Create a new response packet.
[166] Fix | Delete
*
[167] Fix | Delete
* This function is similar to krad_packet_new_requst() except that it crafts a
[168] Fix | Delete
* packet in response to a request packet. This new packet will borrow values
[169] Fix | Delete
* from the request such as the id and the authenticator.
[170] Fix | Delete
*/
[171] Fix | Delete
krb5_error_code
[172] Fix | Delete
krad_packet_new_response(krb5_context ctx, const char *secret, krad_code code,
[173] Fix | Delete
const krad_attrset *set, const krad_packet *request,
[174] Fix | Delete
krad_packet **response);
[175] Fix | Delete
[176] Fix | Delete
/*
[177] Fix | Delete
* Decode a request radius packet from krb5_data.
[178] Fix | Delete
*
[179] Fix | Delete
* The resulting decoded packet will be a request packet stored in *reqpkt.
[180] Fix | Delete
*
[181] Fix | Delete
* If cb is NULL, *duppkt will always be NULL.
[182] Fix | Delete
*
[183] Fix | Delete
* If cb is not NULL, it will be called (with the data argument) to iterate
[184] Fix | Delete
* over a set of requests currently being processed. In this case, if the
[185] Fix | Delete
* packet is a duplicate of an already received request, the original request
[186] Fix | Delete
* will be set in *duppkt.
[187] Fix | Delete
*/
[188] Fix | Delete
krb5_error_code
[189] Fix | Delete
krad_packet_decode_request(krb5_context ctx, const char *secret,
[190] Fix | Delete
const krb5_data *buffer, krad_packet_iter_cb cb,
[191] Fix | Delete
void *data, const krad_packet **duppkt,
[192] Fix | Delete
krad_packet **reqpkt);
[193] Fix | Delete
[194] Fix | Delete
/*
[195] Fix | Delete
* Decode a response radius packet from krb5_data.
[196] Fix | Delete
*
[197] Fix | Delete
* The resulting decoded packet will be a response packet stored in *rsppkt.
[198] Fix | Delete
*
[199] Fix | Delete
* If cb is NULL, *reqpkt will always be NULL.
[200] Fix | Delete
*
[201] Fix | Delete
* If cb is not NULL, it will be called (with the data argument) to iterate
[202] Fix | Delete
* over a set of requests awaiting responses. In this case, if the response
[203] Fix | Delete
* packet matches one of these requests, the original request will be set in
[204] Fix | Delete
* *reqpkt.
[205] Fix | Delete
*/
[206] Fix | Delete
krb5_error_code
[207] Fix | Delete
krad_packet_decode_response(krb5_context ctx, const char *secret,
[208] Fix | Delete
const krb5_data *buffer, krad_packet_iter_cb cb,
[209] Fix | Delete
void *data, const krad_packet **reqpkt,
[210] Fix | Delete
krad_packet **rsppkt);
[211] Fix | Delete
[212] Fix | Delete
/* Encode packet. */
[213] Fix | Delete
const krb5_data *
[214] Fix | Delete
krad_packet_encode(const krad_packet *pkt);
[215] Fix | Delete
[216] Fix | Delete
/* Get the code for the given packet. */
[217] Fix | Delete
krad_code
[218] Fix | Delete
krad_packet_get_code(const krad_packet *pkt);
[219] Fix | Delete
[220] Fix | Delete
/* Get the specified attribute. */
[221] Fix | Delete
const krb5_data *
[222] Fix | Delete
krad_packet_get_attr(const krad_packet *pkt, krad_attr type, size_t indx);
[223] Fix | Delete
[224] Fix | Delete
/*
[225] Fix | Delete
* Client
[226] Fix | Delete
*/
[227] Fix | Delete
[228] Fix | Delete
/* Create a new client. */
[229] Fix | Delete
krb5_error_code
[230] Fix | Delete
krad_client_new(krb5_context kctx, verto_ctx *vctx, krad_client **client);
[231] Fix | Delete
[232] Fix | Delete
/* Free the client. */
[233] Fix | Delete
void
[234] Fix | Delete
krad_client_free(krad_client *client);
[235] Fix | Delete
[236] Fix | Delete
/*
[237] Fix | Delete
* Send a request to a radius server.
[238] Fix | Delete
*
[239] Fix | Delete
* The remote host may be specified by one of the following formats:
[240] Fix | Delete
* - /path/to/unix.socket
[241] Fix | Delete
* - IPv4
[242] Fix | Delete
* - IPv4:port
[243] Fix | Delete
* - IPv4:service
[244] Fix | Delete
* - [IPv6]
[245] Fix | Delete
* - [IPv6]:port
[246] Fix | Delete
* - [IPv6]:service
[247] Fix | Delete
* - hostname
[248] Fix | Delete
* - hostname:port
[249] Fix | Delete
* - hostname:service
[250] Fix | Delete
*
[251] Fix | Delete
* The timeout parameter (milliseconds) is the total timeout across all remote
[252] Fix | Delete
* hosts (when DNS returns multiple entries) and all retries. For stream
[253] Fix | Delete
* sockets, the retries parameter is ignored and no retries are performed.
[254] Fix | Delete
*
[255] Fix | Delete
* The cb function will be called with the data argument when either a response
[256] Fix | Delete
* is received or the request times out on all possible remote hosts.
[257] Fix | Delete
*/
[258] Fix | Delete
krb5_error_code
[259] Fix | Delete
krad_client_send(krad_client *rc, krad_code code, const krad_attrset *attrs,
[260] Fix | Delete
const char *remote, const char *secret, int timeout,
[261] Fix | Delete
size_t retries, krad_cb cb, void *data);
[262] Fix | Delete
[263] Fix | Delete
#endif /* KRAD_H_ */
[264] Fix | Delete
[265] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function