components/proftpd/mod_solaris_audit.c
changeset 598 398722c80922
parent 305 e95b65443448
child 1848 289daf750b26
child 4646 2bb9a036a5f2
equal deleted inserted replaced
597:ea6a3f09379c 598:398722c80922
   384   /* The ftp server code will save errno into this variable
   384   /* The ftp server code will save errno into this variable
   385    * in case an error happens, and there is a valid errno for it.
   385    * in case an error happens, and there is a valid errno for it.
   386    */
   386    */
   387   cmd->error_code = ADT_FAILURE;
   387   cmd->error_code = ADT_FAILURE;
   388 
   388 
   389   if (cmd->argc != 2) {
   389   if (cmd->arg == NULL) {
   390     pr_log_pri(PR_LOG_ERR, "Auditing of %s failed: %s",
   390     pr_log_pri(PR_LOG_ERR, "Auditing of %s failed: %s",
   391       description, "bad arguments");
   391       description, "bad argument");
   392     goto err;
   392     goto err;
   393   }
   393   }
   394 
   394 
   395   if (arg2 != NULL) {
   395   if (arg2 != NULL) {
   396     *arg2 = NULL;
   396     *arg2 = NULL;
   397 
   397 
   398     if ((tmp = pstrdup(cmd->pool, cmd->argv[1])) == NULL) {
   398     if ((tmp = pstrdup(cmd->pool, cmd->arg)) == NULL) {
   399       how = "no memory";
   399       how = "no memory";
   400       pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   400       pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   401         description, cmd->argv[1], how);
   401         description, cmd->arg, how);
   402       goto err;
   402       goto err;
   403     }
   403     }
   404     *arg2 = tmp;
   404     *arg2 = tmp;
   405   }
   405   }
   406 
   406 
   407   if (cmd->notes == NULL ) {
   407   if (cmd->notes == NULL) {
   408     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   408     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   409       description, cmd->argv[1], "API error, notes is NULL");
   409       description, cmd->arg, "API error, notes is NULL");
   410     goto err;
   410     goto err;
   411   }
   411   }
   412 
   412 
   413   if ((event = adt_alloc_event(asession, event_type)) == NULL) {
   413   if ((event = adt_alloc_event(asession, event_type)) == NULL) {
   414     how = "couldn't allocate adt event";
   414     how = "couldn't allocate adt event";
   415     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s(%s)",
   415     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s(%s)",
   416       description, cmd->argv[1], how, strerror(errno));
   416       description, cmd->arg, how, strerror(errno));
   417     goto err;
   417     goto err;
   418   }
   418   }
   419 
   419 
   420   if (pr_table_add(cmd->notes, EVENT_KEY, event, sizeof(*event))==-1) {
   420   if (pr_table_add(cmd->notes, EVENT_KEY, event, sizeof(*event)) == -1) {
   421     how = "pr_table_add() failed";
   421     how = "pr_table_add() failed";
   422     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   422     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   423       description, cmd->argv[1], how);
   423       description, cmd->arg, how);
   424     adt_free_event(event);
   424     adt_free_event(event);
   425     goto err;
   425     goto err;
   426   }
   426   }
   427   
   427   
   428   return event;
   428   return event;
   916 
   916 
   917   event->adt_ft_rename.src_path = ptr;
   917   event->adt_ft_rename.src_path = ptr;
   918   event->adt_ft_rename.src_attr = NULL;
   918   event->adt_ft_rename.src_attr = NULL;
   919   event->adt_ft_rename.dst_path = "";
   919   event->adt_ft_rename.dst_path = "";
   920 
   920 
   921   src_path = strdup(cmd->argv[1]);
   921   src_path = strdup(cmd->arg);
   922   if (src_path == NULL) {
   922   if (src_path == NULL) {
   923     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   923     pr_log_pri(PR_LOG_ERR, "Auditing of %s(%s) failed: %s",
   924       "RNFR", ptr, "no memory");
   924       "RNFR", ptr, "no memory");
   925     goto err;
   925     goto err;
   926   }
   926   }