Merge pull request #102 from Bandie/master

Fixes #101
This commit is contained in:
Bandie 2018-12-23 15:38:20 +01:00 committed by GitHub
commit b5deaf3f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 29 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pam_panic 0.2.0\n" "Project-Id-Version: pam_panic 0.2.0\n"
"Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n" "Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n"
"POT-Creation-Date: 2018-12-03 00:25+0100\n" "POT-Creation-Date: 2018-12-23 15:26+0100\n"
"PO-Revision-Date: 2018-11-14 17:26+0100\n" "PO-Revision-Date: 2018-11-14 17:26+0100\n"
"Last-Translator: Bandie <bandie@chaospott.de>\n" "Last-Translator: Bandie <bandie@chaospott.de>\n"
"Language-Team: German\n" "Language-Team: German\n"
@ -23,7 +23,7 @@ msgstr ""
msgid "CRITICAL: Problem with regcomp." msgid "CRITICAL: Problem with regcomp."
msgstr "CRITICAL: Problem mit regcomp." msgstr "CRITICAL: Problem mit regcomp."
#: src/pam_panic/pam_panic.c:145 #: src/pam_panic/pam_panic.c:147
msgid "" msgid ""
"ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a " "ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a "
"valid GPT UUID." "valid GPT UUID."
@ -31,7 +31,7 @@ msgstr ""
"ERROR: Argument ungültig. Hinweis: \"allow\" und \"reject\" müssen eine " "ERROR: Argument ungültig. Hinweis: \"allow\" und \"reject\" müssen eine "
"valide GPT UUID aufweisen." "valide GPT UUID aufweisen."
#: src/pam_panic/pam_panic.c:184 #: src/pam_panic/pam_panic.c:186
msgid "ALERT for argument \"serious\": Device doesn't exist." msgid "ALERT for argument \"serious\": Device doesn't exist."
msgstr "ALERT für Argument \"serious\": Gerät existiert nicht." msgstr "ALERT für Argument \"serious\": Gerät existiert nicht."

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pam_panic 0.2.0\n" "Project-Id-Version: pam_panic 0.2.0\n"
"Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n" "Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n"
"POT-Creation-Date: 2018-12-03 00:25+0100\n" "POT-Creation-Date: 2018-12-23 15:26+0100\n"
"PO-Revision-Date: 2018-11-14 17:26+0100\n" "PO-Revision-Date: 2018-11-14 17:26+0100\n"
"Last-Translator: Dangered wolf <d@ngeredwolf.me>\n" "Last-Translator: Dangered wolf <d@ngeredwolf.me>\n"
"Language-Team: Spanish\n" "Language-Team: Spanish\n"
@ -23,7 +23,7 @@ msgstr ""
msgid "CRITICAL: Problem with regcomp." msgid "CRITICAL: Problem with regcomp."
msgstr "CRITICAL: Problema con regcomp." msgstr "CRITICAL: Problema con regcomp."
#: src/pam_panic/pam_panic.c:145 #: src/pam_panic/pam_panic.c:147
msgid "" msgid ""
"ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a " "ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a "
"valid GPT UUID." "valid GPT UUID."
@ -31,7 +31,7 @@ msgstr ""
"ERROR: Argumentos inválidos. Tenga en cuenta que \"allow\" y \"reject\" " "ERROR: Argumentos inválidos. Tenga en cuenta que \"allow\" y \"reject\" "
"deben tener un UUID de GPT válido." "deben tener un UUID de GPT válido."
#: src/pam_panic/pam_panic.c:184 #: src/pam_panic/pam_panic.c:186
msgid "ALERT for argument \"serious\": Device doesn't exist." msgid "ALERT for argument \"serious\": Device doesn't exist."
msgstr "ALERT para el argumento \"serious\": El dispositivo no existe." msgstr "ALERT para el argumento \"serious\": El dispositivo no existe."

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pam_panic 0.2.0\n" "Project-Id-Version: pam_panic 0.2.0\n"
"Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n" "Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n"
"POT-Creation-Date: 2018-12-03 00:25+0100\n" "POT-Creation-Date: 2018-12-23 15:26+0100\n"
"PO-Revision-Date: 2018-11-14 17:26+0100\n" "PO-Revision-Date: 2018-11-14 17:26+0100\n"
"Last-Translator: Dashie <dashie@otter.sh>\n" "Last-Translator: Dashie <dashie@otter.sh>\n"
"Language-Team: French\n" "Language-Team: French\n"
@ -22,7 +22,7 @@ msgstr ""
msgid "CRITICAL: Problem with regcomp." msgid "CRITICAL: Problem with regcomp."
msgstr "CRITIQUE: Problème avec regcomp." msgstr "CRITIQUE: Problème avec regcomp."
#: src/pam_panic/pam_panic.c:145 #: src/pam_panic/pam_panic.c:147
msgid "" msgid ""
"ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a " "ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a "
"valid GPT UUID." "valid GPT UUID."
@ -30,7 +30,7 @@ msgstr ""
"ERREUR: Arguments invalides. Notez que \"allow\" et \"reject\" doivent avoir " "ERREUR: Arguments invalides. Notez que \"allow\" et \"reject\" doivent avoir "
"un UUID GPT valide." "un UUID GPT valide."
#: src/pam_panic/pam_panic.c:184 #: src/pam_panic/pam_panic.c:186
msgid "ALERT for argument \"serious\": Device doesn't exist." msgid "ALERT for argument \"serious\": Device doesn't exist."
msgstr "ALERTE pour l'argument \"serious\" : Le périphérique n'existe pas." msgstr "ALERTE pour l'argument \"serious\" : Le périphérique n'existe pas."

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pam_panic 0.2.0\n" "Project-Id-Version: pam_panic 0.2.0\n"
"Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n" "Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n"
"POT-Creation-Date: 2018-12-03 00:25+0100\n" "POT-Creation-Date: 2018-12-23 15:26+0100\n"
"PO-Revision-Date: 2018-11-29 19:47+0100\n" "PO-Revision-Date: 2018-11-29 19:47+0100\n"
"Last-Translator: Chromium Neptune <chromium@neplanet.com>\n" "Last-Translator: Chromium Neptune <chromium@neplanet.com>\n"
"Language-Team: Japanese\n" "Language-Team: Japanese\n"
@ -22,7 +22,7 @@ msgstr ""
msgid "CRITICAL: Problem with regcomp." msgid "CRITICAL: Problem with regcomp."
msgstr "クリティカル: \"regcomp\"の問題" msgstr "クリティカル: \"regcomp\"の問題"
#: src/pam_panic/pam_panic.c:145 #: src/pam_panic/pam_panic.c:147
msgid "" msgid ""
"ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a " "ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a "
"valid GPT UUID." "valid GPT UUID."
@ -30,7 +30,7 @@ msgstr ""
"エラー: 引き数が無効です。 \"allow\"と \"reject\"には有効なGPT UUIDが必要で" "エラー: 引き数が無効です。 \"allow\"と \"reject\"には有効なGPT UUIDが必要で"
"す。" "す。"
#: src/pam_panic/pam_panic.c:184 #: src/pam_panic/pam_panic.c:186
msgid "ALERT for argument \"serious\": Device doesn't exist." msgid "ALERT for argument \"serious\": Device doesn't exist."
msgstr "引数 \"serious\"のアラート:デバイスが存在しません。" msgstr "引数 \"serious\"のアラート:デバイスが存在しません。"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pam_panic 0.2.0\n" "Project-Id-Version: pam_panic 0.2.0\n"
"Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n" "Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n"
"POT-Creation-Date: 2018-12-03 00:25+0100\n" "POT-Creation-Date: 2018-12-23 15:26+0100\n"
"PO-Revision-Date: 2018-11-23 23:50+0100\n" "PO-Revision-Date: 2018-11-23 23:50+0100\n"
"Last-Translator: chris <chris@heychris.eu>\n" "Last-Translator: chris <chris@heychris.eu>\n"
"Language-Team: \n" "Language-Team: \n"
@ -22,7 +22,7 @@ msgstr ""
msgid "CRITICAL: Problem with regcomp." msgid "CRITICAL: Problem with regcomp."
msgstr "KRITISCH: Probleem met regcomp." msgstr "KRITISCH: Probleem met regcomp."
#: src/pam_panic/pam_panic.c:145 #: src/pam_panic/pam_panic.c:147
msgid "" msgid ""
"ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a " "ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a "
"valid GPT UUID." "valid GPT UUID."
@ -30,7 +30,7 @@ msgstr ""
"FOUT: Argumenten niet geldig. Let erop dat \"allow\" en \"reject\" een " "FOUT: Argumenten niet geldig. Let erop dat \"allow\" en \"reject\" een "
"geldige GPT UUID nodig hebben." "geldige GPT UUID nodig hebben."
#: src/pam_panic/pam_panic.c:184 #: src/pam_panic/pam_panic.c:186
msgid "ALERT for argument \"serious\": Device doesn't exist." msgid "ALERT for argument \"serious\": Device doesn't exist."
msgstr "WAARSCHUWING bij argument \"serious\": Toestel bestaat niet." msgstr "WAARSCHUWING bij argument \"serious\": Toestel bestaat niet."

