summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-07-15 17:38:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:00:07 -0500
commiteb1123e5009c900c0eb741c0a075f918b16bbeab (patch)
treebb3a26b18f929f9f0ee577255960797e3fd2988e /source3/lib
parent6fe54515435e351ba958886cb9a7175c436ef88d (diff)
downloadsamba-eb1123e5009c900c0eb741c0a075f918b16bbeab.tar.gz
samba-eb1123e5009c900c0eb741c0a075f918b16bbeab.tar.bz2
samba-eb1123e5009c900c0eb741c0a075f918b16bbeab.zip
r8506: BUG 2853: don't strip out characters like '$' from printer names
when substituting for the lpq command. (This used to be commit 2f5de718a98e56fe55d8905b12505dfc3e432544)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_str.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 42229f105a..6b91a0d625 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -916,7 +916,7 @@ BOOL string_set(char **dest,const char *src)
use of len==0 which was for no length checks to be done.
**/
-void string_sub(char *s,const char *pattern, const char *insert, size_t len)
+void string_sub2(char *s,const char *pattern, const char *insert, size_t len, BOOL remove_unsafe_characters)
{
char *p;
ssize_t ls,lp,li, i;
@@ -951,8 +951,12 @@ void string_sub(char *s,const char *pattern, const char *insert, size_t len)
case '%':
case '\r':
case '\n':
- p[i] = '_';
- break;
+ if ( remove_unsafe_characters ) {
+ p[i] = '_';
+ /* yes this break should be here since we want to
+ fall throw if not replacing unsafe chars */
+ break;
+ }
default:
p[i] = insert[i];
}
@@ -962,6 +966,11 @@ void string_sub(char *s,const char *pattern, const char *insert, size_t len)
}
}
+void string_sub(char *s,const char *pattern, const char *insert, size_t len)
+{
+ string_sub2( s, pattern, insert, len, True );
+}
+
void fstring_sub(char *s,const char *pattern,const char *insert)
{
string_sub(s, pattern, insert, sizeof(fstring));