self->handle = NULL;
}
- self->handle = ldap_init((char *)[self->hostName cString], self->port);
+ self->handle = ldap_init((char *)[self->hostName UTF8String], self->port);
if (self->handle == NULL)
return NO;
else
/* unknown method */
return NO;
-
+
l = (char *)[_login UTF8String];
p = LDAPUseLatin1Creds
? (char *)[_cred cString]
}
else
attrs = NULL;
-
+
if (LDAPDebugEnabled) {
- printf("%s: search with at base %s filter %s for attrs %s\n",
- __PRETTY_FUNCTION__, [_base cString], [filter cString],
- [[_attributes description] cString]);
+ NSLog(@"%s: search with at base %s filter %s for attrs %s\n",
+ __PRETTY_FUNCTION__, _base, filter,
+ _attributes);
}
/* apply limits */
values[j] = bv;
}
values[valCount] = NULL;
-
- /* TODO: use UTF-8, UNICODE */
- attrName = malloc([key cStringLength] + 1);
- [key getCString:attrName];
+
+ attrName = strdup([key UTF8String]);
attrBuf[i].mod_op = LDAP_MOD_BVALUES;
attrBuf[i].mod_type = attrName;
NGLdapModification *mod;
NGLdapAttribute *attr;
NSString *attrName;
- unsigned attrLen;
unsigned valCount;
NSEnumerator *e;
NSData *value;
attr = [mod attribute];
attrName = [attr attributeName];
/* TODO: use UTF-8, UNICODE */
- attrLen = [attrName cStringLength];
-
- modBuf[i].mod_type = malloc(attrLen + 1);
- [attrName getCString:modBuf[i].mod_type];
-
+
+ modBuf[i].mod_type = strdup(modBuf[i].mod_type);
+
valCount = [attr count];
values = calloc(valCount + 1, sizeof(struct berval *));
strDN = [[[NSString alloc] initWithUTF8String:dn] autorelease];
}
NS_HANDLER {
+ // Note: this is not NSLog because of GCC crashers with exception handlers
fprintf(stderr, "Got exception %s while NSUTF8StringEncoding, "
"use defaultCStringEncoding",
- [[localException description] cString]);
+ [[localException description] UTF8String]);
strDN = nil;
}
NS_ENDHANDLER;