Hello, please help me with SQL integration
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Thu Feb 27 17:07:31 CET 2014
On 27 Feb 2014, at 15:29, For Sinton <forsin at inbox.kg> wrote:
> Good day! I installed freeradius 3.0.x on a server with FreeBSD. Simple Authorization Users through a "files" works without problems. I started to connect SQL, as described in the documentation "HOW-SQL". Users added to the table radcheck, and when prompted radtest user user_pass localhost 0 testing123 - user can not login. Comes the following error
> root at gateway:~ # radtest fredf wilma 127.0.0.1 0 testing123
> Sending Access-Request of id 9 from 0.0.0.0 port 52606 to 127.0.0.1 port 1812
> User-Name = 'fredf'
> User-Password = 'wilma'
> NAS-IP-Address = 127.0.0.1
> NAS-Port = 0
> Message-Authenticator = 0x00
> rad_recv: Access-Reject packet from host 127.0.0.1 port 1812, id=9, length=20
> root at gateway:~ #
>
>
> debug message
> rad_recv: Access-Request packet from host 127.0.0.1 port 52606, id=9, length=75
> User-Name = 'fredf'
> User-Password = 'wilma'
> NAS-IP-Address = 127.0.0.1
> NAS-Port = 0
> Message-Authenticator = 0x921e720cf0599ea4cae31cf81ee1da87
> Thu Feb 27 20:06:01 2014 : Debug: (0) # Executing section authorize from file /usr/local/etc/raddb/sites-enabled/default
> Thu Feb 27 20:06:01 2014 : Debug: (0) authorize {
> Thu Feb 27 20:06:01 2014 : Debug: (0) modsingle[authorize]: calling preprocess (rlm_preprocess) for request 0
> Thu Feb 27 20:06:01 2014 : Debug: (0) modsingle[authorize]: returned from preprocess (rlm_preprocess) for request 0
> Thu Feb 27 20:06:01 2014 : Debug: (0) [preprocess] = ok
> Thu Feb 27 20:06:01 2014 : Debug: (0) ? if ("%{sql:SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{User-Name}' ORDER BY id" >= 1)
> Thu Feb 27 20:06:01 2014 : Debug: %{sql:SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{User-Name}' ORDER BY id
> Thu Feb 27 20:06:01 2014 : Debug: Parsed xlat tree:
> Thu Feb 27 20:06:01 2014 : Debug: xlat: sql
> Thu Feb 27 20:06:01 2014 : Debug: {
> Thu Feb 27 20:06:01 2014 : Debug: literal: 'SELECT id, username, attribute, value, op FROM radcheck WHERE username = ''
> Thu Feb 27 20:06:01 2014 : Debug: attribute: User-Name
> Thu Feb 27 20:06:01 2014 : Debug: {
> Thu Feb 27 20:06:01 2014 : Debug: ref 2
> Thu Feb 27 20:06:01 2014 : Debug: list 1
> Thu Feb 27 20:06:01 2014 : Debug: tag -128
> Thu Feb 27 20:06:01 2014 : Debug: }
> Thu Feb 27 20:06:01 2014 : Debug: literal: '' ORDER BY id'
> Thu Feb 27 20:06:01 2014 : Debug: }
> Thu Feb 27 20:06:01 2014 : Debug: %{User-Name}
> Thu Feb 27 20:06:01 2014 : Debug: Parsed xlat tree:
> Thu Feb 27 20:06:01 2014 : Debug: attribute: User-Name
> Thu Feb 27 20:06:01 2014 : Debug: {
> Thu Feb 27 20:06:01 2014 : Debug: ref 2
> Thu Feb 27 20:06:01 2014 : Debug: list 1
> Thu Feb 27 20:06:01 2014 : Debug: tag -128
> Thu Feb 27 20:06:01 2014 : Debug: }
> Thu Feb 27 20:06:01 2014 : Debug: (0) expand: "%{User-Name}" -> 'fredf'
> Thu Feb 27 20:06:01 2014 : Debug: (0) SQL-User-Name set to 'fredf'
> Thu Feb 27 20:06:01 2014 : Debug: rlm_sql (sql): Reserved connection (4)
> Thu Feb 27 20:06:01 2014 : Debug: /var/log/sqllog.sql
> Thu Feb 27 20:06:01 2014 : Debug: Parsed xlat tree:
> Thu Feb 27 20:06:01 2014 : Debug: literal: '/var/log/sqllog.sql'
> Thu Feb 27 20:06:01 2014 : Debug: (0) expand: "/var/log/sqllog.sql" -> '/var/log/sqllog.sql'
> Thu Feb 27 20:06:01 2014 : Debug: rlm_sql (sql): Executing query: 'SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'fredf' ORDER BY id'
> Thu Feb 27 20:06:01 2014 : Debug: (0) SQL query returned no results ------> why ? If you do this query inside mysql - i got result :(
Try SELECT COUNT(*) seeing as you're doing an integer comparison.
Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS Development Team
FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140227/2b9eed66/attachment-0001.pgp>
More information about the Freeradius-Users
mailing list