[PATCH] showing username in ps

Ph. Marek marek at bmlv.gv.at
Tue Jan 22 01:53:07 GMT 2002

Hello everybody!

As it was very nice in the "old" version (around 1.9.18) to see in ps which
process was owned by which user I've made a quick and dirty patch to do
something similar for 2.2pre3.

I know that a smbstatus would do the trick - but that shows only
smbd-processes. I want to have an overview with just ps.

So please - I'd like to get some votes. Should something like this be
implemented in samba?



diff -u -2 orig/smbd/reply.c new/smbd/reply.c
@@ -42,4 +42,6 @@
 unsigned int smb_echo_count = 0;

+extern char *process_name;
 report a possible attack via the password buffer overflow bug
@@ -894,4 +896,8 @@

+  safe_strcpy(process_name,"smbd ",5);
+  safe_strcpy(process_name+5,user,10);
+  process_name[15]=0;

diff -u -2 orig/smbd/server.c new/smbd/server.c
@@ -42,4 +42,6 @@
 extern fstring remote_machine;

+char *process_name;
 /* really we should have a top level context structure that has the
    client file descriptor as an element. That would require a major
rewrite :(
@@ -563,4 +565,6 @@
        pstring logfile;

+       process_name=argv[0];

More information about the samba-technical mailing list