Resolving linking errors
This commit is contained in:
parent
aca16b9f2c
commit
dd78ce5b5b
7
Makefile
7
Makefile
@ -11,14 +11,15 @@ all:
|
||||
@which reboot >/dev/null
|
||||
@which poweroff >/dev/null
|
||||
@which cryptsetup >/dev/null
|
||||
mkdir -p build obj
|
||||
mkdir -p build
|
||||
make -C src -e "PPASSFILE = $(PPASSFILE)"
|
||||
@printf "Done!\n"
|
||||
|
||||
clean:
|
||||
rm build/pam_panic.so
|
||||
rm build/pam_panic_pw
|
||||
rm obj/pam_panic.o
|
||||
rmdir build obj
|
||||
make -C src/pam_panic clean
|
||||
rmdir build
|
||||
@printf "Done!\n"
|
||||
|
||||
detect_pamdir:
|
||||
|
@ -1,9 +1,25 @@
|
||||
CFLAGS = --std=gnu11 -O2 -fPIC -DPOWEROFF=\"`which poweroff`\" -DREBOOT=\"`which reboot`\" -DCRYPTSETUP=\"`which cryptsetup`\" -DPPASSFILE=\"$(PPASSFILE)\"
|
||||
LDFLAGS = -x --shared -lcrypt
|
||||
CFLAGS = -Wall --std=gnu11 -O2 -fPIC -DPOWEROFF=\"`which poweroff`\" -DREBOOT=\"`which reboot`\" -DCRYPTSETUP=\"`which cryptsetup`\" -DPPASSFILE=\"$(PPASSFILE)\"
|
||||
#LDFLAGS = -x -shared -lcrypt -lpam -lpam_misc
|
||||
LDFLAGS = -shared -lcrypt -lpam -lpam_misc
|
||||
|
||||
|
||||
OBJ = pam_panic_authdevice.o pam_panic_password.o pam_panic_reject.o
|
||||
|
||||
|
||||
pam_panic: $(OBJ)
|
||||
cc $(CFLAGS) $(LDFLAGS) -o ../../build/pam_panic.so pam_panic.c $(OBJ)
|
||||
# ld $(LDFLAGS) -o ../../build/pam_panic.so $(OBJ)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
all:
|
||||
mkdir -p ../../obj
|
||||
mkdir -p ../../build
|
||||
cc $(CFLAGS) -c pam_panic.c -o ../../obj/pam_panic.o
|
||||
ld $(LDFLAGS) -o ../../build/pam_panic.so ../../obj/pam_panic.o
|
||||
|
||||
clean:
|
||||
rm *.o
|
||||
|
||||
|
||||
# cc $(CFLAGS) -c pam_panic.c -o ../../obj/pam_panic.o
|
||||
# ld $(LDFLAGS) -o ../../build/pam_panic.so ../../obj/pam_panic.o
|
||||
|
||||
|
@ -25,6 +25,18 @@ LICENSE : GNU-GPLv3
|
||||
#ifdef POWEROFF
|
||||
#ifdef CRYPTSETUP
|
||||
|
||||
int makeRegex(pam_handle_t *pamh, regex_t *regex){
|
||||
char *pattern = "^[A-Fa-f0-9]\\{8\\}\\-[A-Fa-f0-9]\\{4\\}\\-[A-Fa-f0-9]\\{4\\}\\-[A-Fa-f0-9]\\{4\\}\\-[A-Fa-f0-9]\\{12\\}$";
|
||||
|
||||
if(regcomp(regex, pattern, 0)){
|
||||
pam_syslog(pamh, LOG_CRIT, "ERROR: Problem with regcomp.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void argSplit(char **some_arg, char **some_temp, const char *arg){
|
||||
strncpy(*some_arg, arg, 128);
|
||||
*some_temp = strtok(*some_arg, "=");
|
||||
@ -56,13 +68,9 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, cons
|
||||
|
||||
|
||||
// Regex for checking arguments
|
||||
char *pattern = "^[A-Fa-f0-9]\\{8\\}\\-[A-Fa-f0-9]\\{4\\}\\-[A-Fa-f0-9]\\{4\\}\\-[A-Fa-f0-9]\\{4\\}\\-[A-Fa-f0-9]\\{12\\}$";
|
||||
regex_t regex;
|
||||
|
||||
if(regcomp(®ex, pattern, 0)){
|
||||
pam_syslog(pamh, LOG_CRIT, "ERROR: Problem with regcomp.");
|
||||
if(makeRegex(pamh, ®ex))
|
||||
return (PAM_IGNORE);
|
||||
}
|
||||
|
||||
|
||||
// Argument handling
|
||||
|
@ -6,6 +6,14 @@ DATE : 2018-03-27T02:34:08+02:00
|
||||
LICENSE : GNU-GPLv3
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <security/pam_modules.h>
|
||||
#include <security/pam_ext.h>
|
||||
#include <syslog.h>
|
||||
#include "pam_panic_reject.h"
|
||||
|
||||
#include "pam_panic_authdevice.h"
|
||||
|
||||
int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff){
|
||||
|
||||
@ -23,4 +31,6 @@ int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_
|
||||
if(access(rejected, F_OK) != -1)
|
||||
return reject(serious_dev, bSerious, bReboot, bPoweroff);
|
||||
|
||||
return (PAM_MAXTRIES);
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ LICENSE : GNU-GPLv3
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#define ASK "Please enter your secret key to decrypt the firewall and access the mainframe. "
|
||||
|
||||
int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff);
|
||||
|
@ -6,6 +6,17 @@ DATE : 2018-03-27T02:34:08+02:00
|
||||
LICENSE : GNU-GPLv3
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <security/pam_modules.h>
|
||||
#include <security/pam_ext.h>
|
||||
#include <syslog.h>
|
||||
#include <crypt.h>
|
||||
#include "pam_panic_password.h"
|
||||
#include "pam_panic_reject.h"
|
||||
|
||||
|
||||
int readPassword(pam_handle_t *pamh, char pw[2][99]){
|
||||
@ -24,7 +35,6 @@ int readPassword(pam_handle_t *pamh, char pw[2][99]){
|
||||
// Get file contents
|
||||
size_t nread;
|
||||
char filecontent[198];
|
||||
char chr;
|
||||
|
||||
nread = fread(filecontent, sizeof(char), 198, f);
|
||||
fclose(f);
|
||||
|
@ -5,8 +5,6 @@ DATE : 2018-03-27T02:34:08+02:00
|
||||
LICENSE : GNU-GPLv3
|
||||
*/
|
||||
|
||||
#include <crypt.h>
|
||||
|
||||
#ifndef PPASSFILE
|
||||
#error PPASSFILE must be declared!
|
||||
#endif
|
||||
|
@ -6,6 +6,11 @@ DATE : 2018-03-27T02:34:08+02:00
|
||||
LICENSE : GNU-GPLv3
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <security/pam_ext.h>
|
||||
#include <sys/wait.h>
|
||||
#include "pam_panic_reject.h"
|
||||
|
||||
int reject(char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff){
|
||||
if(bSerious){
|
||||
|
Loading…
Reference in New Issue
Block a user