components/proftpd/mod_solaris_audit.c
branchs11-sru
changeset 2251 310a361c2ce7
parent 305 e95b65443448
--- a/components/proftpd/mod_solaris_audit.c	Tue Mar 06 12:31:19 2012 -0800
+++ b/components/proftpd/mod_solaris_audit.c	Tue Mar 06 12:42:44 2012 -0800
@@ -1,6 +1,6 @@
 /*
  * ProFTPD - FTP server daemon
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
  *
  * 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
@@ -368,7 +368,6 @@
  *
  * If arg2 is not NULL, it makes a copy of the first (and only) command
  * argument (using the memory pool "pool" from "cmd") and stores it to *arg2.
- * There must be always exactly one command argument, otherwise it is an error.
  *
  * On success, the pointer to the created event structure is stored
  * into cmd under "notes" variable, so that it is accessible
@@ -386,41 +385,41 @@
    */
   cmd->error_code = ADT_FAILURE;
 
-  if (cmd->argc != 2) {
+  if (cmd->arg == NULL) {
     pr_log_pri(PR_LOG_ERR, "Auditing of %s failed: %s",
-      description, "bad arguments");
+      description, "bad argument");
     goto err;
   }
 
   if (arg2 != NULL) {
     *arg2 = NULL;
 
-    if ((tmp = pstrdup(cmd->pool, cmd->argv[1])) == NULL) {
+    if ((tmp = pstrdup(cmd->pool, cmd->arg)) == NULL) {
       how = "no memory";
       pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
-        description, cmd->argv[1], how);
+        description, cmd->arg, how);
       goto err;
     }
     *arg2 = tmp;
   }
 
-  if (cmd->notes == NULL ) {
+  if (cmd->notes == NULL) {
     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
-      description, cmd->argv[1], "API error, notes is NULL");
+      description, cmd->arg, "API error, notes is NULL");
     goto err;
   }
 
   if ((event = adt_alloc_event(asession, event_type)) == NULL) {
     how = "couldn't allocate adt event";
     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s(%s)",
-      description, cmd->argv[1], how, strerror(errno));
+      description, cmd->arg, how, strerror(errno));
     goto err;
   }
 
-  if (pr_table_add(cmd->notes, EVENT_KEY, event, sizeof(*event))==-1) {
+  if (pr_table_add(cmd->notes, EVENT_KEY, event, sizeof(*event)) == -1) {
     how = "pr_table_add() failed";
     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
-      description, cmd->argv[1], how);
+      description, cmd->arg, how);
     adt_free_event(event);
     goto err;
   }
@@ -918,7 +917,7 @@
   event->adt_ft_rename.src_attr = NULL;
   event->adt_ft_rename.dst_path = "";
 
-  src_path = strdup(cmd->argv[1]);
+  src_path = strdup(cmd->arg);
   if (src_path == NULL) {
     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
       "RNFR", ptr, "no memory");