Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validating parameters simplifies debugging and improves stability as problematic parameters can be prohibited.
- Loading branch information
Showing
7 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Sftp_jail::File_name' do | ||
%w[a B ! *(].each do |value| | ||
it { is_expected.to allow_value(value) } | ||
end | ||
|
||
[:undef, 1, '/', '/a' '/a/a', 'a/a', "\0"].each do |value| | ||
it { is_expected.not_to allow_value(value) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Sftp_jail::User_name' do | ||
%w[a A aa AA _a a.1_-$].each do |value| | ||
it { is_expected.to allow_value(value) } | ||
end | ||
|
||
[:undef, 1, '1a', '.a', '-a', '$a', '[a', '#a'].each do |value| | ||
it { is_expected.not_to allow_value(value) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# The name of a file. Not a full path! | ||
type Sftp_jail::File_name = Pattern[/\A[^\/\0]+\z/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# @summary Each user or group should have a unique alphanumeric name. | ||
# | ||
# From useradd(8): It is usually recommended to only use usernames | ||
# that begin with a lower case letter or an underscore, followed by lower case | ||
# letters, digits, underscores, or dashes. They can end with a dollar sign. | ||
# Usernames may only be up to 32 characters long. | ||
# | ||
# Many installations also allow capitals or periods, for example to separate | ||
# first and last names. | ||
# | ||
type Sftp_jail::User_name = | ||
Pattern[/\A[a-zA-Z_]([a-zA-Z.0-9_-]{0,30}[a-zA-Z0-9_$-])?\z/] |