Skip to content

Commit

Permalink
Remove duplicate escaping/special rules in sqlippool_expand
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Mar 19, 2014
1 parent 4d3d355 commit 5abbfc3
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions src/modules/rlm_sqlippool/rlm_sqlippool.c
Expand Up @@ -242,36 +242,17 @@ static int sqlippool_expand(char * out, int outlen, char const * fmt,
break;

c = *p;
if (c != '%' && c != '$' && c != '\\') {
if (c != '%') {
*q++ = *p;
continue;
}

if (*++p == '\0')
if (*++p == '\0') {
break;

if (c == '\\') {
switch(*p) {
case '\\':
*q++ = '\\';
break;
case 't':
*q++ = '\t';
break;
case 'n':
*q++ = '\n';
break;
default:
*q++ = c;
*q++ = *p;
break;
}
}
else if (c == '%') {

if (c == '%') {
switch(*p) {
case '%':
*q++ = *p;
break;
case 'P': /* pool name */
strlcpy(q, data->pool_name, freespace);
q += strlen(q);
Expand All @@ -293,6 +274,7 @@ static int sqlippool_expand(char * out, int outlen, char const * fmt,
strlcpy(q, tmp, freespace);
q += strlen(q);
break;

default:
*q++ = '%';
*q++ = *p;
Expand Down

0 comments on commit 5abbfc3

Please sign in to comment.