Print this page
NEX-13374 NDMP should be able to backup unmounted ZFS filesystems
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Revert "NEX-5801 Snapshots left over after failed backups"
This reverts commit f182fb95f09036db71fbfc6f0a6b90469b761f21.
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2911 NDMP logging should use syslog and is too chatty
NEX-894 Default location of NDMP log file should be under /var/log
NEX-727 Netbackup Catalog verification hangs waiting for NDMP server
*** 1,8 ****
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
! * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
* BSD 3 Clause License
*
--- 1,8 ----
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
! * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
*/
/*
* BSD 3 Clause License
*
*** 41,50 ****
--- 41,51 ----
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/uio.h>
+ #include <syslog.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <netdb.h>
*** 82,91 ****
--- 83,102 ----
* Do we support Direct Access Restore?
*/
int ndmp_dar_support = 0;
/*
+ * Is autosync enabled?
+ */
+ int ndmp_autosync_support = 0;
+
+ /*
+ * Is HPR snapshot enabled?
+ */
+ int ndmp_hpr_support = 0;
+
+ /*
* ndmp_connection_t handler function
*/
static ndmpd_file_handler_func_t connection_file_handler;
extern ndmp_handler_t ndmp_msghdl_tab[];
*** 152,162 ****
xdrrec_create(&connection->conn_xdrs, 0, 0, (caddr_t)connection,
ndmp_readit, ndmp_writeit);
if (connection->conn_xdrs.x_ops == 0) {
! NDMP_LOG(LOG_DEBUG, "xdrrec_create failed");
(void) mutex_destroy(&connection->conn_lock);
(void) close(connection->conn_sock);
free(connection);
return (0);
}
--- 163,173 ----
xdrrec_create(&connection->conn_xdrs, 0, 0, (caddr_t)connection,
ndmp_readit, ndmp_writeit);
if (connection->conn_xdrs.x_ops == 0) {
! syslog(LOG_ERR, "xdrrec_create failed");
(void) mutex_destroy(&connection->conn_lock);
(void) close(connection->conn_sock);
free(connection);
return (0);
}
*** 276,311 ****
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(port);
if ((server_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
! NDMP_LOG(LOG_DEBUG, "Socket error: %m");
return (-1);
}
on = 1;
(void) setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR,
(char *)&on, sizeof (on));
if (bind(server_socket, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
! NDMP_LOG(LOG_DEBUG, "bind error: %m");
(void) close(server_socket);
return (-1);
}
if (listen(server_socket, 5) < 0) {
! NDMP_LOG(LOG_DEBUG, "listen error: %m");
(void) close(server_socket);
return (-1);
}
for (; ; ) {
if ((ns = tcp_accept(server_socket, &ipaddr)) < 0) {
! NDMP_LOG(LOG_DEBUG, "tcp_accept error: %m");
continue;
}
- NDMP_LOG(LOG_DEBUG, "connection fd: %d", ns);
set_socket_options(ns);
if ((argp = ndmp_malloc(sizeof (ndmpd_worker_arg_t))) != NULL) {
argp->nw_sock = ns;
argp->nw_ipaddr = ipaddr;
--- 287,321 ----
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(port);
if ((server_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
! syslog(LOG_ERR, "Socket error: %m");
return (-1);
}
on = 1;
(void) setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR,
(char *)&on, sizeof (on));
if (bind(server_socket, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
! syslog(LOG_ERR, "bind error: %m");
(void) close(server_socket);
return (-1);
}
if (listen(server_socket, 5) < 0) {
! syslog(LOG_ERR, "listen error: %m");
(void) close(server_socket);
return (-1);
}
for (; ; ) {
if ((ns = tcp_accept(server_socket, &ipaddr)) < 0) {
! syslog(LOG_ERR, "tcp_accept error: %m");
continue;
}
set_socket_options(ns);
if ((argp = ndmp_malloc(sizeof (ndmpd_worker_arg_t))) != NULL) {
argp->nw_sock = ns;
argp->nw_ipaddr = ipaddr;
*** 420,430 ****
int r;
struct timeval time;
/* Lookup info necessary for processing this request. */
if (!(handler = ndmp_get_handler(connection, message))) {
! NDMP_LOG(LOG_DEBUG, "Sending message 0x%x: not supported",
message);
return (-1);
}
(void) gettimeofday(&time, 0);
--- 430,440 ----
int r;
struct timeval time;
/* Lookup info necessary for processing this request. */
if (!(handler = ndmp_get_handler(connection, message))) {
! syslog(LOG_ERR, "Sending message 0x%x: not supported",
message);
return (-1);
}
(void) gettimeofday(&time, 0);
*** 435,463 ****
header.reply_sequence = 0;
header.error = err;
connection->conn_xdrs.x_op = XDR_ENCODE;
if (!xdr_ndmp_header(&connection->conn_xdrs, &header)) {
! NDMP_LOG(LOG_DEBUG,
"Sending message 0x%x: encoding request header", message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
if (err == NDMP_NO_ERR && handler->mh_xdr_request && request_data) {
if (!(*handler->mh_xdr_request)(&connection->conn_xdrs,
request_data)) {
! NDMP_LOG(LOG_DEBUG,
"Sending message 0x%x: encoding request body",
message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
}
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
if (handler->mh_xdr_reply == 0) {
- NDMP_LOG(LOG_DEBUG, "handler->mh_xdr_reply == 0");
return (0);
}
/*
* Process messages until the reply to this request has been
--- 445,472 ----
header.reply_sequence = 0;
header.error = err;
connection->conn_xdrs.x_op = XDR_ENCODE;
if (!xdr_ndmp_header(&connection->conn_xdrs, &header)) {
! syslog(LOG_ERR,
"Sending message 0x%x: encoding request header", message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
if (err == NDMP_NO_ERR && handler->mh_xdr_request && request_data) {
if (!(*handler->mh_xdr_request)(&connection->conn_xdrs,
request_data)) {
! syslog(LOG_ERR,
"Sending message 0x%x: encoding request body",
message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
}
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
if (handler->mh_xdr_reply == 0) {
return (0);
}
/*
* Process messages until the reply to this request has been
*** 476,486 ****
/* reply received? */
if (r == 1) {
if (message !=
connection->conn_msginfo.mi_hdr.message) {
! NDMP_LOG(LOG_DEBUG,
"Received unexpected reply 0x%x",
connection->conn_msginfo.mi_hdr.message);
ndmp_free_message(connection_handle);
return (-1);
}
--- 485,495 ----
/* reply received? */
if (r == 1) {
if (message !=
connection->conn_msginfo.mi_hdr.message) {
! syslog(LOG_ERR,
"Received unexpected reply 0x%x",
connection->conn_msginfo.mi_hdr.message);
ndmp_free_message(connection_handle);
return (-1);
}
*** 569,579 ****
header.reply_sequence = connection->conn_msginfo.mi_hdr.sequence;
header.error = err;
connection->conn_xdrs.x_op = XDR_ENCODE;
if (!xdr_ndmp_header(&connection->conn_xdrs, &header)) {
! NDMP_LOG(LOG_DEBUG, "Sending message 0x%x: "
"encoding reply header",
header.message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
--- 578,588 ----
header.reply_sequence = connection->conn_msginfo.mi_hdr.sequence;
header.error = err;
connection->conn_xdrs.x_op = XDR_ENCODE;
if (!xdr_ndmp_header(&connection->conn_xdrs, &header)) {
! syslog(LOG_ERR, "Sending message 0x%x: "
"encoding reply header",
header.message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
*** 580,590 ****
if (err == NDMP_NO_ERR &&
connection->conn_msginfo.mi_handler->mh_xdr_reply &&
reply) {
if (!(*connection->conn_msginfo.mi_handler->mh_xdr_reply)(
&connection->conn_xdrs, reply)) {
! NDMP_LOG(LOG_DEBUG,
"Sending message 0x%x: encoding reply body",
header.message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
--- 589,599 ----
if (err == NDMP_NO_ERR &&
connection->conn_msginfo.mi_handler->mh_xdr_reply &&
reply) {
if (!(*connection->conn_msginfo.mi_handler->mh_xdr_reply)(
&connection->conn_xdrs, reply)) {
! syslog(LOG_ERR,
"Sending message 0x%x: encoding reply body",
header.message);
(void) xdrrec_endofrecord(&connection->conn_xdrs, 1);
return (-1);
}
*** 856,886 ****
req.protocol_version = ndmp_ver;
req.text_reason = "";
if (ndmp_send_request_lock(connection, NDMP_NOTIFY_CONNECTION_STATUS,
NDMP_NO_ERR, (void *)&req, 0) < 0) {
! NDMP_LOG(LOG_DEBUG, "Connection terminated");
return;
}
connection_fd = ndmp_get_fd(connection);
- NDMP_LOG(LOG_DEBUG, "connection_fd: %d", connection_fd);
-
/*
* Add the handler function for the connection to the DMA.
*/
if (ndmpd_add_file_handler(&session, (void *)&session, connection_fd,
NDMPD_SELECT_MODE_READ, HC_CLIENT, connection_file_handler) != 0) {
! NDMP_LOG(LOG_DEBUG, "Could not register session handler.");
return;
}
/*
* Register the connection in the list of active connections.
*/
if (ndmp_connect_list_add(connection, &conn_id) != 0) {
! NDMP_LOG(LOG_ERR,
"Could not register the session to the server.");
(void) ndmpd_remove_file_handler(&session, connection_fd);
return;
}
--- 865,893 ----
req.protocol_version = ndmp_ver;
req.text_reason = "";
if (ndmp_send_request_lock(connection, NDMP_NOTIFY_CONNECTION_STATUS,
NDMP_NO_ERR, (void *)&req, 0) < 0) {
! syslog(LOG_DEBUG, "Send CONNECTION STATUS failed");
return;
}
connection_fd = ndmp_get_fd(connection);
/*
* Add the handler function for the connection to the DMA.
*/
if (ndmpd_add_file_handler(&session, (void *)&session, connection_fd,
NDMPD_SELECT_MODE_READ, HC_CLIENT, connection_file_handler) != 0) {
! syslog(LOG_ERR, "Could not register session handler.");
return;
}
/*
* Register the connection in the list of active connections.
*/
if (ndmp_connect_list_add(connection, &conn_id) != 0) {
! syslog(LOG_ERR,
"Could not register the session to the server.");
(void) ndmpd_remove_file_handler(&session, connection_fd);
return;
}
*** 889,910 ****
while (session.ns_eof == FALSE)
(void) ndmpd_select(&session, TRUE, HC_ALL);
hardlink_q_cleanup(session.hardlink_q);
- NDMP_LOG(LOG_DEBUG, "Connection terminated");
-
(void) ndmpd_remove_file_handler(&session, connection_fd);
if (session.ns_scsi.sd_is_open != -1) {
! NDMP_LOG(LOG_DEBUG, "scsi.is_open: %d",
session.ns_scsi.sd_is_open);
(void) ndmp_open_list_del(session.ns_scsi.sd_adapter_name,
session.ns_scsi.sd_sid, session.ns_scsi.sd_lun);
}
if (session.ns_tape.td_fd != -1) {
! NDMP_LOG(LOG_DEBUG, "tape.fd: %d", session.ns_tape.td_fd);
(void) close(session.ns_tape.td_fd);
(void) ndmp_open_list_del(session.ns_tape.td_adapter_name,
session.ns_tape.td_sid, session.ns_tape.td_lun);
}
ndmpd_mover_shut_down(&session);
--- 896,915 ----
while (session.ns_eof == FALSE)
(void) ndmpd_select(&session, TRUE, HC_ALL);
hardlink_q_cleanup(session.hardlink_q);
(void) ndmpd_remove_file_handler(&session, connection_fd);
if (session.ns_scsi.sd_is_open != -1) {
! syslog(LOG_ERR, "scsi.is_open: %d",
session.ns_scsi.sd_is_open);
(void) ndmp_open_list_del(session.ns_scsi.sd_adapter_name,
session.ns_scsi.sd_sid, session.ns_scsi.sd_lun);
}
if (session.ns_tape.td_fd != -1) {
! syslog(LOG_ERR, "tape.fd: %d", session.ns_tape.td_fd);
(void) close(session.ns_tape.td_fd);
(void) ndmp_open_list_del(session.ns_tape.td_adapter_name,
session.ns_tape.td_sid, session.ns_tape.td_lun);
}
ndmpd_mover_shut_down(&session);
*** 1032,1042 ****
return (-1);
/* Lookup info necessary for processing this message. */
if ((connection->conn_msginfo.mi_handler = ndmp_get_handler(connection,
connection->conn_msginfo.mi_hdr.message)) == 0) {
! NDMP_LOG(LOG_DEBUG, "Message 0x%x not supported",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_SUPPORTED_ERR);
}
connection->conn_msginfo.mi_body = 0;
--- 1037,1047 ----
return (-1);
/* Lookup info necessary for processing this message. */
if ((connection->conn_msginfo.mi_handler = ndmp_get_handler(connection,
connection->conn_msginfo.mi_hdr.message)) == 0) {
! syslog(LOG_DEBUG, "Message 0x%x not supported",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_SUPPORTED_ERR);
}
connection->conn_msginfo.mi_body = 0;
*** 1047,1067 ****
if (connection->conn_msginfo.mi_hdr.message_type ==
NDMP_MESSAGE_REQUEST) {
if (ndmp_check_auth_required(
connection->conn_msginfo.mi_hdr.message) &&
!connection->conn_authorized) {
! NDMP_LOG(LOG_DEBUG,
"Processing request 0x%x:connection not authorized",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_AUTHORIZED_ERR);
}
if (connection->conn_msginfo.mi_handler->mh_sizeof_request >
0) {
xdr_func =
connection->conn_msginfo.mi_handler->mh_xdr_request;
if (xdr_func == NULL) {
! NDMP_LOG(LOG_DEBUG,
"Processing request 0x%x: no xdr function "
"in handler table",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_SUPPORTED_ERR);
}
--- 1052,1072 ----
if (connection->conn_msginfo.mi_hdr.message_type ==
NDMP_MESSAGE_REQUEST) {
if (ndmp_check_auth_required(
connection->conn_msginfo.mi_hdr.message) &&
!connection->conn_authorized) {
! syslog(LOG_ERR,
"Processing request 0x%x:connection not authorized",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_AUTHORIZED_ERR);
}
if (connection->conn_msginfo.mi_handler->mh_sizeof_request >
0) {
xdr_func =
connection->conn_msginfo.mi_handler->mh_xdr_request;
if (xdr_func == NULL) {
! syslog(LOG_ERR,
"Processing request 0x%x: no xdr function "
"in handler table",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_SUPPORTED_ERR);
}
*** 1078,1088 ****
} else {
if (connection->conn_msginfo.mi_handler->mh_sizeof_reply > 0) {
xdr_func =
connection->conn_msginfo.mi_handler->mh_xdr_reply;
if (xdr_func == NULL) {
! NDMP_LOG(LOG_DEBUG,
"Processing reply 0x%x: no xdr function "
"in handler table",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_SUPPORTED_ERR);
}
--- 1083,1093 ----
} else {
if (connection->conn_msginfo.mi_handler->mh_sizeof_reply > 0) {
xdr_func =
connection->conn_msginfo.mi_handler->mh_xdr_reply;
if (xdr_func == NULL) {
! syslog(LOG_ERR,
"Processing reply 0x%x: no xdr function "
"in handler table",
connection->conn_msginfo.mi_hdr.message);
return (NDMP_NOT_SUPPORTED_ERR);
}
*** 1100,1111 ****
/* Decode message arguments if needed */
if (xdr_func) {
if (!(*xdr_func)(&connection->conn_xdrs,
connection->conn_msginfo.mi_body)) {
! NDMP_LOG(LOG_DEBUG,
! "Processing message 0x%x: error decoding arguments",
connection->conn_msginfo.mi_hdr.message);
free(connection->conn_msginfo.mi_body);
connection->conn_msginfo.mi_body = 0;
return (NDMP_XDR_DECODE_ERR);
}
--- 1105,1120 ----
/* Decode message arguments if needed */
if (xdr_func) {
if (!(*xdr_func)(&connection->conn_xdrs,
connection->conn_msginfo.mi_body)) {
! syslog(LOG_ERR,
! "Processing %s message 0x%x: "
! "error decoding arguments",
! connection->conn_msginfo.mi_hdr.message_type ==
! NDMP_MESSAGE_REQUEST ?
! "Request" : "Reply",
connection->conn_msginfo.mi_hdr.message);
free(connection->conn_msginfo.mi_body);
connection->conn_msginfo.mi_body = 0;
return (NDMP_XDR_DECODE_ERR);
}
*** 1166,1191 ****
msg_info_t reply_msginfo;
boolean_t reply_read = FALSE;
boolean_t reply_error = FALSE;
int err;
- NDMP_LOG(LOG_DEBUG, "reply_expected: %s",
- reply_expected == TRUE ? "TRUE" : "FALSE");
-
(void) memset((void *)&reply_msginfo, 0, sizeof (msg_info_t));
do {
(void) memset((void *)&connection->conn_msginfo, 0,
sizeof (msg_info_t));
if ((err = ndmp_recv_msg(connection)) != NDMP_NO_ERR) {
if (connection->conn_eof) {
- NDMP_LOG(LOG_DEBUG, "detected eof");
return (NDMP_PROC_ERR);
}
if (err < 1) {
! NDMP_LOG(LOG_DEBUG, "error decoding header");
/*
* Error occurred decoding the header.
* Don't send a reply since we don't know
* the message or if the message was even
--- 1175,1196 ----
msg_info_t reply_msginfo;
boolean_t reply_read = FALSE;
boolean_t reply_error = FALSE;
int err;
(void) memset((void *)&reply_msginfo, 0, sizeof (msg_info_t));
do {
(void) memset((void *)&connection->conn_msginfo, 0,
sizeof (msg_info_t));
if ((err = ndmp_recv_msg(connection)) != NDMP_NO_ERR) {
if (connection->conn_eof) {
return (NDMP_PROC_ERR);
}
if (err < 1) {
! syslog(LOG_ERR, "error decoding header");
/*
* Error occurred decoding the header.
* Don't send a reply since we don't know
* the message or if the message was even
*** 1202,1217 ****
continue;
}
if (connection->conn_msginfo.mi_hdr.message_type
!= NDMP_MESSAGE_REQUEST) {
! NDMP_LOG(LOG_DEBUG, "received reply: 0x%x",
connection->conn_msginfo.mi_hdr.message);
if (reply_expected == FALSE ||
reply_read == TRUE)
! NDMP_LOG(LOG_DEBUG,
"Unexpected reply message: 0x%x",
connection->conn_msginfo.mi_hdr.
message);
ndmp_free_message((ndmp_connection_t *)
--- 1207,1222 ----
continue;
}
if (connection->conn_msginfo.mi_hdr.message_type
!= NDMP_MESSAGE_REQUEST) {
! syslog(LOG_DEBUG, "received reply: 0x%x",
connection->conn_msginfo.mi_hdr.message);
if (reply_expected == FALSE ||
reply_read == TRUE)
! syslog(LOG_DEBUG,
"Unexpected reply message: 0x%x",
connection->conn_msginfo.mi_hdr.
message);
ndmp_free_message((ndmp_connection_t *)
*** 1221,1245 ****
reply_read = TRUE;
reply_error = TRUE;
}
continue;
}
- NDMP_LOG(LOG_DEBUG, "received request: 0x%x",
- connection->conn_msginfo.mi_hdr.message);
(void) ndmp_send_response((ndmp_connection_t *)
connection, err, NULL);
ndmp_free_message((ndmp_connection_t *)connection);
continue;
}
if (connection->conn_msginfo.mi_hdr.message_type
!= NDMP_MESSAGE_REQUEST) {
! NDMP_LOG(LOG_DEBUG, "received reply: 0x%x",
connection->conn_msginfo.mi_hdr.message);
if (reply_expected == FALSE || reply_read == TRUE) {
! NDMP_LOG(LOG_DEBUG,
"Unexpected reply message: 0x%x",
connection->conn_msginfo.mi_hdr.message);
ndmp_free_message((ndmp_connection_t *)
connection);
continue;
--- 1226,1248 ----
reply_read = TRUE;
reply_error = TRUE;
}
continue;
}
(void) ndmp_send_response((ndmp_connection_t *)
connection, err, NULL);
ndmp_free_message((ndmp_connection_t *)connection);
continue;
}
if (connection->conn_msginfo.mi_hdr.message_type
!= NDMP_MESSAGE_REQUEST) {
! syslog(LOG_DEBUG, "received reply: 0x%x",
connection->conn_msginfo.mi_hdr.message);
if (reply_expected == FALSE || reply_read == TRUE) {
! syslog(LOG_DEBUG,
"Unexpected reply message: 0x%x",
connection->conn_msginfo.mi_hdr.message);
ndmp_free_message((ndmp_connection_t *)
connection);
continue;
*** 1246,1265 ****
}
reply_read = TRUE;
reply_msginfo = connection->conn_msginfo;
continue;
}
- NDMP_LOG(LOG_DEBUG, "received request: 0x%x",
- connection->conn_msginfo.mi_hdr.message);
-
/*
* The following is needed to catch an improperly constructed
* handler table or to deal with an NDMP client that is not
* conforming to the negotiated protocol version.
*/
if (connection->conn_msginfo.mi_handler->mh_func == NULL) {
! NDMP_LOG(LOG_DEBUG, "No handler for message 0x%x",
connection->conn_msginfo.mi_hdr.message);
(void) ndmp_send_response((ndmp_connection_t *)
connection, NDMP_NOT_SUPPORTED_ERR, NULL);
ndmp_free_message((ndmp_connection_t *)connection);
--- 1249,1265 ----
}
reply_read = TRUE;
reply_msginfo = connection->conn_msginfo;
continue;
}
/*
* The following is needed to catch an improperly constructed
* handler table or to deal with an NDMP client that is not
* conforming to the negotiated protocol version.
*/
if (connection->conn_msginfo.mi_handler->mh_func == NULL) {
! syslog(LOG_DEBUG, "No handler for message 0x%x",
connection->conn_msginfo.mi_hdr.message);
(void) ndmp_send_response((ndmp_connection_t *)
connection, NDMP_NOT_SUPPORTED_ERR, NULL);
ndmp_free_message((ndmp_connection_t *)connection);
*** 1275,1286 ****
ndmp_free_message((ndmp_connection_t *)connection);
} while (xdrrec_eof(&connection->conn_xdrs) == FALSE &&
connection->conn_eof == FALSE);
- NDMP_LOG(LOG_DEBUG, "no more messages in stream buffer");
-
if (connection->conn_eof == TRUE) {
if (reply_msginfo.mi_body)
free(reply_msginfo.mi_body);
return (NDMP_PROC_ERR);
}
--- 1275,1284 ----
*** 1513,1523 ****
char *path, int dest, char *local_path, int result)
{
adt_event_data_t *event;
if ((event = adt_alloc_event(conn->conn_ah, ADT_ndmp_backup)) == NULL) {
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
return;
}
event->adt_ndmp_backup.source = path;
if (dest == NDMP_ADDR_LOCAL) {
--- 1511,1521 ----
char *path, int dest, char *local_path, int result)
{
adt_event_data_t *event;
if ((event = adt_alloc_event(conn->conn_ah, ADT_ndmp_backup)) == NULL) {
! syslog(LOG_ERR, "Audit failure: %m.");
return;
}
event->adt_ndmp_backup.source = path;
if (dest == NDMP_ADDR_LOCAL) {
*** 1526,1539 ****
event->adt_ndmp_backup.remote_dest = conn->conn_sock;
}
if (result == 0) {
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
} else {
if (adt_put_event(event, ADT_FAILURE, result) != 0)
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
}
adt_free_event(event);
}
--- 1524,1537 ----
event->adt_ndmp_backup.remote_dest = conn->conn_sock;
}
if (result == 0) {
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! syslog(LOG_ERR, "Audit failure: %m.");
} else {
if (adt_put_event(event, ADT_FAILURE, result) != 0)
! syslog(LOG_ERR, "Audit failure: %m.");
}
adt_free_event(event);
}
*** 1550,1560 ****
{
adt_event_data_t *event;
if ((event = adt_alloc_event(conn->conn_ah,
ADT_ndmp_restore)) == NULL) {
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
return;
}
event->adt_ndmp_restore.destination = path;
if (dest == NDMP_ADDR_LOCAL) {
--- 1548,1558 ----
{
adt_event_data_t *event;
if ((event = adt_alloc_event(conn->conn_ah,
ADT_ndmp_restore)) == NULL) {
! syslog(LOG_ERR, "Audit failure: %m.");
return;
}
event->adt_ndmp_restore.destination = path;
if (dest == NDMP_ADDR_LOCAL) {
*** 1563,1576 ****
event->adt_ndmp_restore.remote_source = conn->conn_sock;
}
if (result == 0) {
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
} else {
if (adt_put_event(event, ADT_FAILURE, result) != 0)
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
}
adt_free_event(event);
}
--- 1561,1574 ----
event->adt_ndmp_restore.remote_source = conn->conn_sock;
}
if (result == 0) {
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! syslog(LOG_ERR, "Audit failure: %m.");
} else {
if (adt_put_event(event, ADT_FAILURE, result) != 0)
! syslog(LOG_ERR, "Audit failure: %m.");
}
adt_free_event(event);
}
*** 1586,1619 ****
{
adt_event_data_t *event;
adt_termid_t *termid;
if (adt_load_termid(conn->conn_sock, &termid) != 0) {
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
return;
}
if (adt_set_user(conn->conn_ah, ADT_NO_ATTRIB, ADT_NO_ATTRIB,
ADT_NO_ATTRIB, ADT_NO_ATTRIB, termid, ADT_NEW) != 0) {
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
free(termid);
return;
}
free(termid);
if ((event = adt_alloc_event(conn->conn_ah,
ADT_ndmp_connect)) == NULL) {
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
return;
}
if (result == 0) {
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
} else {
if (adt_put_event(event, ADT_FAILURE, result) != 0)
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
}
adt_free_event(event);
}
--- 1584,1617 ----
{
adt_event_data_t *event;
adt_termid_t *termid;
if (adt_load_termid(conn->conn_sock, &termid) != 0) {
! syslog(LOG_ERR, "Audit failure: %m.");
return;
}
if (adt_set_user(conn->conn_ah, ADT_NO_ATTRIB, ADT_NO_ATTRIB,
ADT_NO_ATTRIB, ADT_NO_ATTRIB, termid, ADT_NEW) != 0) {
! syslog(LOG_ERR, "Audit failure: %m.");
free(termid);
return;
}
free(termid);
if ((event = adt_alloc_event(conn->conn_ah,
ADT_ndmp_connect)) == NULL) {
! syslog(LOG_ERR, "Audit failure: %m.");
return;
}
if (result == 0) {
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! syslog(LOG_ERR, "Audit failure: %m.");
} else {
if (adt_put_event(event, ADT_FAILURE, result) != 0)
! syslog(LOG_ERR, "Audit failure: %m.");
}
adt_free_event(event);
}
*** 1629,1643 ****
{
adt_event_data_t *event;
if ((event = adt_alloc_event(conn->conn_ah,
ADT_ndmp_disconnect)) == NULL) {
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
return;
}
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! NDMP_LOG(LOG_ERR, "Audit failure: %m.");
adt_free_event(event);
}
void *
--- 1627,1641 ----
{
adt_event_data_t *event;
if ((event = adt_alloc_event(conn->conn_ah,
ADT_ndmp_disconnect)) == NULL) {
! syslog(LOG_ERR, "Audit failure: %m.");
return;
}
if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
! syslog(LOG_ERR, "Audit failure: %m.");
adt_free_event(event);
}
void *
*** 1644,1654 ****
ndmp_malloc(size_t size)
{
void *data;
if ((data = calloc(1, size)) == NULL) {
! NDMP_LOG(LOG_ERR, "Out of memory.");
}
return (data);
}
--- 1642,1652 ----
ndmp_malloc(size_t size)
{
void *data;
if ((data = calloc(1, size)) == NULL) {
! syslog(LOG_ERR, "Out of memory.");
}
return (data);
}
*** 1676,1686 ****
if (!bkpath) {
MOD_LOGV3(params, NDMP_LOG_ERROR,
"Backup path not defined.\n");
} else {
! NDMP_LOG(LOG_DEBUG, "bkpath: \"%s\"", bkpath);
}
return (bkpath);
}
--- 1674,1684 ----
if (!bkpath) {
MOD_LOGV3(params, NDMP_LOG_ERROR,
"Backup path not defined.\n");
} else {
! syslog(LOG_DEBUG, "bkpath: \"%s\"", bkpath);
}
return (bkpath);
}