/*
-** Copyright 2012 Double Precision, Inc. See COPYING for
+** Copyright 2012-2015 Double Precision, Inc. See COPYING for
** distribution information.
*/
for (i=0; i<configauth_size; )
{
p=configauth+i;
- if (memcmp(p, env, l) == 0 &&
+ if (strncmp(p, env, l) == 0 &&
isspace((int)(unsigned char)p[l]))
{
p += l;
#define SV_END_LEN ((sizeof(SV_END_MARK))-1)
/* siefca@pld.org.pl */
-struct var_data {
+struct var_data {
const char *name;
const char *value;
const size_t size;
"%.*s...", MAX_SUBSTITUTION_LEN, begin);
return NULL;
}
-
+
for (vdp=vdt; vdp->name; vdp++)
if (vdp->size == len+1 &&
!strncmp(begin, vdp->name, len))
vdp->value_length = strlen (vdp->value);
return vdp;
}
-
+
err("get_variable: unknown substitution variable "
SV_BEGIN_MARK
"%.*s"
SV_END_MARK
, (int)len, begin);
-
+
return NULL;
}
"query string");
return -1;
}
-
+
*((size_t *)vp) += length;
-
+
return 0;
}
"query string");
return -1;
}
-
+
if (!length) return 0;
memcpy ((void *) *strptr, (void *) p, length);
*strptr += length;
-
+
return 0;
}
"while parser core was invoked");
return -1;
}
-
+
q = source;
while ( (p=strstr(q, SV_BEGIN_MARK)) )
{
"%.*s...", MAX_SUBSTITUTION_LEN, p);
return -1;
}
-
+
/*
**
** __________sometext$(variable_name)_________
- ** | | | |
+ ** | | | |
** t_begin' t_end' `v_begin `v_end
**
*/
v_begin = p+SV_BEGIN_LEN; /* variable field ptr */
v_end = e-SV_END_LEN; /* variable field last character */
v_size = v_end-v_begin+1;/* variable field length */
-
+
t_begin = q; /* text field ptr */
t_end = p-1; /* text field last character */
t_size = t_end-t_begin+1;/* text field length */
/* work on text */
if ( (outfn (t_begin, t_size, result)) == -1 )
return -1;
-
+
/* work on variable */
v_ptr = get_variable (v_begin, v_size, vdt);
if (!v_ptr) return -1;
-
+
if ( (outfn (v_ptr->value, v_ptr->value_length, result)) == -1 )
return -1;
-
+
q = e + 1;
}
*pass_buf = NULL;
size_t buf_size = 2;
- if (source == NULL || *source == '\0' ||
+ if (source == NULL || *source == '\0' ||
vdt == NULL || vdt[0].name == NULL)
{
err("auth_parse: source clause is empty "
{
free (output_buf);
return NULL;
- }
+ }
*pass_buf = '\0';
-
+
return output_buf;
}
vd[1].value=d_part;
vd[2].value = newpass;
vd[3].value = newpass_crypt;
-
+
if (!vd[0].value || !vd[1].value ||
!vd[2].value || !vd[3].value)
{