/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/splashy.c

  • Committer: Teddy Hogeborn
  • Date: 2008-09-26 04:54:35 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080926045435-0thnnqops1kzclag
* debian/mandos-client.postinst: Change home directory to
                                 "/nonexistent".
* debian/mandos.postinst: - '' -

* plugin-runner.c (main): Bug fix: Block signals while modifying
                          "plugin_list".

* plugins.d/usplash.c (usplash_write): New function.
  (main): Use "usplash_write" to write "INPUTQUIET" command.  Also
          write "TIMEOUT 0" before it, and write "TIMEOUT 15" and
          "PULSATE" if starting a new usplash process.  Kill old
          usplash before forking.  Bug fix: do setuid(geteuid()) to
          preserve genuine rootness.  Better interrupted/error logic
          overall.

* debian/mandos-client.lintian-overrides: Ignore setuid
                                          "plugins.d/usplash".

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
  interrupted_by_signal = 1;
26
26
}
27
27
 
28
 
int main(__attribute__((unused))int argc, char **argv){
 
28
int main(__attribute__((unused))int argc,
 
29
         __attribute__((unused))char **argv){
29
30
  int ret = 0;
30
31
  
31
32
  /* Create prompt string */
76
77
      }
77
78
      /* Find the executable name by doing readlink() on the
78
79
         /proc/<pid>/exe link */
79
 
      char *exe_link;
80
 
      ret = asprintf(&exe_link, "/proc/%s/exe", proc_ent->d_name);
81
 
      if(ret == -1){
82
 
        perror("asprintf");
83
 
        free(prompt);
84
 
        closedir(proc_dir);
85
 
        return EXIT_FAILURE;
86
 
      }
87
80
      char exe_target[sizeof(splashy_name)];
88
 
      ssize_t sret = readlink(exe_link, exe_target,
89
 
                              sizeof(exe_target));
 
81
      ssize_t sret;
 
82
      {
 
83
        char *exe_link;
 
84
        ret = asprintf(&exe_link, "/proc/%s/exe", proc_ent->d_name);
 
85
        if(ret == -1){
 
86
          perror("asprintf");
 
87
          free(prompt);
 
88
          closedir(proc_dir);
 
89
          return EXIT_FAILURE;
 
90
        }
 
91
        sret = readlink(exe_link, exe_target, sizeof(exe_target));
 
92
        free(exe_link);
 
93
      }
90
94
      if((sret == ((ssize_t)sizeof(exe_target)-1))
91
95
         and (memcmp(splashy_name, exe_target,
92
96
                     sizeof(exe_target)-1) == 0)){
195
199
  if(interrupted_by_signal){
196
200
    kill(splashy_command_pid, SIGTERM);
197
201
  }
198
 
 
 
202
  
199
203
  pid_t new_splashy_pid = fork();
200
204
  if(new_splashy_pid == 0){
 
205
    /* Child; will become new splashy process */
201
206
    while(kill(splashy_pid, 0)){
202
207
      sleep(2);
203
208
      kill(splashy_pid, SIGKILL);