Massively cleaned up #include's, so they're in a consistent
[freeradius.git] / src / modules / rlm_dbm / rlm_dbm.c
index c1f5a19..94c0471 100644 (file)
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  * Copyright 2001 Koulik Andrei, Sandy Service
+ * Copyright 2006 The FreeRADIUS server project
  */
 
-#include "autoconf.h"
+#include <freeradius-devel/ident.h>
+RCSID("$Id$")
 
-#include <string.h>
-#include <stdlib.h>
+#include <freeradius-devel/radiusd.h>
+#include <freeradius-devel/modules.h>
 
 #ifdef HAVE_NDBM_H
 #include <ndbm.h>
 
 #include <fcntl.h>
 
-#include "radiusd.h"
-#include "modules.h"
-
 #ifdef SANDY_MOD
 #      include "sandymod.h"
 #endif
 
-static const char rcsid[] = "$Id$";
-
 #define MYDBM  DBM
 #define get_user_content dbm_fetch
 
@@ -208,7 +205,7 @@ static int sm_parse_user(DBM *pdb, const char * username, VALUE_PAIR const* requ
                                        if ( parse_state == SMP_PATTERN ) { /* pattern line found */
                                                DEBUG2("process pattern");
                                                /* check pattern against request */
-                                               if ( paircmp(NULL, request, vp, reply ) == 0 ) {
+                                               if ( paircompare(NULL, request, vp, reply ) == 0 ) {
                                                        DEBUG2("rlm_dbm: Pattern matched, look for request");
                                                        pairmove(&tmp_config, &vp);
                                                        pairfree(&vp);
@@ -226,9 +223,9 @@ static int sm_parse_user(DBM *pdb, const char * username, VALUE_PAIR const* requ
                                                join_attr = vp;
                                                while( (join_attr = pairfind(join_attr,SM_JOIN_ATTR) ) != NULL ) {
                                                        DEBUG2("rlm_dbm: Proccess nested record: username %s",
-                                                               (char *)join_attr->strvalue);
+                                                               (char *)join_attr->vp_strvalue);
                                                        /* res =  RLM_MODULE_NOTFOUND; */
-                                                       res =  sm_parse_user(pdb, (char *)join_attr->strvalue, request, &tmp_config,
+                                                       res =  sm_parse_user(pdb, (char *)join_attr->vp_strvalue, request, &tmp_config,
                                                                        &nu_reply, ulist);
                                                        DEBUG("rlm_dbm: recived: %d\n",res);
                                                        switch ( res ) {
@@ -325,7 +322,7 @@ static int rlm_dbm_authorize(void *instance, REQUEST *request)
          *      Grab the canonical user name.
          */
         namepair = request->username;
-        name = namepair ? (char *) namepair->strvalue : "NONE";
+        name = namepair ? (char *) namepair->vp_strvalue : "NONE";
 
        DEBUG2("rlm_dbm: try open database file: %s\n",inst -> userfile);
 
@@ -361,7 +358,6 @@ static int rlm_dbm_authorize(void *instance, REQUEST *request)
 static int rlm_dbm_detach(void *instance)
 {
        struct rlm_dbm_t *inst = instance;
-       free(inst -> userfile);
        free(inst);
        return 0;
 }