Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37904892
en ru br
ALT Linux repositórios
S:4.17.11-alt1
5.0: 3.0.33-alt4
4.1: 3.0.30-alt3
4.0: 3.0.33-alt1.M40.1
+updates:3.0.33-alt1.M40.1
3.0: 3.0.14a-alt2
+backports:3.0.28-alt1

Group :: Sistema/Servidores
RPM: samba

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: aw-smbstatus.patch
Download


--- samba-3.0.original/source/utils/status.c.aw	2002-11-28 14:48:23 +0200
+++ samba-3.0.original/source/utils/status.c	2002-11-28 15:31:53 +0200
@@ -42,6 +42,7 @@
 static int verbose, brief;
 static int            shares_only = 0;            /* Added by RJS */
 static int            locks_only  = 0;            /* Added by RJS */
+static int            old_style  = 0;            /* Added by EMI */
 static BOOL processes_only=False;
 static int show_brl;
 
@@ -518,6 +519,29 @@
 	return 0;
 }
 
+static int traverse_fn2(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state)
+{
+	struct connections_data crec;
+
+	if (dbuf.dsize != sizeof(crec))
+		return 0;
+
+	memcpy(&crec, dbuf.dptr, sizeof(crec));
+
+	if (crec.cnum == -1)
+		return 0;
+
+	if (!process_exists(crec.pid) || !Ucrit_checkUsername(uidtoname(crec.uid))) {
+		return 0;
+	}
+	d_printf("%-24.24s   :%-15s :%-8s :%5d   :%-8s :(%s) :%s",
+		crec.name,uidtoname(crec.uid),gidtoname(crec.gid),(int)crec.pid,
+		crec.machine,crec.addr,
+		asctime(LocalTime(&crec.start)));
+
+	return 0;
+}
+
 static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state)
 {
 	struct sessionid sessionid;
@@ -559,6 +583,7 @@
 		{"profile",	'P', POPT_ARG_NONE,	&profile_only, 'P', "Do profiling" },
 #endif /* WITH_PROFILE */
 		{"byterange",	'B', POPT_ARG_NONE,	&show_brl, 'B', "Include byte range locks"},
+   		{"old-style",	'o', POPT_ARG_NONE,	&old_style, 'o', "Display data using old style"},
 		POPT_COMMON_SAMBA
 		POPT_TABLEEND
 	};
@@ -596,6 +621,7 @@
 		return profile_dump();
 	}
 	
+	if (old_style) goto old;
 	tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
 	if (!tdb) {
 		d_printf("sessionid.tdb not initialised\n");
@@ -609,7 +635,7 @@
 		tdb_traverse(tdb, traverse_sessionid, NULL);
 		tdb_close(tdb);
 	}
-  
+ old: 
 	tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
 	if (!tdb) {
 		d_printf("%s not initialised\n", lock_path("connections.tdb"));
@@ -622,15 +648,23 @@
 		if (brief) 
 			exit(0);
 		
-		d_printf("\nService      pid     machine       Connected at\n");
-		d_printf("-------------------------------------------------------\n");
+		if (old_style) {
+			d_printf("\nService                     uid               gid       pid      machine\n");
+			d_printf("------------------------------------------------------------------------\n");
+
+			tdb_traverse(tdb, traverse_fn2, NULL);
+		} else {
+			d_printf("\nService      pid     machine       Connected at\n");
+			d_printf("-------------------------------------------------------\n");
 
-		tdb_traverse(tdb, traverse_fn1, NULL);
+			tdb_traverse(tdb, traverse_fn1, NULL);
+		}
 		tdb_close(tdb);
 	}
 
  locks:
 	if (processes_only) exit(0);
+	if (old_style) exit(0);
 
 	if (!shares_only) {
 		int ret;
@@ -659,3 +693,4 @@
 
 	return (0);
 }
+
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009