From 57e218ab61e824133f252e4a0da74552beb14b05 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 18 Aug 2009 22:31:38 +0100 Subject: [PATCH] Make MacOS installer pane permit dashes The MacOS installer only permits characters in [0-9A-Za-z] in cellnames. However, OpenAFS itself will also allow dashes, and they're in use by some sites. This trivially amends the installer pane to permit dashes. FIXES 125211 Reviewed-on: http://gerrit.openafs.org/323 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/platform/DARWIN/afscell/afscellPane.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/platform/DARWIN/afscell/afscellPane.m b/src/platform/DARWIN/afscell/afscellPane.m index 1b1ec29eb1..098e62dcad 100644 --- a/src/platform/DARWIN/afscell/afscellPane.m +++ b/src/platform/DARWIN/afscell/afscellPane.m @@ -20,7 +20,9 @@ NSString *fileWriteCellAlias=@"/private/tmp/org.OpenAFS.Install.CellAlias"; /* check line of CellAlias provided for Cell name, if matches, returns alias in third parameter */ - (BOOL)_cellInCellAliasLine:(NSString *)line cellName:(NSString *)cell intoAlias:(NSString **)alias { - NSCharacterSet *alphaNum = [NSCharacterSet alphanumericCharacterSet]; + NSMutableCharacterSet *alphaNum = [[NSCharacterSet alphanumericCharacterSet] mutableCopy]; + [alphaNum addCharactersInString:@"-"]; + NSScanner *cellScanner = [NSScanner scannerWithString:line]; if (![cellScanner scanUpToString:cell intoString:nil]) { @@ -108,7 +110,8 @@ NSString *fileWriteCellAlias=@"/private/tmp/org.OpenAFS.Install.CellAlias"; } /* make sure it's in internet domain style, i.e. alphanum.alphanum */ - NSCharacterSet *alphaNum = [NSCharacterSet alphanumericCharacterSet]; + NSMutableCharacterSet *alphaNum = [[NSCharacterSet alphanumericCharacterSet] mutableCopy]; + [alphaNum addCharactersInString:@"-"]; NSScanner *cellScanner = [NSScanner scannerWithString:cellString]; /* first 'word' */ @@ -141,7 +144,8 @@ NSString *fileWriteCellAlias=@"/private/tmp/org.OpenAFS.Install.CellAlias"; } /* make sure it's alpha-numeric */ - NSCharacterSet *alphaNum = [NSCharacterSet alphanumericCharacterSet]; + NSMutableCharacterSet *alphaNum = [[NSCharacterSet alphanumericCharacterSet] mutableCopy]; + [alphaNum addCharactersInString:@"-"]; NSScanner *aliasScanner = [NSScanner scannerWithString:aliasString]; if (![aliasScanner scanCharactersFromSet:alphaNum intoString:nil])