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:
parent
4cd1853729
commit
e4f7e4b35f
1 changed files with 23 additions and 2 deletions
|
@ -52,9 +52,9 @@
|
|||
char *node;
|
||||
|
||||
Stringprep_rc rc;
|
||||
if ((rc = stringprep_profile([username_ cString], &node, "Nodeprep", 0))
|
||||
if ((rc = stringprep_profile([username_ cString], &node, "SASLprep", 0))
|
||||
!= STRINGPREP_OK) {
|
||||
of_log(@"Nodeprep failed: %s", stringprep_strerror(rc));
|
||||
of_log(@"SASLprep failed: %s", stringprep_strerror(rc));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,27 @@
|
|||
[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_
|
||||
{
|
||||
OFString *old = server;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue