Skip to content

Commit

Permalink
fixed issue 95: whitespace characters in password and username
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Aug 3, 2023
1 parent 33ef0c9 commit 63f4ca5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions NomadLogin/NoLoMechanism.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class NoLoMechanism: NSObject {
encoding: String.Encoding.utf8.rawValue)
else { return nil }

return username.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines.union.CharacterSet(["\0"]))
return username.replacingOccurrences(of: "\0", with: "") as String
}
}
Expand Down
7 changes: 4 additions & 3 deletions XCredsLoginPlugIn/Mechanisms/XCredsBaseMechanism.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ protocol XCredsMechanismProtocol {
length: value!.pointee.length,
encoding: String.Encoding.utf8.rawValue)
else { return nil }

return username.replacingOccurrences(of: "\0", with: "") as String
return username.trimmingCharacters(in: CharacterSet.whitespaces.union(CharacterSet(["\0"])))
}
}
var passwordContext: String? {
Expand All @@ -119,7 +118,9 @@ protocol XCredsMechanismProtocol {
encoding: String.Encoding.utf8.rawValue)
else { return nil }

return pass.replacingOccurrences(of: "\0", with: "") as String
return pass.trimmingCharacters(in: CharacterSet.whitespaces.union(CharacterSet(["\0"])))


}
}
func allowLogin() {
Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 3.1;
MARKETING_VERSION = 3.2;
PRODUCT_BUNDLE_IDENTIFIER = com.twocanoes.XCredsLoginPlugin;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -1285,7 +1285,7 @@
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 3.1;
MARKETING_VERSION = 3.2;
PRODUCT_BUNDLE_IDENTIFIER = com.twocanoes.XCredsLoginPlugin;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -1404,7 +1404,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 3.1;
MARKETING_VERSION = 3.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.twocanoes.XCreds-Login-Overlay";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -1441,7 +1441,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 3.1;
MARKETING_VERSION = 3.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.twocanoes.XCreds-Login-Overlay";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -1592,7 +1592,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 3.1;
MARKETING_VERSION = 3.2;
PRODUCT_BUNDLE_IDENTIFIER = com.twocanoes.xcreds;
PRODUCT_NAME = "$(TARGET_NAME)";
STRIP_INSTALLED_PRODUCT = NO;
Expand Down Expand Up @@ -1629,7 +1629,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 3.1;
MARKETING_VERSION = 3.2;
PRODUCT_BUNDLE_IDENTIFIER = com.twocanoes.xcreds;
PRODUCT_NAME = "$(TARGET_NAME)";
STRIP_INSTALLED_PRODUCT = NO;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<key>auth_mech_fixup.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>8</integer>
</dict>
<key>authrights.xcscheme_^#shared#^_</key>
<dict>
Expand All @@ -42,7 +42,7 @@
<key>test.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
<integer>7</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down

0 comments on commit 63f4ca5

Please sign in to comment.