summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-14 16:05:42 -0800
committerJeremy Allison <jra@samba.org>2007-11-14 16:05:42 -0800
commit51b46147f285a63bfa91ed3ec4dfb35c28bdea51 (patch)
tree8fe95692cafb912e158f09e2d9f915d264e0bc6c /source3/lib
parentd07eabcb444a281ec63a36c6612aca6e34730f18 (diff)
downloadsamba-51b46147f285a63bfa91ed3ec4dfb35c28bdea51.tar.gz
samba-51b46147f285a63bfa91ed3ec4dfb35c28bdea51.tar.bz2
samba-51b46147f285a63bfa91ed3ec4dfb35c28bdea51.zip
Remove smbldap_get_single_pstring() and all pstrings
from pdb_ldap.c. I don't have an LDAP passdb setup here, so I'm going to need some help on testing this. Jeremy. (This used to be commit 00760451b6c2b65f3a8a9187789ca4f270b622a2)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbldap.c8
-rw-r--r--source3/lib/util_str.c26
2 files changed, 22 insertions, 12 deletions
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 6f9ecb1a31..662a5a948a 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -292,14 +292,6 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
return True;
}
- bool smbldap_get_single_pstring (LDAP * ldap_struct, LDAPMessage * entry,
- const char *attribute, pstring value)
-{
- return smbldap_get_single_attribute(ldap_struct, entry,
- attribute, value,
- sizeof(pstring));
-}
-
char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
const char *attribute,
TALLOC_CTX *mem_ctx)
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 6d429e3719..68b06a6d90 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -1187,14 +1187,17 @@ void pstring_sub(char *s,const char *pattern,const char *insert)
}
/**
- Similar to string_sub, but it will accept only allocated strings
+ Similar to string_sub2, but it will accept only allocated strings
and may realloc them so pay attention at what you pass on no
pointers inside strings, no pstrings or const may be passed
as string.
**/
-char *realloc_string_sub(char *string, const char *pattern,
- const char *insert)
+char *realloc_string_sub2(char *string,
+ const char *pattern,
+ const char *insert,
+ bool remove_unsafe_characters,
+ bool allow_trailing_dollar)
{
char *p, *in;
char *s;
@@ -1221,10 +1224,18 @@ char *realloc_string_sub(char *string, const char *pattern,
case '\'':
case ';':
case '$':
+ /* allow a trailing $
+ * (as in machine accounts) */
+ if (allow_trailing_dollar && (i == li - 1 )) {
+ break;
+ }
case '%':
case '\r':
case '\n':
- in[i] = '_';
+ if ( remove_unsafe_characters ) {
+ in[i] = '_';
+ break;
+ }
default:
/* ok */
break;
@@ -1254,6 +1265,13 @@ char *realloc_string_sub(char *string, const char *pattern,
return string;
}
+char *realloc_string_sub(char *string,
+ const char *pattern,
+ const char *insert)
+{
+ return realloc_string_sub2(string, pattern, insert, true, false);
+}
+
/*
* Internal guts of talloc_string_sub and talloc_all_string_sub.
* 'filter' differentiates between them.