*
* 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
+ * 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/ident.h>
+RCSID("$Id$")
+
+#include <freeradius-devel/autoconf.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <sys/wait.h>
-#include "radiusd.h"
-#include "conffile.h"
+#include <freeradius-devel/radiusd.h>
#include "rlm_sql.h"
#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
#endif
* Purpose: Read entries from the database and fill VALUE_PAIR structures
*
*************************************************************************/
-int sql_userparse(VALUE_PAIR ** first_pair, SQL_ROW row, int querymode)
+int sql_userparse(VALUE_PAIR ** first_pair, SQL_ROW row)
{
- VALUE_PAIR *pair, *check;
+ VALUE_PAIR *pair;
char *ptr, *value;
char buf[MAX_STRING_LEN];
char do_xlat = 0;
}
if (do_xlat) {
pair->flags.do_xlat = 1;
- strNcpy(pair->strvalue, buf, sizeof(pair->strvalue));
+ strlcpy(pair->vp_strvalue, buf, sizeof(pair->vp_strvalue));
pair->length = 0;
}
/*
- * If attribute is already there, skip it because we
- * checked usercheck first and we want user settings to
- * override group settings
- */
- if (operator != T_OP_ADD && (check = pairfind(*first_pair, pair->attribute)) != NULL &&
-#ifdef ASCEND_BINARY
- pair->type != PW_TYPE_ABINARY &&
-#endif
- querymode == PW_VP_GROUPDATA) {
- pairbasicfree(pair);
- return 0;
- }
-
- /*
* Add the pair into the packet
*/
pairadd(first_pair, pair);
* Purpose: Get any group check or reply pairs
*
*************************************************************************/
-int sql_getvpdata(SQL_INST * inst, SQLSOCK * sqlsocket, VALUE_PAIR **pair, char *query, int mode)
+int sql_getvpdata(SQL_INST * inst, SQLSOCK * sqlsocket, VALUE_PAIR **pair, char *query)
{
SQL_ROW row;
int rows = 0;
row = sqlsocket->row;
if (!row)
break;
- if (sql_userparse(pair, row, mode) != 0) {
+ if (sql_userparse(pair, row) != 0) {
radlog(L_ERR | L_CONS, "rlm_sql (%s): Error getting data from database", inst->config->xlat_name);
(inst->module->sql_finish_select_query)(sqlsocket, inst->config);
return -1;