Oops.  Sorry about that.

Thanks
Chris

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Randy
Moore
Sent: Tuesday, January 15, 2002 11:03 AM
To: [EMAIL PROTECTED]
Subject: RE: Patch for using multiple group reply attributes from SQL.

Hi,

I just put it in the body of the email, rather than as a MIME attachment

because that is what the HOWTO on contributing patches suggests. I
should 
have said I 'included' it rather than 'attached' it.

You can download it from:
         http://www.axion-it.net/download/sql.c.patch

At 09:45 AM 1/15/2002 -0600, you wrote:
>Where is the attachment?
>
>Thanks
>Chris
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED]] On Behalf Of Randy
>Moore
>Sent: Sunday, January 13, 2002 4:28 PM
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Cc: [EMAIL PROTECTED]
>Subject: Patch for using multiple group reply attributes from SQL.
>
>Hi All,
>
>I've attached a patch for the src/modules/rlm_sql/sql.c file.
>
>This patch fixes (I hope) 2 related problems.  First, as pointed out by
>[EMAIL PROTECTED] back in mid December, the logic in the
>sql_userparse subroutine does not allow for multiple reply pairs for a
>single attribute from the radgroupreply table.  This patch fixes this
by
>
>explicitly checking to see if the attribute in question has an op value
>of
>"+=".
>
>Second, the Ascend Binary Filter attribute types could not be added
>because
>the wrong(??) DEFINE value was being checked. I'm guessing that the
name
>
>used to be BINARY_FILTERS, but was later changed to ASCEND_BINARY
>everywhere but here?  The string BINARY_FILTERS does not seem to appear
>anywhere else in the distribution but this one subroutine.
>
>This patch also splits a variable "mode" that was serving two different
>functions in this subroutine into two separate variables "querymode"
and
>
>"pairmode".  Hopefully, this makes the code more understandable.
>
>In testing this change, I noticed another small problem with handling
>reply
>items from SQL.  According to the docs, the "==" operator is not
allowed
>as
>a reply item.  This is being permitted, probably to keep everyone sane
>since the ability to add anything but the default '==' was just
>added.  From the "radreply" table, it seems that the operator "=="
>should
>probably be treated as if it were just "=", but it is behaving like
"+="
>
>instead.  This is pretty trivial, but I thought I'd mention it.
>
>Hope this is useful.
>
>--- sql.c.orig  Sun Jan 13 14:04:20 2002
>+++ sql.c       Sun Jan 13 16:56:02 2002
>@@ -240,38 +240,37 @@
>    *    Purpose: Read entries from the database and fill VALUE_PAIR
>structures
>    *
>
>***********************************************************************
*
>*/
>-int sql_userparse(VALUE_PAIR ** first_pair, SQL_ROW row, int mode) {
>+int sql_userparse(VALUE_PAIR ** first_pair, SQL_ROW row, int
querymode)
>{
>
>         DICT_ATTR *attr;
>         VALUE_PAIR *pair, *check;
>         char *ptr;
>         char buf[128];
>+       int pairmode = T_EOL;
>
>         if ((attr = dict_attrbyname(row[2])) == (DICT_ATTR *) NULL) {
>                 radlog(L_ERR | L_CONS, "rlm_sql: unknown attribute
%s",
>row[2]);
>                 return (-1);
>         }
>
>+       if (row[4] != NULL && strlen(row[4]) > 0) {
>+               ptr = row[4];
>+               pairmode = gettoken(&ptr, buf, sizeof(buf));
>+       }
>+       if (pairmode <= T_EOL) pairmode = T_OP_CMP_EQ;
>+
>         /*
>         * If attribute is already there, skip it because we checked
>usercheck
>first
>         * and we want user settings to over ride group settings
>         */
>-       if ((check = pairfind(*first_pair, attr->attr)) != NULL &&
>-#if defined( BINARY_FILTERS )
>+       if (pairmode != T_OP_ADD && (check = pairfind(*first_pair,
>attr->attr))
>!= NULL &&
>+#ifdef ASCEND_BINARY
>                         attr->type != PW_TYPE_ABINARY &&
>   #endif
>-                       mode == PW_VP_GROUPDATA)
>+                       querymode == PW_VP_GROUPDATA)
>                 return 0;
>
>-       if (row[4] != NULL && strlen(row[4]) > 0) {
>-               ptr = row[4];
>-               if ((mode = gettoken(&ptr, buf, sizeof(buf))) <= T_EOL)
>-                       mode = T_OP_CMP_EQ;
>-       } else {
>-               mode = T_OP_CMP_EQ;
>-       }
>-
>-       pair = pairmake(row[2], row[3], mode);
>+       pair = pairmake(row[2], row[3], pairmode);
>         pairadd(first_pair, pair);
>
>         return 0;
>Randy Moore
>Axion Information Technologies, Inc.
>
>email     [EMAIL PROTECTED]
>phone   301-408-1200
>fax        301-445-3947
>
>
>-
>List info/subscribe/unsubscribe? See
>http://www.freeradius.org/list/users.html
>
>
>
>
>-
>List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html

Randy Moore
Axion Information Technologies, Inc.

email     [EMAIL PROTECTED]
phone   301-408-1200
fax        301-445-3947


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




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

Reply via email to