/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/password-prompt.c

  • Committer: Teddy Hogeborn
  • Date: 2008-09-01 08:29:23 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080901082923-i2liq6t7warmu9xe
* mandos.xml: Enclose "RAM" with <acronym>.
* overview.xml: - '' -

* plugin-runner.xml (DESCRIPTION): Improved wording.
  (PURPOSE): New section.
  (OPTIONS): Improved wording.
  (OVERVIEW, PLUGINS): New section.
  (FALLBACK): New empty placeholder section.

* plugins.d/password-prompt.xml: Enclose "RAM" with <acronym>.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  -*- coding: utf-8 -*- */
2
2
/*
3
3
 * Passprompt - Read a password from the terminal and print it
4
 
 * 
5
 
 * Copyright © 2008 Teddy Hogeborn
6
 
 * Copyright © 2008 Björn Påhlsson
 
4
 *
 
5
 * Copyright © 2007-2008 Teddy Hogeborn & Björn Påhlsson
7
6
 * 
8
7
 * This program is free software: you can redistribute it and/or
9
8
 * modify it under the terms of the GNU General Public License as
53
52
 
54
53
volatile bool quit_now = false;
55
54
bool debug = false;
56
 
const char *argp_program_version = "password-prompt " VERSION;
 
55
const char *argp_program_version = "password-prompt 1.0";
57
56
const char *argp_program_bug_address = "<mandos@fukt.bsnet.se>";
58
57
 
59
58
static void termination_handler(__attribute__((unused))int signum){
217
216
      status = EXIT_SUCCESS;
218
217
      /* Make n = data size instead of allocated buffer size */
219
218
      n = (size_t)ret;
220
 
      /* Strip final newline */
221
 
      if(n>0 and buffer[n-1] == '\n'){
222
 
        buffer[n-1] = '\0';     /* not strictly necessary */
223
 
        n--;
224
 
      }
225
219
      size_t written = 0;
226
220
      while(written < n){
227
221
        ret = write(STDOUT_FILENO, buffer + written, n - written);
250
244
      fprintf(stderr, "getline() returned 0, retrying.\n");
251
245
    }
252
246
  }
253
 
 
254
 
  free(buffer);
255
247
  
256
248
  if (debug){
257
249
    fprintf(stderr, "Restoring terminal attributes\n");
264
256
    fprintf(stderr, "%s is exiting with status %d\n", argv[0],
265
257
            status);
266
258
  }
267
 
  if(status == EXIT_SUCCESS){
268
 
    fputc('\n', stderr);
269
 
  }
270
259
  
271
260
  return status;
272
261
}