summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c4
-rw-r--r--source3/lib/charcnv.c26
-rw-r--r--source3/utils/status.c93
3 files changed, 102 insertions, 21 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index a9e81cfd64..e023530cb5 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -4291,8 +4291,6 @@ static void usage(char *pname)
DEBUG(0,("\n"));
}
-
-
/****************************************************************************
main program
****************************************************************************/
@@ -4349,6 +4347,8 @@ static void usage(char *pname)
{
strcpy(service,argv[1]);
+ /* Convert any '/' characters in the service name to '\' characters */
+ string_replace( service, '/','\\');
argc--;
argv++;
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index cf4ae4edb6..b6debbec4a 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -51,7 +51,7 @@ static void update_map(char * str) {
}
}
-static void initiso() {
+static void init_iso8859_1() {
int i;
if (!mapsinited) initmaps();
@@ -79,6 +79,25 @@ update_map("\370\233\371\227\372\243\373\226\374\201\375\354\376\347\377\230");
}
+/* Init for eastern european languages. May need more work ? */
+
+static void init_iso8859_2() {
+
+ int i;
+ if (!mapsinited) initmaps();
+
+ /* Do not map undefined characters to some accidental code */
+ for (i = 128; i < 256; i++)
+ {
+ unix2dos[i] = CTRLZ;
+ dos2unix[i] = CTRLZ;
+ }
+
+update_map("\241\244\306\217\312\250\243\235\321\343\323\340\246\227\254\215");
+update_map("\257\275\261\245\346\206\352\251\263\210\361\344\363\242\266\230");
+update_map("\274\253\277\276");
+}
+
/*
* Convert unix to dos
*/
@@ -125,8 +144,9 @@ int interpret_character_set(char *str, int def)
{
if (strequal (str, "iso8859-1")) {
- initiso();
- return def;
+ init_iso8859_1();
+ } else if (strequal (str, "iso8859-2")) {
+ init_iso8859_2();
} else {
DEBUG(0,("unrecognized character set\n"));
}
diff --git a/source3/utils/status.c b/source3/utils/status.c
index ba7c5f3210..e8e57b3dd7 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -35,6 +35,15 @@
#include "includes.h"
struct connect_record crec;
+
+struct session_record{
+ int pid;
+ int uid;
+ char machine[31];
+ time_t start;
+ struct session_record *next;
+} *srecs;
+
extern int DEBUGLEVEL;
extern FILE *dbf;
extern pstring myhostname;
@@ -51,7 +60,7 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */
int uid, c;
static pstring servicesf = CONFIGFILE;
extern char *optarg;
- int verbose = 0;
+ int verbose = 0, brief =0;
BOOL firstopen=True;
BOOL processes_only=False;
int last_pid=0;
@@ -65,6 +74,7 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */
void *dir;
char *s;
#endif
+ struct session_record *ptr;
TimeInit();
@@ -80,8 +90,11 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */
return(1);
}
- while ((c = getopt(argc, argv, "pds:u:")) != EOF) {
+ while ((c = getopt(argc, argv, "pds:u:b")) != EOF) {
switch (c) {
+ case 'b':
+ brief = 1;
+ break;
case 'd':
verbose = 1;
break;
@@ -133,8 +146,16 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */
if (!processes_only) {
printf("\nSamba version %s\n",VERSION);
- printf("Service uid gid pid machine\n");
- printf("----------------------------------------------\n");
+ if (brief)
+ {
+ printf("PID Username Machine Time logged in\n");
+ printf("-------------------------------------------------------------------\n");
+ }
+ else
+ {
+ printf("Service uid gid pid machine\n");
+ printf("----------------------------------------------\n");
+ }
}
while (!feof(f))
@@ -145,23 +166,63 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */
&& Ucrit_checkUsername(uidtoname(crec.uid)) /* added by OH */
)
{
- Ucrit_addPid(crec.pid); /* added by OH */
- if (processes_only) {
- if (last_pid != crec.pid)
- printf("%d\n",crec.pid);
- last_pid = crec.pid; /* XXXX we can still get repeats, have to
- add a sort at some time */
- }
- else
- printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s",
- crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid,
- crec.machine,crec.addr,
- asctime(LocalTime(&crec.start)));
+ if (brief)
+ {
+ ptr=srecs;
+ while (ptr!=NULL)
+ {
+ if ((ptr->pid==crec.pid)&&(strncmp(ptr->machine,crec.machine,30)==0))
+ {
+ if (ptr->start > crec.start)
+ ptr->start=crec.start;
+ break;
+ }
+ ptr=ptr->next;
+ }
+ if (ptr==NULL)
+ {
+ ptr=(struct session_record *) malloc(sizeof(struct session_record));
+ ptr->uid=crec.uid;
+ ptr->pid=crec.pid;
+ ptr->start=crec.start;
+ strncpy(ptr->machine,crec.machine,30);
+ ptr->machine[30]='\0';
+ ptr->next=srecs;
+ srecs=ptr;
+ }
+ }
+ else
+ {
+ Ucrit_addPid(crec.pid); /* added by OH */
+ if (processes_only) {
+ if (last_pid != crec.pid)
+ printf("%d\n",crec.pid);
+ last_pid = crec.pid; /* XXXX we can still get repeats, have to
+ add a sort at some time */
+ }
+ else
+ printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s",
+ crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid,
+ crec.machine,crec.addr,
+ asctime(LocalTime(&crec.start)));
+ }
}
}
fclose(f);
if (processes_only) exit(0);
+
+ if (brief)
+ {
+ ptr=srecs;
+ while (ptr!=NULL)
+ {
+ printf("%-8d%-10.10s%-30.30s%s",ptr->pid,uidtoname(ptr->uid),ptr->machine,asctime(LocalTime(&(ptr->start))));
+ ptr=ptr->next;
+ }
+ printf("\n");
+ exit(0);
+ }
printf("\n");