* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
- * Copyright 2001 The FreeRADIUS server project
+ * Copyright 2001,2006 The FreeRADIUS server project
* Copyright 2000 Mike Machado <mike@innercite.com>
* Copyright 2000 Alan DeKok <aland@ox.org>
* Copyright 2001 Chad Miller <cmiller@surfsouth.com>
*/
-#include <freeradius-devel/autoconf.h>
+#include <freeradius-devel/ident.h>
+RCSID("$Id$")
+
+#include <freeradius-devel/radiusd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
#include <sys/file.h>
-#include <string.h>
#include <sys/stat.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <netdb.h>
#include <pwd.h>
-#include <time.h>
#include <ctype.h>
-#include <unistd.h>
#include <signal.h>
-#include <errno.h>
#include <sys/wait.h>
-#include <freeradius-devel/radiusd.h>
-#include <freeradius-devel/conffile.h>
#include "rlm_sql.h"
#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
#endif
}
if (do_xlat) {
pair->flags.do_xlat = 1;
- strNcpy(pair->vp_strvalue, buf, sizeof(pair->vp_strvalue));
+ strlcpy(pair->vp_strvalue, buf, sizeof(pair->vp_strvalue));
pair->length = 0;
}
if (ret == SQL_DOWN) {
/* close the socket that failed */
- (inst->module->sql_close)(sqlsocket, inst->config);
+ if (sqlsocket->state == sockconnected) {
+ (inst->module->sql_close)(sqlsocket, inst->config);
+ }
/* reconnect the socket */
if (connect_single_socket(sqlsocket, inst) < 0) {
if (ret == SQL_DOWN) {
/* close the socket that failed */
- (inst->module->sql_close)(sqlsocket, inst->config);
+ if (sqlsocket->state == sockconnected) {
+ (inst->module->sql_close)(sqlsocket, inst->config);
+ }
/* reconnect the socket */
if (connect_single_socket(sqlsocket, inst) < 0) {