if (cp[1] == '\0') break;
/* contains embedded newline; needs doubling */
- ret = string_cat(ret, &size, &ptr, s, cp-s+1);
- ret = string_cat(ret, &size, &ptr, US"\n", 1);
+ ret = string_catn(ret, &size, &ptr, s, cp-s+1);
+ ret = string_catn(ret, &size, &ptr, US"\n", 1);
s = cp+1;
}
/* last bit of header */
- ret = string_cat(ret, &size, &ptr, s, cp-s+1); /* newline-sep list */
+ ret = string_catn(ret, &size, &ptr, s, cp-s+1); /* newline-sep list */
}
while((h = h->next));
{
joinstr[0] = sep;
joinstr[1] = ' ';
- *ptr = string_cat(*ptr, sizeptr, ptrptr, US"<", 1);
+ *ptr = string_catn(*ptr, sizeptr, ptrptr, US"<", 1);
}
- *ptr = string_cat(*ptr, sizeptr, ptrptr, joinstr, 2);
- *ptr = string_cat(*ptr, sizeptr, ptrptr, s, Ustrlen(s));
+ *ptr = string_catn(*ptr, sizeptr, ptrptr, joinstr, 2);
+ *ptr = string_cat (*ptr, sizeptr, ptrptr, s);
}
if (new_smtp_port != NULL)
s = LOGGING(outgoing_port)
? string_append(s, sizep, ptrp, 2, US"]:",
string_sprintf("%d", sending_port))
- : string_cat(s, sizep, ptrp, US"]", 1);
+ : string_catn(s, sizep, ptrp, US"]", 1);
}
return s;
}
s = string_append(s, &size, &ptr, 2, US" H=", addr->host_list->name);
s = d_log_interface(s, &size, &ptr);
if (addr->shadow_message)
- s = string_cat(s, &size, &ptr, addr->shadow_message,
- Ustrlen(addr->shadow_message));
+ s = string_cat(s, &size, &ptr, addr->shadow_message);
}
/* Remote delivery */
{
s = d_hostlog(s, &size, &ptr, addr);
if (continue_sequence > 1)
- s = string_cat(s, &size, &ptr, US"*", 1);
+ s = string_catn(s, &size, &ptr, US"*", 1);
#ifndef DISABLE_EVENT
deliver_host_address = addr->host_used->address;
log_address = string_log_address(addr, LOGGING(all_parents), result == OK);
- s = string_cat(s, &size, &ptr, log_address, Ustrlen(log_address));
+ s = string_cat(s, &size, &ptr, log_address);
/* Either driver_name contains something and driver_kind contains
" router" or " transport" (note the leading space), or driver_name is
s = string_append(s, &size, &ptr, 2, US" ", driver_kind);
sprintf(CS ss, " defer (%d)", addr->basic_errno);
- s = string_cat(s, &size, &ptr, ss, Ustrlen(ss));
+ s = string_cat(s, &size, &ptr, ss);
if (addr->basic_errno > 0)
s = string_append(s, &size, &ptr, 2, US": ",
log_address = string_log_address(addr, LOGGING(all_parents), result == OK);
- s = string_cat(s, &size, &ptr, log_address, Ustrlen(log_address));
+ s = string_cat(s, &size, &ptr, log_address);
if (LOGGING(sender_on_delivery))
s = string_append(s, &size, &ptr, 3, US" F=<", sender_address, US">");
para = store_get(size);
for (;;)
{
- para = string_cat(para, &size, &ptr, buffer, Ustrlen(buffer));
+ para = string_cat(para, &size, &ptr, buffer);
if (!Ufgets(buffer, sizeof(buffer), f) || Ustrcmp(buffer, "****\n") == 0)
break;
}
if (!needs_quote) return lpart;
size = ptr = 0;
-yield = string_cat(NULL, &size, &ptr, US"\"", 1);
+yield = string_catn(NULL, &size, &ptr, US"\"", 1);
for (;;)
{
uschar *nq = US Ustrpbrk(lpart, "\\\"");
if (nq == NULL)
{
- yield = string_cat(yield, &size, &ptr, lpart, Ustrlen(lpart));
+ yield = string_cat(yield, &size, &ptr, lpart);
break;
}
- yield = string_cat(yield, &size, &ptr, lpart, nq - lpart);
- yield = string_cat(yield, &size, &ptr, US"\\", 1);
- yield = string_cat(yield, &size, &ptr, nq, 1);
+ yield = string_catn(yield, &size, &ptr, lpart, nq - lpart);
+ yield = string_catn(yield, &size, &ptr, US"\\", 1);
+ yield = string_catn(yield, &size, &ptr, nq, 1);
lpart = nq + 1;
}
-yield = string_cat(yield, &size, &ptr, US"\"", 1);
+yield = string_catn(yield, &size, &ptr, US"\"", 1);
yield[ptr] = 0;
return yield;
}
while (p < ss && isspace(*p)) p++; /* leading space after cont */
}
- yield = string_cat(yield, &size, &ptr, p, ss - p);
+ yield = string_catn(yield, &size, &ptr, p, ss - p);
#ifdef USE_READLINE
if (fn_readline != NULL) free(readline_line);
uschar * s = store_get(size);
for (i = 0; i < recipients_count; i++)
{
- if (i != 0) s = string_cat(s, &size, &ptr, US", ", 2);
- s = string_cat(s, &size, &ptr, recipients_list[i].address,
- Ustrlen(recipients_list[i].address));
+ if (i != 0) s = string_catn(s, &size, &ptr, US", ", 2);
+ s = string_cat(s, &size, &ptr, recipients_list[i].address);
}
s[ptr] = 0; /* string_cat() leaves room */
return s;
lookup_value = NULL;
if (user_msg)
{
- lookup_value = string_cat(NULL, &size, &ptr, user_msg, Ustrlen(user_msg));
+ lookup_value = string_cat(NULL, &size, &ptr, user_msg);
lookup_value[ptr] = '\0';
}
*yield = cond == testfor;
{
if (type[0] == 'i')
{
- if (yes) *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, US"true", 4);
+ if (yes) *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true", 4);
}
else
{
if (yes && lookup_value)
- *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value,
- Ustrlen(lookup_value));
+ *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value);
lookup_value = save_lookup;
}
s++;
/* If we want the first string, add it to the output */
if (yes)
- *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub1, Ustrlen(sub1));
+ *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub1);
/* If this is called from a lookup/env or a (cert)extract, we want to restore
$value to what it was at the start of the item, so that it has this value
/* If we want the second string, add it to the output */
if (!yes)
- *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub2, Ustrlen(sub2));
+ *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub2);
}
/* If there is no second string, but the word "fail" is present when the use of
if (Ustrlen(key) > 64)
return NULL;
-hash_source = string_cat(NULL,&size,&offset,key_num,1);
-hash_source = string_cat(hash_source,&size,&offset,daystamp,3);
-hash_source = string_cat(hash_source,&size,&offset,address,Ustrlen(address));
+hash_source = string_catn(NULL, &size, &offset, key_num, 1);
+hash_source = string_catn(hash_source, &size, &offset, daystamp, 3);
+hash_source = string_cat(hash_source, &size, &offset, address);
hash_source[offset] = '\0';
DEBUG(D_expand) debug_printf("prvs: hash source is '%s'\n", hash_source);
{
int len = Ustrlen(buffer);
if (eol && buffer[len-1] == '\n') len--;
- yield = string_cat(yield, sizep, ptrp, buffer, len);
+ yield = string_catn(yield, sizep, ptrp, buffer, len);
if (buffer[len] != 0)
- yield = string_cat(yield, sizep, ptrp, eol, eollen);
+ yield = string_catn(yield, sizep, ptrp, eol, eollen);
}
if (yield) yield[*ptrp] = 0;
{
const uschar * t = s + 2;
for (s = t; *s != 0; s++) if (*s == '\\' && s[1] == 'N') break;
- yield = string_cat(yield, &size, &ptr, t, s - t);
+ yield = string_catn(yield, &size, &ptr, t, s - t);
if (*s != 0) s += 2;
}
uschar ch[1];
ch[0] = string_interpret_escape(&s);
s++;
- yield = string_cat(yield, &size, &ptr, ch, 1);
+ yield = string_catn(yield, &size, &ptr, ch, 1);
}
continue;
if (*s != '$' || !honour_dollar)
{
- yield = string_cat(yield, &size, &ptr, s++, 1);
+ yield = string_catn(yield, &size, &ptr, s++, 1);
continue;
}
size = newsize;
ptr = len;
}
- else yield = string_cat(yield, &size, &ptr, value, len);
+ else yield = string_catn(yield, &size, &ptr, value, len);
continue;
}
int n;
s = read_cnumber(&n, s);
if (n >= 0 && n <= expand_nmax)
- yield = string_cat(yield, &size, &ptr, expand_nstring[n],
+ yield = string_catn(yield, &size, &ptr, expand_nstring[n],
expand_nlength[n]);
continue;
}
goto EXPAND_FAILED;
}
if (n >= 0 && n <= expand_nmax)
- yield = string_cat(yield, &size, &ptr, expand_nstring[n],
+ yield = string_catn(yield, &size, &ptr, expand_nstring[n],
expand_nlength[n]);
continue;
}
DEBUG(D_expand)
debug_printf("acl expansion yield: %s\n", user_msg);
if (user_msg)
- yield = string_cat(yield, &size, &ptr, user_msg, Ustrlen(user_msg));
+ yield = string_cat(yield, &size, &ptr, user_msg);
continue;
case DEFER:
sub_arg[1][0], sub_arg[2], &expand_string_message)))
goto EXPAND_FAILED;
if (!skipping)
- yield = string_cat(yield, &size, &ptr, encoded, Ustrlen(encoded));
+ yield = string_cat(yield, &size, &ptr, encoded);
continue;
}
#endif
/* Now separate the domain from the local part */
*domain++ = '\0';
- yield = string_cat(yield,&size,&ptr,US"prvs=",5);
- string_cat(yield,&size,&ptr,(sub_arg[2] != NULL) ? sub_arg[2] : US"0", 1);
- string_cat(yield,&size,&ptr,prvs_daystamp(7),3);
- string_cat(yield,&size,&ptr,p,6);
- string_cat(yield,&size,&ptr,US"=",1);
- string_cat(yield,&size,&ptr,sub_arg[0],Ustrlen(sub_arg[0]));
- string_cat(yield,&size,&ptr,US"@",1);
- string_cat(yield,&size,&ptr,domain,Ustrlen(domain));
+ yield = string_catn(yield, &size, &ptr, US"prvs=", 5);
+ yield = string_catn(yield, &size, &ptr, sub_arg[2] ? sub_arg[2] : US"0", 1);
+ yield = string_catn(yield, &size, &ptr, prvs_daystamp(7), 3);
+ yield = string_catn(yield, &size, &ptr, p, 6);
+ yield = string_catn(yield, &size, &ptr, US"=", 1);
+ yield = string_cat (yield, &size, &ptr, sub_arg[0]);
+ yield = string_catn(yield, &size, &ptr, US"@", 1);
+ yield = string_cat (yield, &size, &ptr, domain);
continue;
}
DEBUG(D_expand) debug_printf("prvscheck domain: %s\n", domain);
/* Set up expansion variables */
- prvscheck_address = string_cat(NULL, &mysize, &myptr, local_part, Ustrlen(local_part));
- string_cat(prvscheck_address,&mysize,&myptr,US"@",1);
- string_cat(prvscheck_address,&mysize,&myptr,domain,Ustrlen(domain));
+ prvscheck_address = string_cat (NULL, &mysize, &myptr, local_part);
+ prvscheck_address = string_catn(prvscheck_address, &mysize, &myptr, US"@", 1);
+ prvscheck_address = string_cat (prvscheck_address, &mysize, &myptr, domain);
prvscheck_address[myptr] = '\0';
prvscheck_keynum = string_copy(key_num);
case 3: goto EXPAND_FAILED;
}
- if (sub_arg[0] == NULL || *sub_arg[0] == '\0')
- yield = string_cat(yield,&size,&ptr,prvscheck_address,Ustrlen(prvscheck_address));
- else
- yield = string_cat(yield,&size,&ptr,sub_arg[0],Ustrlen(sub_arg[0]));
+ yield = string_cat(yield, &size, &ptr,
+ !sub_arg[0] || !*sub_arg[0] ? prvscheck_address : sub_arg[0]);
/* Reset the "internal" variables afterwards, because they are in
dynamic store that will be reclaimed if the expansion succeeded. */
SOCK_FAIL:
if (*s != '{') goto EXPAND_FAILED;
DEBUG(D_any) debug_printf("%s\n", expand_string_message);
- arg = expand_string_internal(s+1, TRUE, &s, FALSE, TRUE, &resetok);
- if (arg == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, arg, Ustrlen(arg));
+ if (!(arg = expand_string_internal(s+1, TRUE, &s, FALSE, TRUE, &resetok)))
+ goto EXPAND_FAILED;
+ yield = string_cat(yield, &size, &ptr, arg);
if (*s++ != '}') goto EXPAND_FAILED_CURLY;
while (isspace(*s)) s++;
if (*s++ != '}') goto EXPAND_FAILED_CURLY;
case 3: goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, sub[0], Ustrlen(sub[0]));
+ yield = string_cat(yield, &size, &ptr, sub[0]);
o2m = Ustrlen(sub[2]) - 1;
if (o2m >= 0) for (; oldptr < ptr; oldptr++)
extract_substr(sub[2], val[0], val[1], &len);
if (ret == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, ret, len);
+ yield = string_catn(yield, &size, &ptr, ret, len);
continue;
}
DEBUG(D_any) debug_printf("HMAC[%s](%.*s,%.*s)=%.*s\n", sub[0],
(int)keylen, keyptr, Ustrlen(sub[2]), sub[2], hashlen*2, finalhash_hex);
- yield = string_cat(yield, &size, &ptr, finalhash_hex, hashlen*2);
+ yield = string_catn(yield, &size, &ptr, finalhash_hex, hashlen*2);
}
continue;
emptyopt = 0;
continue;
}
- yield = string_cat(yield, &size, &ptr, subject+moffset, slen-moffset);
+ yield = string_catn(yield, &size, &ptr, subject+moffset, slen-moffset);
break;
}
/* Copy the characters before the match, plus the expanded insertion. */
- yield = string_cat(yield, &size, &ptr, subject + moffset,
+ yield = string_catn(yield, &size, &ptr, subject + moffset,
ovector[0] - moffset);
insert = expand_string(sub[2]);
if (insert == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, insert, Ustrlen(insert));
+ yield = string_cat(yield, &size, &ptr, insert);
moffset = ovector[1];
moffsetextra = 0;
separator character, or is an empty string. */
if (ptr != save_ptr && (temp[0] == *outsep || temp[0] == 0))
- yield = string_cat(yield, &size, &ptr, US" ", 1);
+ yield = string_catn(yield, &size, &ptr, US" ", 1);
/* Add the string in "temp" to the output list that we are building,
This is done in chunks by searching for the separator character. */
for (;;)
{
size_t seglen = Ustrcspn(temp, outsep);
- yield = string_cat(yield, &size, &ptr, temp, seglen + 1);
+
+ yield = string_catn(yield, &size, &ptr, temp, seglen + 1);
/* If we got to the end of the string we output one character
too many; backup and end the loop. Otherwise arrange to double the
separator. */
if (temp[seglen] == '\0') { ptr--; break; }
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
temp += seglen + 1;
}
/* Output a separator after the string: we will remove the redundant
final one at the end. */
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
} /* End of iteration over the list loop */
/* REDUCE has generated no output above: output the final value of
if (item_type == EITEM_REDUCE)
{
- yield = string_cat(yield, &size, &ptr, lookup_value,
- Ustrlen(lookup_value));
+ yield = string_cat(yield, &size, &ptr, lookup_value);
lookup_value = save_lookup_value; /* Restore $value */
}
}
if (dstlist)
- yield = string_cat(yield, &size, &ptr, dstlist, Ustrlen(dstlist));
+ yield = string_cat(yield, &size, &ptr, dstlist);
/* Restore preserved $item */
iterate_item = save_iterate_item;
if(status == OK)
{
if (result == NULL) result = US"";
- yield = string_cat(yield, &size, &ptr, result, Ustrlen(result));
+ yield = string_cat(yield, &size, &ptr, result);
continue;
}
else
goto EXPAND_FAILED;
}
t = string_base62(n);
- yield = string_cat(yield, &size, &ptr, t, Ustrlen(t));
+ yield = string_cat(yield, &size, &ptr, t);
continue;
}
n = n * BASE_62 + (t - base62_chars);
}
(void)sprintf(CS buf, "%ld", n);
- yield = string_cat(yield, &size, &ptr, buf, Ustrlen(buf));
+ yield = string_cat(yield, &size, &ptr, buf);
continue;
}
expand_string_message);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, expanded, Ustrlen(expanded));
+ yield = string_cat(yield, &size, &ptr, expanded);
continue;
}
int count = 0;
uschar *t = sub - 1;
while (*(++t) != 0) { *t = tolower(*t); count++; }
- yield = string_cat(yield, &size, &ptr, sub, count);
+ yield = string_catn(yield, &size, &ptr, sub, count);
continue;
}
int count = 0;
uschar *t = sub - 1;
while (*(++t) != 0) { *t = toupper(*t); count++; }
- yield = string_cat(yield, &size, &ptr, sub, count);
+ yield = string_catn(yield, &size, &ptr, sub, count);
continue;
}
if (vp && *(void **)vp->value)
{
uschar * cp = tls_cert_fprt_md5(*(void **)vp->value);
- yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
}
else
#endif
md5_start(&base);
md5_end(&base, sub, Ustrlen(sub), digest);
for(j = 0; j < 16; j++) sprintf(st+2*j, "%02x", digest[j]);
- yield = string_cat(yield, &size, &ptr, US st, (int)strlen(st));
+ yield = string_cat(yield, &size, &ptr, US st);
}
continue;
if (vp && *(void **)vp->value)
{
uschar * cp = tls_cert_fprt_sha1(*(void **)vp->value);
- yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
}
else
#endif
sha1_start(&base);
sha1_end(&base, sub, Ustrlen(sub), digest);
for(j = 0; j < 20; j++) sprintf(st+2*j, "%02X", digest[j]);
- yield = string_cat(yield, &size, &ptr, US st, (int)strlen(st));
+ yield = string_cat(yield, &size, &ptr, US st);
}
continue;
if (vp && *(void **)vp->value)
{
uschar * cp = tls_cert_fprt_sha256(*(void **)vp->value);
- yield = string_cat(yield, &size, &ptr, cp, (int)Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
}
else
#endif
}
enc = b64encode(sub, out - sub);
- yield = string_cat(yield, &size, &ptr, enc, Ustrlen(enc));
+ yield = string_cat(yield, &size, &ptr, enc);
continue;
}
while (*(++t) != 0)
{
if (*t < 0x21 || 0x7E < *t)
- yield = string_cat(yield, &size, &ptr,
+ yield = string_catn(yield, &size, &ptr,
string_sprintf("\\x%02x", *t), 4);
else
- yield = string_cat(yield, &size, &ptr, t, 1);
+ yield = string_catn(yield, &size, &ptr, t, 1);
}
continue;
}
while (string_nextinlist(CUSS &sub, &sep, buffer, sizeof(buffer)) != NULL) cnt++;
cp = string_sprintf("%d", cnt);
- yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
continue;
}
{
uschar * buf = US" : ";
if (needsep)
- yield = string_cat(yield, &size, &ptr, buf, 3);
+ yield = string_catn(yield, &size, &ptr, buf, 3);
else
needsep = TRUE;
tok[0] = sep; tok[1] = ':'; tok[2] = 0;
while ((cp= strpbrk((const char *)item, tok)))
{
- yield = string_cat(yield, &size, &ptr, item, cp-(char *)item);
+ yield = string_catn(yield, &size, &ptr, item, cp-(char *)item);
if (*cp++ == ':') /* colon in a non-colon-sep list item, needs doubling */
{
- yield = string_cat(yield, &size, &ptr, US"::", 2);
+ yield = string_catn(yield, &size, &ptr, US"::", 2);
item = (uschar *)cp;
}
else /* sep in item; should already be doubled; emit once */
{
- yield = string_cat(yield, &size, &ptr, (uschar *)tok, 1);
+ yield = string_catn(yield, &size, &ptr, (uschar *)tok, 1);
if (*cp == sep) cp++;
item = (uschar *)cp;
}
}
}
- yield = string_cat(yield, &size, &ptr, item, Ustrlen(item));
+ yield = string_cat(yield, &size, &ptr, item);
}
continue;
}
/* Convert to masked textual format and add to output. */
- yield = string_cat(yield, &size, &ptr, buffer,
+ yield = string_catn(yield, &size, &ptr, buffer,
host_nmtoa(count, binary, mask, buffer, '.'));
continue;
}
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, buffer,
+ yield = string_catn(yield, &size, &ptr, buffer,
c == EOP_IPV6NORM
? ipv6_nmtoa(binary, buffer)
: host_nmtoa(4, binary, -1, buffer, ':')
if (c != EOP_DOMAIN)
{
if (c == EOP_LOCAL_PART && domain != 0) end = start + domain - 1;
- yield = string_cat(yield, &size, &ptr, sub+start, end-start);
+ yield = string_catn(yield, &size, &ptr, sub+start, end-start);
}
else if (domain != 0)
{
domain += start;
- yield = string_cat(yield, &size, &ptr, sub+domain, end-domain);
+ yield = string_catn(yield, &size, &ptr, sub+domain, end-domain);
}
}
continue;
if (address != NULL)
{
if (ptr != save_ptr && address[0] == *outsep)
- yield = string_cat(yield, &size, &ptr, US" ", 1);
+ yield = string_catn(yield, &size, &ptr, US" ", 1);
for (;;)
{
size_t seglen = Ustrcspn(address, outsep);
- yield = string_cat(yield, &size, &ptr, address, seglen + 1);
+ yield = string_catn(yield, &size, &ptr, address, seglen + 1);
/* If we got to the end of the string we output one character
too many. */
if (address[seglen] == '\0') { ptr--; break; }
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
address += seglen + 1;
}
/* Output a separator after the string: we will remove the
redundant final one at the end. */
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
}
if (saveend == '\0') break;
if (needs_quote)
{
- yield = string_cat(yield, &size, &ptr, US"\"", 1);
+ yield = string_catn(yield, &size, &ptr, US"\"", 1);
t = sub - 1;
while (*(++t) != 0)
{
if (*t == '\n')
- yield = string_cat(yield, &size, &ptr, US"\\n", 2);
+ yield = string_catn(yield, &size, &ptr, US"\\n", 2);
else if (*t == '\r')
- yield = string_cat(yield, &size, &ptr, US"\\r", 2);
+ yield = string_catn(yield, &size, &ptr, US"\\r", 2);
else
{
if (*t == '\\' || *t == '"')
- yield = string_cat(yield, &size, &ptr, US"\\", 1);
- yield = string_cat(yield, &size, &ptr, t, 1);
+ yield = string_catn(yield, &size, &ptr, US"\\", 1);
+ yield = string_catn(yield, &size, &ptr, t, 1);
}
}
- yield = string_cat(yield, &size, &ptr, US"\"", 1);
+ yield = string_catn(yield, &size, &ptr, US"\"", 1);
}
- else yield = string_cat(yield, &size, &ptr, sub, Ustrlen(sub));
+ else yield = string_cat(yield, &size, &ptr, sub);
continue;
}
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, sub, Ustrlen(sub));
+ yield = string_cat(yield, &size, &ptr, sub);
continue;
}
while (*(++t) != 0)
{
if (!isalnum(*t))
- yield = string_cat(yield, &size, &ptr, US"\\", 1);
- yield = string_cat(yield, &size, &ptr, t, 1);
+ yield = string_catn(yield, &size, &ptr, US"\\", 1);
+ yield = string_catn(yield, &size, &ptr, t, 1);
}
continue;
}
uschar buffer[2048];
const uschar *string = parse_quote_2047(sub, Ustrlen(sub), headers_charset,
buffer, sizeof(buffer), FALSE);
- yield = string_cat(yield, &size, &ptr, string, Ustrlen(string));
+ yield = string_cat(yield, &size, &ptr, string);
continue;
}
expand_string_message = error;
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, decoded, len);
+ yield = string_catn(yield, &size, &ptr, decoded, len);
continue;
}
GETUTF8INC(c, sub);
if (c > 255) c = '_';
buff[0] = c;
- yield = string_cat(yield, &size, &ptr, buff, 1);
+ yield = string_catn(yield, &size, &ptr, buff, 1);
}
continue;
}
complete = -1; /* error (RFC3629 limit) */
else
{ /* finished; output utf-8 sequence */
- yield = string_cat(yield, &size, &ptr, seq_buff, seq_len);
+ yield = string_catn(yield, &size, &ptr, seq_buff, seq_len);
index = 0;
}
}
{
if((c & 0x80) == 0) /* 1-byte sequence, US-ASCII, keep it */
{
- yield = string_cat(yield, &size, &ptr, &c, 1);
+ yield = string_catn(yield, &size, &ptr, &c, 1);
continue;
}
if((c & 0xe0) == 0xc0) /* 2-byte sequence */
if (complete != 0)
{
bytes_left = index = 0;
- yield = string_cat(yield, &size, &ptr, UTF8_REPLACEMENT_CHAR, 1);
+ yield = string_catn(yield, &size, &ptr, UTF8_REPLACEMENT_CHAR, 1);
}
if ((complete == 1) && ((c & 0x80) == 0))
/* ASCII character follows incomplete sequence */
- yield = string_cat(yield, &size, &ptr, &c, 1);
+ yield = string_catn(yield, &size, &ptr, &c, 1);
}
continue;
}
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
DEBUG(D_expand) debug_printf("yield: '%s'\n", yield);
continue;
}
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
#endif /* EXPERIMENTAL_INTERNATIONAL */
case EOP_ESCAPE:
{
const uschar *t = string_printing(sub);
- yield = string_cat(yield, &size, &ptr, t, Ustrlen(t));
+ yield = string_cat(yield, &size, &ptr, t);
continue;
}
goto EXPAND_FAILED;
}
sprintf(CS var_buffer, PR_EXIM_ARITH, n);
- yield = string_cat(yield, &size, &ptr, var_buffer, Ustrlen(var_buffer));
+ yield = string_cat(yield, &size, &ptr, var_buffer);
continue;
}
goto EXPAND_FAILED;
}
sprintf(CS var_buffer, "%d", n);
- yield = string_cat(yield, &size, &ptr, var_buffer, Ustrlen(var_buffer));
+ yield = string_cat(yield, &size, &ptr, var_buffer);
continue;
}
goto EXPAND_FAILED;
}
t = readconf_printtime(n);
- yield = string_cat(yield, &size, &ptr, t, Ustrlen(t));
+ yield = string_cat(yield, &size, &ptr, t);
continue;
}
#else
uschar * s = b64encode(sub, Ustrlen(sub));
#endif
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
"well-formed for \"%s\" operator", sub, name);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
{
uschar buff[24];
(void)sprintf(CS buff, "%d", Ustrlen(sub));
- yield = string_cat(yield, &size, &ptr, buff, Ustrlen(buff));
+ yield = string_cat(yield, &size, &ptr, buff);
continue;
}
extract_substr(sub, value1, value2, &len);
if (ret == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, ret, len);
+ yield = string_catn(yield, &size, &ptr, ret, len);
continue;
}
(long)st.st_dev, (long)st.st_nlink, (long)st.st_uid,
(long)st.st_gid, st.st_size, (long)st.st_atime,
(long)st.st_mtime, (long)st.st_ctime);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
if (expand_string_message != NULL)
goto EXPAND_FAILED;
s = string_sprintf("%d", vaguely_random_number((int)max));
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
goto EXPAND_FAILED;
}
invert_address(reversed, sub);
- yield = string_cat(yield, &size, &ptr, reversed, Ustrlen(reversed));
+ yield = string_cat(yield, &size, &ptr, reversed);
continue;
}
size = newsize;
ptr = len;
}
- else yield = string_cat(yield, &size, &ptr, value, len);
+ else yield = string_catn(yield, &size, &ptr, value, len);
continue;
}
if (recipient != NULL)
{
- log_addr = string_cat(log_addr, &size, &ptr,
- (log_addr == NULL)? US">" : US",", 1);
- log_addr = string_cat(log_addr, &size, &ptr, recipient,
- Ustrlen(recipient));
+ log_addr = string_catn(log_addr, &size, &ptr,
+ log_addr ? US"," : US">", 1);
+ log_addr = string_cat(log_addr, &size, &ptr, recipient);
}
/* Check size */
if (ptr > 256)
{
- log_addr = string_cat(log_addr, &size, &ptr, US", ...", 5);
+ log_addr = string_catn(log_addr, &size, &ptr, US", ...", 5);
break;
}
extern uschar *string_append_listele(uschar *, uschar, const uschar *);
extern uschar *string_append_listele_n(uschar *, uschar, const uschar *, unsigned);
extern uschar *string_base62(unsigned long int);
-extern uschar *string_cat(uschar *, int *, int *, const uschar *, int);
+extern uschar *string_cat(uschar *, int *, int *, const uschar *);
+extern uschar *string_catn(uschar *, int *, int *, const uschar *, int);
extern int string_compare_by_pointer(const void *, const void *);
extern uschar *string_copy_dnsdomain(uschar *);
extern uschar *string_copy_malloc(const uschar *);
sender_fullhost = (sender_helo_name == NULL)? address :
string_sprintf("(%s) %s", sender_helo_name, address);
- sender_rcvhost = string_cat(NULL, &size, &ptr, address, adlen);
+ sender_rcvhost = string_catn(NULL, &size, &ptr, address, adlen);
if (sender_ident != NULL || show_helo || portptr != NULL)
{
int firstptr;
- sender_rcvhost = string_cat(sender_rcvhost, &size, &ptr, US" (", 2);
+ sender_rcvhost = string_catn(sender_rcvhost, &size, &ptr, US" (", 2);
firstptr = ptr;
if (portptr != NULL)
sender_rcvhost = string_append(sender_rcvhost, &size, &ptr, 2,
(firstptr == ptr)? US"ident=" : US" ident=", sender_ident);
- sender_rcvhost = string_cat(sender_rcvhost, &size, &ptr, US")", 1);
+ sender_rcvhost = string_catn(sender_rcvhost, &size, &ptr, US")", 1);
}
sender_rcvhost[ptr] = 0; /* string_cat() always leaves room */
if (outptr > outbuf + sizeof(outbuf) - 3)
{
- yield = string_cat(yield, &size, &ptr, outbuf, outptr - outbuf);
+ yield = string_catn(yield, &size, &ptr, outbuf, outptr - outbuf);
outptr = outbuf;
}
iconv_close(icd);
#endif
-yield = string_cat(yield, &size, &ptr, outbuf, outptr - outbuf);
+yield = string_catn(yield, &size, &ptr, outbuf, outptr - outbuf);
if (yield[ptr-1] == '.')
ptr--;
yield[ptr] = '\0';
dns_address *da;
for (da = dns_address_from_rr(&dnsa, rr); da; da = da->next)
{
- if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
- yield = string_cat(yield, &size, &ptr, da->address,
- Ustrlen(da->address));
+ if (ptr != 0) yield = string_catn(yield, &size, &ptr, outsep, 1);
+ yield = string_cat(yield, &size, &ptr, da->address);
}
continue;
}
/* Other kinds of record just have one piece of data each, but there may be
several of them, of course. */
- if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
+ if (ptr != 0) yield = string_catn(yield, &size, &ptr, outsep, 1);
if (type == T_TXT || type == T_SPF)
{
if (outsep2 == NULL)
{
/* output only the first item of data */
- yield = string_cat(yield, &size, &ptr, (uschar *)(rr->data+1),
+ yield = string_catn(yield, &size, &ptr, (uschar *)(rr->data+1),
(rr->data)[0]);
}
else
{
uschar chunk_len = (rr->data)[data_offset++];
if (outsep2[0] != '\0' && data_offset != 1)
- yield = string_cat(yield, &size, &ptr, outsep2, 1);
- yield = string_cat(yield, &size, &ptr,
- (uschar *)((rr->data)+data_offset), chunk_len);
+ yield = string_catn(yield, &size, &ptr, outsep2, 1);
+ yield = string_catn(yield, &size, &ptr,
+ US ((rr->data)+data_offset), chunk_len);
data_offset += chunk_len;
}
}
i++)
sp += sprintf(CS sp, "%02x", (unsigned char)p[i]);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
}
else /* T_CNAME, T_CSA, T_MX, T_MXH, T_NS, T_PTR, T_SOA, T_SRV */
{
case T_MX:
GETSHORT(priority, p);
sprintf(CS s, "%d%c", priority, *outsep2);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
break;
case T_SRV:
GETSHORT(port, p);
sprintf(CS s, "%d%c%d%c%d%c", priority, *outsep2,
weight, *outsep2, port, *outsep2);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
break;
case T_CSA:
}
s[1] = ' ';
- yield = string_cat(yield, &size, &ptr, s, 2);
+ yield = string_catn(yield, &size, &ptr, s, 2);
break;
default:
"domain=%s", dns_text_type(type), domain);
break;
}
- else yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ else yield = string_cat(yield, &size, &ptr, s);
if (type == T_SOA && outsep2 != NULL)
{
unsigned long serial, refresh, retry, expire, minimum;
p += rc;
- yield = string_cat(yield, &size, &ptr, outsep2, 1);
+ yield = string_catn(yield, &size, &ptr, outsep2, 1);
rc = dn_expand(dnsa.answer, dnsa.answer + dnsa.answerlen, p,
(DN_EXPAND_ARG4_TYPE)s, sizeof(s));
"domain=%s", dns_text_type(type), domain);
break;
}
- else yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ else yield = string_cat(yield, &size, &ptr, s);
p += rc;
GETLONG(serial, p); GETLONG(refresh, p);
sprintf(CS s, "%c%lu%c%lu%c%lu%c%lu%c%lu",
*outsep2, serial, *outsep2, refresh,
*outsep2, retry, *outsep2, expire, *outsep2, minimum);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
}
}
} /* Loop for list of returned records */
}
if (result != NULL)
- result = string_cat(result, &ssize, &offset, US "\n", 1);
+ result = string_catn(result, &ssize, &offset, US "\n", 1);
/* Find the number of fields returned. If this is one, we don't add field
names to the data. Otherwise we do. */
if (out_sqlda->sqld == 1) {
if (out_sqlda->sqlvar[0].sqlind == NULL || *out_sqlda->sqlvar[0].sqlind != -1) /* NULL value yields nothing */
result =
- string_cat(result, &ssize, &offset, US buffer,
+ string_catn(result, &ssize, &offset, US buffer,
fetch_field(buffer, sizeof(buffer),
&out_sqlda->sqlvar[0]));
}
string_cat(result, &ssize, &offset,
US out_sqlda->sqlvar[i].aliasname,
out_sqlda->sqlvar[i].aliasname_length);
- result = string_cat(result, &ssize, &offset, US "=", 1);
+ result = string_catn(result, &ssize, &offset, US "=", 1);
/* Quote the value if it contains spaces or is empty */
if (*out_sqlda->sqlvar[i].sqlind == -1) { /* NULL value */
result =
- string_cat(result, &ssize, &offset, US "\"\"", 2);
+ string_catn(result, &ssize, &offset, US "\"\"", 2);
}
else if (buffer[0] == 0 || Ustrchr(buffer, ' ') != NULL) {
int j;
result =
- string_cat(result, &ssize, &offset, US "\"", 1);
+ string_catn(result, &ssize, &offset, US "\"", 1);
for (j = 0; j < len; j++) {
if (buffer[j] == '\"' || buffer[j] == '\\')
result =
US buffer + j, 1);
}
result =
- string_cat(result, &ssize, &offset, US "\"", 1);
+ string_catn(result, &ssize, &offset, US "\"", 1);
} else {
result =
- string_cat(result, &ssize, &offset, US buffer,
- len);
+ string_catn(result, &ssize, &offset, US buffer, len);
}
- result = string_cat(result, &ssize, &offset, US " ", 1);
+ result = string_catn(result, &ssize, &offset, US " ", 1);
}
}
/* Results for multiple entries values are separated by newlines. */
- if (data != NULL) data = string_cat(data, &size, &ptr, US"\n", 1);
+ if (data != NULL) data = string_catn(data, &size, &ptr, US"\n", 1);
/* Get the DN from the last result. */
{ /* condition, because of the else */
if (new_dn != NULL) /* below, that's for the first only */
{
- data = string_cat(data, &size, &ptr, new_dn, Ustrlen(new_dn));
+ data = string_cat(data, &size, &ptr, new_dn);
data[ptr] = 0;
attribute_found = TRUE;
}
if (attrs_requested != 1)
{
if (insert_space)
- data = string_cat(data, &size, &ptr, US" ", 1);
+ data = string_catn(data, &size, &ptr, US" ", 1);
else
insert_space = TRUE;
- data = string_cat(data, &size, &ptr, attr, Ustrlen(attr));
- data = string_cat(data, &size, &ptr, US"=\"", 2);
+ data = string_cat(data, &size, &ptr, attr);
+ data = string_catn(data, &size, &ptr, US"=\"", 2);
}
while (*values != NULL)
attribute and append only every non first value. */
if (data && valuecount > 1)
- data = string_cat(data, &size, &ptr, US",", 1);
+ data = string_catn(data, &size, &ptr, US",", 1);
/* For multiple attributes, the data is in quotes. We must escape
internal quotes, backslashes, newlines, and must double commas. */
for (j = 0; j < len; j++)
{
if (value[j] == '\n')
- data = string_cat(data, &size, &ptr, US"\\n", 2);
+ data = string_catn(data, &size, &ptr, US"\\n", 2);
else if (value[j] == ',')
- data = string_cat(data, &size, &ptr, US",,", 2);
+ data = string_catn(data, &size, &ptr, US",,", 2);
else
{
if (value[j] == '\"' || value[j] == '\\')
- data = string_cat(data, &size, &ptr, US"\\", 1);
- data = string_cat(data, &size, &ptr, value+j, 1);
+ data = string_catn(data, &size, &ptr, US"\\", 1);
+ data = string_catn(data, &size, &ptr, value+j, 1);
}
}
}
int j;
for (j = 0; j < len; j++)
if (value[j] == ',')
- data = string_cat(data, &size, &ptr, US",,", 2);
+ data = string_catn(data, &size, &ptr, US",,", 2);
else
- data = string_cat(data, &size, &ptr, value+j, 1);
+ data = string_catn(data, &size, &ptr, value+j, 1);
}
/* Closing quote at the end of the data for a named attribute. */
if (attrs_requested != 1)
- data = string_cat(data, &size, &ptr, US"\"", 1);
+ data = string_catn(data, &size, &ptr, US"\"", 1);
/* Free the values */
if (value[0] == 0 || Ustrpbrk(value, " \t\n\r") != NULL || value[0] == '\"')
{
int j;
- result = string_cat(result, asize, aoffset, US"\"", 1);
+ result = string_catn(result, asize, aoffset, US"\"", 1);
for (j = 0; j < vlength; j++)
{
if (value[j] == '\"' || value[j] == '\\')
- result = string_cat(result, asize, aoffset, US"\\", 1);
- result = string_cat(result, asize, aoffset, US value+j, 1);
+ result = string_catn(result, asize, aoffset, US"\\", 1);
+ result = string_catn(result, asize, aoffset, US value+j, 1);
}
- result = string_cat(result, asize, aoffset, US"\"", 1);
+ result = string_catn(result, asize, aoffset, US"\"", 1);
}
else
- {
- result = string_cat(result, asize, aoffset, US value, vlength);
- }
+ result = string_catn(result, asize, aoffset, US value, vlength);
-return string_cat(result, asize, aoffset, US" ", 1);
+return string_catn(result, asize, aoffset, US" ", 1);
}
/* End of lf_quote.c */
ptr = 0;
yield = store_get(size);
if (*s != 0)
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
/* Now handle continuations */
/* Join a physical or logical line continuation onto the result string. */
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
}
yield[ptr] = 0;
unsigned long *lengths = mysql_fetch_lengths(mysql_result);
if (result != NULL)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
if (num_fields == 1)
{
if (mysql_row_data[0] != NULL) /* NULL value yields nothing */
- result = string_cat(result, &ssize, &offset, US mysql_row_data[0],
+ result = string_catn(result, &ssize, &offset, US mysql_row_data[0],
lengths[0]);
}
if (field_name == NULL)
{
- yield = string_cat(yield, &ssize, &offset,US tc->tc_name,
- Ustrlen(tc->tc_name));
- yield = string_cat(yield, &ssize, &offset, US"=", 1);
+ yield = string_cat(yield, &ssize, &offset,US tc->tc_name);
+ yield = string_catn(yield, &ssize, &offset, US"=", 1);
/* Quote the value if it contains spaces or is empty */
if (value[0] == 0 || Ustrchr(value, ' ') != NULL)
{
int j;
- yield = string_cat(yield, &ssize, &offset, US"\"", 1);
+ yield = string_catn(yield, &ssize, &offset, US"\"", 1);
for (j = 0; j < len; j++)
{
if (value[j] == '\"' || value[j] == '\\')
- yield = string_cat(yield, &ssize, &offset, US"\\", 1);
- yield = string_cat(yield, &ssize, &offset, value+j, 1);
+ yield = string_catn(yield, &ssize, &offset, US"\\", 1);
+ yield = string_catn(yield, &ssize, &offset, value+j, 1);
}
- yield = string_cat(yield, &ssize, &offset, US"\"", 1);
+ yield = string_catn(yield, &ssize, &offset, US"\"", 1);
}
- else yield = string_cat(yield, &ssize, &offset, value, len);
+ else yield = string_catn(yield, &ssize, &offset, value, len);
- yield = string_cat(yield, &ssize, &offset, US" ", 1);
+ yield = string_catn(yield, &ssize, &offset, US" ", 1);
}
/* When the specified field is found, grab its data and finish */
ofetch(cda);
if(cda->rc == NO_DATA_FOUND) break;
- if (result != NULL) result = string_cat(result, &ssize, &offset, "\n", 1);
+ if (result) result = string_catn(result, &ssize, &offset, "\n", 1);
/* Single field - just add on the data */
if (num_fields == 1)
- result = string_cat(result, &ssize, &offset, def[0].buf, def[0].col_retlen);
+ result = string_catn(result, &ssize, &offset, def[0].buf, def[0].col_retlen);
/* Multiple fields - precede by file name, removing {lead,trail}ing WS */
while (*s != 0 && isspace(*s)) s++;
slen = Ustrlen(s);
while (slen > 0 && isspace(s[slen-1])) slen--;
- result = string_cat(result, &ssize, &offset, s, slen);
- result = string_cat(result, &ssize, &offset, US"=", 1);
+ result = string_catn(result, &ssize, &offset, s, slen);
+ result = string_catn(result, &ssize, &offset, US"=", 1);
/* int and float type wont ever need escaping. Otherwise, quote the value
if it contains spaces or is empty. */
(def[i].buf[0] == 0 || strchr(def[i].buf, ' ') != NULL))
{
int j;
- result = string_cat(result, &ssize, &offset, "\"", 1);
+ result = string_catn(result, &ssize, &offset, "\"", 1);
for (j = 0; j < def[i].col_retlen; j++)
{
if (def[i].buf[j] == '\"' || def[i].buf[j] == '\\')
- result = string_cat(result, &ssize, &offset, "\\", 1);
- result = string_cat(result, &ssize, &offset, def[i].buf+j, 1);
+ result = string_catn(result, &ssize, &offset, "\\", 1);
+ result = string_catn(result, &ssize, &offset, def[i].buf+j, 1);
}
- result = string_cat(result, &ssize, &offset, "\"", 1);
+ result = string_catn(result, &ssize, &offset, "\"", 1);
}
else switch(desc[i].dbtype)
{
case INT_TYPE:
sprintf(CS tmp, "%d", def[i].int_buf);
- result = string_cat(result, &ssize, &offset, tmp, Ustrlen(tmp));
+ result = string_cat(result, &ssize, &offset, tmp);
break;
case FLOAT_TYPE:
sprintf(CS tmp, "%f", def[i].flt_buf);
- result = string_cat(result, &ssize, &offset, tmp, Ustrlen(tmp));
+ result = string_cat(result, &ssize, &offset, tmp);
break;
case STRING_TYPE:
- result = string_cat(result, &ssize, &offset, def[i].buf,
+ result = string_catn(result, &ssize, &offset, def[i].buf,
def[i].col_retlen);
break;
goto ORACLE_EXIT;
}
- result = string_cat(result, &ssize, &offset, " ", 1);
+ result = string_catn(result, &ssize, &offset, " ", 1);
}
}
for (i = 0; i < num_tuples; i++)
{
if (result != NULL)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
if (num_fields == 1)
{
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US PQgetvalue(pg_result, i, 0), PQgetlength(pg_result, i, 0));
}
{
for (argv[i] = NULL, siz = ptr = 0; (c = *s) && !isspace(c); s++)
if (c != '\\' || *++s) /* backslash protects next char */
- argv[i] = string_cat(argv[i], &siz, &ptr, s, 1);
+ argv[i] = string_catn(argv[i], &siz, &ptr, s, 1);
*(argv[i]+ptr) = '\0';
DEBUG(D_lookup) debug_printf("REDIS: argv[%d] '%s'\n", i, argv[i]);
while (isspace(*s)) s++;
case REDIS_REPLY_INTEGER:
ttmp = (redis_reply->integer != 0) ? US"true" : US"false";
- result = string_cat(result, &ssize, &offset, US ttmp, Ustrlen(ttmp));
+ result = string_cat(result, &ssize, &offset, US ttmp);
break;
case REDIS_REPLY_STRING:
case REDIS_REPLY_STATUS:
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US redis_reply->str, redis_reply->len);
break;
entry = redis_reply->element[i];
if (result)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
switch (entry->type)
{
case REDIS_REPLY_INTEGER:
tmp = string_sprintf("%d", entry->integer);
- result = string_cat(result, &ssize, &offset, US tmp, Ustrlen(tmp));
+ result = string_cat(result, &ssize, &offset, US tmp);
break;
case REDIS_REPLY_STRING:
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US entry->str, entry->len);
break;
case REDIS_REPLY_ARRAY:
tentry = entry->element[j];
if (result)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
switch (tentry->type)
{
case REDIS_REPLY_INTEGER:
ttmp = string_sprintf("%d", tentry->integer);
- result = string_cat(result, &ssize, &offset,
- US ttmp, Ustrlen(ttmp));
+ result = string_cat(result, &ssize, &offset, US ttmp);
break;
case REDIS_REPLY_STRING:
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US tentry->str, tentry->len);
break;
case REDIS_REPLY_ARRAY:
/* For second and subsequent results, insert \n */
if (res->string != NULL)
- res->string = string_cat(res->string, &res->size, &res->len, US"\n", 1);
+ res->string = string_catn(res->string, &res->size, &res->len, US"\n", 1);
if (argc > 1)
{
{
s++; /* skip opening " */
while (*s && *s != '"') /* " protects ; */
- val = string_cat(val, &size, &ptr, s++, 1);
+ val = string_catn(val, &size, &ptr, s++, 1);
if (*s) s++; /* skip closing " */
}
else
- val = string_cat(val, &size, &ptr, s++, 1);
+ val = string_catn(val, &size, &ptr, s++, 1);
if (val) val[ptr] = '\0';
*sp = s;
return val;
rfc2231_to_2047(const uschar * fname, const uschar * charset, int * len)
{
int size = 0, ptr = 0;
-uschar * val = string_cat(NULL, &size, &ptr, US"=?", 2);
+uschar * val = string_catn(NULL, &size, &ptr, US"=?", 2);
uschar c;
if (charset)
- val = string_cat(val, &size, &ptr, charset, Ustrlen(charset));
-val = string_cat(val, &size, &ptr, US"?Q?", 3);
+ val = string_cat(val, &size, &ptr, charset);
+val = string_catn(val, &size, &ptr, US"?Q?", 3);
while ((c = *fname))
if (c == '%' && isxdigit(fname[1]) && isxdigit(fname[2]))
{
- val = string_cat(val, &size, &ptr, US"=", 1);
- val = string_cat(val, &size, &ptr, ++fname, 2);
+ val = string_catn(val, &size, &ptr, US"=", 1);
+ val = string_catn(val, &size, &ptr, ++fname, 2);
fname += 2;
}
else
- val = string_cat(val, &size, &ptr, fname++, 1);
+ val = string_catn(val, &size, &ptr, fname++, 1);
-val = string_cat(val, &size, &ptr, US"?=", 2);
+val = string_catn(val, &size, &ptr, US"?=", 2);
val[*len = ptr] = '\0';
return val;
}
if (where == PDKIM_HDR_TAG)
{
if (c >= 'a' && c <= 'z')
- cur_tag = string_cat(cur_tag, &ts, &tl, p, 1);
+ cur_tag = string_catn(cur_tag, &ts, &tl, p, 1);
if (c == '=')
{
where = PDKIM_HDR_LIMBO;
}
else
- cur_val = string_cat(cur_val, &vs, &vl, p, 1);
+ cur_val = string_catn(cur_val, &vs, &vl, p, 1);
}
NEXT_CHAR:
if (where == PDKIM_HDR_TAG)
{
if (c >= 'a' && c <= 'z')
- cur_tag = string_cat(cur_tag, &ts, &tl, p, 1);
+ cur_tag = string_catn(cur_tag, &ts, &tl, p, 1);
if (c == '=')
{
where = PDKIM_HDR_LIMBO;
}
else
- cur_val = string_cat(cur_val, &vs, &vl, p, 1);
+ cur_val = string_catn(cur_val, &vs, &vl, p, 1);
}
NEXT_CHAR:
}
if (ctx->cur_header_len < PDKIM_MAX_HEADER_LEN)
- ctx->cur_header = string_cat(ctx->cur_header, &ctx->cur_header_size,
+ ctx->cur_header = string_catn(ctx->cur_header, &ctx->cur_header_size,
&ctx->cur_header_len, &data[p], 1);
}
}
pdkim_hdr_cont(uschar * str, int * size, int * ptr, int * col)
{
*col = 1;
-return string_cat(str, size, ptr, US"\r\n\t", 3);
+return string_catn(str, size, ptr, US"\r\n\t", 3);
}
l = Ustrlen(pad);
if (*col + l > 78)
str = pdkim_hdr_cont(str, size, ptr, col);
- str = string_cat(str, size, ptr, pad, l);
+ str = string_catn(str, size, ptr, pad, l);
*col += l;
}
{ /* this fragment will not fit on a single line */
if (pad)
{
- str = string_cat(str, size, ptr, US" ", 1);
+ str = string_catn(str, size, ptr, US" ", 1);
*col += 1;
pad = NULL; /* only want this once */
l--;
{
size_t sl = Ustrlen(intro);
- str = string_cat(str, size, ptr, intro, sl);
+ str = string_catn(str, size, ptr, intro, sl);
*col += sl;
l -= sl;
intro = NULL; /* only want this once */
size_t sl = Ustrlen(payload);
size_t chomp = *col+sl < 77 ? sl : 78-*col;
- str = string_cat(str, size, ptr, payload, chomp);
+ str = string_catn(str, size, ptr, payload, chomp);
*col += chomp;
payload += chomp;
l -= chomp-1;
if (pad)
{
- str = string_cat(str, size, ptr, US" ", 1);
+ str = string_catn(str, size, ptr, US" ", 1);
*col += 1;
pad = NULL;
}
{
size_t sl = Ustrlen(intro);
- str = string_cat(str, size, ptr, intro, sl);
+ str = string_catn(str, size, ptr, intro, sl);
*col += sl;
l -= sl;
intro = NULL;
{
size_t sl = Ustrlen(payload);
- str = string_cat(str, size, ptr, payload, sl);
+ str = string_catn(str, size, ptr, payload, sl);
*col += sl;
}
uschar * hdr; int hdr_size = 0, hdr_len = 0;
uschar * canon_all; int can_size = 0, can_len = 0;
-canon_all = string_cat(NULL, &can_size, &can_len,
- pdkim_canons[sig->canon_headers], -1);
-canon_all = string_cat(canon_all, &can_size, &can_len, US"/", 1);
-canon_all = string_cat(canon_all, &can_size, &can_len,
- pdkim_canons[sig->canon_body], -1);
+canon_all = string_cat (NULL, &can_size, &can_len,
+ pdkim_canons[sig->canon_headers]);
+canon_all = string_catn(canon_all, &can_size, &can_len, US"/", 1);
+canon_all = string_cat (canon_all, &can_size, &can_len,
+ pdkim_canons[sig->canon_body]);
canon_all[can_len] = '\0';
hdr = string_cat(NULL, &hdr_size, &hdr_len,
- "DKIM-Signature: v="PDKIM_SIGNATURE_VERSION, -1);
+ "DKIM-Signature: v="PDKIM_SIGNATURE_VERSION);
col = hdr_len;
/* Required and static bits */
/* Collect header names (Note: colon presence is guaranteed here) */
uschar * q = Ustrchr(p->value, ':');
- headernames = string_cat(headernames, &hs, &hl,
+ headernames = string_catn(headernames, &hs, &hl,
p->value, (q - US p->value) + (p->next ? 1 : 0));
rh = sig->canon_headers == PDKIM_CANON_RELAXED
if (*s != '_')
{ /*SSS string_append_listele() */
if (hl > 0 && headernames[hl-1] != ':')
- headernames = string_cat(headernames, &hs, &hl, US":", 1);
+ headernames = string_catn(headernames, &hs, &hl, US":", 1);
- headernames = string_cat(headernames, &hs, &hl, s, -1);
+ headernames = string_cat(headernames, &hs, &hl, s);
}
headernames[hl] = '\0';
return NULL;
}
str = US SvPV(sv, len);
- yield = string_cat(yield, sizep, ptrp, str, (int)len);
+ yield = string_catn(yield, sizep, ptrp, str, (int)len);
FREETMPS;
LEAVE;
{
uschar *ss = string_sprintf(" I=[%s]:%d", interface_address,
interface_port);
- s = string_cat(s, sizeptr, ptrptr, ss, Ustrlen(ss));
+ s = string_cat(s, sizeptr, ptrptr, ss);
}
}
if (sender_ident != NULL)
/* Re-use the log line workspace */
sptr = 0;
- s = string_cat(s, &size, &sptr, msg, Ustrlen(msg));
+ s = string_cat(s, &size, &sptr, msg);
s = add_host_info_for_log(s, &size, &sptr);
s[sptr] = 0;
log_write(0, LOG_MAIN, "%s", s);
#endif
if (mimeword != string)
- yield = string_cat(yield, &size, &ptr, string, mimeword - string);
+ yield = string_catn(yield, &size, &ptr, string, mimeword - string);
/* Do a charset translation if required. This is supported only on hosts
that have the iconv() function. Translation errors set error, but carry on,
/* Add the new string onto the result */
- yield = string_cat(yield, &size, &ptr, tptr, tlen);
+ yield = string_catn(yield, &size, &ptr, tptr, tlen);
}
#if HAVE_ICONV
/* Copy the remaining characters of the string, zero-terminate it, and return
the length as well if requested. */
-yield = string_cat(yield, &size, &ptr, string, Ustrlen(string));
+yield = string_cat(yield, &size, &ptr, string);
yield[ptr] = 0;
if (lenptr != NULL) *lenptr = ptr;
if (sizeptr != NULL) *sizeptr = size;
capacity=0;
to.character= NULL;
to.length=0;
- to.character=string_cat(to.character,&capacity,&to.length,start,uri-start);
+ to.character=string_catn(to.character, &capacity, &to.length, start, uri-start);
to.character[to.length]='\0';
if (uri_decode(&to)==-1)
{
capacity=0;
hname.character= NULL;
hname.length=0;
- hname.character=string_cat(hname.character,&capacity,&hname.length,start,uri-start);
+ hname.character = string_catn(hname.character, &capacity, &hname.length, start, uri-start);
hname.character[hname.length]='\0';
if (uri_decode(&hname)==-1)
{
capacity=0;
hvalue.character= NULL;
hvalue.length=0;
- hvalue.character=string_cat(hvalue.character,&capacity,&hvalue.length,start,uri-start);
+ hvalue.character=string_catn(hvalue.character,&capacity,&hvalue.length,start,uri-start);
hvalue.character[hvalue.length]='\0';
if (uri_decode(&hvalue)==-1)
{
{
if (header->length==-1) header->length=0;
capacity=header->length;
- header->character=string_cat(header->character,&capacity,&header->length,hname.character,hname.length);
- header->character=string_cat(header->character,&capacity,&header->length,CUS ": ",2);
- header->character=string_cat(header->character,&capacity,&header->length,hvalue.character,hvalue.length);
- header->character=string_cat(header->character,&capacity,&header->length,CUS "\n",1);
+ header->character=string_catn(header->character,&capacity,&header->length,hname.character,hname.length);
+ header->character=string_catn(header->character,&capacity,&header->length,CUS ": ",2);
+ header->character=string_catn(header->character,&capacity,&header->length,hvalue.character,hvalue.length);
+ header->character=string_catn(header->character,&capacity,&header->length,CUS "\n",1);
header->character[header->length]='\0';
}
}
{
case '\0':
{
- quoted=string_cat(quoted,&size,&ptr,CUS "\\0",2);
+ quoted=string_catn(quoted,&size,&ptr,CUS "\\0",2);
break;
}
case '$':
case '{':
case '}':
{
- quoted=string_cat(quoted,&size,&ptr,CUS "\\",1);
+ quoted=string_catn(quoted,&size,&ptr,CUS "\\",1);
}
default:
{
- quoted=string_cat(quoted,&size,&ptr,h,1);
+ quoted=string_catn(quoted,&size,&ptr,h,1);
}
}
++h;
--l;
}
-quoted=string_cat(quoted,&size,&ptr,CUS "",1);
+quoted=string_catn(quoted,&size,&ptr,CUS "",1);
return quoted;
}
++filter->pc;
/* that way, there will be at least one character allocated */
- data->character=string_cat(data->character,&dataCapacity,&foo,CUS "",1);
+ data->character=string_catn(data->character,&dataCapacity,&foo,CUS "",1);
#ifdef ENCODED_CHARACTER
if (filter->require_encoded_character
&& string_decode(filter,data)==-1)
}
else if (*filter->pc=='\\' && *(filter->pc+1)) /* quoted character */
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,filter->pc+1,1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,filter->pc+1,1);
filter->pc+=2;
}
else /* regular character */
#else
if (*filter->pc=='\n')
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,US"\r",1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,US"\r",1);
++filter->line;
}
#endif
- data->character=string_cat(data->character,&dataCapacity,&data->length,filter->pc,1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,filter->pc,1);
filter->pc++;
}
}
if (*filter->pc=='\n') /* end of line */
#endif
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,CUS "\r\n",2);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,CUS "\r\n",2);
#ifdef RFC_EOL
filter->pc+=2;
#else
int foo=data->length;
/* that way, there will be at least one character allocated */
- data->character=string_cat(data->character,&dataCapacity,&foo,CUS "",1);
+ data->character=string_catn(data->character,&dataCapacity,&foo,CUS "",1);
#ifdef RFC_EOL
filter->pc+=3;
#else
}
else if (*filter->pc=='.' && *(filter->pc+1)=='.') /* remove dot stuffing */
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,CUS ".",1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,CUS ".",1);
filter->pc+=2;
}
}
else /* regular character */
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,filter->pc,1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,filter->pc,1);
filter->pc++;
}
}
capacity=0;
if (handle.length==-1)
{
- if (subject.length!=-1) key.character=string_cat(key.character,&capacity,&key.length,subject.character,subject.length);
- if (from.length!=-1) key.character=string_cat(key.character,&capacity,&key.length,from.character,from.length);
- key.character=string_cat(key.character,&capacity,&key.length,reason_is_mime?US"1":US"0",1);
- key.character=string_cat(key.character,&capacity,&key.length,reason.character,reason.length);
+ if (subject.length!=-1) key.character=string_catn(key.character,&capacity,&key.length,subject.character,subject.length);
+ if (from.length!=-1) key.character=string_catn(key.character,&capacity,&key.length,from.character,from.length);
+ key.character=string_catn(key.character,&capacity,&key.length,reason_is_mime?US"1":US"0",1);
+ key.character=string_catn(key.character,&capacity,&key.length,reason.character,reason.length);
}
else
key=handle;
{
capacity=Ustrlen(filter->vacation_directory);
start=capacity;
- once=string_cat(filter->vacation_directory,&capacity,&start,US"/",1);
- once=string_cat(once,&capacity,&start,hexdigest,33);
+ once=string_catn(filter->vacation_directory,&capacity,&start,US"/",1);
+ once=string_catn(once,&capacity,&start,hexdigest,33);
once[start] = '\0';
/* process subject */
expand_header(&subject,&str_subject);
capacity=6;
start=6;
- subject.character=string_cat(US"Auto: ",&capacity,&start,subject.character,subject.length);
+ subject.character=string_catn(US"Auto: ",&capacity,&start,subject.character,subject.length);
subject.length=start;
}
else
);
capacity = 0;
start = 0;
- addr->reply->headers = string_cat(NULL,&capacity,&start,reason.character,mime_body-reason.character);
+ addr->reply->headers = string_catn(NULL,&capacity,&start,reason.character,mime_body-reason.character);
addr->reply->headers[start] = '\0';
capacity = 0;
start = 0;
if (mime_body+(sizeof(nlnl)-1)<reason_end) mime_body+=(sizeof(nlnl)-1);
else mime_body=reason_end-1;
- addr->reply->text = string_cat(NULL,&capacity,&start,mime_body,reason_end-mime_body);
+ addr->reply->text = string_catn(NULL,&capacity,&start,mime_body,reason_end-mime_body);
addr->reply->text[start] = '\0';
}
else
{
int len;
uschar *linebreak = Ustrchr(p, '\n');
- ss = string_cat(ss, &size, &ptr, code, 3);
+ ss = string_catn(ss, &size, &ptr, code, 3);
if (linebreak == NULL)
{
len = Ustrlen(p);
- ss = string_cat(ss, &size, &ptr, US" ", 1);
+ ss = string_catn(ss, &size, &ptr, US" ", 1);
}
else
{
len = linebreak - p;
- ss = string_cat(ss, &size, &ptr, US"-", 1);
+ ss = string_catn(ss, &size, &ptr, US"-", 1);
}
- ss = string_cat(ss, &size, &ptr, esc, esclen);
- ss = string_cat(ss, &size, &ptr, p, len);
- ss = string_cat(ss, &size, &ptr, US"\r\n", 2);
+ ss = string_catn(ss, &size, &ptr, esc, esclen);
+ ss = string_catn(ss, &size, &ptr, p, len);
+ ss = string_catn(ss, &size, &ptr, US"\r\n", 2);
p += len;
if (linebreak != NULL) p++;
}
if (sender_host_address != NULL)
{
- s = string_cat(s, &size, &ptr, US" [", 2);
- s = string_cat(s, &size, &ptr, sender_host_address,
- Ustrlen(sender_host_address));
- s = string_cat(s, &size, &ptr, US"]", 1);
+ s = string_catn(s, &size, &ptr, US" [", 2);
+ s = string_cat (s, &size, &ptr, sender_host_address);
+ s = string_catn(s, &size, &ptr, US"]", 1);
}
}
size = ptr + 1;
}
- s = string_cat(s, &size, &ptr, US"\r\n", 2);
+ s = string_catn(s, &size, &ptr, US"\r\n", 2);
/* If we received EHLO, we must create a multiline response which includes
the functions supported. */
{
sprintf(CS big_buffer, "%.3s-SIZE %d\r\n", smtp_code,
thismessage_size_limit);
- s = string_cat(s, &size, &ptr, big_buffer, Ustrlen(big_buffer));
+ s = string_cat(s, &size, &ptr, big_buffer);
}
else
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-SIZE\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-SIZE\r\n", 7);
}
/* Exim does not do protocol conversion or data conversion. It is 8-bit
if (accept_8bitmime)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-8BITMIME\r\n", 11);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-8BITMIME\r\n", 11);
}
/* Advertise DSN support if configured to do so. */
if (verify_check_host(&dsn_advertise_hosts) != FAIL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-DSN\r\n", 6);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-DSN\r\n", 6);
dsn_advertised = TRUE;
}
if (acl_smtp_etrn != NULL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-ETRN\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-ETRN\r\n", 7);
}
/* Advertise EXPN if there's an ACL checking whether a host is
if (acl_smtp_expn != NULL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-EXPN\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-EXPN\r\n", 7);
}
/* Exim is quite happy with pipelining, so let the other end know that
if (pipelining_enable &&
verify_check_host(&pipelining_advertise_hosts) == OK)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-PIPELINING\r\n", 13);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-PIPELINING\r\n", 13);
sync_cmd_limit = NON_SYNC_CMD_PIPELINING;
pipelining_advertised = TRUE;
}
int saveptr;
if (first)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-AUTH", 5);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-AUTH", 5);
first = FALSE;
auth_advertised = TRUE;
}
saveptr = ptr;
- s = string_cat(s, &size, &ptr, US" ", 1);
- s = string_cat(s, &size, &ptr, au->public_name,
- Ustrlen(au->public_name));
+ s = string_catn(s, &size, &ptr, US" ", 1);
+ s = string_cat (s, &size, &ptr, au->public_name);
while (++saveptr < ptr) s[saveptr] = toupper(s[saveptr]);
au->advertised = TRUE;
}
else
au->advertised = FALSE;
- if (!first) s = string_cat(s, &size, &ptr, US"\r\n", 2);
+ if (!first) s = string_catn(s, &size, &ptr, US"\r\n", 2);
}
/* Advertise TLS (Transport Level Security) aka SSL (Secure Socket Layer)
if (tls_in.active < 0 &&
verify_check_host(&tls_advertise_hosts) != FAIL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-STARTTLS\r\n", 11);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-STARTTLS\r\n", 11);
tls_advertised = TRUE;
}
#endif
/* Per Recipient Data Response, draft by Eric A. Hall extending RFC */
if (prdr_enable)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-PRDR\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-PRDR\r\n", 7);
}
#endif
if ( accept_8bitmime
&& verify_check_host(&smtputf8_advertise_hosts) != FAIL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-SMTPUTF8\r\n", 11);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-SMTPUTF8\r\n", 11);
smtputf8_advertised = TRUE;
}
#endif
/* Finish off the multiline reply with one that is always available. */
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US" HELP\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US" HELP\r\n", 7);
}
/* Terminate the string (for debug), write it, and note that HELO/EHLO
for (;;)
{
for (ss = s + 1; *ss != 0 && *ss != sep; ss++);
- buffer = string_cat(buffer, &size, &ptr, s, ss-s);
+ buffer = string_catn(buffer, &size, &ptr, s, ss-s);
s = ss;
if (*s == 0 || *(++s) != sep || sep_is_special) break;
}
if (list)
{
- new = string_cat(new, &sz, &off, list, Ustrlen(list));
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_cat (new, &sz, &off, list);
+ new = string_catn(new, &sz, &off, &sep, 1);
}
while((sp = Ustrchr(ele, sep)))
{
- new = string_cat(new, &sz, &off, ele, sp-ele+1);
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_catn(new, &sz, &off, ele, sp-ele+1);
+ new = string_catn(new, &sz, &off, &sep, 1);
ele = sp+1;
}
-new = string_cat(new, &sz, &off, ele, Ustrlen(ele));
+new = string_cat(new, &sz, &off, ele);
new[off] = '\0';
return new;
}
if (list)
{
- new = string_cat(new, &sz, &off, list, Ustrlen(list));
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_cat (new, &sz, &off, list);
+ new = string_catn(new, &sz, &off, &sep, 1);
}
while((sp = Ustrnchr(ele, sep, &len)))
{
- new = string_cat(new, &sz, &off, ele, sp-ele+1);
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_catn(new, &sz, &off, ele, sp-ele+1);
+ new = string_catn(new, &sz, &off, &sep, 1);
ele = sp+1;
len--;
}
-new = string_cat(new, &sz, &off, ele, len);
+new = string_catn(new, &sz, &off, ele, len);
new[off] = '\0';
return new;
}
/* coverity[+alloc] */
uschar *
-string_cat(uschar *string, int *size, int *ptr, const uschar *s, int count)
+string_catn(uschar *string, int *size, int *ptr, const uschar *s, int count)
{
int p = *ptr;
-if (count == -1) count = Ustrlen(s);
-
if (p + count >= *size)
{
int oldsize = *size;
*ptr = p + count;
return string;
}
+
+
+uschar *
+string_cat(uschar *string, int *size, int *ptr, const uschar *s)
+{
+return string_catn(string, size, ptr, s, Ustrlen(s));
+}
#endif /* COMPILE_UTILITY */
for (i = 0; i < count; i++)
{
uschar *t = va_arg(ap, uschar *);
- string = string_cat(string, size, ptr, t, Ustrlen(t));
+ string = string_cat(string, size, ptr, t);
}
va_end(ap);
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
- yield = string_cat(yield, sizeptr, ptrptr, s, Ustrlen(s));
+ yield = string_cat(yield, sizeptr, ptrptr, s);
}
s = addr->local_part;
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
-yield = string_cat(yield, sizeptr, ptrptr, s, Ustrlen(s));
+yield = string_cat(yield, sizeptr, ptrptr, s);
s = addr->suffix;
if (testflag(addr, af_include_affixes) && s)
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
- yield = string_cat(yield, sizeptr, ptrptr, s, Ustrlen(s));
+ yield = string_cat(yield, sizeptr, ptrptr, s);
}
return yield;
addr->transport != NULL && addr->transport->info->local))
{
if (testflag(addr, af_file) && addr->local_part[0] != '/')
- yield = string_cat(yield, &size, &ptr, CUS"save ", 5);
+ yield = string_catn(yield, &size, &ptr, CUS"save ", 5);
yield = string_get_localpart(addr, yield, &size, &ptr);
}
{
const uschar * s;
yield = string_get_localpart(addr, yield, &size, &ptr);
- yield = string_cat(yield, &size, &ptr, US"@", 1);
+ yield = string_catn(yield, &size, &ptr, US"@", 1);
s = addr->domain;
#ifdef SUPPORT_I18N
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s) );
+ yield = string_cat(yield, &size, &ptr, s);
}
else
- {
- yield = string_cat(yield, &size, &ptr, addr->address, Ustrlen(addr->address));
- }
+ yield = string_cat(yield, &size, &ptr, addr->address);
yield[ptr] = 0;
/* If the address we are going to print is the same as the top address,
address_item *addr2;
for (addr2 = addr->parent; addr2 != topaddr; addr2 = addr2->parent)
{
- yield = string_cat(yield, &size, &ptr, s, 2);
- yield = string_cat(yield, &size, &ptr, addr2->address, Ustrlen(addr2->address));
+ yield = string_catn(yield, &size, &ptr, s, 2);
+ yield = string_cat (yield, &size, &ptr, addr2->address);
if (!all_parents) break;
s = US", ";
}
- yield = string_cat(yield, &size, &ptr, US")", 1);
+ yield = string_catn(yield, &size, &ptr, US")", 1);
}
/* Add the top address if it is required */
if (add_topaddr)
{
- yield = string_cat(yield, &size, &ptr, US" <", 2);
+ yield = string_catn(yield, &size, &ptr, US" <", 2);
- if (addr->onetime_parent == NULL)
- yield = string_cat(yield, &size, &ptr, topaddr->address,
- Ustrlen(topaddr->address));
- else
- yield = string_cat(yield, &size, &ptr, addr->onetime_parent,
- Ustrlen(addr->onetime_parent));
+ yield = string_cat(yield, &size, &ptr,
+ addr->onetime_parent ? addr->onetime_parent : topaddr->address);
- yield = string_cat(yield, &size, &ptr, US">", 1);
+ yield = string_catn(yield, &size, &ptr, US">", 1);
}
yield[ptr] = 0; /* string_cat() leaves space */
for (ad = addr; ad != NULL; ad = ad->next)
{
- if (ad != addr) string_cat(s, &size, &offset, US" ", 1);
- string_cat(s, &size, &offset, ad->address, Ustrlen(ad->address));
+ if (ad != addr) string_catn(s, &size, &offset, US" ", 1);
+ string_cat(s, &size, &offset, ad->address);
}
- string_cat(s, &size, &offset, q, Ustrlen(q));
+ string_cat(s, &size, &offset, q);
s[offset] = 0;
}
if (*ss != 0)
{
- addr->message = string_cat(addr->message, &size, &ptr, US" ", 1);
- addr->message = string_cat(addr->message, &size, &ptr,
- ss, Ustrlen(ss));
+ addr->message = string_catn(addr->message, &size, &ptr, US" ", 1);
+ addr->message = string_cat (addr->message, &size, &ptr, ss);
}
/* Now add the command and arguments */
- addr->message = string_cat(addr->message, &size, &ptr,
+ addr->message = string_catn(addr->message, &size, &ptr,
US" from command:", 14);
for (i = 0; i < sizeof(argv)/sizeof(int *) && argv[i] != NULL; i++)
{
BOOL quote = FALSE;
- addr->message = string_cat(addr->message, &size, &ptr, US" ", 1);
+ addr->message = string_catn(addr->message, &size, &ptr, US" ", 1);
if (Ustrpbrk(argv[i], " \t") != NULL)
{
quote = TRUE;
- addr->message = string_cat(addr->message, &size, &ptr, US"\"", 1);
+ addr->message = string_catn(addr->message, &size, &ptr, US"\"", 1);
}
- addr->message = string_cat(addr->message, &size, &ptr, argv[i],
- Ustrlen(argv[i]));
+ addr->message = string_cat(addr->message, &size, &ptr, argv[i]);
if (quote)
- addr->message = string_cat(addr->message, &size, &ptr, US"\"", 1);
+ addr->message = string_catn(addr->message, &size, &ptr, US"\"", 1);
}
/* Add previous filter timeout message, if present. */
- if (*tmsg != 0)
- addr->message = string_cat(addr->message, &size, &ptr, tmsg,
- Ustrlen(tmsg));
+ if (*tmsg)
+ addr->message = string_cat(addr->message, &size, &ptr, tmsg);
addr->message[ptr] = 0; /* Ensure concatenated string terminated */
}