1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #include "chap.h" 27 #include "radius_auth.h" 28 29 #include <netinet/in.h> 30 #include <sys/int_types.h> 31 32 chap_validation_status_type 33 chap_validate(char *target_chap_name, 34 char *initiator_chap_name, 35 uint8_t *challenge, 36 uint8_t *target_response, 37 uint8_t identifier, 38 authentication_method_type auth_method, 39 void *auth_config_data) { 40 41 if (auth_method == RADIUS_AUTHENTICATION) { 42 RADIUS_CONFIG *radius_config = 43 (RADIUS_CONFIG *)auth_config_data; 44 45 if (radius_config == 0) { 46 return (CHAP_VALIDATION_INTERNAL_ERROR); 47 } 48 49 return (radius_chap_validate( 50 target_chap_name, 51 initiator_chap_name, 52 challenge, 53 target_response, 54 identifier, 55 radius_config->rad_svr_addr, 56 radius_config->rad_svr_port, 57 radius_config->rad_svr_shared_secret, 58 radius_config->rad_svr_shared_secret_len)); 59 } else if (auth_method == DIRECT_AUTHENTICATION) { 60 return (CHAP_VALIDATION_UNKNOWN_AUTH_METHOD); 61 } 62 63 return (CHAP_VALIDATION_UNKNOWN_AUTH_METHOD); 64 } 65