Author: jerry
Date: 2005-09-02 15:55:38 +0000 (Fri, 02 Sep 2005)
New Revision: 9963

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9963

Log:
* adding my copyright
* removing handle_string from EventlogInfo structure


Modified:
   trunk/source/rpc_server/srv_eventlog_nt.c


Changeset:
Modified: trunk/source/rpc_server/srv_eventlog_nt.c
===================================================================
--- trunk/source/rpc_server/srv_eventlog_nt.c   2005-09-02 15:54:17 UTC (rev 
9962)
+++ trunk/source/rpc_server/srv_eventlog_nt.c   2005-09-02 15:55:38 UTC (rev 
9963)
@@ -1,7 +1,8 @@
 /* 
  *  Unix SMB/CIFS implementation.
  *  RPC Pipe client / server routines
- *  Copyright (C) Marcin Krzysztof Porwit    2005.
+ *  Copyright (C) Marcin Krzysztof Porwit    2005,
+ *  Copyright (C) Gerald (Jerry) Carter      2005.
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -26,7 +27,6 @@
 typedef struct {
        char *logname;
        char *servername;
-       char *handle_string;
        uint32 num_records;
        uint32 oldest_entry;
        uint32 flags;
@@ -84,30 +84,6 @@
 }
 
 /********************************************************************
-********************************************************************/
-
-char* policy_handle_to_string( void *ctx, POLICY_HND *handle )
-{
-       char *handle_string;
-       
-       handle_string = talloc_asprintf( ctx, 
"%08X-%08X-%04X-%04X-%02X%02X%02X%02X%02X",
-                handle->data1,
-                handle->data2,
-                handle->data3,
-                handle->data4,
-                handle->data5[0],
-                handle->data5[1],
-                handle->data5[2],
-                handle->data5[3],
-                handle->data5[4] );
-                
-       if ( !handle_string )
-               DEBUG(0,("policy_handle_to_string: talloc_asprintf() 
failed!\n"));
-               
-       return handle_string;
-}
-
-/********************************************************************
  Callout to control the specified event log - passing out only 
  the MaxSize and Retention values, along with eventlog name
  uses smbrun...
@@ -170,11 +146,7 @@
        
        /* now run the command */
 
-       pstr_sprintf(command, "%s \"%s\" %u %u",
-                cmd,
-                elogname,
-                uiRetention,
-                uiMaxSize );
+       pstr_sprintf(command, "%s \"%s\" %u %u", cmd, elogname, uiRetention, 
uiMaxSize );
 
        DEBUG(10, ("control_eventlog_hook: Running [%s]\n", command));
        ret = smbrun(command, &fd);
@@ -212,15 +184,12 @@
        int ret;
        int fd = -1;
 
-       if(cmd == NULL || strlen(cmd) == 0) {
+       if ( !cmd || !*cmd ) {
                DEBUG(0, ("Must define an \"eventlog open command\" entry in 
the config.\n"));
                return False;
        }
 
-       pstr_sprintf(command, "%s \"%s\" \"%s\"",
-                cmd,
-                info->logname,
-                info->handle_string);
+       pstr_sprintf(command, "%s \"%s\"", cmd, info->logname );
 
        DEBUG(10, ("Running [%s]\n", command));
        ret = smbrun(command, &fd);
@@ -271,16 +240,12 @@
        int ret;
        int fd = -1;
 
-       if(cmd == NULL || strlen(cmd) == 0) {
+       if ( !cmd || !*cmd ) {
                DEBUG(0, ("Must define an \"eventlog num records command\" 
entry in the config.\n"));
                return False;
        }
 
-       memset(command, 0, sizeof(command));
-       slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"", 
-                cmd,
-                info->logname,
-                info->handle_string);
+       pstr_sprintf( command, "%s \"%s\"", cmd, info->logname );
 
        DEBUG(10, ("Running [%s]\n", command));
        ret = smbrun(command, &fd);
@@ -330,16 +295,12 @@
        int ret;
        int fd = -1;
 
-       if(cmd == NULL || strlen(cmd) == 0) {
+       if ( !cmd || !*cmd ) {
                DEBUG(0, ("Must define an \"eventlog oldest record command\" 
entry in the config.\n"));
                return False;
        }
 
-       memset(command, 0, sizeof(command));
-       slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"", 
-                cmd,
-                info->logname,
-                info->handle_string);
+       pstr_sprintf( command, "%s \"%s\"", cmd, info->logname );
 
        DEBUG(10, ("Running [%s]\n", command));
        ret = smbrun(command, &fd);
@@ -387,16 +348,12 @@
        int ret;
        int fd = -1;
 
-       if(cmd == NULL || strlen(cmd) == 0) {
+       if ( !cmd || !*cmd ) {
                DEBUG(0, ("Must define an \"eventlog close command\" entry in 
the config.\n"));
                return False;
        }
 
-       memset(command, 0, sizeof(command));
-       slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"", 
-                cmd, 
-                info->logname, 
-                info->handle_string);
+       pstr_sprintf( command, "%s \"%s\"", cmd, info->logname );
 
        DEBUG(10, ("Running [%s]\n", command));
        ret = smbrun(command, &fd);
@@ -622,22 +579,16 @@
        int ret;
        int fd = -1;
 
-       if(info == NULL) {
+       if ( !info )
                return False;
-       }
 
-       if(cmd == NULL || strlen(cmd) == 0) {
+       if ( !cmd || !*cmd ) {
                DEBUG(0, ("Must define an \"eventlog read command\" entry in 
the config.\n"));
                return False;
        }
 
-       slprintf(command, sizeof(command)-1, "%s \"%s\" %s %d %d \"%s\"",
-                cmd,
-                info->logname,
-                direction,
-                starting_record,
-                buffer_size,
-                info->handle_string);
+       pstr_sprintf( command, "%s \"%s\" %s %d %d",
+                cmd, info->logname, direction, starting_record, buffer_size );
 
        *numlines = 0;
 
@@ -788,8 +739,7 @@
  *               eventlog_io_q_clear_eventlog for info about odd file name 
behavior
  */
 
-static BOOL clear_eventlog_hook(EventlogInfo *info,
-                                         pstring backup_file_name)
+static BOOL clear_eventlog_hook(EventlogInfo *info, pstring backup_file_name)
 {
        char *cmd = lp_eventlog_clear_cmd();
        char **qlines;
@@ -798,24 +748,15 @@
        int ret;
        int fd = -1;
 
-       if(cmd == NULL || strlen(cmd) == 0) {
+       if ( !cmd || !*cmd ) {
                DEBUG(0, ("Must define an \"eventlog clear command\" entry in 
the config.\n"));
                return False;
        }
 
-       memset(command, 0, sizeof(command));
-       if(strlen(backup_file_name) > 0) {
-               slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\"",
-                        cmd,
-                        info->logname,
-                        backup_file_name,
-                        info->handle_string);
-       } else {
-               slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"", 
-                        cmd, 
-                        info->logname, 
-                        info->handle_string);
-       }
+       if ( strlen(backup_file_name) ) 
+               pstr_sprintf( command, "%s \"%s\" \"%s\"", cmd, info->logname, 
backup_file_name );
+       else 
+               pstr_sprintf( command, "%s \"%s\"", cmd, info->logname );
 
        DEBUG(10, ("Running [%s]\n", command));
        ret = smbrun(command, &fd);
@@ -878,11 +819,6 @@
                return WERR_NOMEM;
        }
        
-       if ( !(info->handle_string = policy_handle_to_string( info, 
&r_u->handle )) ) {
-               close_policy_hnd(p, &r_u->handle);
-               return WERR_BADFILE;    
-       }
-
        if ( !(open_eventlog_hook(info)) ) {
                close_policy_hnd(p, &r_u->handle);
                return WERR_BADFILE;

Reply via email to