**/
void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
- BOOL remove_unsafe_characters, BOOL replace_once)
+ BOOL remove_unsafe_characters, BOOL replace_once, BOOL allow_trailing_dollar)
{
char *p;
ssize_t ls,lp,li, i;
case '\'':
case ';':
case '$':
+ /* allow a trailing $ (as in machine accounts) */
+ if (allow_trailing_dollar && (i == li - 1 )) {
+ p[i] = insert[i];
+ break;
+ }
case '%':
case '\r':
case '\n':
void string_sub_once(char *s, const char *pattern, const char *insert, size_t len)
{
- string_sub2( s, pattern, insert, len, True, True );
+ string_sub2( s, pattern, insert, len, True, True, False );
}
void string_sub(char *s,const char *pattern, const char *insert, size_t len)
{
- string_sub2( s, pattern, insert, len, True, False );
+ string_sub2( s, pattern, insert, len, True, False, False );
}
void fstring_sub(char *s,const char *pattern,const char *insert)
DEBUG(0,("str_list_make: Unable to allocate memory"));
str_list_free(&list);
if (mem_ctx) {
- talloc_free(s);
+ TALLOC_FREE(s);
} else {
SAFE_FREE(s);
}
DEBUG(0,("str_list_make: Unable to allocate memory"));
str_list_free(&list);
if (mem_ctx) {
- talloc_free(s);
+ TALLOC_FREE(s);
} else {
SAFE_FREE(s);
}
}
if (mem_ctx) {
- talloc_free(s);
+ TALLOC_FREE(s);
} else {
SAFE_FREE(s);
}
tlist = *list;
for(; *tlist; tlist++) {
if (mem_ctx) {
- talloc_free(*tlist);
+ TALLOC_FREE(*tlist);
} else {
SAFE_FREE(*tlist);
}
}
if (mem_ctx) {
- talloc_free(*tlist);
+ TALLOC_FREE(*tlist);
} else {
SAFE_FREE(*list);
}
{
int i = 0;
+ if ( ! list )
+ return 0;
+
/* count the number of list members */
for ( i=0; *list; i++, list++ );