It is currently Mon, 25 Sep 2023 11:01:58 GMT



 
Author Message
 How to hide command line args under Solaris
I have a program that I want to hide the command line arguments on.  This
piece of code worked under SunOS 4.1.x, but doesn't seem to work any
longer.  

    while ((ch = getopt(argc, argv, "U:P:e:a:")) != -1)
      switch (ch) {
      case 'U':
                  strcpy(user, optarg);
                  break;
      case 'P':
                  strcpy(pass, optarg);
                  memset(optarg, ' ', strlen(optarg));
                  break;
      case 'e':
                  strcpy(prog, optarg);
                  args[0] = calloc(strlen(optarg)+1, sizeof(char));
                  strcpy(args[0], optarg);
          break;
      case 'a':
                  args[ac] = calloc(strlen(optarg)+1, sizeof(char));
                  strcpy(args[ac++], optarg);
                  break;
      default:
                  usage();
                  exit(-1);
          break;
      }

Basically, I can specify a username / password on the command line, but
I want to hide the password from a "ps -uxwwa".  Under solaris, if I do
a "ps -ef", the password shows up...the memset seems ineffective.

Is there any other way to hide arguments other than prompting for them
once the program starts, which I did a little later:

    if(!pass[0]) {
                cp = getpass("Password: ");
                if(cp) strcpy(pass, cp);
    }

I believe that the isql program for sybase has the same problem running
under solaris, but we're still on 4.9.2...so perhaps they fixed it.

Thanks,

-Erik

e...@walrus.com                         erik.kar...@nytech.nwmarkets.com
        play                                                    work



 Sat, 20 Jun 1998 03:00:00 GMT   
 
   [ 1 post ] 

Similar Threads

1. CGI commands with command line args?

2. how to hide command args

3. how to set argv command line args for ps

4. How to find out all the input args of a long command line

5. Script/Command line args for FTP needed!!

6. Command-line args in C

7. Command line args

8. command line args and 'if'

9. space in command line args

10. csh script command line args


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software