/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: 2011-07-16 00:29:19 UTC
  • Revision ID: teddy@fukt.bsnet.se-20110716002919-r77yikuiulj42o40
* initramfs-tools-script: Abort if plugin-runner is missing.  Removed
                          workaround for Debian bug #633582; the
                          workaround required getopt, which can not be
                          guaranteed.
* plugin-runner.c (main): Work around Debian bug #633582.
* plugins.d/mandos-client.c (main): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
742
742
    }
743
743
  }
744
744
  
745
 
  /* Strip permissions down to nobody */
 
745
  {
 
746
    /* Work around Debian bug #633582:
 
747
       <http://bugs.debian.org/633582> */
 
748
    int plugindir_fd = open(/* plugindir or */ PDIR, O_RDONLY);
 
749
    if(plugindir_fd == -1){
 
750
      error(0, errno, "open");
 
751
    } else {
 
752
      ret = (int)TEMP_FAILURE_RETRY(fstat(plugindir_fd, &st));
 
753
      if(ret == -1){
 
754
        error(0, errno, "fstat");
 
755
      } else {
 
756
        if(S_ISDIR(st.st_mode) and st.st_uid == 0 and st.st_gid == 0){
 
757
          ret = fchown(plugindir_fd, uid, gid);
 
758
          if(ret == -1){
 
759
            error(0, errno, "fchown");
 
760
          }
 
761
        }
 
762
      }
 
763
      TEMP_FAILURE_RETRY(close(plugindir_fd));
 
764
    }
 
765
  }
 
766
  
 
767
  /* Lower permissions */
746
768
  setgid(gid);
747
769
  if(ret == -1){
748
770
    error(0, errno, "setgid");