1 /* Copyright 2004-2007 Thimo Eichstaedt 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * Based on code from 16 * Dirk.vanGulik@jrc.it - original module 17 * mjd@pobox.com - bug fixes, conversion from mSQL to MySQL 18 * 19 */ 20 21 #ifndef _MOD_AUTH_COOKIE_SQL2_H 22 #define _MOD_AUTH_COOKIE_SQL2_H 23 24 #define MAX_USERNAME_LEN 128 25 26 #define WHERE_ALLOWED OR_AUTHCFG 27 28 #define ERRTAG "Mod_Auth_Cookie_Mysql2 " 29 #define MY_MYSQL_APPNAME "ModAuthCookieMysql2" 30 31 #define RET_OK 1 32 #define RET_ERR -1 33 34 #define RET_UNAUTHORIZED 2 35 #define RET_AUTHORIZED 3 36 37 //#define AUTH_COOKIE_SQL2_DEBUG 1 38 39 typedef struct s_auth_cookie_sql2_config_struct { 40 int activated; 41 char *cookiename; 42 char *dbhost; 43 char *dbuser; 44 char *dbpassword; 45 char *dbname; 46 char *dbtable; 47 int dbpersistent; 48 char *dbusername_field; 49 char *dbsessname_field; 50 char *dbsessval_field; 51 char *dbexpiry_field; 52 char *dbremoteip_field; 53 char *sql_addon; 54 char *failureurl; 55 } auth_cookie_sql2_config_rec; 56 57 58 /* Private functions */ 59 extern int check_against_db(auth_cookie_sql2_config_rec *, request_rec *, char *, char *, char *, char *, char *, time_t); 60 extern int open_db(auth_cookie_sql2_config_rec *, request_rec *); 61 extern int close_db(auth_cookie_sql2_config_rec *, request_rec *, int); 62 63 #endif // _MOD_AUTH_COOKIE_SQL2_H 64