/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-24 23:03:31 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080924230331-2qvhppypeo852ksr
* Makefile (PLUGINS): Added "plugins.d/usplash".
  (install-client-nokey): Add setuid bit on "plugins.d/usplash".

* plugins.d/splashy.c (main): Move "sret" to top.

* plugins.d/usplash: Removed.
* plugins.d/usplash.c: New.

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));
90
 
      free(exe_link);
 
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
      }
91
94
      if((sret == ((ssize_t)sizeof(exe_target)-1))
92
95
         and (memcmp(splashy_name, exe_target,
93
96
                     sizeof(exe_target)-1) == 0)){