/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 plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2008-09-06 15:34:21 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080906153421-605ydhwyo404krh9
* initramfs-tools-hook: Use long options where available.  Use only
                        one "test" invocation instead of several.

* mandos-keygen: Use only one "test" invocation instead of several.
                 Use long options where available.  Strip newline from
                 entered password.

* plugin-runner.c (print_out_password): Do not strip trailing newline.
  (fallback): Strip trailing newline from getpass().

* plugin-runner.xml (PLUGINS): Plugins should not print trailing
                               newlines.

* plugins.d/password-prompt.c (main): Strip trailing newline.

* plugins.d/password-request.c (main): Bug fix: Read "pubkey.txt", not
                                       "pupkey.txt".

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
/* Prints out a password to stdout */
256
256
bool print_out_password(const char *buffer, size_t length){
257
257
  ssize_t ret;
258
 
  if(length>0 and buffer[length-1] == '\n'){
259
 
    length--;
260
 
  }
261
258
  for(size_t written = 0; written < length; written += (size_t)ret){
262
259
    ret = TEMP_FAILURE_RETRY(write(STDOUT_FILENO, buffer + written,
263
260
                                   length - written));
1041
1038
    bool bret;
1042
1039
    fprintf(stderr, "Going to fallback mode using getpass(3)\n");
1043
1040
    char *passwordbuffer = getpass("Password: ");
1044
 
    bret = print_out_password(passwordbuffer, strlen(passwordbuffer));
 
1041
    size_t len = strlen(passwordbuffer);
 
1042
    /* Strip trailing newline */
 
1043
    if(len > 0 and passwordbuffer[len-1] == '\n'){
 
1044
      passwordbuffer[len-1] = '\0'; /* not strictly necessary */
 
1045
      len--;
 
1046
    }
 
1047
    bret = print_out_password(passwordbuffer, len);
1045
1048
    if(not bret){
1046
1049
      perror("print_out_password");
1047
1050
      exitstatus = EXIT_FAILURE;