char searchin; /* The same as above just coded as a number for speed */
char *replace; /* The replacement */
int replace_len; /* The length of the replacement string */
- int append; /* Switch to control append mode (1,0) */
+ int append; /* Switch to control append mode (1,0) */
int nocase; /* Ignore case */
int new_attr; /* Boolean. Do we create a new attribute or not? */
int num_matches; /* Maximum number of matches */
rlm_attr_rewrite_t *data;
DICT_ATTR *dattr;
char *instance_name = NULL;
-
+
/*
* Set up a storage area for instance data
*/
}
/*
- * Discover the attribute number of the key.
+ * Discover the attribute number of the key.
*/
if (data->attribute == NULL) {
radlog(L_ERR, "rlm_attr_rewrite: 'attribute' must be set.");
instance_name = cf_section_name2(conf);
if (instance_name != NULL)
data->name = strdup(instance_name);
-
-
+
+
*instance = data;
-
+
return 0;
}
len = pmatch.rm_so;
if (data->append) {
len = len + (pmatch.rm_eo - pmatch.rm_so);
- }
+ }
counter += len;
if (counter >= MAX_STRING_LEN) {
regfree(&preg);
DEBUG2("rlm_attr_rewrite: Replacement out of limits for attribute %s with value '%s'",
- data->attribute, attr_vp->strvalue);
+ data->attribute, attr_vp->strvalue);
return ret;
}
if (counter >= MAX_STRING_LEN) {
regfree(&preg);
DEBUG2("rlm_attr_rewrite: Replacement out of limits for attribute %s with value '%s'",
- data->attribute, attr_vp->strvalue);
+ data->attribute, attr_vp->strvalue);
return ret;
}
if (replace_len){
strncpy(ptr, replace_STR, replace_len);
- ptr += replace_len;
+ ptr += replace_len;
}
}
regfree(&preg);
counter += len;
if (counter >= MAX_STRING_LEN){
DEBUG2("rlm_attr_rewrite: Replacement out of limits for attribute %s with value '%s'",
- data->attribute, attr_vp->strvalue);
+ data->attribute, attr_vp->strvalue);
return ret;
}
strncpy(ptr, ptr2, len);
DEBUG2("rlm_attr_rewrite: Added attribute %s with value '%s'",data->attribute,replace_STR);
ret = RLM_MODULE_OK;
}
-
+
return ret;
}
free(data->attribute);
if (data->search)
free(data->search);
- if (data->replace)
+ if (data->replace)
free(data->replace);
if (data->name)
free(data->name);
* is single-threaded.
*/
module_t rlm_attr_rewrite = {
- "attr_rewrite",
+ "attr_rewrite",
RLM_TYPE_THREAD_UNSAFE, /* type */
NULL, /* initialization */
attr_rewrite_instantiate, /* instantiation */