/mandos/release

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

« back to all changes in this revision

Viewing changes to plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2008-09-05 18:37:28 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080905183728-l0m8v3vqa302uwrw
* mandos (main): Use EAFP with pidfile.

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
  }
258
261
  for(size_t written = 0; written < length; written += (size_t)ret){
259
262
    ret = TEMP_FAILURE_RETRY(write(STDOUT_FILENO, buffer + written,
260
263
                                   length - written));
1038
1041
    bool bret;
1039
1042
    fprintf(stderr, "Going to fallback mode using getpass(3)\n");
1040
1043
    char *passwordbuffer = getpass("Password: ");
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);
 
1044
    bret = print_out_password(passwordbuffer, strlen(passwordbuffer));
1048
1045
    if(not bret){
1049
1046
      perror("print_out_password");
1050
1047
      exitstatus = EXIT_FAILURE;