Perform SASLPrep on the username and Resourceprep on the resource

The username is not necessarily a nodepart, therefore SASLPrep is more
appropriate than Nodeprep which we had before.
This commit is contained in:
Florian Zeitz 2011-02-15 03:52:16 +01:00
parent 4cd1853729
commit e4f7e4b35f

View file

@ -52,9 +52,9 @@
char *node; char *node;
Stringprep_rc rc; Stringprep_rc rc;
if ((rc = stringprep_profile([username_ cString], &node, "Nodeprep", 0)) if ((rc = stringprep_profile([username_ cString], &node, "SASLprep", 0))
!= STRINGPREP_OK) { != STRINGPREP_OK) {
of_log(@"Nodeprep failed: %s", stringprep_strerror(rc)); of_log(@"SASLprep failed: %s", stringprep_strerror(rc));
assert(0); assert(0);
} }
@ -67,6 +67,27 @@
[old release]; [old release];
} }
- (void)setResource: (OFString*)resource_
{
OFString *old = resource;
char *res;
Stringprep_rc rc;
if ((rc = stringprep_profile([resource_ cString], &res, "Resourceprep", 0))
!= STRINGPREP_OK) {
of_log(@"Resourceprep failed: %s", stringprep_strerror(rc));
assert(0);
}
@try {
resource = [[OFString alloc] initWithCString: res];
} @finally {
free(res);
}
[old release];
}
- (void)setServer: (OFString*)server_ - (void)setServer: (OFString*)server_
{ {
OFString *old = server; OFString *old = server;