-
Notifications
You must be signed in to change notification settings - Fork 36
pam: Use pam.ModuleTransaction to implement pam module #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0e7469f
pam: Add comments for main package to please CI
3v1n0 1ad064d
pam: Address some linter warnings
3v1n0 781de20
pam: Fail if no broker has been found
3v1n0 41b84c8
pam: Use pam-go to generate module stubs and handle PAM APIs
3v1n0 9b6d55b
log: Add Warning stub definition
3v1n0 7dc0c29
pam: Simplify the return code handling by using pam.StatusError
3v1n0 17e8585
pam: Send error or info message to PAM if any
3v1n0 c8749d9
pam: Save broker authentication ID in the module data
3v1n0 178ed27
pam: Add pam_test.ModuleTransactionDummy interface definition
3v1n0 41bbd91
pam: Use dummy transaction to run PAM module as test cli app
3v1n0 33fbd9d
CI: Run PAM tests with address sanitizer enabled
3v1n0 c974f78
pam_tests: Force doing a memory leak check at tests Cleanup
3v1n0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| ./*.h | ||
| *.so |
|
GabrielNagy marked this conversation as resolved.
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,45 @@ | ||
| //go:build pam_binary_cli | ||
|
|
||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
|
|
||
| "github.com/msteinert/pam" | ||
| "github.com/sirupsen/logrus" | ||
| "github.com/ubuntu/authd/internal/log" | ||
| "github.com/ubuntu/authd/pam/pam_test" | ||
| ) | ||
|
|
||
| // Simulating pam on the CLI for manual testing. | ||
| func main() { | ||
| log.SetLevel(log.DebugLevel) | ||
| f, err := os.OpenFile("/tmp/logdebug", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0600) | ||
| if err != nil { | ||
| panic(err) | ||
| } | ||
| defer f.Close() | ||
| logrus.SetOutput(f) | ||
|
|
||
| module := &pamModule{} | ||
| mTx := pam_test.NewModuleTransactionDummy(pam.ConversationFunc( | ||
| func(style pam.Style, msg string) (string, error) { | ||
| switch style { | ||
| case pam.TextInfo: | ||
| fmt.Fprintf(os.Stderr, "PAM INFO: %s\n", msg) | ||
| case pam.ErrorMsg: | ||
| fmt.Fprintf(os.Stderr, "PAM ERROR: %s\n", msg) | ||
| default: | ||
| return "", fmt.Errorf("pam style %d not implemented", style) | ||
| } | ||
| return "", nil | ||
| })) | ||
|
|
||
| authResult := module.Authenticate(mTx, pam.Flags(0), nil) | ||
| fmt.Println("Auth return:", authResult) | ||
|
|
||
| // Simulate setting auth broker as default. | ||
| accMgmtResult := module.AcctMgmt(mTx, pam.Flags(0), nil) | ||
| fmt.Println("Acct mgmt return:", accMgmtResult) | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.