Re: Accessing REQUEST structure data outside FreeRADIUS module

2006-04-13 Thread Nicolas Castel
2006/4/12, Alan DeKok [EMAIL PROTECTED]:
 Nicolas Castel [EMAIL PROTECTED] wrote:
  I'm using FreeRADIUS v1.1.0. I'm developping  some modules and I try to
  access auth_req structure (REQUEST) data from an  external function (out of
  my module) and it fails. All works fine when  accessing this data from the
  module itself but when i call an external  function with the address of
  REQUEST, it doesn't work.

   It's possible.  Lots and lots of modules do it.

   The problem is most likely that you're passing different
 compile-time flags to the different C files.  As a result, the magic
 entry at the top of the REQUEST structure is used in one C file, but
 not in another.  There is no such magic in the RADIUS_PACKET
 structure, so that always works.

   The solution is to build your module either as you're building the
 server, or pass -DNDEBUG as an option to the compiler.

   Alan DeKok.
 -
Hello,

Thanks a lot for this solution. As a matter of fact, the module
compilation already have the DBDEBUG flag but i didn't compile my
library with this flag. I passed this famous flag to my lib
compilation and all works fine ! No more problem to access every
fields of structure REQUEST. Once again thanks !

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Accessing REQUEST structure data outside FreeRADIUS module

2006-04-12 Thread Joe Maimon



Nicolas Castel wrote:


Hello and thanks for replies

I'm using FreeRADIUS v1.1.0. I'm developping  some modules and I try to
access auth_req structure (REQUEST) data from an  external function (out of
my module) and it fails. All works fine when  accessing this data from the
module itself but when i call an external  function with the address of
REQUEST, it doesn't work.




and  in anotherfile, lib_com.c


What happens when your external function is in the same file as your 
module function?


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Accessing REQUEST structure data outside FreeRADIUS module

2006-04-12 Thread Nicolas Castel
2006/4/12, Joe Maimon [EMAIL PROTECTED]:


 Nicolas Castel wrote:

  Hello and thanks for replies
 
  I'm using FreeRADIUS v1.1.0. I'm developping  some modules and I try to
  access auth_req structure (REQUEST) data from an  external function (out of
  my module) and it fails. All works fine when  accessing this data from the
  module itself but when i call an external  function with the address of
  REQUEST, it doesn't work.
 

  and  in anotherfile, lib_com.c

 What happens when your external function is in the same file as your
 module function?

 -
 List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Thanks for responding,

When i put the function in the module all works fine too.

I tried to access directly the packet field of the REQUEST structure
in the function in my library and it works in this case.

int lib_com_filter_traffic_bis(RADIUS_PACKET *pt_packet) {

  VALUE_PAIR *lpt_value_pair = NULL;

  if ((lpt_value_pair = pairfind(pt_packet-vps, PW_USER_NAME)) == NULL ) {
WCP_DEBUG(User-Name not found !);
  } else {
WCP_DEBUG(RADIUS attribute name %s, value: [%s],
  lpt_value_pair-name,
  lpt_value_pair-strvalue);
}

So, with the RADIUS_PACKET passed in parameter, it works fine, so why
does it not work with the REQUEST parameter ? Have you any idea ? Is
REQUEST address protected or else ??? I think about static function
...

Thanks

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Accessing REQUEST structure data outside FreeRADIUS module

2006-04-12 Thread Joe Maimon



Nicolas Castel wrote:


2006/4/12, Joe Maimon [EMAIL PROTECTED]:



Nicolas Castel wrote:



Hello and thanks for replies

I'm using FreeRADIUS v1.1.0. I'm developping  some modules and I try to
access auth_req structure (REQUEST) data from an  external function (out of
my module) and it fails. All works fine when  accessing this data from the
module itself but when i call an external  function with the address of
REQUEST, it doesn't work.




and  in anotherfile, lib_com.c


What happens when your external function is in the same file as your
module function?

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html




Thanks for responding,

When i put the function in the module all works fine too.



Let me rewrite that:

When you put the function into the same c language file as the rest of 
the module functions, all works fine.


If that is correct, than I would suggest you are having an include file 
problem and/or a linking problem.


If I am correct, there isnt much I can do without seeing your code other 
than suggest you duplicate what you do for the file that works and/or 
you examine other successfull built modules with multiple files and 
their build process.


Of course, I could be very wide off the mark here.


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Accessing REQUEST structure data outside FreeRADIUS module

2006-04-12 Thread Alan DeKok
Nicolas Castel [EMAIL PROTECTED] wrote:
 I'm using FreeRADIUS v1.1.0. I'm developping  some modules and I try to
 access auth_req structure (REQUEST) data from an  external function (out of
 my module) and it fails. All works fine when  accessing this data from the
 module itself but when i call an external  function with the address of
 REQUEST, it doesn't work.

  It's possible.  Lots and lots of modules do it.

  The problem is most likely that you're passing different
compile-time flags to the different C files.  As a result, the magic
entry at the top of the REQUEST structure is used in one C file, but
not in another.  There is no such magic in the RADIUS_PACKET
structure, so that always works.

  The solution is to build your module either as you're building the
server, or pass -DNDEBUG as an option to the compiler.

  Alan DeKok.
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html