2 Unix SMB/Netbios implementation.
4 Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
5 Copyright (C) Andrew Tridgell 1994-1999,
6 Copyright (C) Jean Francois Micouleau 1998-1999.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 extern int DEBUGLEVEL;
35 extern struct cli_state *smb_cli;
39 /****************************************************************************
40 ****************************************************************************/
41 void cmd_eventlog(struct client_info *info)
56 flags=EVENTLOG_READ_SEQUENTIAL|EVENTLOG_READ_BACKWARD;
58 while (next_token(NULL, temp, NULL, sizeof(temp)))
60 fstrcpy(journal, temp);
63 /* open scheduler session. */
64 res1 = res1 ? cli_nt_session_open(smb_cli, PIPE_EVENTLOG, &nt_pipe_fnum) : False;
66 res1 = res1 ? do_event_open(smb_cli, nt_pipe_fnum, journal, &hnd) : False;
68 res = res1 ? do_event_numofeventlogrec(smb_cli, nt_pipe_fnum, &hnd, &number) : False;
70 fprintf(out_hnd, "Number of events: %d\n", number);
72 display_eventlog_eventrecord(out_hnd, ACTION_HEADER, &ev);
74 for (offset = 0; offset < number && res; offset++)
78 /* try once with a empty buffer */
79 res = res ? do_event_readeventlog(smb_cli, nt_pipe_fnum, &hnd, number,
80 flags, offset, &num_of_bytes, &ev) : False;
82 /* and try again with the correct size */
83 res = res ? do_event_readeventlog(smb_cli, nt_pipe_fnum, &hnd, number,
84 flags, offset, &num_of_bytes, &ev) : False;
86 display_eventlog_eventrecord(out_hnd, ACTION_ENUMERATE, &ev);
89 display_eventlog_eventrecord(out_hnd, ACTION_FOOTER, &ev);
91 res1 = res1 ? do_event_close(smb_cli, nt_pipe_fnum, &hnd): False;
93 /* close the session */
94 cli_nt_session_close(smb_cli, nt_pipe_fnum);