mod-auth-commit Mailing List for mod_auth (Page 5)
Brought to you by:
firechipmunk,
honx
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(36) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(7) |
Feb
(51) |
Mar
(22) |
Apr
|
May
(6) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <fir...@us...> - 2003-11-17 04:08:21
|
Update of /cvsroot/mod-auth/mod_authn_cache/src In directory sc8-pr-cvs1:/tmp/cvs-serv8208 Modified Files: mod_authn_cache.c Added Files: authn_scache.c authn_scache_shmht.c authn_util_table.c authn_util_table.h mod_authn_cache.h Removed Files: util_authn_cache.c util_authn_cache.h util_authn_cache_mgr.c Log Message: change to shmht type cache. still needs major work. --- NEW FILE: authn_scache.c --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== */ /* WARNING: This code is directly taken from mod_ssl. If there is a bug in ssl_scache.c, there will likely be a bug here. */ /* ``Open-Source Software: generous programmers from around the world all join forces to help you shoot yourself in the foot for free.'' -- Unknown */ #include "mod_authn_cache.h" x /* _________________________________________________________________ ** ** Session Cache: Common Abstraction Layer ** _________________________________________________________________ */ void authn_scache_init(server_rec *s, apr_pool_t *p) { SSLModConfigRec *mc = myModConfig(s); /* * Warn the user that he should use the session cache. * But we can operate without it, of course. */ if (mc->nSessionCacheMode == AUTHN_SCMODE_UNSET) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, "Init: AuthnCache is not configured " "[hint: AuthnCacheMode]"); mc->nSessionCacheMode = AUTHN_SCMODE_NONE; return; } if (mc->nSessionCacheMode == AUTHN_SCMODE_SHMHT) void *data; const char *userdata_key = "authn_scache_init"; apr_pool_userdata_get(&data, userdata_key, s->process->pool); if (!data) { apr_pool_userdata_set((const void *)1, userdata_key, apr_pool_cleanup_null, s->process->pool); return; } if(mc->nSessionCacheMode == AUTHN_SCMODE_SHMHT) authn_scache_shmht_init(s, p); } } void authn_scache_kill(server_rec *s) { SSLModConfigRec *mc = myModConfig(s); if (mc->nSessionCacheMode == AUTHN_SCMODE_SHMHT) authn_scache_shmht_kill(s); return; } BOOL authn_scache_store(server_rec *s, authn_cache_node_t* node, time_t expiry) { SSLModConfigRec *mc = myModConfig(s); BOOL rv = FALSE; if (mc->nSessionCacheMode == AUTHN_SCMODE_SHMHT) rv = authn_scache_shmht_store(s, node, expiry); return rv; } SSL_SESSION *ssl_scache_retrieve(server_rec *s, authn_cache_node_t* node) { SSLModConfigRec *mc = myModConfig(s); SSL_SESSION *sess = NULL; if (mc->nSessionCacheMode == AUTHN_SCMODE_SHMHT) sess = authn_scache_shmht_retrieve(s, node); return sess; } void authn_scache_remove(server_rec *s, authn_cache_node_t* node) { SSLModConfigRec *mc = myModConfig(s); if (mc->nSessionCacheMode == AUTHN_SCMODE_SHMHT) authn_scache_shmht_remove(s, node); return; } void authn_scache_expire(server_rec *s) { SSLModConfigRec *mc = myModConfig(s); if (mc->nSessionCacheMode == AUTHN_SCMODE_SHMHT) authn_scache_shmht_expire(s); return; } --- NEW FILE: authn_scache_shmht.c --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== */ #include "mod_authn_cache.h" /* * Wrapper functions for table library which resemble malloc(3) & Co * but use the variants from the MM shared memory library. */ static void *authn_scache_shmht_malloc(void *opt_param, size_t size) { SSLModConfigRec *mc = myModConfig((server_rec *)opt_param); apr_rmm_off_t off = apr_rmm_calloc(mc->pSessionCacheDataRMM, size); return apr_rmm_addr_get(mc->pSessionCacheDataRMM, off); } static void *authn_scache_shmht_calloc(void *opt_param, size_t number, size_t size) { SSLModConfigRec *mc = myModConfig((server_rec *)opt_param); apr_rmm_off_t off = apr_rmm_calloc(mc->pSessionCacheDataRMM, (number*size)); return apr_rmm_addr_get(mc->pSessionCacheDataRMM, off); } static void *authn_scache_shmht_realloc(void *opt_param, void *ptr, size_t size) { SSLModConfigRec *mc = myModConfig((server_rec *)opt_param); apr_rmm_off_t off = apr_rmm_realloc(mc->pSessionCacheDataRMM, ptr, size); return apr_rmm_addr_get(mc->pSessionCacheDataRMM, off); } static void authn_scache_shmht_free(void *opt_param, void *ptr) { SSLModConfigRec *mc = myModConfig((server_rec *)opt_param); apr_rmm_off_t off = apr_rmm_offset_get(mc->pSessionCacheDataRMM, ptr); apr_rmm_free(mc->pSessionCacheDataRMM, off); return; } /* * Now the actual session cache implementation * based on a hash table inside a shared memory segment. */ void authn_scache_shmht_init(server_rec *s, apr_pool_t *p) { SSLModConfigRec *mc = myModConfig(s); table_t *ta; int ta_errno; apr_size_t avail; int n; apr_status_t rv; /* * Create shared memory segment */ if (mc->szSessionCacheDataFile == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "SSLSessionCache required"); exit(1); } if ((rv = apr_shm_create(&(mc->pSessionCacheDataMM), mc->nSessionCacheDataSize, mc->szSessionCacheDataFile, mc->pPool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "Cannot allocate shared memory"); exit(1); } if ((rv = apr_rmm_init(&(mc->pSessionCacheDataRMM), NULL, apr_shm_baseaddr_get(mc->pSessionCacheDataMM), mc->nSessionCacheDataSize, mc->pPool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "Cannot initialize rmm"); exit(1); } ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "initialize MM %pp RMM %pp", mc->pSessionCacheDataMM, mc->pSessionCacheDataRMM); /* * Create hash table in shared memory segment */ avail = mc->nSessionCacheDataSize; n = (avail/2) / 1024; n = n < 10 ? 10 : n; /* * Passing server_rec as opt_param to table_alloc so that we can do * logging if required ssl_util_table. Otherwise, mc is sufficient. */ if ((ta = table_alloc(n, &ta_errno, authn_scache_shmht_malloc, authn_scache_shmht_calloc, authn_scache_shmht_realloc, authn_scache_shmht_free, s )) == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "Cannot allocate hash table in shared memory: %s", table_strerror(ta_errno)); exit(1); } table_attr(ta, TABLE_FLAG_AUTO_ADJUST|TABLE_FLAG_ADJUST_DOWN); table_set_data_alignment(ta, sizeof(char *)); table_clear(ta); mc->tSessionCacheDataTable = ta; /* * Log the done work */ ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "Init: Created hash-table (%d buckets) " "in shared memory (%" APR_SIZE_T_FMT " bytes) for AuthnCache", n, avail); return; } void authn_scache_shmht_kill(server_rec *s) { SSLModConfigRec *mc = myModConfig(s); if (mc->pSessionCacheDataRMM != NULL) { apr_rmm_destroy(mc->pSessionCacheDataRMM); mc->pSessionCacheDataRMM = NULL; } if (mc->pSessionCacheDataMM != NULL) { apr_shm_destroy(mc->pSessionCacheDataMM); mc->pSessionCacheDataMM = NULL; } return; } BOOL authn_scache_shmht_store(server_rec *s, time_t expiry, authn_cache_node_t* node) { SSLModConfigRec *mc = myModConfig(s); void *vp; UCHAR ucaData[SSL_SESSION_MAX_DER]; int nData; UCHAR *ucp; /* streamline session data */ if ((nData = i2d_SSL_SESSION(sess, NULL)) > sizeof(ucaData)) return FALSE; ucp = ucaData; i2d_SSL_SESSION(sess, &ucp); authn_mutex_on(s); if (table_insert_kd(mc->tSessionCacheDataTable, id, idlen, NULL, sizeof(time_t)+nData, NULL, &vp, 1) != TABLE_ERROR_NONE) { authn_mutex_off(s); return FALSE; } memcpy(vp, &expiry, sizeof(time_t)); memcpy((char *)vp+sizeof(time_t), ucaData, nData); autn_mutex_off(s); /* allow the regular expiring to occur */ authn_scache_shmht_expire(s); return TRUE; } SSL_SESSION *authn_scache_shmht_retrieve(server_rec *s, UCHAR *id, int idlen) { SSLModConfigRec *mc = myModConfig(s); void *vp; SSL_SESSION *sess = NULL; UCHAR *ucpData; int nData; time_t expiry; time_t now; int n; /* allow the regular expiring to occur */ authn_scache_shmht_expire(s); /* lookup key in table */ authn_mutex_on(s); if (table_retrieve(mc->tSessionCacheDataTable, id, idlen, &vp, &n) != TABLE_ERROR_NONE) { authn_mutex_off(s); return NULL; } /* copy over the information to the SCI */ nData = n-sizeof(time_t); ucpData = (UCHAR *)malloc(nData); if (ucpData == NULL) { authn_mutex_off(s); return NULL; } memcpy(&expiry, vp, sizeof(time_t)); memcpy(ucpData, (char *)vp+sizeof(time_t), nData); authn_mutex_off(s); /* make sure the stuff is still not expired */ now = time(NULL); if (expiry <= now) { authn_scache_shmht_remove(s, id, idlen); return NULL; } /* unstreamed SSL_SESSION */ sess = d2i_SSL_SESSION(NULL, &ucpData, nData); return sess; } void authn_scache_shmht_remove(server_rec *s, UCHAR *id, int idlen) { SSLModConfigRec *mc = myModConfig(s); /* remove value under key in table */ authn_mutex_on(s); table_delete(mc->tSessionCacheDataTable, id, idlen, NULL, NULL); authn_mutex_off(s); return; } void authn_scache_shmht_expire(server_rec *s) { SSLModConfigRec *mc = myModConfig(s); SSLSrvConfigRec *sc = mySrvConfig(s); static time_t tLast = 0; table_linear_t iterator; time_t tExpiresAt; void *vpKey; void *vpKeyThis; void *vpData; int nKey; int nKeyThis; int nData; int nElements = 0; int nDeleted = 0; int bDelete; int rc; time_t tNow; /* * make sure the expiration for still not-accessed session * cache entries is done only from time to time */ tNow = time(NULL); if (tNow < tLast+sc->session_cache_timeout) return; tLast = tNow; authn_mutex_on(s); if (table_first_r(mc->tSessionCacheDataTable, &iterator, &vpKey, &nKey, &vpData, &nData) == TABLE_ERROR_NONE) { do { bDelete = FALSE; nElements++; if (nData < sizeof(time_t) || vpData == NULL) bDelete = TRUE; else { memcpy(&tExpiresAt, vpData, sizeof(time_t)); /* * XXX : Force the record to be cleaned up. TBD (Madhu) * tExpiresAt = tNow; */ if (tExpiresAt <= tNow) bDelete = TRUE; } vpKeyThis = vpKey; nKeyThis = nKey; rc = table_next_r(mc->tSessionCacheDataTable, &iterator, &vpKey, &nKey, &vpData, &nData); if (bDelete) { table_delete(mc->tSessionCacheDataTable, vpKeyThis, nKeyThis, NULL, NULL); nDeleted++; } } while (rc == TABLE_ERROR_NONE); /* (vpKeyThis != vpKey) && (nKeyThis != nKey) */ } authn_mutex_off(s); ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Inter-Process Session Cache (SHMHT) Expiry: " "old: %d, new: %d, removed: %d", nElements, nElements-nDeleted, nDeleted); return; } void authn_scache_shmht_status(server_rec *s, apr_pool_t *p, void (*func)(char *, void *), void *arg) { SSLModConfigRec *mc = myModConfig(s); void *vpKey; void *vpData; int nKey; int nData; int nElem; int nSize; int nAverage; nElem = 0; nSize = 0; authn_mutex_on(s); if (table_first(mc->tSessionCacheDataTable, &vpKey, &nKey, &vpData, &nData) == TABLE_ERROR_NONE) { do { if (vpKey == NULL || vpData == NULL) continue; nElem += 1; nSize += nData; } while (table_next(mc->tSessionCacheDataTable, &vpKey, &nKey, &vpData, &nData) == TABLE_ERROR_NONE); } authn_mutex_off(s); if (nSize > 0 && nElem > 0) nAverage = nSize / nElem; else nAverage = 0; func(apr_psprintf(p, "cache type: <b>SHMHT</b>, maximum size: <b>%d</b> bytes<br>", mc->nSessionCacheDataSize), arg); func(apr_psprintf(p, "current sessions: <b>%d</b>, current size: <b>%d</b> bytes<br>", nElem, nSize), arg); func(apr_psprintf(p, "average session size: <b>%d</b> bytes<br>", nAverage), arg); return; } --- NEW FILE: authn_util_table.c --- /* _ _ ** _ __ ___ ___ __| | ___ ___| | mod_ssl ** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL ** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org ** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org ** |_____| ** ssl_util_table.c ** High Performance Hash Table Functions */ /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: [...2512 lines suppressed...] return TABLE_ERROR_ARG_NULL; if (key_buf_p != NULL) *key_buf_p = ENTRY_KEY_BUF(entry_p); if (key_size_p != NULL) *key_size_p = entry_p->te_key_size; if (data_buf_p != NULL) { if (entry_p->te_data_size == 0) *data_buf_p = NULL; else { if (table_p->ta_data_align == 0) *data_buf_p = ENTRY_DATA_BUF(table_p, entry_p); else *data_buf_p = entry_data_buf(table_p, entry_p); } } if (data_size_p != NULL) *data_size_p = entry_p->te_data_size; return TABLE_ERROR_NONE; } --- NEW FILE: authn_util_table.h --- /* _ _ ** _ __ ___ ___ __| | ___ ___| | mod_ssl ** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL ** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org ** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org ** |_____| ** ssl_util_table.h ** High Performance Hash Table Header */ /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== */ /* * Generic hash table defines * Table 4.1.0 July-28-1998 * * This library is a generic open hash table with buckets and * linked lists. It is pretty high performance. Each element * has a key and a data. The user indexes on the key to find the * data. * * Copyright 1998 by Gray Watson <gr...@le...> * * Permission to use, copy, modify, and distribute this software for any * purpose and without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, * and that the name of Gray Watson not be used in advertising or * publicity pertaining to distribution of the document or software * without specific, written prior permission. * * Gray Watson makes no representations about the suitability of the * software described herein for any purpose. It is provided "as is" * without express or implied warranty. */ #ifndef __SSL_UTIL_TABLE_H__ #define __SSL_UTIL_TABLE_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * To build a "key" in any of the below routines, pass in a pointer to * the key and its size [i.e. sizeof(int), etc]. With any of the * "key" or "data" arguments, if their size is < 0, it will do an * internal strlen of the item and add 1 for the \0. * * If you are using firstkey() and nextkey() functions, be careful if, * after starting your firstkey loop, you use delete or insert, it * will not crash but may produce interesting results. If you are * deleting from firstkey to NULL it will work fine. */ /* return types for table functions */ #define TABLE_ERROR_NONE 1 /* no error from function */ #define TABLE_ERROR_PNT 2 /* bad table pointer */ #define TABLE_ERROR_ARG_NULL 3 /* buffer args were null */ #define TABLE_ERROR_SIZE 4 /* size of data was bad */ #define TABLE_ERROR_OVERWRITE 5 /* key exists and we cant overwrite */ #define TABLE_ERROR_NOT_FOUND 6 /* key does not exist */ #define TABLE_ERROR_ALLOC 7 /* memory allocation error */ #define TABLE_ERROR_LINEAR 8 /* no linear access started */ #define TABLE_ERROR_OPEN 9 /* could not open file */ #define TABLE_ERROR_SEEK 10 /* could not seek to pos in file */ #define TABLE_ERROR_READ 11 /* could not read from file */ #define TABLE_ERROR_WRITE 12 /* could not write to file */ #define TABLE_ERROR_EMPTY 13 /* table is empty */ #define TABLE_ERROR_NOT_EMPTY 14 /* table contains data */ #define TABLE_ERROR_ALIGNMENT 15 /* invalid alignment value */ /* * Table flags set with table_attr. */ /* * Automatically adjust the number of table buckets on the fly. * Whenever the number of entries gets above some threshold, the * number of buckets is realloced to a new size and each entry is * re-hashed. Although this may take some time when it re-hashes, the * table will perform better over time. */ #define TABLE_FLAG_AUTO_ADJUST (1<<0) /* * If the above auto-adjust flag is set, also adjust the number of * table buckets down as we delete entries. */ #define TABLE_FLAG_ADJUST_DOWN (1<<1) /* structure to walk through the fields in a linear order */ typedef struct { unsigned int tl_magic; /* magic structure to ensure correct init */ unsigned int tl_bucket_c; /* where in the table buck array we are */ unsigned int tl_entry_c; /* in the bucket, which entry we are on */ } table_linear_t; typedef int (*table_compare_t)(const void *key1, const int key1_size, const void *data1, const int data1_size, const void *key2, const int key2_size, const void *data2, const int data2_size); #ifndef TABLE_PRIVATE typedef void table_t; typedef void table_entry_t; #endif /* * Prototypes */ extern table_t *table_alloc(const unsigned int bucket_n, int *error_p, void *(*malloc_f)(void *opt_param, size_t size), void *(*calloc_f)(void *opt_param, size_t number, size_t size), void *(*realloc_f)(void *opt_param, void *ptr, size_t size), void (*free_f)(void *opt_param, void *ptr), void *opt_param); extern int table_attr(table_t *table_p, const int attr); extern int table_set_data_alignment(table_t *table_p, const int alignment); extern int table_clear(table_t *table_p); extern int table_free(table_t *table_p); extern int table_insert_kd(table_t *table_p, const void *key_buf, const int key_size, const void *data_buf, const int data_size, void **key_buf_p, void **data_buf_p, const char overwrite_b); extern int table_insert(table_t *table_p, const void *key_buf, const int key_size, const void *data_buf, const int data_size, void **data_buf_p, const char overwrite_b); extern int table_retrieve(table_t *table_p, const void *key_buf, const int key_size, void **data_buf_p, int *data_size_p); extern int table_delete(table_t *table_p, const void *key_buf, const int key_size, void **data_buf_p, int *data_size_p); extern int table_delete_first(table_t *table_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); extern int table_info(table_t *table_p, int *num_buckets_p, int *num_entries_p); extern int table_adjust(table_t *table_p, const int bucket_n); extern const char *table_strerror(const int error); extern int table_type_size(void); extern int table_first(table_t *table_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); extern int table_next(table_t *table_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); extern int table_this(table_t *table_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); extern int table_first_r(table_t *table_p, table_linear_t *linear_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); extern int table_next_r(table_t *table_p, table_linear_t *linear_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); extern int table_this_r(table_t *table_p, table_linear_t *linear_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); extern table_entry_t **table_order(table_t *table_p, table_compare_t compare, int *num_entries_p, int *error_p); extern int table_entry_info(table_t *table_p, table_entry_t *entry_p, void **key_buf_p, int *key_size_p, void **data_buf_p, int *data_size_p); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __SSL_UTIL_TABLE_H__ */ --- NEW FILE: mod_authn_cache.h --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. */ /* * mod_authn_cache.h * * Paul Querna * * ** heavily based on mod_ssl's session cache system. ** * */ /* * XXXX: Convert all of these to apr_* * XXXX: if you did it here, might as well do it in mod_ssl! */ #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (!FALSE) #endif #ifndef BOOL #define BOOL unsigned int #endif #ifndef UCHAR #define UCHAR unsigned char #endif #ifndef UNSET #define UNSET (-1) #endif /* * XXX: Add Other Backends besides shmht */ typedef enum { AUTHN_SCMODE_UNSET = UNSET, AUTHN_SCMODE_NONE = 0, AUTHN_SCMODE_SHMHT = 1 } authn_scmode_t; typedef stuct authn_cache_node_t { char* username; char* realm; char* digest_hash; } authn_cache_node_t; /* Session Cache Support */ void authn_scache_init(server_rec *, apr_pool_t *); void authn_scache_kill(server_rec *); BOOL authn_scache_store(server_rec *, authn_cache_node_t *); authn_cache_node_t *authn_scache_retrieve(server_rec *, authn_cache_node_t*); void authn_scache_remove(server_rec *, authn_cache_node_t*); void authn_scache_expire(server_rec *); int authn_mutex_on(server_rec *s); int authn_mutex_off(server_rec *s); Index: mod_authn_cache.c =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_cache/src/mod_authn_cache.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mod_authn_cache.c 12 Nov 2003 07:04:37 -0000 1.2 --- mod_authn_cache.c 17 Nov 2003 04:07:37 -0000 1.3 *************** *** 91,156 **** #include "util_authn_cache.h" ! #define DFLT_TIMEOUT 300 // 5 minutes ! ! enum ! { ! CONF_CACHE_HANDLER, ! CONF_CACHE_TIMEOUT, ! CONF_CACHE_TYPE, ! }; ! typedef struct { ! char *handler; ! char *type_path; ! int type; ! apr_interval_time_t timeout; authn_provider_list *providers; ! util_cache_state_t *cache; ! } cache_config_rec; ! ! ! enum ! { ! CT_SHMEM, ! CT_FILE, ! }; ! ! static void *create_authn_cache_config(apr_pool_t * p, char *d) { ! cache_config_rec *conf; ! conf = (cache_config_rec *) apr_pcalloc(p, sizeof(cache_config_rec)); ! if (conf == NULL) { return NULL; } ! ! conf->handler = NULL; ! conf->type = CT_FILE; ! conf->type_path = NULL; ! conf->timeout = apr_time_from_sec(DFLT_TIMEOUT); ! conf->cache = (util_cache_state_t *)apr_pcalloc(p, sizeof(util_cache_state_t)); ! conf->cache->pool = p; return conf; } - static const char *set_cache_switch_conf(cmd_parms * cmd, void *config, const char *value) - { - apr_ssize_t pos = (apr_ssize_t) cmd->info; - cache_config_rec *temp = (cache_config_rec*)config; - switch (pos) { - case CONF_CACHE_HANDLER: - temp->handler = (char *)value; - break; - case CONF_CACHE_TIMEOUT: - temp->timeout = apr_time_from_sec(atoi(value)); - break; - case CONF_CACHE_TYPE: ! break; ! default: ! // unknown config directive? ! break; } ! return NULL; } --- 91,126 ---- #include "util_authn_cache.h" ! module AP_MODULE_DECLARE_DATA authn_cache_module; ! typedef struct authn_cache_conf_t { authn_provider_list *providers; ! } authn_cache_conf_t; ! static void *create_authn_cache_dconfig(apr_pool_t * p, char *d) { ! authn_cache_conf_t *conf; ! if (d == NULL) { return NULL; } ! conf = (authn_cache_conf_t *) apr_pcalloc(p, sizeof(authn_cache_conf_t)); ! if (conf) { ! conf->providers = NULL; ! } return conf; } ! static void *create_authn_cache_config(apr_pool_t *p, server_rec *s) ! { ! util_cache_state_t *st; ! st = (util_cache_state_t *) apr_pcalloc(p, sizeof(util_cache_state_t)); ! if (st == NULL) { ! return NULL; } ! ! st->pool = p; ! st->cache_bytes = 100000; ! st->cache_size = 1000; ! return st; } *************** *** 158,162 **** const char *arg) { ! cache_config_rec *conf = (cache_config_rec*)config; authn_provider_list *newp; const char *provider_name; --- 128,132 ---- const char *arg) { ! authn_cache_conf_t *conf = (authn_cache_conf_t*)config; authn_provider_list *newp; const char *provider_name; *************** *** 208,219 **** } static const command_rec authn_cache_cmds[] = { /* per auth section */ ! AP_INIT_TAKE1("AuthnCacheProvider", add_authn_provider, (void *) CONF_CACHE_HANDLER, OR_AUTHCFG, "The name of the configuration to use for this section"), ! AP_INIT_TAKE1("AuthnCacheTimeout", set_cache_switch_conf, (void *) CONF_CACHE_TIMEOUT, OR_AUTHCFG, ! "Time for Auth Tokens to Timeout"), ! AP_INIT_TAKE1("AuthnCacheType", set_cache_switch_conf, (void *) CONF_CACHE_TYPE, OR_AUTHCFG, ! "Type of storage for authen tokens"), {NULL} }; --- 178,213 ---- } + static const char *util_authn_set_cache_file(cmd_parms *cmd, void *dummy, const char *file) + { + util_cache_state_t *st = + (util_cache_state_t *)ap_get_module_config(cmd->server->module_config, + &authn_cache_module); + + if (file) { + st->cache_file = ap_server_root_relative(st->pool, file); + } + else { + st->cache_file = NULL; + } + + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, + "AuthnCache: Setting shared memory cache file to '%s'", + st->cache_file); + + return NULL; + } + + + static const command_rec authn_cache_cmds[] = { /* per auth section */ ! AP_INIT_TAKE1("AuthnCacheProvider", add_authn_provider, NULL, OR_AUTHCFG, "The name of the configuration to use for this section"), ! /* global config */ ! AP_INIT_TAKE1("AuthnCacheSharedCacheFile", util_authn_set_cache_file, NULL, RSRC_CONF, ! "Sets the file of the shared memory cache." ! "Nothing means disable the shared memory cache."), ! ! {NULL} }; *************** *** 226,248 **** authn_status auth_result; util_authn_any_node_t newnode; ! util_authn_any_node_t *node; ! util_authn_vhost_node_t *curl; util_authn_vhost_node_t curnode; authn_provider_list *current_provider; ! cache_config_rec *conf = ap_get_module_config(r->per_dir_config, &authn_cache_module); ! AUTHN_CACHE_WRLOCK(); ! curnode.vhost = apr_pstrdup(conf->cache->pool, r->server->server_hostname); ! curl = util_authn_cache_fetch(util_authn_cache, &curnode); ! if (curl == NULL) { ! curl = util_authn_create_caches(conf->cache, curnode.vhost); } - AUTHN_CACHE_UNLOCK(); ! AUTHN_CACHE_WRLOCK(); newnode.username = user; newnode.realm = ap_auth_name(r); ! node = util_authn_cache_fetch(curl->auth_cache, &newnode); if (node != NULL) { AUTHN_CACHE_UNLOCK(); --- 220,259 ---- authn_status auth_result; util_authn_any_node_t newnode; ! util_authn_any_node_t *node = NULL; ! util_authn_vhost_node_t *curl = NULL; util_authn_vhost_node_t curnode; authn_provider_list *current_provider; ! authn_cache_conf_t *conf = ap_get_module_config(r->per_dir_config, &authn_cache_module); ! util_cache_state_t *st = ap_get_module_config(r->server->module_config, ! &authn_cache_module); ! ! AUTHN_CACHE_RDLOCK(); ! curnode.vhost = r->server->server_hostname; ! ! if(st->util_authn_cache_d == NULL) ! { ! util_authn_cache_init(st->pool, st); ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "creating a new util_authn_cache_d!"); } ! curl = (util_authn_vhost_node_t* )util_authn_fetch(st->util_authn_cache_d, &curnode); ! if (curl == NULL) { ! curl = util_authn_create_caches(st, curnode.vhost); ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "creating new cache on vhost: %s cache: 0x%08x", r->server->server_hostname,curl); ! } ! else ! { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "existing cache on vhost: %s! cache: 0x%08x", r->server->server_hostname,curl); ! } newnode.username = user; newnode.realm = ap_auth_name(r); ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "checking cache for username: %s in realm: %s on vhost: %s cache: 0x%08x node: 0x%08x", newnode.username, newnode.realm, r->server->server_hostname, curl->auth_cache, node); ! node = util_authn_fetch(curl->auth_cache, &newnode); if (node != NULL) { AUTHN_CACHE_UNLOCK(); *************** *** 252,256 **** } ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "NOT used cached auth!"); AUTHN_CACHE_UNLOCK(); --- 263,267 ---- } ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "NOT used cached auth! node: 0x%08x newnode.user:%s newnode.realm:%s",node,newnode.username,newnode.realm); AUTHN_CACHE_UNLOCK(); *************** *** 280,292 **** /* Something occured. Stop checking. */ if (auth_result != AUTH_USER_NOT_FOUND) { - if(auth_result == AUTH_GRANTED) - { - // add to cache - AUTHN_CACHE_RDLOCK(); - newnode.username = user; - newnode.realm = ap_auth_name(r); - util_authn_cache_insert(curl->auth_cache, &newnode); - AUTHN_CACHE_UNLOCK(); - } break; } --- 291,294 ---- *************** *** 301,304 **** --- 303,322 ---- } while (current_provider); + if(auth_result == AUTH_GRANTED) + { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "adding user: %s to cache for realm: %s cache: 0x%08x auth cache: 0x%08x",user,ap_auth_name(r), curl, curl->auth_cache); + // add to cache + AUTHN_CACHE_WRLOCK(); + newnode.username = user; + newnode.realm = ap_auth_name(r); + util_authn_insert(curl->auth_cache, &newnode); + AUTHN_CACHE_UNLOCK(); + } + else { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "NOT adding user(but auth good?): %s to cache for realm: %s!",user,ap_auth_name(r)); + } + return auth_result; } *************** *** 308,401 **** { ! authn_status auth_result; ! util_authn_any_node_t newnode; ! authn_provider_list *current_provider; ! cache_config_rec *conf = ap_get_module_config(r->per_dir_config, ! &authn_cache_module); ! ! current_provider = conf->providers; ! ! do { ! const authn_provider *provider; ! if (!current_provider) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "No Cache Authn provider configured"); ! auth_result = AUTH_GENERAL_ERROR; ! break; ! } ! else { ! provider = current_provider->provider; ! } ! ! if(!provider->check_password) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "The '%s' Cache Authn provider doesn't support Digest Authentication", current_provider->provider_name); ! auth_result = AUTH_GENERAL_ERROR; ! break; ! } ! ! /* We expect the password to be md5 hash of user:realm:password */ ! auth_result = provider->get_realm_hash(r, user, realm, ! rethash); ! ! /* Something occured. Stop checking. */ ! if (auth_result != AUTH_USER_NOT_FOUND) { ! if(auth_result == AUTH_GRANTED) ! { ! // add to cache ! AUTHN_CACHE_RDLOCK(); ! newnode.username = (char *)user; ! newnode.realm = (char *)ap_auth_name(r); ! util_authn_cache_insert(util_authn_cache, &newnode); ! AUTHN_CACHE_UNLOCK(); ! } ! break; ! } ! ! /* If we're not really configured for providers, stop now. */ ! if (!conf->providers) { ! break; ! } ! ! current_provider = current_provider->next; ! ! } while (current_provider); ! ! return auth_result; } ! ! static apr_status_t init_authn_cache_config(apr_pool_t * pconf, ! apr_pool_t * plog, ! apr_pool_t * ptemp) { - apr_status_t rv = APR_SUCCESS; ! return rv; ! } - static apr_status_t init_authn_cache(apr_pool_t * p, apr_pool_t * plog, - apr_pool_t * ptemp, server_rec * s) - { - apr_status_t rv = APR_SUCCESS; - void *data; - const char *userdata_key = "mod_authn_cache_init"; ! apr_pool_userdata_get(&data, userdata_key, s->process->pool); ! if (!data) { ! apr_pool_userdata_set((const void *) 1, userdata_key, ! apr_pool_cleanup_null, s->process->pool); ! return OK; ! } ! ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, p, ! "[mod_authn_cache.c] Running Cache init Code"); ! AUTHN_CACHE_LOCK_CREATE(p); ! apr_status_t result = util_authn_cache_init(p, 10000); ! return rv; } --- 326,377 ---- { ! return AUTH_USER_NOT_FOUND; } ! static int init_authn_cache(apr_pool_t *p, apr_pool_t *plog, ! apr_pool_t *ptemp, server_rec *s) { + char buf[MAX_STRING_LEN]; + apr_status_t result; ! util_cache_state_t *st = (util_cache_state_t *)ap_get_module_config(s->module_config, &authn_cache_module); ! st->pool = p; ! #if APR_HAS_SHARED_MEMORY ! server_rec *s_vhost; ! util_cache_state_t *st_vhost; ! /* initializing cache if file is here and we already don't have shm addr*/ ! if (st->cache_file && !st->cache_shm) { ! #endif ! AUTHN_CACHE_LOCK_CREATE(p); ! result = util_authn_cache_init(p, st); ! apr_strerror(result, buf, sizeof(buf)); ! ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, result, s, ! "AuthnCache init: %s", buf); ! #if APR_HAS_SHARED_MEMORY ! /* merge config in all vhost */ ! s_vhost = s->next; ! while (s_vhost) { ! ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, result, s, ! "Authn merging Shared Cache conf: shm=0x%x rmm=0x%x for VHOST: %s", ! st->cache_shm, st->cache_rmm, s_vhost->server_hostname); ! st_vhost = (util_cache_state_t *)ap_get_module_config(s_vhost->module_config, &authn_cache_module); ! st_vhost->cache_shm = st->cache_shm; ! st_vhost->cache_rmm = st->cache_rmm; ! st_vhost->cache_file = st->cache_file; ! s_vhost = s_vhost->next; ! } ! } ! else { ! ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0 , s, "AuthnCache: Unable to init Shared Cache: no file"); ! } ! #endif ! return 0; } *************** *** 408,412 **** static void register_hooks(apr_pool_t * p) { - ap_hook_pre_config(init_authn_cache_config, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_post_config(init_authn_cache, NULL, NULL, APR_HOOK_MIDDLE); ap_register_provider(p, AUTHN_PROVIDER_GROUP, "cache", "0", --- 384,387 ---- *************** *** 414,424 **** } module AP_MODULE_DECLARE_DATA authn_cache_module = { STANDARD20_MODULE_STUFF, ! create_authn_cache_config, /* dir config creater */ NULL, /* dir merger --- default is to override */ ! NULL, /* server config creator */ NULL, /* merge server config */ ! authn_cache_cmds, /* command apr_table_t */ register_hooks /* register hooks */ }; --- 389,429 ---- } + int authn_mutex_on(server_rec *s) + { + SSLModConfigRec *mc = myModConfig(s); + apr_status_t rv; + + if (mc->nMutexMode == SSL_MUTEXMODE_NONE) + return TRUE; + if ((rv = apr_global_mutex_lock(mc->pMutex)) != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_WARNING, rv, s, + "Failed to acquire global mutex lock"); + return FALSE; + } + return TRUE; + } + + int authn_mutex_off(server_rec *s) + { + SSLModConfigRec *mc = myModConfig(s); + apr_status_t rv; + + if (mc->nMutexMode == SSL_MUTEXMODE_NONE) + return TRUE; + if ((rv = apr_global_mutex_unlock(mc->pMutex)) != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_WARNING, rv, s, + "Failed to release global mutex lock"); + return FALSE; + } + return TRUE; + } + module AP_MODULE_DECLARE_DATA authn_cache_module = { STANDARD20_MODULE_STUFF, ! create_authn_cache_dconfig, /* dir config creater */ NULL, /* dir merger --- default is to override */ ! create_authn_cache_config, /* server config creator */ NULL, /* merge server config */ ! authn_cache_cmds, /* command apr_table_t */ register_hooks /* register hooks */ }; --- util_authn_cache.c DELETED --- --- util_authn_cache.h DELETED --- --- util_authn_cache_mgr.c DELETED --- |
From: <fir...@us...> - 2003-11-12 07:05:01
|
Update of /cvsroot/mod-auth/mod_authn_cache/src In directory sc8-pr-cvs1:/tmp/cvs-serv7860 Modified Files: mod_authn_cache.c Log Message: fix copy and paste error Index: mod_authn_cache.c =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_cache/src/mod_authn_cache.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mod_authn_cache.c 12 Nov 2003 06:40:28 -0000 1.1 --- mod_authn_cache.c 12 Nov 2003 07:04:37 -0000 1.2 *************** *** 253,257 **** ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "NOT used cached auth!"); - return AUTH_GRANTED; AUTHN_CACHE_UNLOCK(); --- 253,256 ---- |
Update of /cvsroot/mod-auth/mod_authn_cache/src In directory sc8-pr-cvs1:/tmp/cvs-serv4746/mod_authn_cache/src Added Files: Makefile.am mod_authn_cache.c util_authn_cache.c util_authn_cache.h util_authn_cache_mgr.c Log Message: add initial mod_authn_cache --- NEW FILE: Makefile.am --- CLEANFILES = .libs/libmod_authn_cache *~ libmod_authn_cache_la_SOURCES = mod_authn_cache.c lib_LTLIBRARIES = libmod_authn_cache.la make_so: @if test ! -L mod_authn_cache.so ; then ln -s .libs/libmod_authn_cache.so mod_authn_cache.so ; fi install: $(INSTALL) -m 644 .libs/libmod_authn_cache.so $(LIBEXECDIR)/mod_authn_cache.so @echo "" @echo "" @echo "***********************************************" @echo "" @echo " Please read the documentation at " @echo " http://mod-auth.sourceforge.net/docs/ for " @echo " details on configuration of this module " @echo "" @echo "***********************************************" @echo "" --- NEW FILE: mod_authn_cache.c --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. */ /* * mod_authn_cache * * Paul Querna */ #include "apr_lib.h" #define APR_WANT_STRFUNC #include "apr_want.h" #include "apr_strings.h" #include "apr_md5.h" #include "apr_sha1.h" #include "apr_reslist.h" #include "apr_thread_mutex.h" #include "apr_hash.h" #include "apr_shm.h" #include "ap_provider.h" #include "httpd.h" #include "http_config.h" #include "http_core.h" #include "http_log.h" #include "http_protocol.h" #include "http_request.h" #include "mod_auth.h" #include "util_md5.h" #if !APR_HAS_SHARED_MEMORY #error Shared Memory is required to use authn_cache #endif #include "util_authn_cache.h" #define DFLT_TIMEOUT 300 // 5 minutes enum { CONF_CACHE_HANDLER, CONF_CACHE_TIMEOUT, CONF_CACHE_TYPE, }; typedef struct { char *handler; char *type_path; int type; apr_interval_time_t timeout; authn_provider_list *providers; util_cache_state_t *cache; } cache_config_rec; enum { CT_SHMEM, CT_FILE, }; static void *create_authn_cache_config(apr_pool_t * p, char *d) { cache_config_rec *conf; conf = (cache_config_rec *) apr_pcalloc(p, sizeof(cache_config_rec)); if (conf == NULL) { return NULL; } conf->handler = NULL; conf->type = CT_FILE; conf->type_path = NULL; conf->timeout = apr_time_from_sec(DFLT_TIMEOUT); conf->cache = (util_cache_state_t *)apr_pcalloc(p, sizeof(util_cache_state_t)); conf->cache->pool = p; return conf; } static const char *set_cache_switch_conf(cmd_parms * cmd, void *config, const char *value) { apr_ssize_t pos = (apr_ssize_t) cmd->info; cache_config_rec *temp = (cache_config_rec*)config; switch (pos) { case CONF_CACHE_HANDLER: temp->handler = (char *)value; break; case CONF_CACHE_TIMEOUT: temp->timeout = apr_time_from_sec(atoi(value)); break; case CONF_CACHE_TYPE: break; default: // unknown config directive? break; } return NULL; } static const char *add_authn_provider(cmd_parms *cmd, void *config, const char *arg) { cache_config_rec *conf = (cache_config_rec*)config; authn_provider_list *newp; const char *provider_name; if (strcasecmp(arg, "cache") == 0) { /* hey, recursively cache`ing auth requests is bad.. mmmmkay? */ return NULL; } provider_name = apr_pstrdup(cmd->pool, arg); newp = apr_pcalloc(cmd->pool, sizeof(authn_provider_list)); newp->provider_name = provider_name; /* lookup and cache the actual provider now */ newp->provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP, newp->provider_name, "0"); if (newp->provider == NULL) { /* by the time they use it, the provider should be loaded and registered with us. */ return apr_psprintf(cmd->pool, "Unknown Authn provider: %s", newp->provider_name); } if (!newp->provider->check_password) { /* if it doesn't provide the appropriate function, reject it */ return apr_psprintf(cmd->pool, "The '%s' Authn provider doesn't support " "Basic Authentication", provider_name); } /* Add it to the list now. */ if (!conf->providers) { conf->providers = newp; } else { authn_provider_list *last = conf->providers; while (last->next) { last = last->next; } last->next = newp; } return NULL; } static const command_rec authn_cache_cmds[] = { /* per auth section */ AP_INIT_TAKE1("AuthnCacheProvider", add_authn_provider, (void *) CONF_CACHE_HANDLER, OR_AUTHCFG, "The name of the configuration to use for this section"), AP_INIT_TAKE1("AuthnCacheTimeout", set_cache_switch_conf, (void *) CONF_CACHE_TIMEOUT, OR_AUTHCFG, "Time for Auth Tokens to Timeout"), AP_INIT_TAKE1("AuthnCacheType", set_cache_switch_conf, (void *) CONF_CACHE_TYPE, OR_AUTHCFG, "Type of storage for authen tokens"), {NULL} }; module AP_MODULE_DECLARE_DATA authn_cache_module; static authn_status check_cache_pw(request_rec * r, const char *user, const char *password) { authn_status auth_result; util_authn_any_node_t newnode; util_authn_any_node_t *node; util_authn_vhost_node_t *curl; util_authn_vhost_node_t curnode; authn_provider_list *current_provider; cache_config_rec *conf = ap_get_module_config(r->per_dir_config, &authn_cache_module); AUTHN_CACHE_WRLOCK(); curnode.vhost = apr_pstrdup(conf->cache->pool, r->server->server_hostname); curl = util_authn_cache_fetch(util_authn_cache, &curnode); if (curl == NULL) { curl = util_authn_create_caches(conf->cache, curnode.vhost); } AUTHN_CACHE_UNLOCK(); AUTHN_CACHE_WRLOCK(); newnode.username = user; newnode.realm = ap_auth_name(r); node = util_authn_cache_fetch(curl->auth_cache, &newnode); if (node != NULL) { AUTHN_CACHE_UNLOCK(); ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "used cached auth!"); return AUTH_GRANTED; } ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "NOT used cached auth!"); return AUTH_GRANTED; AUTHN_CACHE_UNLOCK(); current_provider = conf->providers; do { const authn_provider *provider; if (!current_provider) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No Cache Authn provider configured"); auth_result = AUTH_GENERAL_ERROR; break; } else { provider = current_provider->provider; } if(!provider->check_password) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "The '%s' Cache Authn provider doesn't support Basic Authentication", current_provider->provider_name); auth_result = AUTH_GENERAL_ERROR; break; } auth_result = provider->check_password(r, user, password); /* Something occured. Stop checking. */ if (auth_result != AUTH_USER_NOT_FOUND) { if(auth_result == AUTH_GRANTED) { // add to cache AUTHN_CACHE_RDLOCK(); newnode.username = user; newnode.realm = ap_auth_name(r); util_authn_cache_insert(curl->auth_cache, &newnode); AUTHN_CACHE_UNLOCK(); } break; } /* If we're not really configured for providers, stop now. */ if (!conf->providers) { break; } current_provider = current_provider->next; } while (current_provider); return auth_result; } static authn_status get_cache_realm_hash(request_rec * r, const char *user, const char *realm, char **rethash) { authn_status auth_result; util_authn_any_node_t newnode; authn_provider_list *current_provider; cache_config_rec *conf = ap_get_module_config(r->per_dir_config, &authn_cache_module); current_provider = conf->providers; do { const authn_provider *provider; if (!current_provider) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No Cache Authn provider configured"); auth_result = AUTH_GENERAL_ERROR; break; } else { provider = current_provider->provider; } if(!provider->check_password) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "The '%s' Cache Authn provider doesn't support Digest Authentication", current_provider->provider_name); auth_result = AUTH_GENERAL_ERROR; break; } /* We expect the password to be md5 hash of user:realm:password */ auth_result = provider->get_realm_hash(r, user, realm, rethash); /* Something occured. Stop checking. */ if (auth_result != AUTH_USER_NOT_FOUND) { if(auth_result == AUTH_GRANTED) { // add to cache AUTHN_CACHE_RDLOCK(); newnode.username = (char *)user; newnode.realm = (char *)ap_auth_name(r); util_authn_cache_insert(util_authn_cache, &newnode); AUTHN_CACHE_UNLOCK(); } break; } /* If we're not really configured for providers, stop now. */ if (!conf->providers) { break; } current_provider = current_provider->next; } while (current_provider); return auth_result; } static apr_status_t init_authn_cache_config(apr_pool_t * pconf, apr_pool_t * plog, apr_pool_t * ptemp) { apr_status_t rv = APR_SUCCESS; return rv; } static apr_status_t init_authn_cache(apr_pool_t * p, apr_pool_t * plog, apr_pool_t * ptemp, server_rec * s) { apr_status_t rv = APR_SUCCESS; void *data; const char *userdata_key = "mod_authn_cache_init"; apr_pool_userdata_get(&data, userdata_key, s->process->pool); if (!data) { apr_pool_userdata_set((const void *) 1, userdata_key, apr_pool_cleanup_null, s->process->pool); return OK; } ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, p, "[mod_authn_cache.c] Running Cache init Code"); AUTHN_CACHE_LOCK_CREATE(p); apr_status_t result = util_authn_cache_init(p, 10000); return rv; } static const authn_provider authn_cache_provider = { &check_cache_pw, &get_cache_realm_hash }; static void register_hooks(apr_pool_t * p) { ap_hook_pre_config(init_authn_cache_config, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_post_config(init_authn_cache, NULL, NULL, APR_HOOK_MIDDLE); ap_register_provider(p, AUTHN_PROVIDER_GROUP, "cache", "0", &authn_cache_provider); } module AP_MODULE_DECLARE_DATA authn_cache_module = { STANDARD20_MODULE_STUFF, create_authn_cache_config, /* dir config creater */ NULL, /* dir merger --- default is to override */ NULL, /* server config creator */ NULL, /* merge server config */ authn_cache_cmds, /* command apr_table_t */ register_hooks /* register hooks */ }; --- NEW FILE: util_authn_cache.c --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ /* * util_authn_cache.c: Authen cache things * * Original code from auth_ldap module for Apache v1.3: * Copyright 1998, 1999 Enbridge Pipelines Inc. * Copyright 1999-2001 Dave Carrigan */ #include "util_authn_cache.h" #define MODAUTHN_SHMEM_CACHE "/tmp/mod_authn_cache" /* ------------------------------------------------------------------ */ unsigned long util_authn_any_hash(void *n) { util_authn_any_node_t *node = (util_authn_any_node_t *)n; return util_authn_hash_string(2, node->username, node->realm); } int util_authn_any_compare(void *a, void *b) { util_authn_any_node_t *na = (util_authn_any_node_t *)a; util_authn_any_node_t *nb = (util_authn_any_node_t *)b; return( strcmp(na->username, nb->username) == 0 && strcmp(na->realm, nb->realm) == 0 ); } void *util_authn_any_copy(void *c) { util_authn_any_node_t *n = (util_authn_any_node_t *)c; util_authn_any_node_t *node = (util_authn_any_node_t *)util_authn_alloc(sizeof(util_authn_any_node_t)); if (node) { if ( !(node->username = util_authn_strdup(n->username)) || !(node->realm = util_authn_strdup(n->realm)) ) { util_authn_any_free((void*)node); return NULL; } return node; } else { return NULL; } } void util_authn_any_free(void *n) { util_authn_any_node_t *node = (util_authn_any_node_t *)n; util_authn_free(node->username); util_authn_free(node->realm); util_authn_free(node); } /* ------------------------------------------------------------------ */ unsigned long util_authn_vhost_hash(void *n) { util_authn_vhost_node_t *node = (util_authn_vhost_node_t *)n; return util_authn_hash_string(1, node->vhost); } int util_authn_vhost_compare(void *a, void *b) { util_authn_vhost_node_t *na = (util_authn_vhost_node_t *)a; util_authn_vhost_node_t *nb = (util_authn_vhost_node_t *)b; return( strcmp(na->vhost, nb->vhost) == 0); } void *util_authn_vhost_copy(void *c) { util_authn_vhost_node_t *n = (util_authn_vhost_node_t *)c; util_authn_vhost_node_t *node = (util_authn_vhost_node_t *)util_authn_alloc(sizeof(util_authn_vhost_node_t)); if (node) { if ( !(node->vhost = util_authn_strdup(n->vhost)) ) { util_authn_vhost_free((void*)node); return NULL; } return node; } else { return NULL; } } void util_authn_vhost_free(void *n) { util_authn_vhost_node_t *node = (util_authn_vhost_node_t *)n; util_authn_free(node->vhost); util_authn_free(node); } /* ------------------------------------------------------------------ */ apr_status_t util_authn_cache_child_kill(void *data); apr_status_t util_authn_cache_module_kill(void *data); apr_status_t util_authn_cache_module_kill(void *data) { #if APR_HAS_SHARED_MEMORY if (util_authn_shm != NULL) { apr_status_t result = apr_shm_destroy(util_authn_shm); util_authn_shm = NULL; return result; } #endif util_authn_destroy_cache(util_authn_cache); return APR_SUCCESS; } apr_status_t util_authn_cache_init(apr_pool_t *pool, apr_size_t reqsize) { #if APR_HAS_SHARED_MEMORY apr_status_t result; result = apr_shm_create(&util_authn_shm, reqsize, MODAUTHN_SHMEM_CACHE, pool); if (result == EEXIST) { /* * The cache could have already been created (i.e. we may be a child process). See * if we can attach to the existing shared memory */ result = apr_shm_attach(&util_authn_shm, MODAUTHN_SHMEM_CACHE, pool); } if (result != APR_SUCCESS) { return result; } /* This will create a rmm "handler" to get into the shared memory area */ apr_rmm_init(&util_authn_rmm, NULL, (void *)apr_shm_baseaddr_get(util_authn_shm), reqsize, pool); #endif apr_pool_cleanup_register(pool, NULL, util_authn_cache_module_kill, apr_pool_cleanup_null); util_authn_cache = util_authn_create_cache(50, util_authn_vhost_hash, util_authn_vhost_compare, util_authn_vhost_copy, util_authn_vhost_free); return APR_SUCCESS; } --- NEW FILE: util_authn_cache.h --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ #ifndef APU_AUTHN_CACHE_H #define APU_AUTHN_CACHE_H /* * This switches AUTHN support on or off. */ /* * AUTHN Cache Manager */ #include "apr_shm.h" #include "apr_rmm.h" #include "apr_time.h" typedef struct util_cache_state_t { apr_pool_t *pool; /* pool from which this state is allocated */ #if APR_HAS_THREADS apr_thread_mutex_t *mutex; /* mutex lock for the connection list */ #endif apr_size_t cache_bytes; /* Size (in bytes) of shared memory cache */ } util_cache_state_t; typedef struct util_cache_node_t { void *payload; /* Pointer to the payload */ apr_time_t add_time; /* Time node was added to cache */ struct util_cache_node_t *next; } util_cache_node_t; typedef struct util_authn_cache_t { unsigned long size; /* Size of cache array */ unsigned long maxentries; /* Maximum number of cache entries */ unsigned long numentries; /* Current number of cache entries */ unsigned long fullmark; /* Used to keep track of when cache becomes 3/4 full */ apr_time_t marktime; /* Time that the cache became 3/4 full */ unsigned long (*hash)(void *); /* Func to hash the payload */ int (*compare)(void *, void *); /* Func to compare two payloads */ void * (*copy)(void *); /* Func to alloc mem and copy payload to new mem */ void (*free)(void *); /* Func to free mem used by the payload */ util_cache_node_t **nodes; unsigned long numpurges; /* No. of times the cache has been purged */ double avg_purgetime; /* Average time to purge the cache */ apr_time_t last_purge; /* Time of the last purge */ unsigned long npurged; /* Number of elements purged in last purge. This is not obvious: it won't be 3/4 the size of the cache if there were a lot of expired entries. */ unsigned long fetches; /* Number of fetches */ unsigned long hits; /* Number of cache hits */ unsigned long inserts; /* Number of inserts */ unsigned long removes; /* Number of removes */ } util_authn_cache_t; #if APR_HAS_SHARED_MEMORY apr_shm_t *util_authn_shm; apr_rmm_t *util_authn_rmm; #endif util_authn_cache_t *util_authn_cache; #if APR_HAS_THREADS apr_thread_rwlock_t *util_authn_cache_lock; #define AUTHN_CACHE_LOCK_CREATE(p) \ if (!util_authn_cache_lock) apr_thread_rwlock_create(&util_authn_cache_lock, p) #define AUTHN_CACHE_WRLOCK() \ apr_thread_rwlock_wrlock(util_authn_cache_lock) #define AUTHN_CACHE_UNLOCK() \ apr_thread_rwlock_unlock(util_authn_cache_lock) #define AUTHN_CACHE_RDLOCK() \ apr_thread_rwlock_rdlock(util_authn_cache_lock) #else #define AUTHN_CACHE_LOCK_CREATE(p) #define AUTHN_CACHE_WRLOCK() #define AUTHN_CACHE_UNLOCK() #define AUTHN_CACHE_RDLOCK() #endif #ifndef WIN32 #define ALD_MM_FILE_MODE ( S_IRUSR|S_IWUSR ) #else #define ALD_MM_FILE_MODE ( _S_IREAD|_S_IWRITE ) #endif /* * AUTHN Cache */ typedef struct util_authn_vhost_node_t { const char *vhost; util_cache_node_t *auth_cache; } util_authn_vhost_node_t; typedef struct util_authn_any_node_t { const char *username; const char *realm; const char *rethash; } util_authn_any_node_t; /* * Function prototypes for AUTHN cache */ /* util_authn_cache.c */ unsigned long util_authn_any_hash(void *n); int util_authn_any_compare(void *a, void *b); void *util_authn_any_copy(void *c); void util_authn_any_free(void *n); unsigned long util_authn_vhost_hash(void *n); int util_authn_vhost_compare(void *a, void *b); void *util_authn_vhost_copy(void *c); void util_authn_vhost_free(void *n); /* util_authn_cache_mgr.c */ void util_authn_free(const void *ptr); void *util_authn_alloc(unsigned long size); const char *util_authn_strdup(const char *s); unsigned long util_authn_hash_string(int nstr, ...); void util_authn_cache_purge(util_authn_cache_t *cache); util_authn_vhost_node_t *util_authn_create_caches(util_cache_state_t *s, const char *vhost); util_authn_cache_t *util_authn_create_cache(unsigned long maxentries, unsigned long (*hashfunc)(void *), int (*comparefunc)(void *, void *), void * (*copyfunc)(void *), void (*freefunc)(void *)); void util_authn_destroy_cache(util_authn_cache_t *cache); void *util_authn_cache_fetch(util_authn_cache_t *cache, void *payload); void util_authn_cache_insert(util_authn_cache_t *cache, void *payload); void util_authn_cache_remove(util_authn_cache_t *cache, void *payload); #endif /* APU_AUTHN_CACHE_H */ --- NEW FILE: util_authn_cache_mgr.c --- /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ /* * util_authn_cache_mgr.c: AUTHN cache manager things * * Original code from auth_ldap module for Apache v1.3: * Copyright 1998, 1999 Enbridge Pipelines Inc. * Copyright 1999-2001 Dave Carrigan */ #include "util_authn_cache.h" #include <apr_strings.h> /* only here until strdup is gone */ #include <string.h> /* here till malloc is gone */ #include <stdlib.h> static const unsigned long primes[] = { 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237, 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627, 47431, 71143, 106721, 160073, 240101, 360163, 540217, 810343, 1215497, 1823231, 2734867, 4102283, 6153409, 9230113, 13845163, 0 }; void util_authn_free(const void *ptr) { #if APR_HAS_SHARED_MEMORY if (util_authn_shm) { if (ptr) apr_rmm_free(util_authn_rmm, apr_rmm_offset_get(util_authn_rmm, (void *)ptr)); } else { if (ptr) free((void *)ptr); } #else if (ptr) free((void *)ptr); #endif } void *util_authn_alloc(unsigned long size) { if (0 == size) return NULL; #if APR_HAS_SHARED_MEMORY if (util_authn_shm) { return (void *)apr_rmm_addr_get(util_authn_rmm, apr_rmm_calloc(util_authn_rmm, size)); } else { return (void *)calloc(sizeof(char), size); } #else return (void *)calloc(sizeof(char), size); #endif } const char *util_authn_strdup(const char *s) { #if APR_HAS_SHARED_MEMORY if (util_authn_shm) { char *buf = (char *)apr_rmm_addr_get(util_authn_rmm, apr_rmm_calloc(util_authn_rmm, strlen(s)+1)); if (buf) { strcpy(buf, s); return buf; } else { return NULL; } } else { return strdup(s); } #else return strdup(s); #endif } /* * Computes the hash on a set of strings. The first argument is the number * of strings to hash, the rest of the args are strings. * Algorithm taken from glibc. */ unsigned long util_authn_hash_string(int nstr, ...) { int i; va_list args; unsigned long h=0, g; char *str, *p; va_start(args, nstr); for (i=0; i < nstr; ++i) { str = va_arg(args, char *); for (p = str; *p; ++p) { h = ( h << 4 ) + *p; if ( ( g = h & 0xf0000000 ) ) { h = h ^ (g >> 24); h = h ^ g; } } } va_end(args); return h; } /* Purges a cache that has gotten full. We keep track of the time that we added the entry that made the cache 3/4 full, then delete all entries that were added before that time. It's pretty simplistic, but time to purge is only O(n), which is more important. */ void util_authn_cache_purge(util_authn_cache_t *cache) { unsigned long i; util_cache_node_t *p, *q; apr_time_t t; if (!cache) return; cache->last_purge = apr_time_now(); cache->npurged = 0; cache->numpurges++; for (i=0; i < cache->size; ++i) { p = cache->nodes[i]; while (p != NULL) { if (p->add_time < cache->marktime) { q = p->next; (*cache->free)(p->payload); util_authn_free(p); cache->numentries--; cache->npurged++; p = q; } else { p = p->next; } } } t = apr_time_now(); cache->avg_purgetime = ((t - cache->last_purge) + (cache->avg_purgetime * (cache->numpurges-1))) / cache->numpurges; } /* * create caches */ util_authn_vhost_node_t *util_authn_create_caches(util_cache_state_t *st, const char *vhost) { util_authn_vhost_node_t *curl = NULL; util_authn_cache_t *auth_cache; auth_cache = util_authn_create_cache(1000, util_authn_any_hash, util_authn_any_compare, util_authn_any_copy, util_authn_any_free); if (auth_cache) { curl = (util_authn_vhost_node_t *)apr_pcalloc(st->pool, sizeof(util_authn_vhost_node_t)); curl->vhost = vhost; curl->auth_cache = (util_authn_cache_t*) auth_cache; util_authn_cache_insert(util_authn_cache, curl); } return curl; } util_authn_cache_t *util_authn_create_cache(unsigned long maxentries, unsigned long (*hashfunc)(void *), int (*comparefunc)(void *, void *), void * (*copyfunc)(void *), void (*freefunc)(void *)) { util_authn_cache_t *cache; unsigned long i; if (maxentries <= 0) return NULL; cache = (util_authn_cache_t *)util_authn_alloc(sizeof(util_authn_cache_t)); if (!cache) return NULL; cache->maxentries = maxentries; cache->numentries = 0; cache->size = maxentries / 3; if (cache->size < 64) cache->size = 64; for (i = 0; primes[i] && primes[i] < cache->size; ++i) ; cache->size = primes[i]? primes[i] : primes[i-1]; cache->nodes = (util_cache_node_t **)util_authn_alloc(cache->size * sizeof(util_cache_node_t *)); if (!cache->nodes) { util_authn_free(cache); return NULL; } for (i=0; i < cache->size; ++i) cache->nodes[i] = NULL; cache->hash = hashfunc; cache->compare = comparefunc; cache->copy = copyfunc; cache->free = freefunc; cache->fullmark = cache->maxentries / 4 * 3; cache->marktime = 0; cache->avg_purgetime = 0.0; cache->numpurges = 0; cache->last_purge = 0; cache->npurged = 0; cache->fetches = 0; cache->hits = 0; cache->inserts = 0; cache->removes = 0; return cache; } void util_authn_destroy_cache(util_authn_cache_t *cache) { unsigned long i; util_cache_node_t *p, *q; if (cache == NULL) return; for (i = 0; i < cache->size; ++i) { p = cache->nodes[i]; q = NULL; while (p != NULL) { q = p->next; (*cache->free)(p->payload); util_authn_free(p); p = q; } } util_authn_free(cache->nodes); util_authn_free(cache); } void *util_authn_cache_fetch(util_authn_cache_t *cache, void *payload) { int hashval; util_cache_node_t *p; if (cache == NULL) return NULL; cache->fetches++; hashval = (*cache->hash)(payload) % cache->size; for (p = cache->nodes[hashval]; p && !(*cache->compare)(p->payload, payload); p = p->next) ; if (p != NULL) { cache->hits++; return p->payload; } else { return NULL; } } /* * Insert an item into the cache. * *** Does not catch duplicates!!! *** */ void util_authn_cache_insert(util_authn_cache_t *cache, void *payload) { int hashval; util_cache_node_t *node; if (cache == NULL || payload == NULL) return; cache->inserts++; hashval = (*cache->hash)(payload) % cache->size; node = (util_cache_node_t *)util_authn_alloc(sizeof(util_cache_node_t)); node->add_time = apr_time_now(); node->payload = (*cache->copy)(payload); node->next = cache->nodes[hashval]; cache->nodes[hashval] = node; if (++cache->numentries == cache->fullmark) cache->marktime=apr_time_now(); if (cache->numentries >= cache->maxentries) util_authn_cache_purge(cache); } void util_authn_cache_remove(util_authn_cache_t *cache, void *payload) { int hashval; util_cache_node_t *p, *q; if (cache == NULL) return; cache->removes++; hashval = (*cache->hash)(payload) % cache->size; for (p = cache->nodes[hashval], q=NULL; p && !(*cache->compare)(p->payload, payload); p = p->next) { q = p; } /* If p is null, it means that we couldn't find the node, so just return */ if (p == NULL) return; if (q == NULL) { /* We found the node, and it's the first in the list */ cache->nodes[hashval] = p->next; } else { /* We found the node and it's not the first in the list */ q->next = p->next; } (*cache->free)(p->payload); util_authn_free(p); cache->numentries--; } |
From: <fir...@us...> - 2003-11-12 06:39:25
|
Update of /cvsroot/mod-auth/mod_authn_cache/src In directory sc8-pr-cvs1:/tmp/cvs-serv4528/mod_authn_cache/src Log Message: Directory /cvsroot/mod-auth/mod_authn_cache/src added to the repository |
From: <fir...@us...> - 2003-11-12 06:39:25
|
Update of /cvsroot/mod-auth/mod_authn_cache/include In directory sc8-pr-cvs1:/tmp/cvs-serv4528/mod_authn_cache/include Log Message: Directory /cvsroot/mod-auth/mod_authn_cache/include added to the repository |
From: <fir...@us...> - 2003-11-12 06:39:00
|
Update of /cvsroot/mod-auth/mod_authn_cache In directory sc8-pr-cvs1:/tmp/cvs-serv4484/mod_authn_cache Log Message: Directory /cvsroot/mod-auth/mod_authn_cache added to the repository |
From: <fir...@us...> - 2003-11-12 01:18:13
|
Update of /cvsroot/mod-auth/mod_authn_pam In directory sc8-pr-cvs1:/tmp/cvs-serv21015 Modified Files: aclocal.m4 ltmain.sh Log Message: trying to make automake cool. Index: aclocal.m4 =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_pam/aclocal.m4,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** aclocal.m4 11 Nov 2003 08:39:27 -0000 1.1 --- aclocal.m4 12 Nov 2003 01:18:08 -0000 1.2 *************** *** 1,5 **** ! # aclocal.m4 generated automatically by aclocal 1.5 ! # Copyright 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation --- 1,5 ---- ! # generated automatically by aclocal 1.7.3 -*- Autoconf -*- ! # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. [...4853 lines suppressed...] ! cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break ! # 40000 chars as input seems more than enough ! test $_count -gt 10 && break ! _count=`expr $_count + 1` ! if test $_count -gt $_max; then ! _max=$_count ! lt_cv_path_SED=$_sed ! fi ! done ! done ! rm -rf "$tmp" ! ]) ! if test "X$SED" != "X"; then ! lt_cv_path_SED=$SED ! else ! SED=$lt_cv_path_SED ! fi ! AC_MSG_RESULT([$SED]) ! ]) Index: ltmain.sh =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_pam/ltmain.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ltmain.sh 11 Nov 2003 08:39:27 -0000 1.1 --- ltmain.sh 12 Nov 2003 01:18:08 -0000 1.2 *************** *** 1062,1066 **** elif test "X$arg" = "X-lc_r"; then case $host in ! *-*-openbsd* | *-*-freebsd4*) # Do not include libc_r directly, use -pthread flag. continue --- 1062,1066 ---- elif test "X$arg" = "X-lc_r"; then case $host in ! *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue *************** *** 1074,1083 **** -module) module=yes - case $host in - *-*-freebsd*) - # Do not build the useless static library - build_old_libs=no - ;; - esac continue ;; --- 1074,1077 ---- *************** *** 3465,3471 **** finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; - *-*-freebsd*) - # FreeBSD doesn't need this... - ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 --- 3459,3462 ---- *************** *** 4290,4304 **** # Install the pseudo-library for information purposes. ! case $host in ! *-*-freebsd*) ! # Do not install the useless pseudo-library ! ;; ! *) ! name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` ! instname="$dir/$name"i ! $show "$install_prog $instname $destdir/$name" ! $run eval "$install_prog $instname $destdir/$name" || exit $? ! ;; ! esac # Maybe install the static library, too. --- 4281,4288 ---- # Install the pseudo-library for information purposes. ! name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` ! instname="$dir/$name"i ! $show "$install_prog $instname $destdir/$name" ! $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. |
From: <fir...@us...> - 2003-11-11 10:25:56
|
Update of /cvsroot/mod-auth/mod_authn_pam In directory sc8-pr-cvs1:/tmp/cvs-serv24362 Modified Files: configure.in Log Message: fixed test for pam-libs/include Index: configure.in =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_pam/configure.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configure.in 11 Nov 2003 08:39:27 -0000 1.1 --- configure.in 11 Nov 2003 10:25:52 -0000 1.2 *************** *** 11,15 **** AC_MSG_CHECKING(for --with-pam) ! AC_ARG_WITH(pam, [ --with-pam=PATH Path to dbi], [ if test -e "$withval/include/security/pam_appl.h" --- 11,15 ---- AC_MSG_CHECKING(for --with-pam) ! AC_ARG_WITH(pam, [ --with-pam=PATH Path to pam], [ if test -e "$withval/include/security/pam_appl.h" *************** *** 26,30 **** AC_MSG_CHECKING(for --with-pam-include) ! AC_ARG_WITH(dbi-include, [ --with-pam-include=PATH Path to dbi headers], [ if test -e "$withval/security/pam_appl.h" --- 26,30 ---- AC_MSG_CHECKING(for --with-pam-include) ! AC_ARG_WITH(pam-include, [ --with-pam-include=PATH Path to pam headers], [ if test -e "$withval/security/pam_appl.h" *************** *** 40,44 **** AC_MSG_CHECKING(for --with-pam-libs) ! AC_ARG_WITH(dbi-libs, [ --with-pam-libs=PATH Path to dbi libs], [ if test -e "$withval/libpam.so" --- 40,44 ---- AC_MSG_CHECKING(for --with-pam-libs) ! AC_ARG_WITH(pam-libs, [ --with-pam-libs=PATH Path to pam libs], [ if test -e "$withval/libpam.so" |
From: <fir...@us...> - 2003-11-11 09:16:20
|
Update of /cvsroot/mod-auth/mod_authn_pam/src In directory sc8-pr-cvs1:/tmp/cvs-serv13173/src Modified Files: mod_authn_pam.c Log Message: added more PAM checking. still don't work :-/ Index: mod_authn_pam.c =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_pam/src/mod_authn_pam.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mod_authn_pam.c 11 Nov 2003 08:53:07 -0000 1.2 --- mod_authn_pam.c 11 Nov 2003 09:16:17 -0000 1.3 *************** *** 164,169 **** for (i = 0; i < num_msg; i++) { /* initialize to safe values */ ! // response[i].resp_retcode = 0; ! // response[i].resp = 0; /* select response based on requested output style */ --- 164,169 ---- for (i = 0; i < num_msg; i++) { /* initialize to safe values */ ! response[i].resp_retcode = 0; ! response[i].resp = 0; /* select response based on requested output style */ *************** *** 183,186 **** --- 183,191 ---- response[i].resp_retcode = PAM_SUCCESS; break; + case PAM_ERROR_MSG: + case PAM_TEXT_INFO: + response[i].resp = strdup(""); + response[i].resp_retcode = PAM_SUCCESS; + break; default: if (response) *************** *** 245,249 **** pam_end(pamh, PAM_SUCCESS); ! // XXX: I don't like defaulting to GRANTED. I would like to reorganize the logic above sometime -chip return AUTH_GRANTED; } --- 250,254 ---- pam_end(pamh, PAM_SUCCESS); ! // XXX: I don't like defaulting to AUTH_GRANTED. I would like to reorganize the logic above sometime -chip return AUTH_GRANTED; } |
From: <fir...@us...> - 2003-11-11 08:59:54
|
Update of /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_pam In directory sc8-pr-cvs1:/tmp/cvs-serv10136/mod_auth_webspace/htdocs/docs/mod_authn_pam Added Files: index.xml index.xml.meta Log Message: adding docs for authn_pam and fixed a typo in authn_pop3 docs --- NEW FILE: index.xml --- <?xml version="1.0"?> <!DOCTYPE modulesynopsis SYSTEM "../../style/modulesynopsis.dtd"> <?xml-stylesheet type="text/xsl" href="../../style/manual.en.xsl"?> <modulesynopsis metafile="index.xml.meta"> <name>mod_authn_pam</name> <description>User authentication using PAM</description> <status>External</status> <sourcefile>mod_authn_pam.c</sourcefile> <identifier>authn_pam</identifier> <compatibility>Apache 2.1 or greater</compatibility> <summary> <p> The module <code>mod_authn_pam</code> provides Authentication against a PAM framework using cleartext passwords. </p> </summary> <section id="compilation"> <title>Compilation</title> <p> <code>mod_authn_pam</code> uses the "<code>configure/make/make install</code>" mechanism common to many Open Source programs. Most of the dirty work is handled by either configure or Apache's apxs utility. If you have built apache modules before, there shouldn't be any surprises for you. </p> <p> Before you can begin compiling <code>mod_authn_pam</code>, you will need a working installation of Apache 2.1-dev (any earlier version, including Apache 2.0.x will NOT work). </p> <p> The interesting options you can pass to configure are: <ul> <li><code>--with-apxs=/path/to/apache/dir/bin/apxs</code> <p> This option is used to specify the location of the apxs utility that was installed as part of apache. Specify the location of the binary, not the directory it is located in. </p> </li> <li><code>--with-pam=/path/to/libpam</code> <p> </p> </li> <li><code>--with-pam-includes=/path/to/libpam/includes</code> <p> </p> </li> <li><code>--with-pam-libs=/path/to/libpam/lib</code> <p> </p> </li> </ul> </p> <p> Call configure with your site-specific values and then "make" and "make install" as usual. The module will be installed in the module directory of your Apache installation. </p> </section> <section id="integration"> <title>Integration into Apache</title> <p>Again <code>mod_authn_pam</code> behave like your average next-door Apache module. Just add<br /><br /> <code>LoadModule authn_pam_module modules/mod_authn_pam.so</code><br /><br /> to your <code>httpd.conf</code> as usual and restart Apache. </p> </section> <section id="basic"> <title>Basic configuration of mod_authn_pam</title> <p><b>Draft...</b></p> <p> <example> <title>Example Config</title> <pre> <Location /secure-area> AuthType Basic AuthName "basic authn_pop3 testing area" AuthBasicProvider pam Require valid-user </Location> </pre> </example> </p> </section> <directivesynopsis> <name>AuthnPAMFailDelay</name> <description>Time to delay on failed authentication</description> <syntax>AuthnPAMFailDelay <var>time</var></syntax> <default>none</default> <contextlist> <context>.htaccess</context> </contextlist> <usage> <p>Requires Support from the Operating System PAM Lib. </p> </usage> </directivesynopsis> </modulesynopsis> --- NEW FILE: index.xml.meta --- <?xml version="1.0" encoding="UTF-8" ?> <metafile> <basename>mod_authn_pam</basename> <path>../</path> <relpath>../../</relpath> <variants> <variant>en</variant> </variants> </metafile> |
From: <fir...@us...> - 2003-11-11 08:59:54
|
Update of /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_pop3 In directory sc8-pr-cvs1:/tmp/cvs-serv10136/mod_auth_webspace/htdocs/docs/mod_authn_pop3 Modified Files: index.xml Log Message: adding docs for authn_pam and fixed a typo in authn_pop3 docs Index: index.xml =================================================================== RCS file: /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_pop3/index.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.xml 11 Nov 2003 06:16:48 -0000 1.2 --- index.xml 11 Nov 2003 08:59:51 -0000 1.3 *************** *** 56,62 **** <section id="integration"> <title>Integration into Apache</title> ! <p>Again <code>mod_authn_dbi</code> behave like your average next-door Apache module. Just add<br /><br /> ! <code>LoadModule authn_dbi_module modules/mod_authn_dbi.so</code><br /><br /> to your <code>httpd.conf</code> as usual and restart Apache. --- 56,62 ---- <section id="integration"> <title>Integration into Apache</title> ! <p>Again <code>mod_authn_pop3</code> behave like your average next-door Apache module. Just add<br /><br /> ! <code>LoadModule authn_pop3_module modules/mod_authn_pop3.so</code><br /><br /> to your <code>httpd.conf</code> as usual and restart Apache. |
From: <fir...@us...> - 2003-11-11 08:53:10
|
Update of /cvsroot/mod-auth/mod_authn_pam/src In directory sc8-pr-cvs1:/tmp/cvs-serv8962/src Modified Files: mod_authn_pam.c Log Message: add respcode stuff. Still doesn't work in FreeBSD. Index: mod_authn_pam.c =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_pam/src/mod_authn_pam.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mod_authn_pam.c 11 Nov 2003 08:39:27 -0000 1.1 --- mod_authn_pam.c 11 Nov 2003 08:53:07 -0000 1.2 *************** *** 62,67 **** #include <security/pam_appl.h> - /* change this to 0 on RedHat 4.x */ - #define PAM_STRE_NEEDS_PAMH 1 #define VERSION "2.0-1.1" --- 62,65 ---- *************** *** 69,73 **** static const char ! *pam_servicename = "sshd", *valid_user = "valid-user"; --- 67,71 ---- static const char ! *pam_servicename = "httpd", *valid_user = "valid-user"; *************** *** 87,99 **** #endif - /* - * the pam_strerror function has different parameters in early PAM - * versions - */ - #ifndef PAM_STRE_NEEDS_PAMH - #define compat_pam_strerror(pamh, res) pam_strerror(res) - #else #define compat_pam_strerror(pamh, res) pam_strerror(pamh, res) - #endif /* --- 85,89 ---- *************** *** 174,188 **** for (i = 0; i < num_msg; i++) { /* initialize to safe values */ ! response[i].resp_retcode = 0; ! response[i].resp = 0; /* select response based on requested output style */ switch (msg[i]->msg_style) { case PAM_PROMPT_ECHO_ON: /* on memory allocation failure, auth fails */ response[i].resp = strdup(userinfo->name); break; case PAM_PROMPT_ECHO_OFF: response[i].resp = strdup(userinfo->pw); break; default: --- 164,185 ---- for (i = 0; i < num_msg; i++) { /* initialize to safe values */ ! // response[i].resp_retcode = 0; ! // response[i].resp = 0; /* select response based on requested output style */ switch (msg[i]->msg_style) { + + // XXXX:(SECURITY) + // This whole section needs better error checking + // See pure-ftpd-1.0.16c/src/log_pam.c:PAM_conv for a better example + case PAM_PROMPT_ECHO_ON: /* on memory allocation failure, auth fails */ response[i].resp = strdup(userinfo->name); + response[i].resp_retcode = PAM_SUCCESS; break; case PAM_PROMPT_ECHO_OFF: response[i].resp = strdup(userinfo->pw); + response[i].resp_retcode = PAM_SUCCESS; break; default: |
From: <fir...@us...> - 2003-11-11 08:41:55
|
Update of /cvsroot/mod-auth/mod_authn_pam In directory sc8-pr-cvs1:/tmp/cvs-serv6769 Added Files: autogen.sh Log Message: missed a few files on the last commit. --- NEW FILE: autogen.sh --- #!/bin/sh # autogen.sh - generates configure using the autotools # $Id: autogen.sh,v 1.1 2003/11/11 08:41:51 firechipmunk Exp $ #libtoolize --force --copy libtoolize14 --force --copy #aclocal autoheader automake --add-missing echo echo "Using `autoconf --version`, if you have problems" echo "while building then edit autogen.sh and rerun it..." echo #autoconf ## autoconf 2.53 will not work, at least on FreeBSD. Change the following ## line appropriately to call autoconf 2.13 instead. This one works for ## FreeBSD 4.7: autoconf213 |
From: <fir...@us...> - 2003-11-11 08:41:55
|
Update of /cvsroot/mod-auth/mod_authn_pam/src In directory sc8-pr-cvs1:/tmp/cvs-serv6769/src Added Files: Makefile.am Log Message: missed a few files on the last commit. --- NEW FILE: Makefile.am --- CLEANFILES = .libs/libmod_authn_pam *~ libmod_authn_pam_la_SOURCES = mod_authn_pam.c libmod_authn_pam_la_CFLAGS = -I$(PAM_INCLUDES) libmod_authn_pam_la_LDFLAGS = -L$(PAM_LIB) -lpam lib_LTLIBRARIES = libmod_authn_pam.la make_so: @if test ! -L mod_authn_pam.so ; then ln -s .libs/libmod_authn_pam.so mod_authn_pam.so ; fi install: $(INSTALL) -m 644 .libs/libmod_authn_pam.so $(LIBEXECDIR)/mod_authn_pam.so @echo "" @echo "" @echo "***********************************************" @echo "" @echo " Please read the documentation at " @echo " http://mod-auth.sourceforge.net/docs/ for " @echo " details on configuration of this module " @echo "" @echo "***********************************************" @echo "" |
From: <fir...@us...> - 2003-11-11 08:39:31
|
Update of /cvsroot/mod-auth/mod_authn_pam In directory sc8-pr-cvs1:/tmp/cvs-serv6305 Added Files: AUTHORS COPYING ChangeLog INSTALL Makefile.am NEWS README aclocal.m4 configure.in depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs Log Message: adding authn_pam. I am having problems with this on FreeBSD 5.x I will try it with a Linux box in a couple days. --- NEW FILE: AUTHORS --- Paul Querna --- NEW FILE: COPYING --- The Apache Software License, Version 1.1 Copyright (c) 2000 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact ap...@ap.... 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================== This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. Portions of this software are based upon public domain software originally written at the National Center for Supercomputing Applications, University of Illinois, Urbana-Champaign. --- NEW FILE: ChangeLog --- --- NEW FILE: INSTALL --- Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. --- NEW FILE: Makefile.am --- EXTRA_DIST = SUBDIRS = src --- NEW FILE: NEWS --- --- NEW FILE: README --- --- NEW FILE: aclocal.m4 --- # aclocal.m4 generated automatically by aclocal 1.5 # Copyright 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # Add --enable-maintainer-mode option to configure. # From Jim Meyering # serial 1 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) # serial 3 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. # # FIXME: Once using 2.50, use this: # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [errprint(__file__:__line__: [$0: invalid condition: $1 ])dnl m4exit(1)])dnl ifelse([$1], [FALSE], [errprint(__file__:__line__: [$0: invalid condition: $1 ])dnl m4exit(1)])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi]) # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 5 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # We require 2.13 because we rely on SHELL being computed by configure. AC_PREREQ([2.13]) # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) # ----------------------------------------------------------- # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. # The purpose of this macro is to provide the user with a means to # check macros which are provided without letting her know how the # information is coded. # If this macro is not defined by Autoconf, define it here. ifdef([AC_PROVIDE_IFELSE], [], [define([AC_PROVIDE_IFELSE], [ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) # ---------------------------------------------- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) fi # Define the identity of the package. PACKAGE=$1 AC_SUBST(PACKAGE)dnl VERSION=$2 AC_SUBST(VERSION)dnl ifelse([$3],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. ifdef([m4_pattern_allow], [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl # Autoconf 2.50 always computes EXEEXT. However we need to be # compatible with 2.13, for now. So we always define EXEEXT, but we # don't compute it. AC_SUBST(EXEEXT) # Similar for OBJEXT -- only we only use OBJEXT if the user actually # requests that it be used. This is a bit dumb. : ${OBJEXT=o} AC_SUBST(OBJEXT) # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_DEP_TRACK])dnl AC_REQUIRE([AM_SET_DEPDIR])dnl AC_PROVIDE_IFELSE([AC_PROG_][CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_][CC], defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_][CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_][CXX], defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) # # Check to make sure that the build environment is sane. # # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # serial 2 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= am_backtick='`' AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) fi ]) # AM_AUX_DIR_EXPAND # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # serial 4 -*- Autoconf -*- # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # --------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX" or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_$1_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" AC_SUBST([$1DEPMODE]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null AC_SUBST(DEPDIR) ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) pushdef([subst], defn([AC_SUBST])) subst(AMDEPBACKSLASH) popdef([subst]) ]) # Generate code to set up dependency tracking. # This macro should only be invoked once -- use via AC_REQUIRE. # Usage: # AM_OUTPUT_DEPENDENCY_COMMANDS # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ AC_OUTPUT_COMMANDS([ test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do case "$mf" in Makefile) dirpart=.;; */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; *) continue;; esac grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`echo "$file" | sed -e 's|/[^/]*$||'` $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])]) # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include='#' am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote='"' _am_result=BSD fi fi AC_SUBST(am__include) AC_SUBST(am__quote) AC_MSG_RESULT($_am_result) rm -f confinc confmf ]) # Like AC_CONFIG_HEADER, but automatically create stamp file. # serial 3 # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. We must strip everything past the first ":", # and everything past the last "/". AC_PREREQ([2.12]) AC_DEFUN([AM_CONFIG_HEADER], [ifdef([AC_FOREACH],dnl [dnl init our file count if it isn't already m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) dnl prepare to store our destination file list for use in config.status AC_FOREACH([_AM_File], [$1], [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) dnl and add it to the list of files AC keeps track of, along dnl with our hook AC_CONFIG_HEADERS(_AM_File, dnl COMMANDS, [, INIT-CMDS] [# update the timestamp echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS m4_popdef([_AM_Dest])])],dnl [AC_CONFIG_HEADER([$1]) AC_OUTPUT_COMMANDS( ifelse(patsubst([$1], [[^ ]], []), [], [test -z "$CONFIG_HEADERS" || echo timestamp >dnl patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl [am_indx=1 for am_file in $1; do case " \$CONFIG_HEADERS " in *" \$am_file "*) am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` if test -n "\$am_dir"; then am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do am_tmpdir=\$am_tmpdir\$am_subdir/ if test ! -d \$am_tmpdir; then mkdir \$am_tmpdir fi done fi echo timestamp > "\$am_dir"stamp-h\$am_indx ;; esac am_indx=\`expr \$am_indx + 1\` done]) ])]) # AM_CONFIG_HEADER # _AM_DIRNAME(PATH) # ----------------- # Like AS_DIRNAME, only do it during macro expansion AC_DEFUN([_AM_DIRNAME], [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, m4_if(m4_regexp([$1], [^/.*]), -1, [.], m4_patsubst([$1], [^\(/\).*], [\1])), m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl ]) # _AM_DIRNAME # serial 40 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN(AC_LIBTOOL_SETUP, [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl case "$target" in NONE) lt_target="$host" ;; *) lt_target="$target" ;; esac # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_SHARED, [dnl define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_STATIC, [dnl define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case "$lt_target" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library, adds --enable-ltdl-convenience to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case "$enable_ltdl_convenience" in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library, and adds --enable-ltdl-install to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl --- NEW FILE: configure.in --- AC_INIT(src/mod_authn_pam.c) AM_MAINTAINER_MODE AM_INIT_AUTOMAKE(mod_authn_pam, 0.0.1) AM_CONFIG_HEADER(include/mod_authn_pam_config.h:config.in) AC_PROG_CC AC_PROG_CPP AC_PROG_LD AC_PROG_INSTALL AM_PROG_LIBTOOL AC_MSG_CHECKING(for --with-pam) AC_ARG_WITH(pam, [ --with-pam=PATH Path to dbi], [ if test -e "$withval/include/security/pam_appl.h" then PAM_INCLUDES=$withval/include PAM_LIB=$withval/lib AC_MSG_RESULT([found pam_appl.h]) else echo AC_MSG_ERROR([$withval/include/security/pam_appl.h not found ]) fi ], AC_MSG_RESULT(no)) AC_MSG_CHECKING(for --with-pam-include) AC_ARG_WITH(dbi-include, [ --with-pam-include=PATH Path to dbi headers], [ if test -e "$withval/security/pam_appl.h" then PAM_INCLUDES=$withval AC_MSG_RESULT([found pam_appl.h]) else echo AC_MSG_ERROR([$withval/security/pam_appl.h not found ]) fi ], AC_MSG_RESULT(no)) AC_MSG_CHECKING(for --with-pam-libs) AC_ARG_WITH(dbi-libs, [ --with-pam-libs=PATH Path to dbi libs], [ if test -e "$withval/libpam.so" then PAM_LIB=$withval AC_MSG_RESULT([found libpam.so]) else echo AC_MSG_ERROR([$withval/libpam.so not found ]) fi ], AC_MSG_RESULT(no)) if test -z "$PAM_LIB"; then AC_MSG_CHECKING(for pam-libs in /usr/lib) if test -e /usr/lib/libpam.so; then PAM_LIB=/usr/lib AC_MSG_RESULT([found libpam.so, we'll use this. Use --with-pam-libs to specify another.]) else AC_MSG_RESULT(no) fi fi if test -z "$PAM_INCLUDES"; then AC_MSG_CHECKING(for pam-include in /usr/include) if test -e /usr/include/security/pam_appl.h; then PAM_INCLUDES=/usr/include AC_MSG_RESULT([found security/pam_appl.h, we'll use this. Use --with-pam-include to specify another.]) else AC_MSG_RESULT(no) fi fi if test -z "$PAM_LIB"; then AC_MSG_CHECKING(for pam-libs in /usr/local/lib) if test -e /usr/local/lib/libpam.so; then PAM_LIB=/usr/local/lib AC_MSG_RESULT([found libpam.so, we'll use this. Use --with-pam-libs to specify another.]) else AC_MSG_ERROR([please set --with-pam-libs=PATH or --with-pam=PATH to your PAM install]) fi fi if test -z "$PAM_INCLUDES"; then AC_MSG_CHECKING(for pam-include in /usr/local/include) if test -e /usr/local/include/security/pam_appl.h; then PAM_INCLUDES=/usr/local/include AC_MSG_RESULT([found security/pam_appl.h, we'll use this. Use --with-pam-include to specify another.]) else AC_MSG_ERROR([please set --with-pam-include=PATH or --with-pam=PATH to your PAM install]) fi fi # check for --with-apxs AC_MSG_CHECKING(for --with-apxs) AC_ARG_WITH(apxs, [ --with-apxs=PATH Path to apxs], [ if test -x "$withval" then AC_MSG_RESULT([$withval executable, good]) APXS=$withval else echo AC_MSG_ERROR([$withval not found or not executable]) fi ], AC_MSG_RESULT(no)) # if no apxs found yet, check /usr/local/apache/sbin # since it's the default Apache location if test -z "$APXS"; then AC_MSG_CHECKING(for apxs in /usr/local/apache/sbin) if test -x /usr/local/apache/sbin/apxs; then APXS=/usr/local/apache/sbin/apxs AC_MSG_RESULT([found, we'll use this. Use --with-apxs to specify another.]) else AC_MSG_RESULT(no) fi fi if test -z "$APXS"; then AC_MSG_CHECKING(for apxs in /usr/local/apache2/bin) if test -x /usr/local/apache2/bin/apxs; then APXS=/usr/local/apache2/bin/apxs AC_MSG_RESULT([found, we'll use this. Use --with-apxs to specify another.]) else AC_MSG_RESULT(no) fi fi if test -z "$APXS"; then AC_MSG_CHECKING(for apxs in /usr/sbin) if test -x /usr/sbin/apxs; then APXS=/usr/sbin/apxs AC_MSG_RESULT([found, we'll use this. Use --with-apxs to specify another.]) else AC_MSG_RESULT(no) fi fi # last resort if test -z "$APXS"; then AC_MSG_CHECKING(for apxs in your PATH) AC_PATH_PROG(APXS, apxs) if test -n "$APXS"; then AC_MSG_RESULT([found $APXS, we'll use this. Use --with-apxs to specify another.]) fi fi if test -z "$APXS"; then AC_MSG_ERROR([**** apxs was not found, DSO compilation will not be available.]) fi # determine LIBEXEC AC_MSG_CHECKING(for Apache libexec directory) LIBEXECDIR=`${APXS} -q LIBEXECDIR` AC_MSG_RESULT($LIBEXECDIR) # determine INCLUDES AC_MSG_CHECKING([for Apache include directory]) AP_INCLUDES="-I`${APXS} -q INCLUDEDIR`" AC_MSG_RESULT($AP_INCLUDES) CFLAGS="$CFLAGS $AP_INCLUDES" AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test "x$PKG_CONFIG" = "xno"; then AC_MSG_ERROR([You need to install pkg-config]) fi PKG_PATH= AC_SUBST(LIBEXECDIR) AC_SUBST(AP_INCLUDES) AC_SUBST(PAM_INCLUDES) AC_SUBST(PAM_LIB) AC_SUBST(CFLAGS) AC_OUTPUT(Makefile src/Makefile) echo "---" echo "Configuration summary for mod_authn_pam" echo "" echo " * Apache modules directory = $LIBEXECDIR" echo " * PAM include directory = $PAM_INCLUDES" echo " * PAM lib directory = $PAM_LIB" echo "" echo "---" echo "****" echo " If you have problems with libtool try this:" echo " export SED=sed" echo "****" --- NEW FILE: depcomp --- #! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva <ol...@dc...>. if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; tru64) # The Tru64 AIX compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. tmpdepfile1="$object.d" tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` if test "$libtool" = yes; then "$@" -Wc,-MD else "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) # X makedepend ( shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tail +3 "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments ... [truncated message content] |
From: <fir...@us...> - 2003-11-11 08:39:30
|
Update of /cvsroot/mod-auth/mod_authn_pam/src In directory sc8-pr-cvs1:/tmp/cvs-serv6305/src Added Files: mod_authn_pam.c Log Message: adding authn_pam. I am having problems with this on FreeBSD 5.x I will try it with a Linux box in a couple days. --- NEW FILE: mod_authn_pam.c --- /* Copyright (c) 2000 Ingo Luetkebohle, All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CODE CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * $Id: mod_authn_pam.c,v 1.1 2003/11/11 08:39:27 firechipmunk Exp $ * * mod_authn_pam for apache 2.1 * * Based on: v 2.0-1.1 from 07. July 2002 for APACHE 2.0 * * mod_authn_pam: * basic authentication against pluggable authentication module lib * * Written by Ingo Luetkebohle, based upon mod_auth.c, with contributions * from Fredrik Ohrn (group performance), Dirk-Willem van Gulik (licensing * consultation) and Michael Johnson (example group implementation). * Ported to Apache 2.0 by Dirk-Willem van Gulik. * * Ported to Apache 2.1 by Paul Querna * */ #include <sys/types.h> #include <pwd.h> /* for getpwnam et.al. */ #include <grp.h> /* for getpwnam et.al. */ #include <unistd.h> #include "ap_config.h" #include "httpd.h" #include "http_config.h" #include "http_core.h" #include "http_log.h" #include "http_protocol.h" #include "http_request.h" #include "mod_auth.h" #include <security/pam_appl.h> /* change this to 0 on RedHat 4.x */ #define PAM_STRE_NEEDS_PAMH 1 #define VERSION "2.0-1.1" module authn_pam_module; static const char *pam_servicename = "sshd", *valid_user = "valid-user"; typedef struct { request_rec * r; char *name, *pw; } authn_pam_userinfo; /* * Solaris 2.6.x has a broken conversation function and needs this * as a global variable * I refused to pollute code for other platforms with this, * so all Solaris 2.6 specific stuff is if'd like the following */ #if SOLARIS2 == 260 authn_pam_userinfo *global_userinfo; #endif /* * the pam_strerror function has different parameters in early PAM * versions */ #ifndef PAM_STRE_NEEDS_PAMH #define compat_pam_strerror(pamh, res) pam_strerror(res) #else #define compat_pam_strerror(pamh, res) pam_strerror(pamh, res) #endif /* * configuration directive handling */ typedef struct { int fail_delay; /* fail delay in ms -- needs library support */ } authn_pam_dir_config; static int authn_pam_init( apr_pool_t * p, apr_pool_t * plog, apr_pool_t * ptemp, server_rec * s ) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "PAM: mod_authn_pam/" VERSION); return OK; } static void *create_authn_pam_dir_config(apr_pool_t * p, char *dummy) { authn_pam_dir_config *new = (authn_pam_dir_config *) apr_palloc(p, sizeof(authn_pam_dir_config)); new->fail_delay = 0; /* 0 ms */ return new; } static command_rec authn_pam_cmds[] = { AP_INIT_TAKE1("AuthnPAMFailDelay", ap_set_int_slot, (void *) APR_OFFSETOF(authn_pam_dir_config, fail_delay), OR_AUTHCFG, "number of micro seconds to wait after failed authentication " "attempt. (default is 0.)"), {NULL} }; /* * authn_pam_talker: supply authentication information to PAM when asked * * Assumptions: * A password is asked for by requesting input without echoing * A username is asked for by requesting input _with_ echoing * */ static int authn_pam_talker(int num_msg, const struct pam_message ** msg, struct pam_response ** resp, void *appdata_ptr) { unsigned short i = 0; authn_pam_userinfo *userinfo = (authn_pam_userinfo *) appdata_ptr; struct pam_response *response = 0; #if SOLARIS2 == 260 if (!userinfo) userinfo = global_userinfo; #endif /* parameter sanity checking */ if (!resp || !msg || !userinfo) return PAM_CONV_ERR; /* allocate memory to store response */ response = malloc(num_msg * sizeof(struct pam_response)); if (!response) return PAM_CONV_ERR; /* copy values */ for (i = 0; i < num_msg; i++) { /* initialize to safe values */ response[i].resp_retcode = 0; response[i].resp = 0; /* select response based on requested output style */ switch (msg[i]->msg_style) { case PAM_PROMPT_ECHO_ON: /* on memory allocation failure, auth fails */ response[i].resp = strdup(userinfo->name); break; case PAM_PROMPT_ECHO_OFF: response[i].resp = strdup(userinfo->pw); break; default: if (response) free(response); return PAM_CONV_ERR; } } /* everything okay, set PAM response values */ *resp = response; return PAM_SUCCESS; } static authn_status check_pam_pw(request_rec * r, const char *user, const char *password) { int res = 0; /* mod_authn_pam specific */ authn_pam_userinfo userinfo = {NULL, NULL}; authn_pam_dir_config *conf = (authn_pam_dir_config *) ap_get_module_config(r->per_dir_config, &authn_pam_module); /* PAM specific */ struct pam_conv conv_info = {&authn_pam_talker, (void *) &userinfo}; pam_handle_t *pamh = NULL; userinfo.r = r; userinfo.name = (char*)user; userinfo.pw = (char*)password; if ((res = pam_start(pam_servicename, userinfo.name, &conv_info, &pamh)) != PAM_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "PAM: Could not start pam service: %s", compat_pam_strerror(pamh, res)); return HTTP_INTERNAL_SERVER_ERROR; } #ifdef PAM_FAIL_DELAY pam_fail_delay(pamh, conf->fail_delay); #endif if ((res = pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK)) != PAM_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "PAM: user '%s' - not authenticated: (%d) %s", user, res, compat_pam_strerror(pamh, res)); pam_end(pamh, PAM_SUCCESS); return AUTH_DENIED; } if ((res = pam_acct_mgmt(pamh, PAM_DISALLOW_NULL_AUTHTOK)) != PAM_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "PAM: user '%s' - invalid account: %s", user, compat_pam_strerror(pamh, res)); pam_end(pamh, PAM_SUCCESS); return AUTH_DENIED; } pam_end(pamh, PAM_SUCCESS); // XXX: I don't like defaulting to GRANTED. I would like to reorganize the logic above sometime -chip return AUTH_GRANTED; } static authn_status get_pam_realm_hash(request_rec * r, const char *user, const char *realm, char **rethash) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "[mod_authn_pam.c] - Digest Authentication with authn_pam is not possible"); return AUTH_DENIED; } static const authn_provider authn_pam_provider = { &check_pam_pw, &get_pam_realm_hash }; static void pam_register_hooks(apr_pool_t * p) { ap_hook_post_config(authn_pam_init, NULL, NULL, APR_HOOK_MIDDLE); ap_register_provider(p, AUTHN_PROVIDER_GROUP, "pam", "0", &authn_pam_provider); } module AP_MODULE_DECLARE_DATA authn_pam_module = { STANDARD20_MODULE_STUFF, create_authn_pam_dir_config, /* dir config creater */ NULL, /* dir merger --- default is to override */ NULL, /* server config */ NULL, /* merge server config */ authn_pam_cmds, /* command table */ pam_register_hooks, /* register hooks */ }; |
From: <fir...@us...> - 2003-11-11 08:38:10
|
Update of /cvsroot/mod-auth/mod_authn_pam/include In directory sc8-pr-cvs1:/tmp/cvs-serv6278/include Log Message: Directory /cvsroot/mod-auth/mod_authn_pam/include added to the repository |
From: <fir...@us...> - 2003-11-11 06:16:51
|
Update of /cvsroot/mod-auth/mod_authn_pop3/src In directory sc8-pr-cvs1:/tmp/cvs-serv16544/mod_authn_pop3/src Modified Files: mod_authn_pop3.c Log Message: Add AuthnPOP3Timeout to authn_pop3 Index: mod_authn_pop3.c =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_pop3/src/mod_authn_pop3.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mod_authn_pop3.c 11 Nov 2003 04:02:04 -0000 1.3 --- mod_authn_pop3.c 11 Nov 2003 06:16:48 -0000 1.4 *************** *** 89,92 **** --- 89,93 ---- char *serverhostname; int port; + apr_interval_time_t timeout; } pop_auth_config_rec; *************** *** 97,100 **** --- 98,102 ---- conf->serverhostname = NULL; conf->port = 110; + conf->timeout = apr_time_from_sec(5); return conf; *************** *** 119,122 **** --- 121,133 ---- } + static const char *set_pop_timeout(cmd_parms * cmd, + void *dir_config, const char *arg) + { + pop_auth_config_rec *conf = dir_config; + + conf->timeout = apr_time_from_sec(atoi(arg)); + return NULL; + } + static const command_rec authn_pop3_cmds[] = { *************** *** 127,130 **** --- 138,144 ---- NULL, OR_AUTHCFG, "port for POP Server"), + AP_INIT_TAKE1("AuthnPOP3Timeout", set_pop_timeout, + NULL, + OR_AUTHCFG, "port for POP Server"), {NULL} }; *************** *** 269,276 **** &authn_pop3_module); - apr_interval_time_t timeout = apr_time_from_sec(2); - pop3_ret = pop_auth(r, ! user, password, conf->serverhostname, conf->port, timeout); if (pop3_ret != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, --- 283,288 ---- &authn_pop3_module); pop3_ret = pop_auth(r, ! user, password, conf->serverhostname, conf->port, conf->timeout); if (pop3_ret != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, |
From: <fir...@us...> - 2003-11-11 06:16:51
|
Update of /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_pop3 In directory sc8-pr-cvs1:/tmp/cvs-serv16544/mod_auth_webspace/htdocs/docs/mod_authn_pop3 Modified Files: index.xml Log Message: Add AuthnPOP3Timeout to authn_pop3 Index: index.xml =================================================================== RCS file: /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_pop3/index.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.xml 11 Nov 2003 04:17:38 -0000 1.1 --- index.xml 11 Nov 2003 06:16:48 -0000 1.2 *************** *** 76,79 **** --- 76,80 ---- AuthBasicProvider pop3 AuthnPOP3Hostname force-elite.com + AuthnPOP3Timeout 10 AuthnPOP3Port 110 Require valid-user *************** *** 101,106 **** <name>AuthnPOP3Port</name> <description>Sets the Port to use</description> ! <syntax>AuthnPOP3Hostname <var>port</var></syntax> <default>110</default> <contextlist> <context>.htaccess</context> --- 102,121 ---- <name>AuthnPOP3Port</name> <description>Sets the Port to use</description> ! <syntax>AuthnPOP3Port <var>port</var></syntax> <default>110</default> + <contextlist> + <context>.htaccess</context> + </contextlist> + <usage> + <p> + </p> + </usage> + </directivesynopsis> + + <directivesynopsis> + <name>AuthnPOP3Timeout</name> + <description>Sets the timeout for communication to the POP3 Server.</description> + <syntax>AuthnPOP3Timeout <var>seconds</var></syntax> + <default>5</default> <contextlist> <context>.htaccess</context> |
From: <fir...@us...> - 2003-11-11 04:34:41
|
Update of /cvsroot/mod-auth/mod_auth_webspace/htdocs In directory sc8-pr-cvs1:/tmp/cvs-serv1979 Modified Files: index.xml Log Message: remove downloads link for modules that don't have any downloads yet. Index: index.xml =================================================================== RCS file: /cvsroot/mod-auth/mod_auth_webspace/htdocs/index.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** index.xml 11 Nov 2003 04:19:08 -0000 1.9 --- index.xml 11 Nov 2003 04:34:38 -0000 1.10 *************** *** 54,58 **** [Status: <span style="color: red;">Broken</span>] [<a href="docs/mod_authn_mysql">docs</a>] ! [<a href="http://sourceforge.net/project/showfiles.php?group_id=93106">download</a>] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_mysql/">cvsweb</a>] </section> --- 54,58 ---- [Status: <span style="color: red;">Broken</span>] [<a href="docs/mod_authn_mysql">docs</a>] ! [no downloads] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_mysql/">cvsweb</a>] </section> *************** *** 61,65 **** [Status: <span style="color: red;">In Development</span>] [<a href="docs/mod_authn_pam">docs</a>] ! [<a href="http://sourceforge.net/project/showfiles.php?group_id=93106">download</a>] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_pam/">cvsweb</a>] </section> --- 61,65 ---- [Status: <span style="color: red;">In Development</span>] [<a href="docs/mod_authn_pam">docs</a>] ! [no downloads] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_pam/">cvsweb</a>] </section> *************** *** 68,72 **** [Status: <span style="color: red;">In Development</span>] [<a href="docs/mod_authn_pgsql">docs</a>] ! [<a href="http://sourceforge.net/project/showfiles.php?group_id=93106">download</a>] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_pgsql/">cvsweb</a>] </section> --- 68,72 ---- [Status: <span style="color: red;">In Development</span>] [<a href="docs/mod_authn_pgsql">docs</a>] ! [no downloads] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_pgsql/">cvsweb</a>] </section> *************** *** 75,79 **** [Status: <span style="color: blue;">Working</span>] [<a href="docs/mod_authn_pop3">docs</a>] ! [<a href="http://sourceforge.net/project/showfiles.php?group_id=93106">download</a>] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_pop3/">cvsweb</a>] </section> --- 75,79 ---- [Status: <span style="color: blue;">Working</span>] [<a href="docs/mod_authn_pop3">docs</a>] ! [no downloads] [<a href="http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_pop3/">cvsweb</a>] </section> |
From: <fir...@us...> - 2003-11-11 04:19:10
|
Update of /cvsroot/mod-auth/mod_auth_webspace/htdocs In directory sc8-pr-cvs1:/tmp/cvs-serv32099/htdocs Modified Files: index.xml Log Message: updated status for authn_dbi Index: index.xml =================================================================== RCS file: /cvsroot/mod-auth/mod_auth_webspace/htdocs/index.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** index.xml 11 Nov 2003 00:54:11 -0000 1.8 --- index.xml 11 Nov 2003 04:19:08 -0000 1.9 *************** *** 73,77 **** <section id="mod_authn_pop3"> <title>mod_authn_pop3</title> Authenticate against POP3 servers.<br/> ! [Status: <span style="color: red;">In Development</span>] [<a href="docs/mod_authn_pop3">docs</a>] [<a href="http://sourceforge.net/project/showfiles.php?group_id=93106">download</a>] --- 73,77 ---- <section id="mod_authn_pop3"> <title>mod_authn_pop3</title> Authenticate against POP3 servers.<br/> ! [Status: <span style="color: blue;">Working</span>] [<a href="docs/mod_authn_pop3">docs</a>] [<a href="http://sourceforge.net/project/showfiles.php?group_id=93106">download</a>] |
From: <fir...@us...> - 2003-11-11 04:17:41
|
Update of /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_pop3 In directory sc8-pr-cvs1:/tmp/cvs-serv31898/docs/mod_authn_pop3 Added Files: index.xml index.xml.meta Log Message: add initial docs for authn_pop3 fixed .meta for authn_dbi --- NEW FILE: index.xml --- <?xml version="1.0"?> <!DOCTYPE modulesynopsis SYSTEM "../../style/modulesynopsis.dtd"> <?xml-stylesheet type="text/xsl" href="../../style/manual.en.xsl"?> <modulesynopsis metafile="index.xml.meta"> <name>mod_authn_pop3</name> <description>User authentication using POP3</description> <status>External</status> <sourcefile>mod_authn_pop3.c</sourcefile> <identifier>authn_pop3</identifier> <compatibility>Apache 2.1 or greater</compatibility> <summary> <p> The module <code>mod_authn_pop3</code> provides Authentication against a POP3 useing cleartext passwords. </p> </summary> <section id="compilation"> <title>Compilation</title> <p> <code>mod_authn_pop3</code> uses the "<code>configure/make/make install</code>" mechanism common to many Open Source programs. Most of the dirty work is handled by either configure or Apache's apxs utility. If you have built apache modules before, there shouldn't be any surprises for you. </p> <p> Before you can begin compiling mod_authn_pop3, you will need a working installation of Apache 2.1-dev (any earlier version, including Apache 2.0.x will NOT work). </p> <p> The interesting options you can pass to configure are: <ul> <li><code>--with-apxs=/path/to/apache/dir/bin/apxs</code> <p> This option is used to specify the location of the apxs utility that was installed as part of apache. Specify the location of the binary, not the directory it is located in. </p> </li> </ul> </p> <p> Call configure with your site-specific values and then "make" and "make install" as usual. The module will be installed in the module directory of your Apache installation. </p> </section> <section id="integration"> <title>Integration into Apache</title> <p>Again <code>mod_authn_dbi</code> behave like your average next-door Apache module. Just add<br /><br /> <code>LoadModule authn_dbi_module modules/mod_authn_dbi.so</code><br /><br /> to your <code>httpd.conf</code> as usual and restart Apache. </p> </section> <section id="basic"> <title>Basic configuration of mod_authn_pop3</title> <p><b>Draft...</b></p> <p> <example> <title>Example Config</title> <pre> <Location /secure-area> AuthType Basic AuthName "basic authn_pop3 testing area" AuthBasicProvider pop3 AuthnPOP3Hostname force-elite.com AuthnPOP3Port 110 Require valid-user </Location> </pre> </example> </p> </section> <directivesynopsis> <name>AuthnPOP3Hostname</name> <description>Sets the Server to use</description> <syntax>AuthnPOP3Hostname <var>hostname</var></syntax> <default>none</default> <contextlist> <context>.htaccess</context> </contextlist> <usage> <p> </p> </usage> </directivesynopsis> <directivesynopsis> <name>AuthnPOP3Port</name> <description>Sets the Port to use</description> <syntax>AuthnPOP3Hostname <var>port</var></syntax> <default>110</default> <contextlist> <context>.htaccess</context> </contextlist> <usage> <p> </p> </usage> </directivesynopsis> </modulesynopsis> --- NEW FILE: index.xml.meta --- <?xml version="1.0" encoding="UTF-8" ?> <metafile> <basename>mod_authn_pop3</basename> <path>../</path> <relpath>../../</relpath> <variants> <variant>en</variant> </variants> </metafile> |
From: <fir...@us...> - 2003-11-11 04:17:41
|
Update of /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_dbi In directory sc8-pr-cvs1:/tmp/cvs-serv31898/docs/mod_authn_dbi Modified Files: index.xml.meta Log Message: add initial docs for authn_pop3 fixed .meta for authn_dbi Index: index.xml.meta =================================================================== RCS file: /cvsroot/mod-auth/mod_auth_webspace/htdocs/docs/mod_authn_dbi/index.xml.meta,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.xml.meta 4 Nov 2003 03:50:03 -0000 1.2 --- index.xml.meta 11 Nov 2003 04:17:38 -0000 1.3 *************** *** 2,6 **** <metafile> ! <basename>mod_authn_file</basename> <path>../</path> <relpath>../../</relpath> --- 2,6 ---- <metafile> ! <basename>mod_authn_dbi</basename> <path>../</path> <relpath>../../</relpath> |
From: <fir...@us...> - 2003-11-11 04:02:07
|
Update of /cvsroot/mod-auth/mod_authn_pop3/src In directory sc8-pr-cvs1:/tmp/cvs-serv29329/src Modified Files: mod_authn_pop3.c Log Message: indented code properly, and made it all work. Index: mod_authn_pop3.c =================================================================== RCS file: /cvsroot/mod-auth/mod_authn_pop3/src/mod_authn_pop3.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mod_authn_pop3.c 11 Nov 2003 03:26:48 -0000 1.2 --- mod_authn_pop3.c 11 Nov 2003 04:02:04 -0000 1.3 *************** *** 82,86 **** #include "http_log.h" #include "http_protocol.h" ! #include "http_request.h" /* for ap_hook_(check_user_id | auth_checker)*/ #include "mod_auth.h" --- 82,86 ---- #include "http_log.h" #include "http_protocol.h" ! #include "http_request.h" /* for ap_hook_(check_user_id | auth_checker) */ #include "mod_auth.h" *************** *** 91,95 **** } pop_auth_config_rec; ! static void *create_authn_pop3_dir_config(apr_pool_t *p, char *d) { pop_auth_config_rec *conf = apr_palloc(p, sizeof(*conf)); --- 91,95 ---- } pop_auth_config_rec; ! static void *create_authn_pop3_dir_config(apr_pool_t * p, char *d) { pop_auth_config_rec *conf = apr_palloc(p, sizeof(*conf)); *************** *** 101,107 **** } ! static const char *set_pop_hostname(cmd_parms *cmd, ! void *dir_config, ! const char *arg) { pop_auth_config_rec *conf = dir_config; --- 101,106 ---- } ! static const char *set_pop_hostname(cmd_parms * cmd, ! void *dir_config, const char *arg) { pop_auth_config_rec *conf = dir_config; *************** *** 111,117 **** } ! static const char *set_pop_port(cmd_parms *cmd, ! void *dir_config, ! const char *arg) { pop_auth_config_rec *conf = dir_config; --- 110,115 ---- } ! static const char *set_pop_port(cmd_parms * cmd, ! void *dir_config, const char *arg) { pop_auth_config_rec *conf = dir_config; *************** *** 122,142 **** ! static const command_rec authn_pop3_cmds[] = ! { AP_INIT_TAKE1("AuthnPOP3Hostname", set_pop_hostname, ! NULL, ! OR_AUTHCFG, "hostname for POP Server"), AP_INIT_TAKE1("AuthnPOP3Port", set_pop_port, ! NULL, ! OR_AUTHCFG, "port for POP Server"), {NULL} }; #define RECVLEN 200 ! static apr_status_t send_pop_command( request_rec *r, ! apr_socket_t *sock, ! const char* command, ! char*response, ! apr_size_t *responselen) { apr_status_t rv; --- 120,137 ---- ! static const command_rec authn_pop3_cmds[] = { AP_INIT_TAKE1("AuthnPOP3Hostname", set_pop_hostname, ! NULL, ! OR_AUTHCFG, "hostname for POP Server"), AP_INIT_TAKE1("AuthnPOP3Port", set_pop_port, ! NULL, ! OR_AUTHCFG, "port for POP Server"), {NULL} }; #define RECVLEN 200 ! static apr_status_t send_pop_command(request_rec * r, ! apr_socket_t * sock, ! const char *command, char *response, apr_size_t * responselen) { apr_status_t rv; *************** *** 146,173 **** sendlen = strlen(command); ! rv = apr_socket_send( sock, command, &sendlen); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_socket_send"); return rv; ! } ! ! memset( response, 0, *responselen); ! rv = apr_socket_recv( sock, response, responselen); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_socket_recv"); return rv; ! } return rv; } ! static apr_status_t pop_auth( ! request_rec *r, ! const char *user, ! const char *pass, ! const char *hostname, ! int port, ! apr_interval_time_t timeout) { apr_status_t rv; --- 141,167 ---- sendlen = strlen(command); ! rv = apr_socket_send(sock, command, &sendlen); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "apr_socket_send"); return rv; ! } ! //ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv , r, "sending: %s", command); ! memset(response, 0, *responselen); ! rv = apr_socket_recv(sock, response, responselen); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "apr_socket_recv"); return rv; ! } ! //ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv , r, "got: %s", response); ! return rv; } ! static apr_status_t pop_auth(request_rec * r, ! const char *user, ! const char *pass, ! const char *hostname, int port, apr_interval_time_t timeout) { apr_status_t rv; *************** *** 176,255 **** apr_pool_t *pool; ! char *line=NULL; ! char *recv=NULL; ! apr_size_t recvlen; pool = r->pool; ! recv = apr_palloc( pool, RECVLEN); ! recvlen = RECVLEN; ! rv = apr_sockaddr_info_get(&sockaddr, hostname, APR_UNSPEC, port, 0, pool ); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_sockaddr_info_get"); return rv; ! } ! if (apr_socket_create(&sock, sockaddr->family, SOCK_STREAM, 0, pool) != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_socket_create"); return rv; } rv = apr_socket_timeout_set(sock, timeout); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_socket_timeout_set"); return rv; ! } ! rv = apr_socket_connect( sock, sockaddr); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_socket_connect"); return rv; ! } ! rv = apr_socket_recv( sock, recv, &recvlen); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_socket_recv handshake"); apr_socket_close(sock); return rv; ! } ! if ( *recv != '+' ) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0 , r, "invalid handshake %s", recv); apr_socket_close(sock); return APR_EGENERAL; } ! line = apr_psprintf(pool, "USER %s\r\n", user ); ! rv = send_pop_command(r, sock, line, recv, &recvlen ); ! if (rv != APR_SUCCESS) { apr_socket_close(sock); return rv; ! } ! if ( *recv != '+' ) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "invalid response to USER command %s",recv); apr_socket_close(sock); return APR_EGENERAL; } ! recvlen = RECVLEN; ! line = apr_psprintf(pool, "PASS %s\r\n", pass ); ! rv = send_pop_command(r, sock, line, recv, &recvlen ); ! if (rv != APR_SUCCESS) { apr_socket_close(sock); return rv; } ! if ( *recv != '+' ) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0 , r, "invalid password %s",recv); apr_socket_close(sock); return APR_EGENERAL; } ! recvlen = RECVLEN; ! line = apr_psprintf(pool, "QUIT\r\n" ); ! rv = send_pop_command(r, sock, line, recv, &recvlen ); ! rv = apr_socket_close( sock ); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv , r, "apr_socket_close"); return rv; ! } return APR_SUCCESS; --- 170,259 ---- apr_pool_t *pool; ! char *line = NULL; ! char *recv = NULL; ! apr_size_t recvlen; ! pool = r->pool; ! if (user == NULL) { ! return APR_BADARG; ! } ! recv = apr_palloc(pool, RECVLEN); ! recvlen = RECVLEN; ! ! rv = apr_sockaddr_info_get(&sockaddr, hostname, APR_UNSPEC, port, 0, pool); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "apr_sockaddr_info_get"); return rv; ! } ! if (apr_socket_create(&sock, sockaddr->family, SOCK_STREAM, 0, ! pool) != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "apr_socket_create"); return rv; } rv = apr_socket_timeout_set(sock, timeout); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "apr_socket_timeout_set"); return rv; ! } ! rv = apr_socket_connect(sock, sockaddr); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "apr_socket_connect"); return rv; ! } ! rv = apr_socket_recv(sock, recv, &recvlen); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ! "apr_socket_recv handshake"); apr_socket_close(sock); return rv; ! } ! if (*recv != '+') { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "invalid handshake %s", ! recv); apr_socket_close(sock); return APR_EGENERAL; } ! line = apr_psprintf(pool, "USER %s\r\n", user); ! rv = send_pop_command(r, sock, line, recv, &recvlen); ! if (rv != APR_SUCCESS) { apr_socket_close(sock); return rv; ! } ! if (*recv != '+') { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ! "invalid response to USER command %s", recv); apr_socket_close(sock); return APR_EGENERAL; } ! recvlen = RECVLEN; ! line = apr_psprintf(pool, "PASS %s\r\n", pass); ! rv = send_pop_command(r, sock, line, recv, &recvlen); ! if (rv != APR_SUCCESS) { apr_socket_close(sock); return rv; } ! if (*recv != '+') { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "invalid password %s", ! recv); apr_socket_close(sock); return APR_EGENERAL; } ! recvlen = RECVLEN; ! line = apr_psprintf(pool, "QUIT\r\n"); ! rv = send_pop_command(r, sock, line, recv, &recvlen); ! rv = apr_socket_close(sock); ! if (rv != APR_SUCCESS) { ! ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "apr_socket_close"); return rv; ! } return APR_SUCCESS; *************** *** 259,281 **** static authn_status check_pop3_pw(request_rec * r, const char *user, ! const char *password) { apr_status_t pop3_ret; pop_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, ! &authn_pop3_module); ! int timeout = 20; ! pop3_ret = pop_auth( r, ! user, ! password, ! conf->serverhostname, ! conf->port, ! timeout); ! if (pop3_ret != APR_SUCCESS ) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "POP user %s authentication failure for \"%s\": " ! "Password Mismatch", ! r->user, r->uri ); } else { --- 263,280 ---- static authn_status check_pop3_pw(request_rec * r, const char *user, ! const char *password) { apr_status_t pop3_ret; pop_auth_config_rec *conf = ap_get_module_config(r->per_dir_config, ! &authn_pop3_module); ! apr_interval_time_t timeout = apr_time_from_sec(2); ! pop3_ret = pop_auth(r, ! user, password, conf->serverhostname, conf->port, timeout); ! if (pop3_ret != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "POP user %s authentication failure for \"%s\": " ! "Password Mismatch", r->user, r->uri); } else { *************** *** 288,295 **** static authn_status get_pop3_realm_hash(request_rec * r, const char *user, ! const char *realm, char **rethash) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "[mod_authn_pop3.c] - Digest Authentication with authn_pop3 is not possible"); return AUTH_DENIED; --- 287,294 ---- static authn_status get_pop3_realm_hash(request_rec * r, const char *user, ! const char *realm, char **rethash) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ! "[mod_authn_pop3.c] - Digest Authentication with authn_pop3 is not possible"); return AUTH_DENIED; *************** *** 301,320 **** }; ! static void register_hooks(apr_pool_t *p) { ap_register_provider(p, AUTHN_PROVIDER_GROUP, "pop3", "0", ! &authn_pop3_provider); } ! module AP_MODULE_DECLARE_DATA authn_pop3_module = ! { STANDARD20_MODULE_STUFF, ! create_authn_pop3_dir_config, /* dir config creater */ NULL, /* dir merger --- default is to override */ NULL, /* server config */ NULL, /* merge server config */ ! authn_pop3_cmds, /* command apr_table_t */ register_hooks /* register hooks */ }; - --- 300,317 ---- }; ! static void register_hooks(apr_pool_t * p) { ap_register_provider(p, AUTHN_PROVIDER_GROUP, "pop3", "0", ! &authn_pop3_provider); } ! module AP_MODULE_DECLARE_DATA authn_pop3_module = { STANDARD20_MODULE_STUFF, ! create_authn_pop3_dir_config, /* dir config creater */ NULL, /* dir merger --- default is to override */ NULL, /* server config */ NULL, /* merge server config */ ! authn_pop3_cmds, /* command apr_table_t */ register_hooks /* register hooks */ }; |
Update of /cvsroot/mod-auth/mod_authn_pop3 In directory sc8-pr-cvs1:/tmp/cvs-serv23734 Added Files: aclocal.m4 autogen.sh depcomp install-sh libtool ltconfig ltmain.sh missing Log Message: converted pop3 auth to authn_pop3. should "work" for 2.1 authentication now. I also added a couple autoconf things that are the *correct* versions. I hate you autoconf. I hate you so very very much. --- NEW FILE: aclocal.m4 --- # aclocal.m4 generated automatically by aclocal 1.5 # Copyright 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # Add --enable-maintainer-mode option to configure. # From Jim Meyering # serial 1 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) # serial 3 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. # # FIXME: Once using 2.50, use this: # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [errprint(__file__:__line__: [$0: invalid condition: $1 ])dnl m4exit(1)])dnl ifelse([$1], [FALSE], [errprint(__file__:__line__: [$0: invalid condition: $1 ])dnl m4exit(1)])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi]) # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 5 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # We require 2.13 because we rely on SHELL being computed by configure. AC_PREREQ([2.13]) # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) # ----------------------------------------------------------- # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. # The purpose of this macro is to provide the user with a means to # check macros which are provided without letting her know how the # information is coded. # If this macro is not defined by Autoconf, define it here. ifdef([AC_PROVIDE_IFELSE], [], [define([AC_PROVIDE_IFELSE], [ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) # ---------------------------------------------- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) fi # Define the identity of the package. PACKAGE=$1 AC_SUBST(PACKAGE)dnl VERSION=$2 AC_SUBST(VERSION)dnl ifelse([$3],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. ifdef([m4_pattern_allow], [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl # Autoconf 2.50 always computes EXEEXT. However we need to be # compatible with 2.13, for now. So we always define EXEEXT, but we # don't compute it. AC_SUBST(EXEEXT) # Similar for OBJEXT -- only we only use OBJEXT if the user actually # requests that it be used. This is a bit dumb. : ${OBJEXT=o} AC_SUBST(OBJEXT) # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_DEP_TRACK])dnl AC_REQUIRE([AM_SET_DEPDIR])dnl AC_PROVIDE_IFELSE([AC_PROG_][CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_][CC], defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_][CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_][CXX], defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) # # Check to make sure that the build environment is sane. # # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # serial 2 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= am_backtick='`' AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) fi ]) # AM_AUX_DIR_EXPAND # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # serial 4 -*- Autoconf -*- # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # --------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX" or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_$1_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" AC_SUBST([$1DEPMODE]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null AC_SUBST(DEPDIR) ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) pushdef([subst], defn([AC_SUBST])) subst(AMDEPBACKSLASH) popdef([subst]) ]) # Generate code to set up dependency tracking. # This macro should only be invoked once -- use via AC_REQUIRE. # Usage: # AM_OUTPUT_DEPENDENCY_COMMANDS # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ AC_OUTPUT_COMMANDS([ test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do case "$mf" in Makefile) dirpart=.;; */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; *) continue;; esac grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`echo "$file" | sed -e 's|/[^/]*$||'` $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])]) # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include='#' am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote='"' _am_result=BSD fi fi AC_SUBST(am__include) AC_SUBST(am__quote) AC_MSG_RESULT($_am_result) rm -f confinc confmf ]) # Like AC_CONFIG_HEADER, but automatically create stamp file. # serial 3 # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. We must strip everything past the first ":", # and everything past the last "/". AC_PREREQ([2.12]) AC_DEFUN([AM_CONFIG_HEADER], [ifdef([AC_FOREACH],dnl [dnl init our file count if it isn't already m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) dnl prepare to store our destination file list for use in config.status AC_FOREACH([_AM_File], [$1], [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) dnl and add it to the list of files AC keeps track of, along dnl with our hook AC_CONFIG_HEADERS(_AM_File, dnl COMMANDS, [, INIT-CMDS] [# update the timestamp echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS m4_popdef([_AM_Dest])])],dnl [AC_CONFIG_HEADER([$1]) AC_OUTPUT_COMMANDS( ifelse(patsubst([$1], [[^ ]], []), [], [test -z "$CONFIG_HEADERS" || echo timestamp >dnl patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl [am_indx=1 for am_file in $1; do case " \$CONFIG_HEADERS " in *" \$am_file "*) am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` if test -n "\$am_dir"; then am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do am_tmpdir=\$am_tmpdir\$am_subdir/ if test ! -d \$am_tmpdir; then mkdir \$am_tmpdir fi done fi echo timestamp > "\$am_dir"stamp-h\$am_indx ;; esac am_indx=\`expr \$am_indx + 1\` done]) ])]) # AM_CONFIG_HEADER # _AM_DIRNAME(PATH) # ----------------- # Like AS_DIRNAME, only do it during macro expansion AC_DEFUN([_AM_DIRNAME], [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, m4_if(m4_regexp([$1], [^/.*]), -1, [.], m4_patsubst([$1], [^\(/\).*], [\1])), m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl ]) # _AM_DIRNAME # serial 40 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN(AC_LIBTOOL_SETUP, [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl case "$target" in NONE) lt_target="$host" ;; *) lt_target="$target" ;; esac # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_SHARED, [dnl define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_STATIC, [dnl define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case "$lt_target" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library, adds --enable-ltdl-convenience to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case "$enable_ltdl_convenience" in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library, and adds --enable-ltdl-install to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl --- NEW FILE: autogen.sh --- #!/bin/sh # autogen.sh - generates configure using the autotools # $Id: autogen.sh,v 1.1 2003/11/11 03:26:48 firechipmunk Exp $ #libtoolize --force --copy libtoolize14 --force --copy #aclocal autoheader automake --add-missing echo echo "Using `autoconf --version`, if you have problems" echo "while building then edit autogen.sh and rerun it..." echo #autoconf ## autoconf 2.53 will not work, at least on FreeBSD. Change the following ## line appropriately to call autoconf 2.13 instead. This one works for ## FreeBSD 4.7: autoconf213 --- NEW FILE: depcomp --- #! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva <ol...@dc...>. if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; tru64) # The Tru64 AIX compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. tmpdepfile1="$object.d" tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` if test "$libtool" = yes; then "$@" -Wc,-MD else "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) # X makedepend ( shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tail +3 "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 --- NEW FILE: install-sh --- #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 --- NEW FILE: libtool --- #! /bin/sh # libtool - Provide generalized library-building support services. # Generated automatically by ltconfig (GNU libtool 1.3.4-freebsd-ports (1.385.2.196 1999/12/07 21:47:57)) # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit <go...@gn...>, 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # [...5308 lines suppressed...] If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: --- NEW FILE: ltconfig --- #! /bin/sh # ltconfig - Create a system-specific libtool. # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit <go...@gn...>, 1996 # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. [...3057 lines suppressed...] ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: --- NEW FILE: ltmain.sh --- # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit <go...@gn...>, 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software [...5039 lines suppressed...] If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: --- NEW FILE: missing --- #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pi...@ir...>, 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.3 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may ... [truncated message content] |