[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?


Regards,

Phil




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 @@

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

   reload_services(True);
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];
+
 #ifdef HAVE_SET_AUTH_PARAMETERS
        set_auth_parameters(argc,argv);





More information about the samba-technical mailing list