From 7a2218b5071df70a2d34546131751155ac68ed5c Mon Sep 17 00:00:00 2001 From: Lucas Castro Date: Wed, 9 Sep 2020 17:34:42 -0300 Subject: ADD Makefile --- Makefile | 13 +++++++++++++ README.txt | 1 - check_user.c | 49 ------------------------------------------------- 3 files changed, 13 insertions(+), 50 deletions(-) create mode 100644 Makefile delete mode 100644 README.txt delete mode 100644 check_user.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cf47386 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +CC = gcc +CFLAGS += `pkg-config --cflags gtk+-2.0 --cflags` +LIBS += `pkg-config --libs gtk+-2.0 --libs` +LIBS += -lpam -lpam_misc + +capu : ui-login.o + ${CC} ${CFLAGS} ${LIBS} -o capu ui-login.o + +ui-login.o : ui-login.c + ${CC} ${CFLAGS} ${LIBS} -c ui-login.c + +clean : + rm capu ui-login.o diff --git a/README.txt b/README.txt deleted file mode 100644 index fb2f9a4..0000000 --- a/README.txt +++ /dev/null @@ -1 +0,0 @@ -Control de Acesso Perimentro Universal diff --git a/check_user.c b/check_user.c deleted file mode 100644 index 5f50aa9..0000000 --- a/check_user.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include - -static struct pam_conv conv = { - misc_conv, - NULL -}; - -int main (int argc, char *argv[]) -{ - pam_handle_t *pamh=NULL; - int retval; - const char *user = "lucas"; - - if (argc == 2) { - user = argv[1]; - } - - if (argc > 2) { - fprintf(stderr, "Usage: check_user [username]\n"); - exit(1); - } - - retval = pam_start("check_user", user, &conv, &pamh); - if (retval == PAM_SUCCESS) { - retval = pam_authenticate(pamh, 0); - } - - if (retval == PAM_SUCCESS) { - retval = pam_acct_mgmt(pamh, 0); - } - - if (retval == PAM_SUCCESS) { - fprintf(stdout, "Authenticated\n"); - } else { - fprintf(stdout, "Not Authenticated\n"); - } - - if (pam_end (pamh,retval) != PAM_SUCCESS) { - pamh = NULL; - fprintf (stderr, "check_user: failed to release authenticator\n"); - exit(1); - } - - return (retval == PAM_SUCCESS ? 0:1 ); - -} - -- cgit v1.2.3