Mercurial > crates > nonstick
comparison pam-sober/test.c @ 35:3b2ff50db010
Merge pull request #8 from bossmc/master
Various enhancements/fixes
| author | Anthony Nowell <anowell@gmail.com> |
|---|---|
| date | Wed, 08 Jun 2022 09:28:13 -0700 |
| parents | ec70822cbdef |
| children |
comparison
equal
deleted
inserted
replaced
| 33:86113e45f88f | 35:3b2ff50db010 |
|---|---|
| 21 | 21 |
| 22 retval = pam_start("sober-auth", user, &conv, &pamh); | 22 retval = pam_start("sober-auth", user, &conv, &pamh); |
| 23 | 23 |
| 24 // Are the credentials correct? | 24 // Are the credentials correct? |
| 25 if (retval == PAM_SUCCESS) { | 25 if (retval == PAM_SUCCESS) { |
| 26 printf("Credentials accepted.\n"); | 26 printf("PAM module initialized\n"); |
| 27 retval = pam_authenticate(pamh, 0); | 27 retval = pam_authenticate(pamh, 0); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Can the accound be used at this time? | 30 // Can the accound be used at this time? |
| 31 if (retval == PAM_SUCCESS) { | 31 if (retval == PAM_SUCCESS) { |
| 32 printf("Account is valid.\n"); | 32 printf("Credentials accepted.\n"); |
| 33 retval = pam_acct_mgmt(pamh, 0); | 33 retval = pam_acct_mgmt(pamh, 0); |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Did everything work? | 36 // Did everything work? |
| 37 if (retval == PAM_SUCCESS) { | 37 if (retval == PAM_SUCCESS) { |
| 38 printf("Account is valid.\n"); | |
| 38 printf("Authenticated\n"); | 39 printf("Authenticated\n"); |
| 39 } else { | 40 } else { |
| 40 printf("Not Authenticated\n"); | 41 printf("Not Authenticated\n"); |
| 41 } | 42 } |
| 42 | 43 |
