-x option causes 'whitelines' in ps output

Mauce
2006-02-10
2013-04-22
  • Mauce

    Mauce - 2006-02-10

    I'm using this tool for quite a while now and I think is one of the most valuable tool IMO.

    A 'bug' I'd like to report regarding the -x parameter:
    When defining the processtitle the string will appear in the processlist (ps -ef) but has a number of emptylines ('witregels') underneath in the processlist.

    This is an axample (I named my tunnel process 'pijpje')

    root@laptopeth0:/root # ps -ef|grep pijpje
    root      4544  4543  0 09:30 pts/1    00:00:00 pijpje

    mauce     4556  2861  0 09:31 ?        00:00:00 /usr/bin/gaim
    .......

    As you can see there are empty lines in this output.
    Allthough this is not a big problem for the functionality it undermines the idea of running this process without being noticed.

    I hope this helps

    Good luck

    Mauce

     
    • Dieter Stüken

      Dieter Stüken - 2006-02-17

      In order to hide the parameters, especially the password, of the command line, I would suggest a much easier approach: Just erase all characters of the **argv string. Don't know if it works on a MAC or under Cygwin, too, but on all UNIX systems I know    about, this shows up in the command line for 'ps'.
      I even think this should always be done by default at least for the password, or even for all arguments. Here is an example patch to wipe all arguments:

      --- cmdline.c.ORIG      2006-02-07 13:38:25.000000000 +0100
      +++ cmdline.c   2006-02-17 14:41:05.000000000 +0100
      @@ -111,4 +111,11 @@
      }

      +/* replace all characters by '\0' */
      +static void destroy_string(char* s)
      +{
      +    while(*s)
      +        *s++ = '\0';
      +}
      +
      int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *args_info )
      {
      @@ -390,4 +397,8 @@
                 abort ();
               } /* switch */
      +
      +        /* erase commandline string visible to "ps" */
      +        destroy_string(optarg);
      +
           } /* while */

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks