gettext: pam_panic_authdevice + better texts
This commit is contained in:
parent
9ee0585927
commit
54ffdc16f1
@ -6,23 +6,37 @@ DATE : 2018-03-27T02:34:08+02:00
|
|||||||
LICENSE : GNU-GPLv3
|
LICENSE : GNU-GPLv3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
|
#include "../../lib/gettext.h"
|
||||||
#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 "pam_panic_reject.h"
|
|
||||||
|
|
||||||
|
#include "pam_panic_reject.h"
|
||||||
#include "pam_panic_authdevice.h"
|
#include "pam_panic_authdevice.h"
|
||||||
|
|
||||||
|
#define _(String) gettext(String)
|
||||||
|
|
||||||
|
|
||||||
int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff){
|
int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff){
|
||||||
|
|
||||||
#ifndef TEST
|
#ifndef TEST
|
||||||
|
|
||||||
|
// gettext
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
|
textdomain(PACKAGE);
|
||||||
|
|
||||||
int8_t counter = 0;
|
int8_t counter = 0;
|
||||||
while(access(allowed, F_OK) == -1 && access(rejected, F_OK) == -1){
|
while(access(allowed, F_OK) == -1 && access(rejected, F_OK) == -1){
|
||||||
pam_prompt(pamh, PAM_PROMPT_ECHO_OFF, NULL, ASK);
|
pam_prompt(pamh, PAM_PROMPT_ECHO_OFF, NULL, _("Key? "));
|
||||||
if(++counter >= 3){
|
if(++counter >= 3){
|
||||||
pam_syslog(pamh, LOG_NOTICE, "Couldn't identify any keys. 3 tries.");
|
pam_syslog(pamh, LOG_NOTICE, _("Couldn't identify any key after 3 tries."));
|
||||||
return (PAM_MAXTRIES);
|
return (PAM_MAXTRIES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ DATE : 2018-03-27T02:34:08+02:00
|
|||||||
LICENSE : GNU-GPLv3
|
LICENSE : GNU-GPLv3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
#define ASK "Key? "
|
|
||||||
|
|
||||||
int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff);
|
int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff);
|
||||||
|
Loading…
Reference in New Issue
Block a user