-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove obsolete tests: They were testing behavior which has changed. * Fix tests by using either predictable UIDs or replacing UIDs in golden files with placeholders (normalizing) * Limit number of pre-auth user records to avoid denial of service by sending many SSH requests for unique users to fill up the UID range. * Remove field UID from users.UserInfo struct because it's not set in internal/brokers/broker.go anymore and there is no need to expose this field. * Rename localgroups package to localentries because it now also provides functions for passwd entries. * Check for error when calling getpwent or getgrent
- Loading branch information
Showing
111 changed files
with
2,351 additions
and
427 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
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
24 changes: 12 additions & 12 deletions
24
internal/services/pam/testdata/golden/TestIDGeneration/Generate_ID/cache.db
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
GroupByID: | ||
"1648262143": '{"Name":"TestIDGeneration_separator_success","GID":1648262143,"UGID":"TestIDGeneration_separator_success"}' | ||
"1946747284": '{"Name":"group-success","GID":1946747284,"UGID":"ugid-success"}' | ||
"1111": '{"Name":"TestIDGeneration_separator_success","GID":1111,"UGID":"TestIDGeneration_separator_success"}' | ||
"2222": '{"Name":"group-success","GID":2222,"UGID":"ugid-success"}' | ||
GroupByName: | ||
TestIDGeneration_separator_success: '{"Name":"TestIDGeneration_separator_success","GID":1648262143,"UGID":"TestIDGeneration_separator_success"}' | ||
group-success: '{"Name":"group-success","GID":1946747284,"UGID":"ugid-success"}' | ||
TestIDGeneration_separator_success: '{"Name":"TestIDGeneration_separator_success","GID":1111,"UGID":"TestIDGeneration_separator_success"}' | ||
group-success: '{"Name":"group-success","GID":2222,"UGID":"ugid-success"}' | ||
GroupByUGID: | ||
TestIDGeneration_separator_success: '{"Name":"TestIDGeneration_separator_success","GID":1648262143,"UGID":"TestIDGeneration_separator_success"}' | ||
ugid-success: '{"Name":"group-success","GID":1946747284,"UGID":"ugid-success"}' | ||
TestIDGeneration_separator_success: '{"Name":"TestIDGeneration_separator_success","GID":1111,"UGID":"TestIDGeneration_separator_success"}' | ||
ugid-success: '{"Name":"group-success","GID":2222,"UGID":"ugid-success"}' | ||
GroupToUsers: | ||
"1648262143": '{"GID":1648262143,"UIDs":[1648262143]}' | ||
"1946747284": '{"GID":1946747284,"UIDs":[1648262143]}' | ||
"1111": '{"GID":1111,"UIDs":[1111]}' | ||
"2222": '{"GID":2222,"UIDs":[1111]}' | ||
UserByID: | ||
"1648262143": '{"Name":"TestIDGeneration_separator_success","UID":1648262143,"GID":1648262143,"Gecos":"gecos for success","Dir":"/home/success","Shell":"/bin/sh/success","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
"1111": '{"Name":"TestIDGeneration_separator_success","UID":1111,"GID":1111,"Gecos":"gecos for success","Dir":"/home/success","Shell":"/bin/sh/success","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
UserByName: | ||
TestIDGeneration_separator_success: '{"Name":"TestIDGeneration_separator_success","UID":1648262143,"GID":1648262143,"Gecos":"gecos for success","Dir":"/home/success","Shell":"/bin/sh/success","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
TestIDGeneration_separator_success: '{"Name":"TestIDGeneration_separator_success","UID":1111,"GID":1111,"Gecos":"gecos for success","Dir":"/home/success","Shell":"/bin/sh/success","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
UserToBroker: {} | ||
UserToGroups: | ||
"1648262143": '{"UID":1648262143,"GIDs":[1648262143,1946747284]}' | ||
"1111": '{"UID":1111,"GIDs":[1111,2222]}' | ||
UserToLocalGroups: | ||
"1648262143": "null" | ||
"1111": "null" |
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
2 changes: 1 addition & 1 deletion
2
...ata/golden/TestIsAuthenticated/Error_when_broker_returns_invalid_userinfo/IsAuthenticated
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FIRST CALL: | ||
access: | ||
msg: | ||
err: can't check authentication: message is not JSON formatted: json: cannot unmarshal string into Go value of type users.UserInfo | ||
err: can't check authentication: message is not JSON formatted: json: cannot unmarshal string into Go value of type types.UserInfo |
24 changes: 12 additions & 12 deletions
24
...ata/golden/TestIsAuthenticated/Error_when_calling_second_time_without_cancelling/cache.db
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
GroupByID: | ||
"1369382419": '{"Name":"group-IA_second_call","GID":1369382419,"UGID":"ugid-IA_second_call"}' | ||
"1556535091": '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","GID":1556535091,"UGID":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call"}' | ||
"1111": '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","GID":1111,"UGID":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call"}' | ||
"2222": '{"Name":"group-IA_second_call","GID":2222,"UGID":"ugid-IA_second_call"}' | ||
GroupByName: | ||
TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call: '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","GID":1556535091,"UGID":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call"}' | ||
group-IA_second_call: '{"Name":"group-IA_second_call","GID":1369382419,"UGID":"ugid-IA_second_call"}' | ||
TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call: '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","GID":1111,"UGID":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call"}' | ||
group-IA_second_call: '{"Name":"group-IA_second_call","GID":2222,"UGID":"ugid-IA_second_call"}' | ||
GroupByUGID: | ||
TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call: '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","GID":1556535091,"UGID":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call"}' | ||
ugid-IA_second_call: '{"Name":"group-IA_second_call","GID":1369382419,"UGID":"ugid-IA_second_call"}' | ||
TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call: '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","GID":1111,"UGID":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call"}' | ||
ugid-IA_second_call: '{"Name":"group-IA_second_call","GID":2222,"UGID":"ugid-IA_second_call"}' | ||
GroupToUsers: | ||
"1369382419": '{"GID":1369382419,"UIDs":[1556535091]}' | ||
"1556535091": '{"GID":1556535091,"UIDs":[1556535091]}' | ||
"1111": '{"GID":1111,"UIDs":[1111]}' | ||
"2222": '{"GID":2222,"UIDs":[1111]}' | ||
UserByID: | ||
"1556535091": '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","UID":1556535091,"GID":1556535091,"Gecos":"gecos for IA_second_call","Dir":"/home/IA_second_call","Shell":"/bin/sh/IA_second_call","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
"1111": '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","UID":1111,"GID":1111,"Gecos":"gecos for IA_second_call","Dir":"/home/IA_second_call","Shell":"/bin/sh/IA_second_call","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
UserByName: | ||
TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call: '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","UID":1556535091,"GID":1556535091,"Gecos":"gecos for IA_second_call","Dir":"/home/IA_second_call","Shell":"/bin/sh/IA_second_call","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call: '{"Name":"TestIsAuthenticated/Error_when_calling_second_time_without_cancelling_separator_IA_second_call","UID":1111,"GID":1111,"Gecos":"gecos for IA_second_call","Dir":"/home/IA_second_call","Shell":"/bin/sh/IA_second_call","LastPwdChange":-1,"MaxPwdAge":-1,"PwdWarnPeriod":-1,"PwdInactivity":-1,"MinPwdAge":-1,"ExpirationDate":-1,"LastLogin":"ABCDETIME"}' | ||
UserToBroker: {} | ||
UserToGroups: | ||
"1556535091": '{"UID":1556535091,"GIDs":[1556535091,1369382419]}' | ||
"1111": '{"UID":1111,"GIDs":[1111,2222]}' | ||
UserToLocalGroups: | ||
"1556535091": "null" | ||
"1111": "null" |
Oops, something went wrong.