/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-07 09:36:35 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080907093635-yg1y272yv53dijhp
* Makefile (CONFDIR): Changed to be the same ("/etc/mandos") in both a
                      /usr/local install and a package install.
  (KEYDIR): Changed /usr/local install value to be "/etc/mandos/keys".
  (INITRAMFSTOOLS): Use $(DESTDIR) in /usr/local value too.

* initramfs-tools-hook: Look in "/etc/mandos/keys" too.

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));
737
734
    }
738
735
 
739
736
    char *filename;
740
 
    ret = asprintf(&filename, "%s/%s", plugindir, dirst->d_name);
 
737
    if(plugindir == NULL){
 
738
      ret = asprintf(&filename, PDIR "/%s", dirst->d_name);
 
739
    } else {
 
740
      ret = asprintf(&filename, "%s/%s", plugindir, dirst->d_name);
 
741
    }
741
742
    if(ret < 0){
742
743
      perror("asprintf");
743
744
      continue;
1039
1040
    bool bret;
1040
1041
    fprintf(stderr, "Going to fallback mode using getpass(3)\n");
1041
1042
    char *passwordbuffer = getpass("Password: ");
1042
 
    bret = print_out_password(passwordbuffer, strlen(passwordbuffer));
 
1043
    size_t len = strlen(passwordbuffer);
 
1044
    /* Strip trailing newline */
 
1045
    if(len > 0 and passwordbuffer[len-1] == '\n'){
 
1046
      passwordbuffer[len-1] = '\0'; /* not strictly necessary */
 
1047
      len--;
 
1048
    }
 
1049
    bret = print_out_password(passwordbuffer, len);
1043
1050
    if(not bret){
1044
1051
      perror("print_out_password");
1045
1052
      exitstatus = EXIT_FAILURE;