View File

@ -6,9 +6,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pam_panic 0.3.0\n" "Project-Id-Version: pam_panic 0.3.1\n"
"Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n" "Report-Msgid-Bugs-To: https://github.com/pampanic/pam_panic\n"
"POT-Creation-Date: 2018-12-03 00:25+0100\n" "POT-Creation-Date: 2018-12-23 15:26+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -21,13 +21,13 @@ msgstr ""
msgid "CRITICAL: Problem with regcomp." msgid "CRITICAL: Problem with regcomp."
msgstr "" msgstr ""
#: src/pam_panic/pam_panic.c:145 #: src/pam_panic/pam_panic.c:147
msgid "" msgid ""
"ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a " "ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a "
"valid GPT UUID." "valid GPT UUID."
msgstr "" msgstr ""
#: src/pam_panic/pam_panic.c:184 #: src/pam_panic/pam_panic.c:186
msgid "ALERT for argument \"serious\": Device doesn't exist." msgid "ALERT for argument \"serious\": Device doesn't exist."
msgstr "" msgstr ""

View File

@ -52,15 +52,16 @@ void argSplit(char **some_arg, char **some_temp, const char *arg){
*some_temp = strtok(NULL, "="); *some_temp = strtok(NULL, "=");
} }
void constrPath(char **dst, char **src){ void constrPath(char **dst, char **src, int8_t bGPTOnly){
char tmp[256]; char tmp[256];
// EFI // GPT
strcpy(tmp, "/dev/disk/by-partuuid/"); strcpy(tmp, "/dev/disk/by-partuuid/");
strcat(tmp, *src); strcat(tmp, *src);
if(access(tmp, F_OK) != -1) if(access(tmp, F_OK) != -1 || bGPTOnly)
sprintf(*dst, "/dev/disk/by-partuuid/%s", *src); sprintf(*dst, "/dev/disk/by-partuuid/%s", *src);
return;
// MBR // MBR
memset(tmp, 0, sizeof tmp); memset(tmp, 0, sizeof tmp);
@ -68,10 +69,11 @@ void constrPath(char **dst, char **src){
strcat(tmp, *src); strcat(tmp, *src);
if(access(tmp, F_OK) != -1) if(access(tmp, F_OK) != -1)
sprintf(*dst, "/dev/disk/by-uuid/%s", *src); sprintf(*dst, "/dev/disk/by-uuid/%s", *src);
return;
// Fallback vendor hardware id // Fallback vendor hardware id
else
sprintf(*dst, "/dev/disk/by-id/%s", *src); sprintf(*dst, "/dev/disk/by-id/%s", *src);
return;
} }
@ -160,8 +162,8 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, cons
// Construct variables from arguments // Construct variables from arguments
if(allowed_temp != NULL && rejected_temp != NULL){ if(allowed_temp != NULL && rejected_temp != NULL){
constrPath(&rejected, &rejected_temp); constrPath(&rejected, &rejected_temp, 1);
constrPath(&allowed, &allowed_temp); constrPath(&allowed, &allowed_temp, 1);
}else{ }else{
rejected = NULL; rejected = NULL;
allowed = NULL; allowed = NULL;
@ -169,7 +171,7 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, cons
if(bSerious) if(bSerious)
constrPath(&serious_dev, &serious_temp); constrPath(&serious_dev, &serious_temp, 0);
// Free not needed vars // Free not needed vars

View File

@ -10,10 +10,11 @@ LICENSE : GNU-GPLv3
#include <security/pam_modules.h> #include <security/pam_modules.h>
#include <security/pam_ext.h> #include <security/pam_ext.h>
#include <syslog.h> #include <syslog.h>
#include <stdlib.h>
void argSplit(char **some_arg, char **some_temp, const char *arg); void argSplit(char **some_arg, char **some_temp, const char *arg);
void constrPath(char **dst, char **src); void constrPath(char **dst, char **src, int8_t bGPTOnly);
PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char *argv[]); PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char *argv[]);