sql query in post-auth - segmentation fault

Alan DeKok aland at deployingradius.com
Fri Sep 11 14:40:47 CEST 2015


On Sep 11, 2015, at 8:24 AM, Mohamed Imran (NBI) <Mohamed.Imran at nbi.ac.uk> wrote:
> 	if("%{sql:SELECT COUNT(*) FROM tblwindows WHERE MacAddress
> ='%{Calling-Station-ID}'}" ==1){
> 	update reply {
>        		Tunnel-Type = VLAN
>                	Tunnel-Medium-Type = IEEE-802
>                	Tunnel-Private-Group-Id = 100
>        	}
>        	else {
>        	update reply {
>        		Tunnel-Type = VLAN
>                	Tunnel-Medium-Type = IEEE-802
>                	Tunnel-Private-Group-Id = 101
>              	 }
>        	         }
>       	 }

  With correct indentation:

	if("%{sql:SELECT COUNT(*) FROM tblwindows WHERE MacAddress='%{Calling-Station-ID}'}" ==1){
		update reply {
       			Tunnel-Type = VLAN
               		Tunnel-Medium-Type = IEEE-802
               		Tunnel-Private-Group-Id = 100
       		}
       		else {
       			update reply {
       				Tunnel-Type = VLAN
               			Tunnel-Medium-Type = IEEE-802
               			Tunnel-Private-Group-Id = 101
             		}
       	         }
      	 }


  It shouldn't SEGV.  But... your config is wrong.  The "else" comes after the "update".  It doesn't come after the "if" statement.

  Fix the braces, and it will work.  I'll add code to check for this kind of bad syntax, and give a descriptive error.

  Alan DeKok.




More information about the Freeradius-Users mailing list