/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/passprompt.c

  • Committer: Teddy Hogeborn
  • Date: 2008-07-21 04:42:08 UTC
  • mfrom: (15.1.3 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20080721044208-y8v1sjmvalfiehrv
Merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  -*- coding: utf-8 -*- */
2
 
/*
3
 
 * Passprompt - Read a password from the terminal and print it
4
 
 *
5
 
 * Copyright © 2007-2008 Teddy Hogeborn & Björn Påhlsson
6
 
 * 
7
 
 * This program is free software: you can redistribute it and/or
8
 
 * modify it under the terms of the GNU General Public License as
9
 
 * published by the Free Software Foundation, either version 3 of the
10
 
 * License, or (at your option) any later version.
11
 
 * 
12
 
 * This program is distributed in the hope that it will be useful, but
13
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
 * General Public License for more details.
16
 
 * 
17
 
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program.  If not, see
19
 
 * <http://www.gnu.org/licenses/>.
20
 
 * 
21
 
 * Contact the authors at <https://www.fukt.bsnet.se/~belorn/> and
22
 
 * <https://www.fukt.bsnet.se/~teddy/>.
23
 
 */
24
 
 
25
1
#define _GNU_SOURCE             /* getline() */
26
 
 
 
2
#define _FORTIFY_SOURCE 2
27
3
#include <termios.h>            /* struct termios, tcsetattr(),
28
4
                                   TCSAFLUSH, tcgetattr(), ECHO */
29
5
#include <unistd.h>             /* struct termios, tcsetattr(),
49
25
volatile bool quit_now = false;
50
26
bool debug = false;
51
27
 
52
 
void termination_handler(__attribute__((unused))int signum){
 
28
void termination_handler(int signum){
53
29
  quit_now = true;
54
30
}
55
31
 
102
78
  
103
79
  sigemptyset(&new_action.sa_mask);
104
80
  sigaddset(&new_action.sa_mask, SIGINT);
 
81
  sigaddset(&new_action.sa_mask, SIGQUIT);
105
82
  sigaddset(&new_action.sa_mask, SIGHUP);
106
83
  sigaddset(&new_action.sa_mask, SIGTERM);
107
84
  sigaction(SIGINT, NULL, &old_action);
108
85
  if (old_action.sa_handler != SIG_IGN)
109
86
    sigaction(SIGINT, &new_action, NULL);
 
87
  sigaction(SIGQUIT, NULL, &old_action);
 
88
  if (old_action.sa_handler != SIG_IGN)
 
89
    sigaction(SIGQUIT, &new_action, NULL);
110
90
  sigaction(SIGHUP, NULL, &old_action);
111
91
  if (old_action.sa_handler != SIG_IGN)
112
92
    sigaction(SIGHUP, &new_action, NULL);