From 9ee0585927825ca31c35161e7b810cc2915366dd Mon Sep 17 00:00:00 2001 From: Bandie Date: Fri, 21 Sep 2018 22:46:31 +0200 Subject: [PATCH] putting pam_panic.c on gettext --- src/pam_panic/pam_panic.c | 16 ++++++++++++---- src/pam_panic/pam_panic.h | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/pam_panic/pam_panic.c b/src/pam_panic/pam_panic.c index 37f8072..4b61085 100644 --- a/src/pam_panic/pam_panic.c +++ b/src/pam_panic/pam_panic.c @@ -16,12 +16,18 @@ LICENSE : GNU-GPLv3 #include #include #include -#include "config.h" + #include "pam_panic_reject.h" +#include "../../lib/gettext.h" + +#define _(String) gettext(String) + #include "pam_panic_authdevice.h" #include "pam_panic_password.h" +#ifdef PACKAGE +#ifdef LOCALEDIR #ifdef REBOOT #ifdef POWEROFF #ifdef CRYPTSETUP @@ -30,7 +36,7 @@ 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."); + pam_syslog(pamh, LOG_CRIT, _("CRITICAL: Problem with regcomp.")); return 1; } @@ -107,7 +113,7 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, cons || (rejected_temp != NULL && regexec(®ex, rejected_temp, 0, NULL, 0) == REG_NOMATCH) || (bSerious && serious_temp == NULL) ) { - pam_syslog(pamh, LOG_ERR, "Arguments invalid. Note that allow and reject must have a valid GPT UUID."); + pam_syslog(pamh, LOG_ERR, _("ERROR: Arguments invalid. Note that \"allow\" and \"reject\" must have a valid GPT UUID.")); return (PAM_ABORT); } @@ -143,7 +149,7 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, cons // Check if panic key exist if(bSerious && access(serious_dev, F_OK) == -1){ - pam_syslog(pamh, LOG_ALERT, "ALERT for argument \"serious\": Device doesn't exist."); + pam_syslog(pamh, LOG_ALERT, _("ALERT for argument \"serious\": Device doesn't exist.")); return (PAM_ABORT); } @@ -201,3 +207,5 @@ PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const c #endif #endif #endif +#endif +#endif diff --git a/src/pam_panic/pam_panic.h b/src/pam_panic/pam_panic.h index 0ec8644..d0761a2 100644 --- a/src/pam_panic/pam_panic.h +++ b/src/pam_panic/pam_panic.h @@ -17,6 +17,8 @@ LICENSE : GNU-GPLv3 #include #include #include +#include "../../lib/gettext.h" + #include "pam_panic_reject.h" #include "pam_panic_authdevice.h" #include "pam_panic_password.h"