RFC: KCmdLineArgs::obfuscateOption()

Jarosław Staniek js at iidea.pl
Mon Oct 4 20:04:20 BST 2004

The proposal:
An enhancement for security in KDE apps: sometimes it's needed to obfuscate  
CL option value (replacing with "x" string), when it contain a password, to 
hide it from stealing using 'ps' command.

static void KCmdLineArgs::obfuscateOption(const char*)

would be usable to do that without playing with int argc, char **argv.

I've done this as follows (for password" option), 
but it could be easier with KCmdLineArgs:

	for (int i=1; i<(argc-1); i++) {
		if (qstrcmp("--password",argv[i])==0
		  || qstrcmp("-password",argv[i])==0)
			QCString pwd(argv[i+1]);
			if (!pwd.isEmpty()) {
				pwd.fill(' ');
				qstrcpy(argv[i+1], (const char*)pwd);

regards / pozdrawiam,
  Jaroslaw Staniek / OpenOffice Polska
  Kexi Project: http://www.kexi-project.org, http://koffice.kde.org/kexi
  QT-KDE Wrapper Project: http://iidea.pl/~js/qkw

More information about the kde-core-devel mailing list