Add vp_listdebug function that prints a list of value pairs to the DEBUG
authorramoore <ramoore>
Mon, 22 Jul 2002 23:10:05 +0000 (23:10 +0000)
committerramoore <ramoore>
Mon, 22 Jul 2002 23:10:05 +0000 (23:10 +0000)
function.  Used this in rlm_sql.c.

src/include/radiusd.h
src/main/log.c
src/modules/rlm_sql/rlm_sql.c

index 991adcc..ae80d63 100644 (file)
@@ -261,7 +261,7 @@ NAS         *nas_findbyname(char *nasname);
 void           version(void);
 
 /* log.c */
-int radlogdir_iswritable(const char *);
+int            radlogdir_iswritable(const char *);
 int            vradlog(int, const char *, va_list ap);
 int            radlog(int, const char *, ...)
 #ifdef __GNUC__
@@ -273,6 +273,7 @@ int         log_debug(const char *, ...)
                __attribute__ ((format (printf, 1, 2)))
 #endif
 ;
+void           vp_listdebug(VALUE_PAIR *vp);
 
 /* proxy.c */
 int proxy_receive(REQUEST *request);
index 7330fa9..641dd54 100644 (file)
@@ -281,3 +281,20 @@ int radlog(int lvl, const char *msg, ...)
 
        return r;
 }
+
+
+/*
+ *      Dump a whole list of attributes to DEBUG2
+ */                     
+void vp_listdebug(VALUE_PAIR *vp)
+{       
+        char tmpPair[70];  
+        for (; vp; vp = vp->next) {
+                vp_prints(tmpPair, sizeof(tmpPair), vp);
+                DEBUG2("     %s", tmpPair);
+        }               
+}
+   
+
+        
index e4c177d..67bd5da 100644 (file)
@@ -426,21 +426,19 @@ static int rlm_sql_authorize(void *instance, REQUEST * request) {
                pairdelete(&request->packet->vps, PW_SQL_USER_NAME);
                return RLM_MODULE_NOTFOUND;
        }
-#if 0 /* FIXME: Debug being printed elsewhere? */
+
        /*
         * Uncomment these lines for debugging
         * Recompile, and run 'radiusd -X'
-        *
-        DEBUG2("rlm_sql:  check items");
-        vp_printlist(stderr, check_tmp);
-        DEBUG2("rlm_sql:  reply items");
-        vp_printlist(stderr, reply_tmp);
         */
-#endif
 
-#if 0 /* FIXME: this is the *real* authorizing */
-       vp_printlist(stderr, check_tmp);
-#endif
+       /* 
+       DEBUG2("rlm_sql:  check items");
+       vp_listdebug(check_tmp);
+       DEBUG2("rlm_sql:  reply items");
+       vp_listdebug(reply_tmp); 
+       */
+
        if (paircmp(request, request->packet->vps, check_tmp, &reply_tmp) != 0) {
                radlog(L_INFO, "rlm_sql: Pairs do not match [%s]", sqlusername);
                /* Remove the username we (maybe) added above */