]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add increment operator for LDAP
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 10 Dec 2012 19:02:23 +0000 (19:02 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 10 Dec 2012 19:16:57 +0000 (19:16 +0000)
raddb/mods-available/ldap
src/include/token.h
src/lib/token.c
src/main/conffile.c
src/modules/rlm_ldap/rlm_ldap.c

index ca2772ba9089b834afde0f678d7344b0690441a4..74abddec77de17ae717e24828b7c1a98f0ce1ef6 100644 (file)
@@ -126,7 +126,8 @@ ldap {
        # 
        #  Where:
        #       <ldap attr>:    The LDAP attribute to add modify or delete.
-       #       <op>:           One of the assignment operators (:=, +=, -=).
+       #       <op>:           One of the assignment operators
+       #                       (:=, +=, -=, ++).
        #                       Note: '=' is *not* supported.
        #       <value>:        The value to add modify or delete.
        # 
index b6097430e9e3799101c61d510650dcd1d03c850d..f7d81f4a3de1e32f5542e78d11e83b6f28272dd4 100644 (file)
@@ -41,24 +41,25 @@ typedef enum fr_token_t {
   T_COMMA,                     /* , */
   T_SEMICOLON,                 /* ; */
 
+  T_OP_INCRM,                  /* ++ */
   T_OP_ADD,                    /* += */
-  T_OP_SUB,                    /* -= */
-  T_OP_SET,                    /* :=           10 */
+  T_OP_SUB,                    /* -=           10 */
+  T_OP_SET,                    /* := */
   T_OP_EQ,                     /* = */
   T_OP_NE,                     /* != */
   T_OP_GE,                     /* >= */
-  T_OP_GT,                     /* > */
-  T_OP_LE,                     /* <=           15 */
+  T_OP_GT,                     /* >            15 */
+  T_OP_LE,                     /* <= */
   T_OP_LT,                     /* < */
   T_OP_REG_EQ,                 /* =~ */
   T_OP_REG_NE,                 /* !~ */
-  T_OP_CMP_TRUE,                /* =* */
-  T_OP_CMP_FALSE,               /* !*          20 */
+  T_OP_CMP_TRUE,                /* =*          20 */
+  T_OP_CMP_FALSE,               /* !* */
   T_OP_CMP_EQ,                 /* == */
   T_HASH,                      /* # */
   T_BARE_WORD,                 /* bare word */
-  T_DOUBLE_QUOTED_STRING,      /* "foo" */
-  T_SINGLE_QUOTED_STRING,      /* 'foo'        25 */
+  T_DOUBLE_QUOTED_STRING,      /* "foo"        25 */
+  T_SINGLE_QUOTED_STRING,      /* 'foo' */
   T_BACK_QUOTED_STRING,                /* `foo` */
   T_TOKEN_LAST
 } FR_TOKEN;
index 14355e92723cd3e4bce1c76e281d31befa8eb264..6333347184214df4ebb5f7b686da1ace5bd074bd 100644 (file)
@@ -37,6 +37,7 @@ const FR_NAME_NUMBER fr_tokens[] = {
        { "(",  T_LBRACE,       },
        { ")",  T_RBRACE,       },
        { ",",  T_COMMA,        },
+       { "++", T_OP_INCRM,     },
        { "+=", T_OP_ADD,       },
        { "-=", T_OP_SUB,       },
        { ":=", T_OP_SET,       },
index b7f2f17ffd7eadd2481e70b9d80927dc475f68f8..219d95ad7ac1d9a2a4a27d0fe60b37205e305297 100644 (file)
@@ -1703,6 +1703,7 @@ static int cf_section_read(const char *filename, int *lineno, FILE *fp,
                        value = NULL;
                        goto do_set;
 
+               case T_OP_INCRM:
                case T_OP_ADD:
                case T_OP_CMP_EQ:
                case T_OP_SUB:
index b063e3e26a4344797d74b44079a2120cc056c9bd..abed6dc4d249f18b29853bf480d5d7ab1a0bf307 100644 (file)
@@ -2266,7 +2266,7 @@ static int user_modify(ldap_instance *inst, REQUEST *request,
                 *      Now we know the value is ok, copy the pointers into
                 *      the ldapmod struct.
                 */
-               memcpy(&(mod_s[total].mod_type), &(attr),
+               memcpy(&(mod_s[total].mod_type), &(attr), 
                       sizeof(mod_s[total].mod_type));
 
                op = cf_pair_operator(cp);
@@ -2285,6 +2285,11 @@ static int user_modify(ldap_instance *inst, REQUEST *request,
                        case T_OP_SUB:
                                mod_s[total].mod_op = LDAP_MOD_DELETE;
                        break;
+#ifdef LDAP_MOD_INCREMENT
+                       case T_OP_INCRM:
+                               mod_s[total].mod_op = LDAP_MOD_INCREMENT;
+                       break;
+#endif
                        default:
                                radlog(L_ERR, "rlm_ldap (%s): Operator '%s' "
                                       "is not supported for LDAP modify "