[bug 571 PATCH] make rlm_sqlipool escape properly

Phil Mayers p.mayers at imperial.ac.uk
Wed Sep 17 13:14:13 CEST 2008


This is an updated patch to the one in bug 571

---
  src/modules/rlm_sql/rlm_sql.c             |    3 +--
  src/modules/rlm_sql/rlm_sql.h             |    1 +
  src/modules/rlm_sqlippool/rlm_sqlippool.c |    4 ++--
  3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c
index 1987d81..de9cd53 100644
--- a/src/modules/rlm_sql/rlm_sql.c
+++ b/src/modules/rlm_sql/rlm_sql.c
@@ -123,7 +123,6 @@ static int fallthrough(VALUE_PAIR *vp)
   *	Yucky prototype.
   */
  static int generate_sql_clients(SQL_INST *inst);
-static size_t sql_escape_func(char *out, size_t outlen, const char *in);
  
  /*
   *	sql xlat function. Right now only SELECTs are supported. Only
@@ -355,7 +354,7 @@ static int generate_sql_clients(SQL_INST *inst)
  /*
   *	Translate the SQL queries.
   */
-static size_t sql_escape_func(char *out, size_t outlen, const char *in)
+size_t sql_escape_func(char *out, size_t outlen, const char *in)
  {
  	size_t len = 0;
  
diff --git a/src/modules/rlm_sql/rlm_sql.h b/src/modules/rlm_sql/rlm_sql.h
index 54cc6ee..40cd526 100644
--- a/src/modules/rlm_sql/rlm_sql.h
+++ b/src/modules/rlm_sql/rlm_sql.h
@@ -89,4 +89,5 @@ int	rlm_sql_select_query(SQLSOCK *sqlsocket, SQL_INST *inst, char *query);
  int	rlm_sql_query(SQLSOCK *sqlsocket, SQL_INST *inst, char *query);
  int	rlm_sql_fetch_row(SQLSOCK *sqlsocket, SQL_INST *inst);
  int	sql_set_user(SQL_INST *inst, REQUEST *request, char *sqlusername, const char *username);
+size_t	sql_escape_func(char *out, size_t outlen, const char *in);
  #endif
diff --git a/src/modules/rlm_sqlippool/rlm_sqlippool.c b/src/modules/rlm_sqlippool/rlm_sqlippool.c
index b9df57b..ab0e5b6 100644
--- a/src/modules/rlm_sqlippool/rlm_sqlippool.c
+++ b/src/modules/rlm_sqlippool/rlm_sqlippool.c
@@ -318,7 +318,7 @@ static int sqlippool_command(const char * fmt, SQLSOCK * sqlsocket,
  			return RLM_MODULE_FAIL;
  		}
  
-		if (!radius_xlat(query, sizeof(query), expansion, request, NULL)) {
+		if (!radius_xlat(query, sizeof(query), expansion, request, sql_escape_func)) {
  			radlog(L_ERR, "sqlippool_command: xlat failed on: '%s'", query);
  			return 0;
  		}
@@ -364,7 +364,7 @@ static int sqlippool_query1(char * out, int outlen, const char * fmt,
  			return RLM_MODULE_FAIL;
  		}
  
-		if (!radius_xlat(query, sizeof(query), expansion, request, NULL)) {
+		if (!radius_xlat(query, sizeof(query), expansion, request, sql_escape_func)) {
  			radlog(L_ERR, "sqlippool_command: xlat failed.");
  			out[0] = '\0';
  			return 0;
-- 
1.5.4.3




More information about the Freeradius-Users mailing list