Print this page
NEX-9532 NDMP: readdir errors when file/directory has special characters
Reviewed by: Peer Dampmann <peer.dampmann@nexenta.com>
Reviewed by: Alexander Eremin <alexander.eremin@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@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>
NEX-2990 ndmpd dumping core when used with ndmpcopy
NEX-2911 NDMP logging should use syslog and is too chatty
*** 1,8 ****
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/*
* BSD 3 Clause License
*
--- 1,7 ----
*** 34,43 ****
--- 33,45 ----
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+ /* Copyright 2017 Nexenta Systems, Inc. All rights reserved. */
+
+ #include <syslog.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
*** 226,236 ****
for (x = 0; sels[x] != NULL; x++) {
if (strcmp(sels[x], " ")) {
*pos = x;
(void) strlcpy(longname, sels[x], TLM_MAX_PATH_NAME);
! NDMP_LOG(LOG_DEBUG,
"to replace hardlink name [%s], pos [%d]",
longname, *pos);
return (rs_new_name(rnp, name, *pos, longname));
}
--- 228,238 ----
for (x = 0; sels[x] != NULL; x++) {
if (strcmp(sels[x], " ")) {
*pos = x;
(void) strlcpy(longname, sels[x], TLM_MAX_PATH_NAME);
! syslog(LOG_DEBUG,
"to replace hardlink name [%s], pos [%d]",
longname, *pos);
return (rs_new_name(rnp, name, *pos, longname));
}
*** 267,277 ****
boolean_t is_long_name = FALSE;
char *longlink;
char *hugename;
longlong_t huge_size = 0; /* size of a HUGE file */
long acl_spot; /* any ACL info on the next volume */
! long file_size; /* size of file to restore */
long size_left = 0; /* need this after volume change */
int last_action = 0; /* what we are doing at EOT */
boolean_t multi_volume = FALSE; /* is this a multi-volume switch ? */
int chk_rv; /* scratch area */
--- 269,279 ----
boolean_t is_long_name = FALSE;
char *longlink;
char *hugename;
longlong_t huge_size = 0; /* size of a HUGE file */
long acl_spot; /* any ACL info on the next volume */
! long file_size = 0; /* size of file to restore */
long size_left = 0; /* need this after volume change */
int last_action = 0; /* what we are doing at EOT */
boolean_t multi_volume = FALSE; /* is this a multi-volume switch ? */
int chk_rv; /* scratch area */
*** 335,348 ****
lnk_end = 0;
*longlink = '\0';
(void) memset(acls, 0, sizeof (tlm_acls_t));
if (IS_SET(flags, RSFLG_OVR_ALWAYS)) {
acls->acl_overwrite = TRUE;
! NDMP_LOG(LOG_DEBUG, "RSFLG_OVR_ALWAYS");
} else if (IS_SET(flags, RSFLG_OVR_UPDATE)) {
acls->acl_update = TRUE;
! NDMP_LOG(LOG_DEBUG, "RSFLG_OVR_UPDATE");
}
/*
* work
*/
--- 337,350 ----
lnk_end = 0;
*longlink = '\0';
(void) memset(acls, 0, sizeof (tlm_acls_t));
if (IS_SET(flags, RSFLG_OVR_ALWAYS)) {
acls->acl_overwrite = TRUE;
! syslog(LOG_DEBUG, "RSFLG_OVR_ALWAYS");
} else if (IS_SET(flags, RSFLG_OVR_UPDATE)) {
acls->acl_update = TRUE;
! syslog(LOG_DEBUG, "RSFLG_OVR_UPDATE");
}
/*
* work
*/
*** 381,391 ****
/* used to make up hardlink_tmp_name */
static int hardlink_tmp_idx = 0;
if (multi_volume) {
! NDMP_LOG(LOG_DEBUG, "multi_volume %c %d",
last_action, size_left);
/*
* the previous volume is out of data
* and is back in the rack, a new tape
--- 383,393 ----
/* used to make up hardlink_tmp_name */
static int hardlink_tmp_idx = 0;
if (multi_volume) {
! syslog(LOG_DEBUG, "multi_volume %c %d",
last_action, size_left);
/*
* the previous volume is out of data
* and is back in the rack, a new tape
*** 432,448 ****
*/
chk_rv = tlm_vfy_tar_checksum(tar_hdr);
if (chk_rv == 0) {
/* one of the end of tar file marks */
if (++nzerohdr >= 2) {
! NDMP_LOG(LOG_DEBUG,
"nzerohdr %d, breaking",
nzerohdr);
/* end of tar file */
break;
}
! NDMP_LOG(LOG_DEBUG, "nzerohdr %d, continuing",
nzerohdr);
continue;
} else if (chk_rv < 0) {
nzerohdr = 0;
/* skip this record */
--- 434,450 ----
*/
chk_rv = tlm_vfy_tar_checksum(tar_hdr);
if (chk_rv == 0) {
/* one of the end of tar file marks */
if (++nzerohdr >= 2) {
! syslog(LOG_DEBUG,
"nzerohdr %d, breaking",
nzerohdr);
/* end of tar file */
break;
}
! syslog(LOG_DEBUG, "nzerohdr %d, continuing",
nzerohdr);
continue;
} else if (chk_rv < 0) {
nzerohdr = 0;
/* skip this record */
*** 482,497 ****
acl_spot = 0;
last_action = tar_hdr->th_linkflag;
}
}
- NDMP_LOG(LOG_DEBUG, "n [%s] f [%c] s %lld m %o u %d g %d t %d",
- tar_hdr->th_name, tar_hdr->th_linkflag,
- acls->acl_attr.st_size, acls->acl_attr.st_mode,
- acls->acl_attr.st_uid, acls->acl_attr.st_gid,
- acls->acl_attr.st_mtime);
-
/*
* If the restore is running using DAR we should check for
* extended attribute entries
*/
if (dar_recovered &&
--- 484,493 ----
*** 518,528 ****
hardlink_done = !hardlink_q_get(hardlink_q,
hardlink_inode, 0, &hardlink_target);
}
if (hardlink_done) {
! NDMP_LOG(LOG_DEBUG,
"found hardlink, inode = %u, target = [%s]",
hardlink_inode,
hardlink_target? hardlink_target : "--");
/* create a hardlink to hardlink_target */
--- 514,524 ----
hardlink_done = !hardlink_q_get(hardlink_q,
hardlink_inode, 0, &hardlink_target);
}
if (hardlink_done) {
! syslog(LOG_DEBUG,
"found hardlink, inode = %u, target = [%s]",
hardlink_inode,
hardlink_target? hardlink_target : "--");
/* create a hardlink to hardlink_target */
*** 547,557 ****
}
} else {
nmp = rs_new_name(rnp, name, pos,
file_name);
if (!nmp) {
! NDMP_LOG(LOG_DEBUG,
"can't make name for %s",
longname);
}
}
--- 543,553 ----
}
} else {
nmp = rs_new_name(rnp, name, pos,
file_name);
if (!nmp) {
! syslog(LOG_ERR,
"can't make name for %s",
longname);
}
}
*** 567,583 ****
if (erc == 0) {
(void)
tlm_entry_restored(
job_stats,
file_name, pos);
! NDMP_LOG(LOG_DEBUG,
"restored %s -> %s",
nmp,
hardlink_target);
}
} else {
! NDMP_LOG(LOG_DEBUG,
"no target for hardlink %s",
nmp);
}
name[0] = 0;
--- 563,579 ----
if (erc == 0) {
(void)
tlm_entry_restored(
job_stats,
file_name, pos);
! syslog(LOG_DEBUG,
"restored %s -> %s",
nmp,
hardlink_target);
}
} else {
! syslog(LOG_DEBUG,
"no target for hardlink %s",
nmp);
}
name[0] = 0;
*** 688,702 ****
nmp = name;
hardlink_tmp_idx++;
hardlink_tmp_file = 1;
want_this_file = TRUE;
! NDMP_LOG(LOG_DEBUG,
"To restore temp hardlink file %s.",
nmp);
} else {
! NDMP_LOG(LOG_DEBUG,
"No tmplink_dir specified.");
}
}
rv = restore_file(&fp, nmp, file_size,
--- 684,698 ----
nmp = name;
hardlink_tmp_idx++;
hardlink_tmp_file = 1;
want_this_file = TRUE;
! syslog(LOG_DEBUG,
"To restore temp hardlink file %s.",
nmp);
} else {
! syslog(LOG_DEBUG,
"No tmplink_dir specified.");
}
}
rv = restore_file(&fp, nmp, file_size,
*** 716,726 ****
* to locate the data records.
*/
if (is_hardlink && !DAR) {
if (hardlink_q_add(hardlink_q, hardlink_inode,
0, nmp, hardlink_tmp_file))
! NDMP_LOG(LOG_DEBUG,
"failed to add (%u, %s) to HL q",
hardlink_inode, nmp);
}
/* remove / reverse the temporary stuff */
--- 712,722 ----
* to locate the data records.
*/
if (is_hardlink && !DAR) {
if (hardlink_q_add(hardlink_q, hardlink_inode,
0, nmp, hardlink_tmp_file))
! syslog(LOG_ERR,
"failed to add (%u, %s) to HL q",
hardlink_inode, nmp);
}
/* remove / reverse the temporary stuff */
*** 747,759 ****
}
}
if (rv != 0)
continue;
- NDMP_LOG(LOG_DEBUG, "sizeleft %s %d, %lld", longname,
- size_left, huge_size);
-
if (want_this_file) {
job_stats->js_bytes_total += file_size;
job_stats->js_files_total++;
}
--- 743,752 ----
*** 769,779 ****
/*
* Add an entry to hardlink_q to record
* this hardlink.
*/
if (is_hardlink) {
! NDMP_LOG(LOG_DEBUG,
"Restored hardlink file %s",
nmp);
if (DAR) {
(void) hardlink_q_add(
--- 762,772 ----
/*
* Add an entry to hardlink_q to record
* this hardlink.
*/
if (is_hardlink) {
! syslog(LOG_DEBUG,
"Restored hardlink file %s",
nmp);
if (DAR) {
(void) hardlink_q_add(
*** 805,816 ****
case LF_SYMLINK:
file_name = (*longname == 0) ? thname_buf :
longname;
link_name = (*longlink == 0) ?
tar_hdr->th_linkname : longlink;
! NDMP_LOG(LOG_DEBUG, "file_name[%s]", file_name);
! NDMP_LOG(LOG_DEBUG, "link_name[%s]", link_name);
if (is_file_wanted(file_name, sels, exls, flags,
&mchtype, &pos)) {
nmp = rs_new_name(rnp, name, pos, file_name);
if (nmp) {
erc = create_sym_link(nmp, link_name,
--- 798,809 ----
case LF_SYMLINK:
file_name = (*longname == 0) ? thname_buf :
longname;
link_name = (*longlink == 0) ?
tar_hdr->th_linkname : longlink;
! syslog(LOG_DEBUG, "file_name[%s]", file_name);
! syslog(LOG_DEBUG, "link_name[%s]", link_name);
if (is_file_wanted(file_name, sels, exls, flags,
&mchtype, &pos)) {
nmp = rs_new_name(rnp, name, pos, file_name);
if (nmp) {
erc = create_sym_link(nmp, link_name,
*** 918,928 ****
file_size = max(0, file_size);
size_left = get_long_name(lib, drv, file_size, longlink,
&lnk_end, local_commands);
if (size_left != 0)
! NDMP_LOG(LOG_DEBUG,
"fsize %d sleft %d lnkend %d",
file_size, size_left, lnk_end);
break;
case LF_LONGNAME:
file_size = min(file_size,
--- 911,921 ----
file_size = max(0, file_size);
size_left = get_long_name(lib, drv, file_size, longlink,
&lnk_end, local_commands);
if (size_left != 0)
! syslog(LOG_DEBUG,
"fsize %d sleft %d lnkend %d",
file_size, size_left, lnk_end);
break;
case LF_LONGNAME:
file_size = min(file_size,
*** 930,940 ****
file_size = max(0, file_size);
size_left = get_long_name(lib, drv, file_size, longname,
&nm_end, local_commands);
if (size_left != 0)
! NDMP_LOG(LOG_DEBUG,
"fsize %d sleft %d nmend %d",
file_size, size_left, nm_end);
is_long_name = TRUE;
break;
case LF_ACL:
--- 923,933 ----
file_size = max(0, file_size);
size_left = get_long_name(lib, drv, file_size, longname,
&nm_end, local_commands);
if (size_left != 0)
! syslog(LOG_DEBUG,
"fsize %d sleft %d nmend %d",
file_size, size_left, nm_end);
is_long_name = TRUE;
break;
case LF_ACL:
*** 996,1005 ****
--- 989,999 ----
char *dir; /* where to restore the files */
char job[TLM_MAX_BACKUP_JOB_NAME+1];
/* the restore job name */
int erc; /* error return codes */
int flags;
+ int i;
struct rs_name_maker rn;
tlm_commands_t *commands;
tlm_cmd_t *local_commands;
char *list = NULL;
*** 1025,1052 ****
* do not test for "dir" having no string, since that
* is a legal condition. Restore to origional location
* will not have a restore directory.
*/
if (*job == '\0') {
! NDMP_LOG(LOG_DEBUG, "No job defined");
local_commands->tc_reader = TLM_STOP;
free(dir);
(void) pthread_barrier_wait(&argp->ba_barrier);
return (-1);
}
! sels = argp->ba_sels;
if (sels == NULL) {
local_commands->tc_reader = TLM_STOP;
free(dir);
(void) pthread_barrier_wait(&argp->ba_barrier);
return (-1);
}
exls = &list;
tlm_log_list("selections", sels);
- tlm_log_list("exclusions", exls);
if (wildcard_enabled())
flags |= RSFLG_MATCH_WCARD;
local_commands->tc_ref++;
--- 1019,1052 ----
* do not test for "dir" having no string, since that
* is a legal condition. Restore to origional location
* will not have a restore directory.
*/
if (*job == '\0') {
! syslog(LOG_DEBUG, "No job defined");
local_commands->tc_reader = TLM_STOP;
free(dir);
(void) pthread_barrier_wait(&argp->ba_barrier);
return (-1);
}
! sels = ndmp_malloc(sizeof (char *) * (argp->ba_count + 1));
! /* One extra for NULL terminate */
if (sels == NULL) {
local_commands->tc_reader = TLM_STOP;
free(dir);
(void) pthread_barrier_wait(&argp->ba_barrier);
return (-1);
}
+
+ (void) memset(sels, 0, (argp->ba_count + 1) * sizeof (char *));
+ for (i = 0; i < argp->ba_count; i++) {
+ sels[i] = argp->ba_sels[i];
+ }
+
exls = &list;
tlm_log_list("selections", sels);
if (wildcard_enabled())
flags |= RSFLG_MATCH_WCARD;
local_commands->tc_ref++;
*** 1063,1083 ****
rn.rn_nlp = dir;
/*
* work
*/
- NDMP_LOG(LOG_DEBUG, "start restore job %s", job);
erc = tar_getdir(commands, local_commands, job_stats, &rn, 1, 1,
sels, exls, flags, 0, NULL, NULL);
/*
* teardown
*/
- NDMP_LOG(LOG_DEBUG, "end restore job %s", job);
tlm_un_ref_job_stats(job);
tlm_release_list(sels);
- tlm_release_list(exls);
commands->tcs_writer_count--;
local_commands->tc_reader = TLM_STOP;
tlm_release_reader_writer_ipc(local_commands);
free(dir);
--- 1063,1080 ----
*** 1102,1112 ****
if (*cp == '\0' || *cp == '/') {
c = *cp;
*cp = '\0';
if (lstat64(dir, &st) < 0)
if (mkdir(dir, 0777) < 0) {
! NDMP_LOG(LOG_DEBUG, "Error %d"
" creating directory %s",
errno, dir);
*cp = c;
return (errno);
}
--- 1099,1109 ----
if (*cp == '\0' || *cp == '/') {
c = *cp;
*cp = '\0';
if (lstat64(dir, &st) < 0)
if (mkdir(dir, 0777) < 0) {
! syslog(LOG_ERR, "Error %d"
" creating directory %s",
errno, dir);
*cp = c;
return (errno);
}
*** 1127,1137 ****
int rv;
char *cp;
struct stat64 st;
if (!path || !*path) {
! NDMP_LOG(LOG_DEBUG, "Invalid argument");
return (-1);
}
cp = strrchr(path, '/');
if (cp)
--- 1124,1134 ----
int rv;
char *cp;
struct stat64 st;
if (!path || !*path) {
! syslog(LOG_ERR, "Invalid argument");
return (-1);
}
cp = strrchr(path, '/');
if (cp)
*** 1167,1181 ****
int ret, rv;
*size_left = 0;
if (!real_name) {
if (want_this_file) {
! NDMP_LOG(LOG_DEBUG, "No file name but wanted!");
want_this_file = FALSE;
}
! } else
! NDMP_LOG(LOG_DEBUG, "new file[%s]", real_name);
/*
* OK, some FM is creeping in here ...
* int *fp is used to keep the
* backup file channel open through
--- 1164,1177 ----
int ret, rv;
*size_left = 0;
if (!real_name) {
if (want_this_file) {
! syslog(LOG_DEBUG, "No file name but wanted!");
want_this_file = FALSE;
}
! }
/*
* OK, some FM is creeping in here ...
* int *fp is used to keep the
* backup file channel open through
*** 1225,1235 ****
if (want_this_file) {
*fp = open(real_name, O_CREAT | O_TRUNC | O_WRONLY,
S_IRUSR | S_IWUSR);
if (*fp == -1) {
! NDMP_LOG(LOG_ERR,
"Could not open %s for restore: %d",
real_name, errno);
job_stats->js_errors++;
want_this_file = FALSE;
/*
--- 1221,1231 ----
if (want_this_file) {
*fp = open(real_name, O_CREAT | O_TRUNC | O_WRONLY,
S_IRUSR | S_IWUSR);
if (*fp == -1) {
! syslog(LOG_ERR,
"Could not open %s for restore: %d",
real_name, errno);
job_stats->js_errors++;
want_this_file = FALSE;
/*
*** 1268,1296 ****
error = 0;
rec = get_read_buffer(size, &error, &actual_size,
local_commands);
if (actual_size <= 0) {
! NDMP_LOG(LOG_DEBUG,
"RESTORE WRITER> error %d, actual_size %d",
error, actual_size);
/* no more data for this file for now */
job_stats->js_bytes_in_file = 0;
*size_left = size;
return (0);
} else if (error) {
! NDMP_LOG(LOG_DEBUG, "Error %d in file [%s]",
error, local_commands->tc_file_name);
break;
}
write_size = min(size, actual_size);
if (want_this_file) {
ret = write(*fp, rec, write_size);
if (ret < 0) {
! NDMP_LOG(LOG_ERR,
"Write error %d for file [%s]", errno,
local_commands->tc_file_name);
job_stats->js_errors++;
if (ERROR_IS_FATAL(errno)) {
rv = errno;
--- 1264,1292 ----
error = 0;
rec = get_read_buffer(size, &error, &actual_size,
local_commands);
if (actual_size <= 0) {
! syslog(LOG_ERR,
"RESTORE WRITER> error %d, actual_size %d",
error, actual_size);
/* no more data for this file for now */
job_stats->js_bytes_in_file = 0;
*size_left = size;
return (0);
} else if (error) {
! syslog(LOG_ERR, "Error %d in file [%s]",
error, local_commands->tc_file_name);
break;
}
write_size = min(size, actual_size);
if (want_this_file) {
ret = write(*fp, rec, write_size);
if (ret < 0) {
! syslog(LOG_ERR,
"Write error %d for file [%s]", errno,
local_commands->tc_file_name);
job_stats->js_errors++;
if (ERROR_IS_FATAL(errno)) {
rv = errno;
*** 1298,1308 ****
}
} else {
NS_ADD(wdisk, ret);
NS_INC(wfile);
if (ret < write_size) {
! NDMP_LOG(LOG_ERR,
"Partial write for file [%s]",
local_commands->tc_file_name);
}
}
}
--- 1294,1304 ----
}
} else {
NS_ADD(wdisk, ret);
NS_INC(wfile);
if (ret < write_size) {
! syslog(LOG_ERR,
"Partial write for file [%s]",
local_commands->tc_file_name);
}
}
}
*** 1398,1426 ****
char *xattrname;
int actual_size;
int error;
if (!fname) {
! NDMP_LOG(LOG_DEBUG, "No file name but wanted!");
! } else {
! NDMP_LOG(LOG_DEBUG, "new xattr[%s]", fname);
}
error = 0;
xhdr = (struct xattr_hdr *)get_read_buffer(size, &error,
&actual_size, local_commands);
if (xhdr == NULL || error != 0) {
! NDMP_LOG(LOG_DEBUG,
"Could not read xattr [%s:%s] for restore. ",
name, fname);
job_stats->js_errors++;
return (0);
}
/* Check extended attribute header */
if (strcmp(xhdr->h_version, XATTR_ARCH_VERS) != 0) {
! NDMP_LOG(LOG_DEBUG,
"Unrecognized header format [%s]", xhdr->h_version);
return (0);
}
xbuf = (struct xattr_buf *)(((char *)xhdr) + sizeof (struct xattr_hdr));
--- 1394,1420 ----
char *xattrname;
int actual_size;
int error;
if (!fname) {
! syslog(LOG_DEBUG, "No file name but wanted!");
}
error = 0;
xhdr = (struct xattr_hdr *)get_read_buffer(size, &error,
&actual_size, local_commands);
if (xhdr == NULL || error != 0) {
! syslog(LOG_ERR,
"Could not read xattr [%s:%s] for restore. ",
name, fname);
job_stats->js_errors++;
return (0);
}
/* Check extended attribute header */
if (strcmp(xhdr->h_version, XATTR_ARCH_VERS) != 0) {
! syslog(LOG_ERR,
"Unrecognized header format [%s]", xhdr->h_version);
return (0);
}
xbuf = (struct xattr_buf *)(((char *)xhdr) + sizeof (struct xattr_hdr));
*** 1430,1440 ****
if (*fp == 0) {
int fd;
fd = attropen(name, xattrname, O_CREAT | O_RDWR, 0755);
if (fd == -1) {
! NDMP_LOG(LOG_DEBUG,
"Could not open xattr [%s:%s] for restore err=%d.",
name, xattrname, errno);
job_stats->js_errors++;
return (0);
}
--- 1424,1434 ----
if (*fp == 0) {
int fd;
fd = attropen(name, xattrname, O_CREAT | O_RDWR, 0755);
if (fd == -1) {
! syslog(LOG_ERR,
"Could not open xattr [%s:%s] for restore err=%d.",
name, xattrname, errno);
job_stats->js_errors++;
return (0);
}
*** 1445,1455 ****
/* Get the actual extended attribute file */
tar_hdr = (tlm_tar_hdr_t *)get_read_buffer(sizeof (*tar_hdr),
&error, &actual_size, local_commands);
if (tar_hdr == NULL || error != 0) {
! NDMP_LOG(LOG_DEBUG,
"Could not read xattr data [%s:%s] for restore. ",
fname, xattrname);
job_stats->js_errors++;
return (0);
}
--- 1439,1449 ----
/* Get the actual extended attribute file */
tar_hdr = (tlm_tar_hdr_t *)get_read_buffer(sizeof (*tar_hdr),
&error, &actual_size, local_commands);
if (tar_hdr == NULL || error != 0) {
! syslog(LOG_ERR,
"Could not read xattr data [%s:%s] for restore. ",
fname, xattrname);
job_stats->js_errors++;
return (0);
}
*** 1457,1470 ****
acls->acl_attr.st_size = oct_atoi(tar_hdr->th_size);
acls->acl_attr.st_uid = oct_atoi(tar_hdr->th_uid);
acls->acl_attr.st_gid = oct_atoi(tar_hdr->th_gid);
acls->acl_attr.st_mtime = oct_atoi(tar_hdr->th_mtime);
- NDMP_LOG(LOG_DEBUG, "xattr_hdr: %s size %d mode %06o uid %d gid %d",
- xattrname, acls->acl_attr.st_size, acls->acl_attr.st_mode,
- acls->acl_attr.st_uid, acls->acl_attr.st_gid);
-
size = acls->acl_attr.st_size;
while (size > 0 && local_commands->tc_writer == TLM_RESTORE_RUN) {
char *rec;
int write_size;
int sysattr_write = 0;
--- 1451,1460 ----
*** 1475,1499 ****
if ((actual_size < size) && sysattr_rw(xattrname)) {
rec = get_read_one_buf(rec, actual_size, size, &error,
local_commands);
if (rec == NULL) {
! NDMP_LOG(LOG_DEBUG, "Error %d in file [%s]",
error, xattrname);
return (size);
}
actual_size = size;
sysattr_write = 1;
}
if (actual_size <= 0) {
! NDMP_LOG(LOG_DEBUG,
"RESTORE WRITER> error %d, actual_size %d",
error, actual_size);
return (size);
} else if (error) {
! NDMP_LOG(LOG_DEBUG, "Error %d in file [%s]",
error, local_commands->tc_file_name);
break;
} else {
write_size = min(size, actual_size);
if ((write_size = write(*fp, rec, write_size)) < 0) {
--- 1465,1489 ----
if ((actual_size < size) && sysattr_rw(xattrname)) {
rec = get_read_one_buf(rec, actual_size, size, &error,
local_commands);
if (rec == NULL) {
! syslog(LOG_ERR, "Error %d in file [%s]",
error, xattrname);
return (size);
}
actual_size = size;
sysattr_write = 1;
}
if (actual_size <= 0) {
! syslog(LOG_ERR,
"RESTORE WRITER> error %d, actual_size %d",
error, actual_size);
return (size);
} else if (error) {
! syslog(LOG_ERR, "Error %d in file [%s]",
error, local_commands->tc_file_name);
break;
} else {
write_size = min(size, actual_size);
if ((write_size = write(*fp, rec, write_size)) < 0) {
*** 1532,1542 ****
found = FALSE;
for (i = 0; *list != NULL; list++, i++) {
cp = *list + strspn(*list, "/");
if (match(cp, name)) {
found = TRUE;
! NDMP_LOG(LOG_DEBUG, "exact_find> found[%s]", cp);
break;
}
}
return (found);
--- 1522,1532 ----
found = FALSE;
for (i = 0; *list != NULL; list++, i++) {
cp = *list + strspn(*list, "/");
if (match(cp, name)) {
found = TRUE;
! syslog(LOG_DEBUG, "exact_find> found[%s]", cp);
break;
}
}
return (found);
*** 1551,1568 ****
char tmp[TLM_MAX_PATH_NAME];
boolean_t rv;
if (IS_SET(flags, RSFLG_MATCH_WCARD)) {
if (!tlm_cat_path(tmp, parent, "*")) {
! NDMP_LOG(LOG_DEBUG,
"is_parent> path too long [%s]", parent);
rv = FALSE;
} else
rv = (match(tmp, child) != 0) ? TRUE : FALSE;
} else {
if (!tlm_cat_path(tmp, parent, "/")) {
! NDMP_LOG(LOG_DEBUG,
"is_parent> path too long [%s]", parent);
rv = FALSE;
} else
rv = (strncmp(tmp, child, strlen(tmp)) == 0) ?
TRUE : FALSE;
--- 1541,1558 ----
char tmp[TLM_MAX_PATH_NAME];
boolean_t rv;
if (IS_SET(flags, RSFLG_MATCH_WCARD)) {
if (!tlm_cat_path(tmp, parent, "*")) {
! syslog(LOG_ERR,
"is_parent> path too long [%s]", parent);
rv = FALSE;
} else
rv = (match(tmp, child) != 0) ? TRUE : FALSE;
} else {
if (!tlm_cat_path(tmp, parent, "/")) {
! syslog(LOG_ERR,
"is_parent> path too long [%s]", parent);
rv = FALSE;
} else
rv = (strncmp(tmp, child, strlen(tmp)) == 0) ?
TRUE : FALSE;
*** 1590,1600 ****
int flags,
int *mchtype,
int *pos)
{
char *p_sel;
! char *uc_name, *retry, *namep;
boolean_t found;
int i;
name_match_fp_t *cmp_fp;
if (name == NULL || sels == NULL || exls == NULL)
--- 1580,1590 ----
int flags,
int *mchtype,
int *pos)
{
char *p_sel;
! char *uc_name = NULL, *retry, *namep;
boolean_t found;
int i;
name_match_fp_t *cmp_fp;
if (name == NULL || sels == NULL || exls == NULL)
*** 1608,1618 ****
/*
* For empty selection, restore everything
*/
if (*sels == NULL || **sels == '\0') {
! NDMP_LOG(LOG_DEBUG, "is_file_wanted: Restore all");
return (TRUE);
}
retry = ndmp_malloc(TLM_MAX_PATH_NAME);
if (retry == NULL)
--- 1598,1608 ----
/*
* For empty selection, restore everything
*/
if (*sels == NULL || **sels == '\0') {
! syslog(LOG_DEBUG, "is_file_wanted: Restore all");
return (TRUE);
}
retry = ndmp_malloc(TLM_MAX_PATH_NAME);
if (retry == NULL)
*** 1633,1654 ****
}
(void) strlcpy(uc_name, namep, TLM_MAX_PATH_NAME);
(void) strupr(uc_name);
namep = uc_name;
}
- NDMP_LOG(LOG_DEBUG, "is_file_wanted> flg: 0x%x name: [%s]",
- flags, name);
for (i = 0; *sels != NULL; sels++, i++) {
p_sel = *sels + strspn(*sels, "/");
/*
* Try exact match.
*/
if ((*cmp_fp)(p_sel, namep)) {
- NDMP_LOG(LOG_DEBUG, "match1> pos: %d [%s][%s]",
- i, p_sel, name);
found = TRUE;
if (mchtype != NULL)
*mchtype = PM_EXACT;
break;
}
--- 1623,1640 ----
*** 1656,1666 ****
* Try "entry/" and the current selection. The
* current selection may be something like "<something>/".
*/
(void) tlm_cat_path(retry, namep, "/");
if ((*cmp_fp)(p_sel, retry)) {
! NDMP_LOG(LOG_DEBUG, "match2> pos %d [%s][%s]",
i, p_sel, name);
found = TRUE;
if (mchtype != NULL)
*mchtype = PM_EXACT;
break;
--- 1642,1652 ----
* Try "entry/" and the current selection. The
* current selection may be something like "<something>/".
*/
(void) tlm_cat_path(retry, namep, "/");
if ((*cmp_fp)(p_sel, retry)) {
! syslog(LOG_DEBUG, "match2> pos %d [%s][%s]",
i, p_sel, name);
found = TRUE;
if (mchtype != NULL)
*mchtype = PM_EXACT;
break;
*** 1668,1679 ****
/*
* If the following check returns true it means that the
* 'name' is an entry below the 'p_sel' hierarchy.
*/
if (is_parent(p_sel, namep, flags)) {
- NDMP_LOG(LOG_DEBUG, "parent1> pos %d [%s][%s]",
- i, p_sel, name);
found = TRUE;
if (mchtype != NULL)
*mchtype = PM_CHILD;
break;
}
--- 1654,1663 ----
*** 1684,1694 ****
* until the final entry matches with 'p_sel'. At that
* time the middle directories of the entry have been passed
* and they can't be restored.
*/
if (is_parent(namep, p_sel, flags)) {
! NDMP_LOG(LOG_DEBUG, "parent2> pos %d [%s][%s]",
i, p_sel, name);
found = TRUE;
if (mchtype != NULL)
*mchtype = PM_PARENT;
break;
--- 1668,1678 ----
* until the final entry matches with 'p_sel'. At that
* time the middle directories of the entry have been passed
* and they can't be restored.
*/
if (is_parent(namep, p_sel, flags)) {
! syslog(LOG_DEBUG, "parent2> pos %d [%s][%s]",
i, p_sel, name);
found = TRUE;
if (mchtype != NULL)
*mchtype = PM_PARENT;
break;
*** 1726,1748 ****
int err;
int toread, actual_size, rec_size;
char *rec;
if (l <= 0 || d <= 0 || !lcmds || !mem) {
! NDMP_LOG(LOG_DEBUG, "Invalid argument");
return (-1);
}
toread = len;
while (toread > 0) {
rec = get_read_buffer(toread, &err, &actual_size, lcmds);
if (actual_size <= 0) {
! NDMP_LOG(LOG_DEBUG, "err %d act_size %d detected",
err, actual_size);
break;
} else if (err) {
! NDMP_LOG(LOG_DEBUG, "error %d reading data", err);
return (-1);
}
rec_size = min(actual_size, toread);
(void) memcpy(mem, rec, rec_size);
mem += rec_size;
--- 1710,1732 ----
int err;
int toread, actual_size, rec_size;
char *rec;
if (l <= 0 || d <= 0 || !lcmds || !mem) {
! syslog(LOG_ERR, "Invalid argument");
return (-1);
}
toread = len;
while (toread > 0) {
rec = get_read_buffer(toread, &err, &actual_size, lcmds);
if (actual_size <= 0) {
! syslog(LOG_ERR, "err %d act_size %d detected",
err, actual_size);
break;
} else if (err) {
! syslog(LOG_ERR, "error %d reading data", err);
return (-1);
}
rec_size = min(actual_size, toread);
(void) memcpy(mem, rec, rec_size);
mem += rec_size;
*** 1764,1774 ****
tlm_cmd_t *local_commands)
{
char *p_record, *value;
int rv;
! NDMP_LOG(LOG_DEBUG, "HUGE Record found: %d", recsize);
rv = 0;
if (recsize == 0) {
/*
* The humongus_file_header was written in a
--- 1748,1758 ----
tlm_cmd_t *local_commands)
{
char *p_record, *value;
int rv;
! syslog(LOG_WARNING, "HUGE Record found: %d", recsize);
rv = 0;
if (recsize == 0) {
/*
* The humongus_file_header was written in a
*** 1776,1796 ****
* record was 0 before this fix. For backward compatiblity
* read only one RECORDSIZE-size block if the header.size
* field is 0. Otherwise the header.size field should show
* the length of the data of this header.
*/
! NDMP_LOG(LOG_DEBUG, "Old HUGE record found");
recsize = RECORDSIZE;
}
if (input_mem(lib, drv, local_commands, name, recsize) != recsize) {
rv = -1;
*size = 0;
*name = '\0';
! NDMP_LOG(LOG_DEBUG, "Error reading a HUGE file name");
} else {
! NDMP_LOG(LOG_DEBUG, "HUGE [%s]", name);
p_record = name;
value = parse(&p_record, " ");
*size = atoll(value);
/*
--- 1760,1780 ----
* record was 0 before this fix. For backward compatiblity
* read only one RECORDSIZE-size block if the header.size
* field is 0. Otherwise the header.size field should show
* the length of the data of this header.
*/
! syslog(LOG_WARNING, "Old HUGE record found");
recsize = RECORDSIZE;
}
if (input_mem(lib, drv, local_commands, name, recsize) != recsize) {
rv = -1;
*size = 0;
*name = '\0';
! syslog(LOG_ERR, "Error reading a HUGE file name");
} else {
! syslog(LOG_DEBUG, "HUGE [%s]", name);
p_record = name;
value = parse(&p_record, " ");
*size = atoll(value);
/*
*** 1800,1810 ****
* without check on the buffer size.
*/
(void) strlcpy(name, p_record, TLM_MAX_PATH_NAME);
}
! NDMP_LOG(LOG_DEBUG, "HUGE Record %lld [%s]", *size, name);
return (rv);
}
/*
--- 1784,1794 ----
* without check on the buffer size.
*/
(void) strlcpy(name, p_record, TLM_MAX_PATH_NAME);
}
! syslog(LOG_DEBUG, "HUGE Record %lld [%s]", *size, name);
return (rv);
}
/*
*** 1818,1828 ****
long *buf_spot,
tlm_cmd_t *local_commands)
{
int nread;
! NDMP_LOG(LOG_DEBUG, "LONGNAME Record found rs %d bs %d", recsize,
*buf_spot);
if (*buf_spot < 0)
*buf_spot = 0;
--- 1802,1812 ----
long *buf_spot,
tlm_cmd_t *local_commands)
{
int nread;
! syslog(LOG_DEBUG, "LONGNAME Record found rs %d bs %d", recsize,
*buf_spot);
if (*buf_spot < 0)
*buf_spot = 0;
*** 1829,1844 ****
nread = input_mem(lib, drv, local_commands, name + *buf_spot,
recsize);
if (nread < 0) {
nread = recsize; /* return 0 as size left */
name[*buf_spot] = '\0';
! NDMP_LOG(LOG_ERR, "Error %d reading a long file name %s.",
nread, name);
} else {
*buf_spot += nread;
name[*buf_spot] = '\0';
! NDMP_LOG(LOG_DEBUG, "LONGNAME [%s]", name);
}
return (recsize - nread);
}
--- 1813,1828 ----
nread = input_mem(lib, drv, local_commands, name + *buf_spot,
recsize);
if (nread < 0) {
nread = recsize; /* return 0 as size left */
name[*buf_spot] = '\0';
! syslog(LOG_ERR, "Error %d reading a long file name %s.",
nread, name);
} else {
*buf_spot += nread;
name[*buf_spot] = '\0';
! syslog(LOG_DEBUG, "LONGNAME [%s]", name);
}
return (recsize - nread);
}
*** 1855,1865 ****
/*
* Make sure all directories in this path exist, create them if
* needed.
*/
- NDMP_LOG(LOG_DEBUG, "new dir[%s]", dir);
erc = 0;
p = &dir[1];
do {
temp = *p;
--- 1839,1848 ----
*** 1867,1877 ****
*p = 0;
if (stat64(dir, &attr) < 0) {
if (mkdir(dir, 0777) != 0 && errno != EEXIST) {
erc = errno;
job_stats->js_errors++;
! NDMP_LOG(LOG_DEBUG,
"Could not create directory %s: %d",
dir, errno);
break;
}
}
--- 1850,1860 ----
*p = 0;
if (stat64(dir, &attr) < 0) {
if (mkdir(dir, 0777) != 0 && errno != EEXIST) {
erc = errno;
job_stats->js_errors++;
! syslog(LOG_ERR,
"Could not create directory %s: %d",
dir, errno);
break;
}
}
*** 1902,1912 ****
if (erc) {
/* Nothing to do if the destination already exists */
if (erc == EEXIST)
return (0);
job_stats->js_errors++;
! NDMP_LOG(LOG_DEBUG, "error %d (errno %d) hardlink [%s] to [%s]",
erc, errno, name_new, name_old);
return (erc);
}
return (set_acl(name_new, acls));
}
--- 1885,1895 ----
if (erc) {
/* Nothing to do if the destination already exists */
if (erc == EEXIST)
return (0);
job_stats->js_errors++;
! syslog(LOG_ERR, "error %d (errno %d) hardlink [%s] to [%s]",
erc, errno, name_new, name_old);
return (erc);
}
return (set_acl(name_new, acls));
}
*** 1927,1939 ****
return (erc);
st = &acls->acl_attr;
if (symlink(target, dst) != 0) {
erc = errno;
job_stats->js_errors++;
! NDMP_LOG(LOG_DEBUG, "error %d softlink [%s] to [%s]",
errno, dst, target);
} else {
st->st_mode |= S_IFLNK;
erc = set_acl(dst, acls);
}
--- 1910,1929 ----
return (erc);
st = &acls->acl_attr;
if (symlink(target, dst) != 0) {
erc = errno;
+ if (errno == EEXIST) {
+ erc = 0;
+ syslog(LOG_DEBUG,
+ "softlink [%s] to [%s] already existed",
+ dst, target);
+ } else {
job_stats->js_errors++;
! syslog(LOG_ERR, "error %d softlink [%s] to [%s]",
errno, dst, target);
+ }
} else {
st->st_mode |= S_IFLNK;
erc = set_acl(dst, acls);
}
*** 1962,1972 ****
case LF_FIFO:
mode = S_IFIFO;
dev = 0;
break;
default:
! NDMP_LOG(LOG_ERR, "unsupported flag %d", flag);
return (-1);
}
/* Remove the old entry first */
if (rmdir(name) < 0) {
--- 1952,1962 ----
case LF_FIFO:
mode = S_IFIFO;
dev = 0;
break;
default:
! syslog(LOG_ERR, "unsupported flag %d", flag);
return (-1);
}
/* Remove the old entry first */
if (rmdir(name) < 0) {
*** 1973,1983 ****
if (errno == ENOTDIR)
(void) unlink(name);
}
if (mknod(name, 0777 | mode, dev) != 0) {
job_stats->js_errors++;
! NDMP_LOG(LOG_DEBUG, "error %d mknod [%s] major"
" %d minor %d", errno, name, major, minor);
return (errno);
}
return (set_acl(name, acls));
}
--- 1963,1973 ----
if (errno == ENOTDIR)
(void) unlink(name);
}
if (mknod(name, 0777 | mode, dev) != 0) {
job_stats->js_errors++;
! syslog(LOG_ERR, "error %d mknod [%s] major"
" %d minor %d", errno, name, major, minor);
return (errno);
}
return (set_acl(name, acls));
}
*** 2008,2018 ****
bp = ((char *)&acls->acl_info) + *acl_spot;
nread = input_mem(lib, drv, local_commands, (void *)bp, file_size);
if (nread < 0) {
*acl_spot = 0;
(void) memset(acls, 0, sizeof (tlm_acls_t));
! NDMP_LOG(LOG_DEBUG, "Error reading ACL data");
return (0);
}
*acl_spot += nread;
acls->acl_non_trivial = TRUE;
--- 1998,2008 ----
bp = ((char *)&acls->acl_info) + *acl_spot;
nread = input_mem(lib, drv, local_commands, (void *)bp, file_size);
if (nread < 0) {
*acl_spot = 0;
(void) memset(acls, 0, sizeof (tlm_acls_t));
! syslog(LOG_ERR, "Error reading ACL data");
return (0);
}
*acl_spot += nread;
acls->acl_non_trivial = TRUE;
*** 2023,2033 ****
ndmp_set_eprivs_least(void)
{
priv_set_t *priv_set;
if ((priv_set = priv_allocset()) == NULL) {
! NDMP_LOG(LOG_ERR, "Out of memory.");
return (-1);
}
priv_basicset(priv_set);
--- 2013,2023 ----
ndmp_set_eprivs_least(void)
{
priv_set_t *priv_set;
if ((priv_set = priv_allocset()) == NULL) {
! syslog(LOG_ERR, "Out of memory.");
return (-1);
}
priv_basicset(priv_set);
*** 2045,2055 ****
(void) priv_addset(priv_set, PRIV_SYS_DEVICES);
(void) priv_addset(priv_set, PRIV_SYS_MOUNT);
(void) priv_addset(priv_set, PRIV_SYS_CONFIG);
if (setppriv(PRIV_SET, PRIV_EFFECTIVE, priv_set) == -1) {
! NDMP_LOG(LOG_ERR, "Additional privileges required.");
priv_freeset(priv_set);
return (-1);
}
priv_freeset(priv_set);
return (0);
--- 2035,2045 ----
(void) priv_addset(priv_set, PRIV_SYS_DEVICES);
(void) priv_addset(priv_set, PRIV_SYS_MOUNT);
(void) priv_addset(priv_set, PRIV_SYS_CONFIG);
if (setppriv(PRIV_SET, PRIV_EFFECTIVE, priv_set) == -1) {
! syslog(LOG_ERR, "Additional privileges required.");
priv_freeset(priv_set);
return (-1);
}
priv_freeset(priv_set);
return (0);
*** 2059,2076 ****
ndmp_set_eprivs_all(void)
{
priv_set_t *priv_set;
if ((priv_set = priv_allocset()) == NULL) {
! NDMP_LOG(LOG_ERR, "Out of memory.");
return (-1);
}
priv_fillset(priv_set);
if (setppriv(PRIV_SET, PRIV_EFFECTIVE, priv_set) != 0) {
! NDMP_LOG(LOG_ERR, "Additional privileges required.");
return (-1);
}
priv_freeset(priv_set);
return (0);
}
--- 2049,2066 ----
ndmp_set_eprivs_all(void)
{
priv_set_t *priv_set;
if ((priv_set = priv_allocset()) == NULL) {
! syslog(LOG_ERR, "Out of memory.");
return (-1);
}
priv_fillset(priv_set);
if (setppriv(PRIV_SET, PRIV_EFFECTIVE, priv_set) != 0) {
! syslog(LOG_ERR, "Additional privileges required.");
return (-1);
}
priv_freeset(priv_set);
return (0);
}
*** 2093,2124 ****
if (!name || !acls)
return (0);
st = &acls->acl_attr;
- NDMP_LOG(LOG_DEBUG, "set_attr: %s uid %d gid %d uname %s gname %s "
- "mode %o", name, st->st_uid, st->st_gid, acls->uname, acls->gname,
- st->st_mode);
uid = st->st_uid;
if ((pwd = getpwnam(acls->uname)) != NULL) {
- NDMP_LOG(LOG_DEBUG, "set_attr: new uid %d old %d",
- pwd->pw_uid, uid);
uid = pwd->pw_uid;
}
gid = st->st_gid;
if ((grp = getgrnam(acls->gname)) != NULL) {
- NDMP_LOG(LOG_DEBUG, "set_attr: new gid %d old %d",
- grp->gr_gid, gid);
gid = grp->gr_gid;
}
erc = lchown(name, uid, gid);
if (erc != 0) {
erc = errno;
! NDMP_LOG(LOG_ERR,
"Could not set uid or/and gid for file %s.", name);
}
if ((st->st_mode & (S_ISUID | S_ISGID)) != 0) {
/*
--- 2083,2107 ----
if (!name || !acls)
return (0);
st = &acls->acl_attr;
uid = st->st_uid;
if ((pwd = getpwnam(acls->uname)) != NULL) {
uid = pwd->pw_uid;
}
gid = st->st_gid;
if ((grp = getgrnam(acls->gname)) != NULL) {
gid = grp->gr_gid;
}
erc = lchown(name, uid, gid);
if (erc != 0) {
erc = errno;
! syslog(LOG_ERR,
"Could not set uid or/and gid for file %s.", name);
}
if ((st->st_mode & (S_ISUID | S_ISGID)) != 0) {
/*
*** 2125,2135 ****
* Change effective privileges to 'all' which is required to
* change setuid bit for 'root' owned files. If fails, just
* send error to log file and proceed.
*/
if (ndmp_set_eprivs_all()) {
! NDMP_LOG(LOG_ERR,
"Could not set effective privileges to 'all'.");
} else {
priv_all = TRUE;
}
}
--- 2108,2118 ----
* Change effective privileges to 'all' which is required to
* change setuid bit for 'root' owned files. If fails, just
* send error to log file and proceed.
*/
if (ndmp_set_eprivs_all()) {
! syslog(LOG_ERR,
"Could not set effective privileges to 'all'.");
} else {
priv_all = TRUE;
}
}
*** 2136,2146 ****
if (!S_ISLNK(st->st_mode)) {
erc = chmod(name, st->st_mode);
if (erc != 0) {
erc = errno;
! NDMP_LOG(LOG_ERR, "Could not set correct file"
" permission for file %s: %d", name, errno);
}
tbuf.modtime = st->st_mtime;
tbuf.actime = st->st_atime;
--- 2119,2129 ----
if (!S_ISLNK(st->st_mode)) {
erc = chmod(name, st->st_mode);
if (erc != 0) {
erc = errno;
! syslog(LOG_ERR, "Could not set correct file"
" permission for file %s: %d", name, errno);
}
tbuf.modtime = st->st_mtime;
tbuf.actime = st->st_atime;
*** 2152,2162 ****
* Give up the 'all' privileges for effective sets and go back
* to least required privileges. If fails, just send error to
* log file and proceed.
*/
if (ndmp_set_eprivs_least())
! NDMP_LOG(LOG_ERR,
"Could not set least required privileges.");
}
return (erc);
}
--- 2135,2145 ----
* Give up the 'all' privileges for effective sets and go back
* to least required privileges. If fails, just send error to
* log file and proceed.
*/
if (ndmp_set_eprivs_least())
! syslog(LOG_ERR,
"Could not set least required privileges.");
}
return (erc);
}
*** 2168,2179 ****
set_acl(char *name, tlm_acls_t *acls)
{
int erc;
acl_t *aclp = NULL;
- if (name)
- NDMP_LOG(LOG_DEBUG, "set_acl: %s", name);
if (acls == NULL)
return (0);
/* Need a place to save real modification time */
--- 2151,2160 ----
*** 2181,2204 ****
if (ERROR_IS_FATAL(erc))
return (erc);
if (!acls->acl_non_trivial) {
(void) memset(acls, 0, sizeof (tlm_acls_t));
- NDMP_LOG(LOG_DEBUG, "set_acl: skipping trivial");
return (erc);
}
erc = acl_fromtext(acls->acl_info.attr_info, &aclp);
if (erc != 0) {
! NDMP_LOG(LOG_DEBUG,
"TAPE RESTORE> acl_fromtext errno %d", erc);
}
if (aclp) {
erc = acl_set(name, aclp);
if (erc < 0) {
erc = errno;
! NDMP_LOG(LOG_DEBUG,
"TAPE RESTORE> acl_set errno %d", errno);
}
acl_free(aclp);
}
(void) memset(acls, 0, sizeof (tlm_acls_t));
--- 2162,2184 ----
if (ERROR_IS_FATAL(erc))
return (erc);
if (!acls->acl_non_trivial) {
(void) memset(acls, 0, sizeof (tlm_acls_t));
return (erc);
}
erc = acl_fromtext(acls->acl_info.attr_info, &aclp);
if (erc != 0) {
! syslog(LOG_ERR,
"TAPE RESTORE> acl_fromtext errno %d", erc);
}
if (aclp) {
erc = acl_set(name, aclp);
if (erc < 0) {
erc = errno;
! syslog(LOG_ERR,
"TAPE RESTORE> acl_set errno %d", errno);
}
acl_free(aclp);
}
(void) memset(acls, 0, sizeof (tlm_acls_t));
*** 2256,2272 ****
{
char *rv;
rv = NULL;
if (!buf) {
! NDMP_LOG(LOG_DEBUG, "buf is NULL");
} else if (!path) {
! NDMP_LOG(LOG_DEBUG, "path is NULL");
} else if (!rnp->rn_nlp) {
! NDMP_LOG(LOG_DEBUG, "rn_nlp is NULL [%s]", path);
} else if (!tlm_cat_path(buf, rnp->rn_nlp, path)) {
! NDMP_LOG(LOG_DEBUG, "Path too long [%s][%s]",
rnp->rn_nlp, path);
} else
rv = buf;
return (rv);
--- 2236,2252 ----
{
char *rv;
rv = NULL;
if (!buf) {
! syslog(LOG_DEBUG, "buf is NULL");
} else if (!path) {
! syslog(LOG_DEBUG, "path is NULL");
} else if (!rnp->rn_nlp) {
! syslog(LOG_DEBUG, "rn_nlp is NULL [%s]", path);
} else if (!tlm_cat_path(buf, rnp->rn_nlp, path)) {
! syslog(LOG_DEBUG, "Path too long [%s][%s]",
rnp->rn_nlp, path);
} else
rv = buf;
return (rv);
*** 2303,2314 ****
slashp = bk_path + strlen(bk_path) - 1;
if (*slashp == '/')
(void) snprintf(pbuf, TLM_MAX_PATH_NAME, "%s%s", bk_path, p);
else
(void) snprintf(pbuf, TLM_MAX_PATH_NAME, "%s/%s", bk_path, p);
-
- NDMP_LOG(LOG_DEBUG, "old path [%s] new path [%s]", path, pbuf);
}
/*
* Iterate over ZFS metadata stored in the backup stream and use the callback
--- 2283,2292 ----
*** 2406,2425 ****
/* LINTED improper alignment */
mhpx = (ndmp_metadata_header_ext_t *)mhbuf;
if (mhpx->nh_major > META_HDR_MAJOR_VERSION) {
/* Major header mismatch */
! NDMP_LOG(LOG_ERR, "metadata header mismatch",
"M%d != M%d", mhpx->nh_major,
META_HDR_MAJOR_VERSION);
free(mhbuf);
return (-1);
}
if (mhpx->nh_major == META_HDR_MAJOR_VERSION &&
mhpx->nh_minor > META_HDR_MINOR_VERSION) {
/* Minor header mismatch */
! NDMP_LOG(LOG_ERR, "Warning:"
"metadata header mismatch m%d != m%d",
mhpx->nh_minor,
META_HDR_MINOR_VERSION);
continue;
}
--- 2384,2403 ----
/* LINTED improper alignment */
mhpx = (ndmp_metadata_header_ext_t *)mhbuf;
if (mhpx->nh_major > META_HDR_MAJOR_VERSION) {
/* Major header mismatch */
! syslog(LOG_ERR, "metadata header mismatch",
"M%d != M%d", mhpx->nh_major,
META_HDR_MAJOR_VERSION);
free(mhbuf);
return (-1);
}
if (mhpx->nh_major == META_HDR_MAJOR_VERSION &&
mhpx->nh_minor > META_HDR_MINOR_VERSION) {
/* Minor header mismatch */
! syslog(LOG_ERR, "Warning:"
"metadata header mismatch m%d != m%d",
mhpx->nh_minor,
META_HDR_MINOR_VERSION);
continue;
}