Mercurial > crates > nonstick
comparison pam-sober/test.c @ 34:ec70822cbdef
Overhaul
| author | Andy Caldwell <andrew.caldwell@metaswitch.com> |
|---|---|
| date | Sun, 24 Apr 2022 03:42:11 +0100 |
| parents | 53efbcff805d |
| children |
comparison
equal
deleted
inserted
replaced
| 32:ea5f195f035f | 34:ec70822cbdef |
|---|---|
| 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 |
