On Oct 20, 2015, at 10:39 AM, Eran Pasternak <eran.pasternak@forescout.com> wrote:
I'm developing FR which is not installed in the standard location. Specifically raddb dir is not the default so when running radclient (and other applications) I have to add its location (with the '-d' flag). This is required even though the compilation is configured with the appropriate @prefix@ for this location.
Hmm.. you can check the file Make.inc to see what the raddbdir is set to. radclient *will* use that directory.
I noticed that radclient.c (and others) use h files from 'freeradius-devel' and not 'include'.
Yes. Because you might already have FreeRADIUS headers installed for version X, and are building for version Y. If the build process for version Y used the standard include files, it would grab the headers for version X. And all kinds of things would go wrong. When the headers are installed, the includes that *they* use are changed. See the make files in src/include.
Now in the 'include' dir 'build-radpaths-h' uses my configured prefix while in 'freeradius-devel' it doesn't which is obviously the reason why the prefix have no effect for radclient.
I don't know what that means. "freeradius-devel" is a directory. What *file* contains the wrong prefix? Where is that file on disk? On my system, I get: $ grep RADDBDIR src/include/*.h src/include/conf.h:#define RADIUS_DIR RADDBDIR src/include/radpaths.h:#define RADDBDIR "/home/aland/test/etc/raddb" Which is fine. If I look in /usr/include/freeradius/radpaths.h, I might get a different value for RADDBDIR... because it's for a different version of the server.
I couldn't find a way to make the configure script or whatever to place the prefix in 'freeradius-devel' as well.
Again, freeradius-devel is a directory. The file src/include/radpaths.h has the correct path for RADDBDIR... *for the version you are building*. The file in /usr/include/freeradius/radpaths.h has the correct path *for the version which is installed*. The two paths might be different.
Bottom line is why are these two separate directories which are identical (aside from the paths)?
Because they're for two different versions of the server.
And how to "convey" the prefix to the files in 'freeradius-devel'.
You don't. It's added there automatically. When you're running radclient from the *installed* location, it uses the *installed* path for RADDBDIR. When you're building radclient from the *source*, that version of radclient uses the value of RADDBDIR which is taken from src/include/radpaths.h. And *nothing* in the source tree does: #include <freeradius/foo.h> It' s*always* #include <freeradius-devel/foo.h> And the freeradius-devel directory is a symlink to src/include/ in the build tree. So... *which* radclient are you running? The installed one? Or the one from the source tree? Most of this confusion can be avoided by *not* installing a production version of FreeRADIUS on a development machine. That way there's only one version of radclient, only one version of the headers, and only one path for RADDBDIR. Alan DeKok.