]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add context pointer to pairalloc
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 18 Feb 2013 20:47:19 +0000 (15:47 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 19 Feb 2013 21:13:17 +0000 (16:13 -0500)
src/include/libradius.h
src/lib/radius.c
src/lib/valuepair.c
src/modules/rlm_cache/rlm_cache.c
src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_rest/rest.c
src/modules/rlm_sql/rlm_sql.c

index 572348e6afa5d2856356fd85fd94a366a318edf2..e22fe19cacf60fd87099a95c79833ae95c11a8bc 100644 (file)
@@ -428,7 +428,7 @@ int rad_vp2attr(const RADIUS_PACKET *packet,
                const VALUE_PAIR **pvp, uint8_t *ptr, size_t room);
 
 /* valuepair.c */
-VALUE_PAIR     *pairalloc(const DICT_ATTR *da);
+VALUE_PAIR     *pairalloc(TALLOC_CTX *ctx, const DICT_ATTR *da);
 VALUE_PAIR     *paircreate(unsigned int attr, unsigned int vendor);
 int            pair2unknown(VALUE_PAIR *vp);
 void           pairfree(VALUE_PAIR **);
index 1797a17c84142f01debf3d77d4b35c7a2987ae33..35a60ca165913cf57a455d69fa19b82442588ea3 100644 (file)
@@ -3449,7 +3449,7 @@ static ssize_t data2vp(const RADIUS_PACKET *packet,
         *      And now that we've verified the basic type
         *      information, decode the actual data.
         */
-       vp = pairalloc(da);
+       vp = pairalloc(NULL, da);
        if (!vp) return -1;
 
        vp->length = datalen;
index ab90ec273b5a73cb7bf13762d9170a05e2fdf039..9914c843c87382e2a30387ff047691f487ad9996 100644 (file)
@@ -49,10 +49,11 @@ static const char *months[] = {
  *
  * Allocates a new attribute and a new dictionary attr if no DA is provided.
  *
+ * @param[in] ctx for allocated memory, usually a pointer to the request.
  * @param[in] da Specifies the dictionary attribute to build the VP from.
  * @return a new value pair or NULL if an error occurred.
  */
-VALUE_PAIR *pairalloc(const DICT_ATTR *da)
+VALUE_PAIR *pairalloc(UNUSED void *ctx, const DICT_ATTR *da)
 {
        VALUE_PAIR *vp;
 
@@ -102,7 +103,7 @@ VALUE_PAIR *paircreate(unsigned int attr, unsigned int vendor)
                }
        }
 
-       return pairalloc(da);
+       return pairalloc(NULL, da);
 }
 
 /** Free memory used by a single valuepair.
@@ -383,7 +384,7 @@ VALUE_PAIR *paircopyvpdata(const DICT_ATTR *da, const VALUE_PAIR *vp)
 
        if (da->type != vp->da->type) return NULL;
        
-       n = pairalloc(da);
+       n = pairalloc(NULL, da);
        if (!n) {
                return NULL;    
        }
@@ -1474,7 +1475,7 @@ static VALUE_PAIR *pairmake_any(const char *attribute, const char *value,
         *      it.  This next stop also looks the attribute up in the
         *      dictionary, and creates the appropriate type for it.
         */
-       vp = pairalloc(da);
+       vp = pairalloc(NULL, da);
        if (!vp) {
                return NULL;
        }
@@ -1573,7 +1574,8 @@ VALUE_PAIR *pairmake(const char *attribute, const char *value, FR_TOKEN op)
                return pairmake_any(attrname, value, op);
        }
 
-       if ((vp = pairalloc(da)) == NULL) {
+       vp = pairalloc(NULL, da);
+       if (!vp) {
                return NULL;
        }
 
index 2e36843eb68cbf2e21ae7bcba700864bc04c1819..a83518a59b13e2ae6d1f74a20bd6732b668349f3 100644 (file)
@@ -473,7 +473,7 @@ static rlm_cache_entry_t *cache_add(rlm_cache_t *inst, REQUEST *request,
                               fr_int2str(fr_tokens, map->op, "¿unknown?"),
                               buffer);
 
-                       vp = pairalloc(map->dst->da);
+                       vp = pairalloc(NULL, map->dst->da);
                        if (!vp) continue;
                        
                        vp->op = map->op;
@@ -498,7 +498,7 @@ static rlm_cache_entry_t *cache_add(rlm_cache_t *inst, REQUEST *request,
                               fr_int2str(fr_tokens, map->op, "¿unknown?"),
                               map->src->name);
                               
-                       vp = pairalloc(map->dst->da);
+                       vp = pairalloc(NULL, map->dst->da);
                        if (!vp) continue;
                        
                        vp->op = map->op;
index 70332915f8026f221265e7f9854593992f615744..3ee5d01c68dbe70f38cbf3170d794c3077d8cda5 100644 (file)
@@ -277,7 +277,7 @@ static VALUE_PAIR *diameter2vp(REQUEST *request, SSL *ssl,
                                if (vp) pairfree(&vp);
                                da = dict_attrunknown(attr, vendor, TRUE);
                                if (!da) return NULL;
-                               vp = pairalloc(da);
+                               vp = pairalloc(NULL, da);
                                if (size >= 253) size = 253;
                                vp->length = size;
                                memcpy(vp->vp_octets, data, vp->length);
index 58c79550d434521fb7ff6b78a211dfa769b11596..f18a3b7054d3edaf1d804b3365d6070e196f8bf7 100644 (file)
@@ -1629,7 +1629,7 @@ static VALUE_PAIR *ldap_getvalue(REQUEST *request, const value_pair_map_t *map,
         *      just use whatever was set in the attribute map. 
         */
        for (i = 0; i < self->count; i++) {
-               vp = pairalloc(map->dst->da);
+               vp = pairalloc(NULL, map->dst->da);
                rad_assert(vp);
 
                pairparsevalue(vp, self->values[i]);
index 5a7d3d4669aba975c65a7e8c1ccee377c21f98f0..9bf465800be4da029b10530024d8a435251b5e37 100644 (file)
@@ -1056,7 +1056,7 @@ static int rest_decode_post(rlm_rest_t *instance,
                        goto skip;
                }
 
-               vp = pairalloc(da);
+               vp = pairalloc(NULL, da);
                if (!vp) {
                        radlog(L_ERR, "rlm_rest (%s): Failed creating"
                               " valuepair", instance->xlat_name);
index 3e6ed6f1405b93b7a607544620af5ed102121068..ba1e4e85449cdd356d5ebf2f3ec1e6807f812dbb 100644 (file)
@@ -473,7 +473,7 @@ int sql_set_user(SQL_INST *inst, REQUEST *request, const char *username)
                return -1;
        }
        
-       vp = pairalloc(inst->sql_user);
+       vp = pairalloc(NULL, inst->sql_user);
        vp->op = T_OP_SET;
        
        strlcpy(vp->vp_strvalue, buffer, sizeof(vp->vp_strvalue));