The exec formatmac module should have this instead of what was shown below exec formatmac { wait = yes program = "/home/jose/formatmac %{Calling-Station-Id}" input_pairs = request output_pairs = request }
On Tue, 2004-10-26 at 23:47, Jose Guevarra wrote: > Hi, > > I have an exec module (formatmac) that would take in the > Client-Station-Id, pass it to a perl script (formatmac), which would > then set the User-Name of the request packet to a formatted version of > the Client-Station-Id. This works but, the sql authentication module > then complains that > > ""rlm_sql (sql): zero length username not permitted "" > > How should I pass the User-Name = 'formatted mac address' attribute pair > from the formatmac perl script? If I don't use ':=' when I print the > attribute then the change to User-Name is ignored if I do use ':=' as > shown it erases the User-Name value. I've tried no, single and double > quotes around 'formatted mac address' with no luck. > > > This is what my config, script, and debug look like.... > > > under modules section of radius.conf: > ------------------------------------- > exec formatmac { > wait = yes > program = "/home/jose/formatmac %{Client-Station-Id}" > input_pairs = request > output_pairs = request > } > > > if have 'formatmac' in the authorize section of radius.conf > > > formatmac perl script: > ---------------------- > > my $inmac = $ARGV[0]; > > $inmac =~ s/\://g; > > print "User-Name := \'$inmac\'"; > > > radius -X output: > ----------------- > > radius_xlat: '/home/jose/formatmac 00:22:11:45:ff:43' > Exec-Program: /home/jose/formatmac 00:22:11:45:ff:43 > Exec-Program output: User-Name := '00221145ff43' > Exec-Program-Wait: value-pairs: User-Name := '00221145ff43' > Exec-Program: returned: 0 > modcall[authorize]: module "formatmac" returns ok for request 0 > rlm_sql (sql): zero length username not permitted > modcall[authorize]: module "sql" returns invalid for request 0 > modcall: group authorize returns invalid for request 0 > Delaying request 0 for 1 seconds > > > > - > List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html