Hide passwords in ps output

Registered by Dmitry Ilyin

mydumper should not show password it was ran with in ps output for all users to see it.
Yes, yo can put password in ~/.my.cfg as workaround.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

commit 056fa3edc2a3880d35986d6f123430fde5fe292a
Author: Dmitry Ilyin <email address hidden>
Date: Sat Oct 27 02:10:40 2012 +0400

    Add cmdline mask for mydumper

diff --git a/mydumper.c b/mydumper.c
index 9c37d39..39edff1 100644
--- a/mydumper.c
+++ b/mydumper.c
@@ -367,6 +367,15 @@ int main(int argc, char *argv[])

        init_mutex = g_mutex_new();

+ //calculate cmdlen
+ int cmdlen = 0;
+ int argn = 0;
+
+ for (argn = 0; argn < argc; ++argn) {
+ cmdlen += (int) strlen(argv[argn]);
+ }
+ cmdlen = cmdlen + argc - 1;
+
        context = g_option_context_new("multi-threaded MySQL dumping");
        GOptionGroup *main_group= g_option_group_new("main", "Main Options", "Main Options", NULL, NULL);
        g_option_group_add_entries(main_group, entries);
@@ -377,6 +386,11 @@ int main(int argc, char *argv[])
                exit (EXIT_FAILURE);
        }
        g_option_context_free(context);
+
+ //erase cmdline
+ memset(argv[0],'\0',cmdlen);
+ //set new cmdline
+ sprintf(argv[0],"mydumper: dumping database '%s'",db);

        if (program_version) {
                g_print("mydumper %s, built against MySQL %s\n", VERSION, MYSQL_SERVER_VERSION);

-------
and this for my loader
-------

commit f8f9850045a317b927903482317ee32ecce47eea
Author: Dmitry Ilyin <email address hidden>
Date: Sat Oct 27 02:24:33 2012 +0400

    Add cmdline mask for myloader

diff --git a/myloader.c b/myloader.c
index 7697e97..a38b4fd 100644
--- a/myloader.c
+++ b/myloader.c
@@ -93,6 +93,15 @@ int main(int argc, char *argv[]) {

        init_mutex= g_mutex_new();

+ //calculate cmdlen
+ int cmdlen = 0;
+ int argn = 0;
+
+ for (argn = 0; argn < argc; ++argn) {
+ cmdlen += (int) strlen(argv[argn]);
+ }
+ cmdlen = cmdlen + argc - 1;
+
        context= g_option_context_new("multi-threaded MySQL loader");
        GOptionGroup *main_group= g_option_group_new("main", "Main Options", "Main Options", NULL, NULL);
        g_option_group_add_entries(main_group, entries);
@@ -104,6 +113,11 @@ int main(int argc, char *argv[]) {
        }
        g_option_context_free(context);

+ //erase cmdline
+ memset(argv[0],'\0',cmdlen);
+ //set new cmdline
+ sprintf(argv[0],"myloader: loading from directory '%s'",directory);
+
        if (program_version) {
                g_print("myloader %s, built against MySQL %s\n", VERSION, MYSQL_SERVER_VERSION);
                exit(EXIT_SUCCESS);

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.