Respectively do Nameprep/SASLPrep on domain name and password

This commit is contained in:
Florian Zeitz 2011-02-11 02:25:15 +01:00
parent 12ec7d5f08
commit 0e200d99d7

View file

@ -66,6 +66,48 @@
[old release]; [old release];
} }
- (void)setServer: (OFString*)server_
{
OFString *old = server;
char *srv;
Stringprep_rc rc;
if ((rc = stringprep_profile([server_ cString], &srv, "Nameprep", 0))
!= STRINGPREP_OK) {
of_log(@"Nameprep failed: %s", stringprep_strerror(rc));
assert(0);
}
@try {
server = [[OFString alloc] initWithCString: srv];
} @finally {
free(srv);
}
[old release];
}
- (void)setPassword: (OFString*)password_
{
OFString *old = password;
char *pass;
Stringprep_rc rc;
if ((rc = stringprep_profile([password_ cString], &pass, "SASLprep", 0))
!= STRINGPREP_OK) {
of_log(@"SASLprep failed: %s", stringprep_strerror(rc));
assert(0);
}
@try {
password = [[OFString alloc] initWithCString: pass];
} @finally {
free(pass);
}
[old release];
}
- (void)_startStream - (void)_startStream
{ {
[sock writeFormat: @"<?xml version='1.0'?>\n" [sock writeFormat: @"<?xml version='1.0'?>\n"