How to return "Reply-Message" from python script

Александра Белова belovaay at mail.ru
Thu Sep 24 16:53:43 CEST 2009


I use the python a script for authorisation, for this purpose I in radiusd.conf have placed in section modules 
exec auth {
   profram = "/user/local/etc/raddb/auth.py"
   wait = yse
   inpyt_pairs = request
   shell_escape = yes
   output = no
   output_pairs = reply
}
As I have understood inpyt_pairs = request
   shell_escape = yes places attributes of request in variable environments of a script, and output_pairs = reply should allow to return to transfer atributes value pairs generated by a script in the server reply.As I have understood values returned by a script, 0 - ok, 1 - reject, the server answer to authorise or not the user, I besides it would would like to return to the user the message "Reply-Message", but I can not understand as it to make.My script looks in the simplified sort so

def handleUserList (p):
  u_name = p [' USER_NAME ']
  u_pwd = p [' USER_PASSWORD ']
  ................
  if (well user):
    sys.exit (3)
  else:
    sys.exit (1)

if __ name __ == "__ main __":
  import os
  hendleUserList (os.eniron)

 And it works correctly, but he does not allow to transfer the message to the user.
As I saw in prepaid.py for message return is used 
return (RLM_MODULE_XX, ((' Auth-Type ', ' python '), (' Reply-Message ', ' text '))) when I use similar string return (3, ((' Reply-Message ', ' text '))) the message is not transferred to the user and exec-Program: returned: 0 always.Please illustrate on an example how  value pairs for attributes of the answer of a server are formed and transferred to it.




More information about the Freeradius-Devel mailing list