summaryrefslogtreecommitdiff
path: root/source3/lib/smbldap.c
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2004-03-11 16:32:19 +0000
committerJim McDonough <jmcd@samba.org>2004-03-11 16:32:19 +0000
commit3d18997afda94504e9db24115aaa56a58086a653 (patch)
treef419fd44f705171d45b4768c4de89207d2a44731 /source3/lib/smbldap.c
parenta26e22edfb036ba0ab9e1a8bbe859ba2c1092b12 (diff)
downloadsamba-3d18997afda94504e9db24115aaa56a58086a653.tar.gz
samba-3d18997afda94504e9db24115aaa56a58086a653.tar.bz2
samba-3d18997afda94504e9db24115aaa56a58086a653.zip
Get MungedDial actually working with full TS strings in it for pdb_ldap.
I know this isn't pretty, but neither was our assumption that all strings from the directory fit inside a pstring. There was no way this worked before will all versions of usrmgr (for example, the only version of mine that has the TS Confic button). (This used to be commit d275c0e384db08c2a6efc28e52844f676ff71fb6)
Diffstat (limited to 'source3/lib/smbldap.c')
-rw-r--r--source3/lib/smbldap.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index c8305eeb80..2ade9d5197 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -290,7 +290,8 @@ static BOOL fetch_ldap_pw(char **dn, char** pw)
******************************************************************/
BOOL smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
- const char *attribute, pstring value)
+ const char *attribute, char *value,
+ int max_len)
{
char **values;
@@ -305,7 +306,7 @@ static BOOL fetch_ldap_pw(char **dn, char** pw)
return False;
}
- if (convert_string(CH_UTF8, CH_UNIX,values[0], -1, value, sizeof(pstring)) == (size_t)-1) {
+ if (convert_string(CH_UTF8, CH_UNIX,values[0], -1, value, max_len) == (size_t)-1) {
DEBUG(1, ("smbldap_get_single_attribute: string conversion of [%s] = [%s] failed!\n",
attribute, values[0]));
ldap_value_free(values);
@@ -319,6 +320,14 @@ static BOOL fetch_ldap_pw(char **dn, char** pw)
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));
+}
+
/************************************************************************
Routine to manage the LDAPMod structure array
manage memory used by the array, by each struct, and values
@@ -415,11 +424,11 @@ static BOOL fetch_ldap_pw(char **dn, char** pw)
LDAPMod ***mods,
const char *attribute, const char *newval)
{
- pstring oldval;
+ char oldval[2048]; /* current largest allowed value is mungeddial */
BOOL existed;
if (existing != NULL) {
- existed = smbldap_get_single_attribute(ldap_struct, existing, attribute, oldval);
+ existed = smbldap_get_single_attribute(ldap_struct, existing, attribute, oldval, sizeof(oldval));
} else {
existed = False;
*oldval = '\0';