/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-30 03:19:39 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080930031939-t72se4dhr632o9ct
* Makefile: Add HTML rules for manual pages.
  (DOCBOOKTOHTML, HTMLPOST): New commands.
  (htmldocs): New file list.
  (html, install-html): New targets.
  (.PHONY, clean): Added "html".

* README (The Plugin System): New section; describe plugin system.

* debian/control (Uploaders): New field.

* mandos-options.xml (servicename): Improve wording.

* plugins.d/mandos-client.xml (SECURITY): Improve wording.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Passprompt - Read a password from the terminal and print it
4
4
 *
5
 
 * Copyright © 2007-2008 Teddy Hogeborn & Björn Påhlsson
 
5
 * Copyright © 2008 Teddy Hogeborn & Björn Påhlsson
6
6
 * 
7
7
 * This program is free software: you can redistribute it and/or
8
8
 * modify it under the terms of the GNU General Public License as
216
216
      status = EXIT_SUCCESS;
217
217
      /* Make n = data size instead of allocated buffer size */
218
218
      n = (size_t)ret;
 
219
      /* Strip final newline */
 
220
      if(n>0 and buffer[n-1] == '\n'){
 
221
        buffer[n-1] = '\0';     /* not strictly necessary */
 
222
        n--;
 
223
      }
219
224
      size_t written = 0;
220
225
      while(written < n){
221
226
        ret = write(STDOUT_FILENO, buffer + written, n - written);
244
249
      fprintf(stderr, "getline() returned 0, retrying.\n");
245
250
    }
246
251
  }
 
252
 
 
253
  free(buffer);
247
254
  
248
255
  if (debug){
249
256
    fprintf(stderr, "Restoring terminal attributes\n");
256
263
    fprintf(stderr, "%s is exiting with status %d\n", argv[0],
257
264
            status);
258
265
  }
 
266
  if(status == EXIT_SUCCESS){
 
267
    fputc('\n', stderr);
 
268
  }
259
269
  
260
270
  return status;
261
271
}