本文整理汇总了C++中smb_fname_str_dbg函数的典型用法代码示例。如果您正苦于以下问题:C++ smb_fname_str_dbg函数的具体用法?C++ smb_fname_str_dbg怎么用?C++ smb_fname_str_dbg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smb_fname_str_dbg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recycle_get_file_size
/**
* Return file size
* @param conn connection
* @param fname file name
* @return size in bytes
**/
static SMB_OFF_T recycle_get_file_size(vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
struct smb_filename *smb_fname_tmp = NULL;
NTSTATUS status;
SMB_OFF_T size;
status = copy_smb_filename(talloc_tos(), smb_fname, &smb_fname_tmp);
if (!NT_STATUS_IS_OK(status)) {
size = (SMB_OFF_T)0;
goto out;
}
if (SMB_VFS_STAT(handle->conn, smb_fname_tmp) != 0) {
DEBUG(0,("recycle: stat for %s returned %s\n",
smb_fname_str_dbg(smb_fname_tmp), strerror(errno)));
size = (SMB_OFF_T)0;
goto out;
}
size = smb_fname_tmp->st.st_ex_size;
out:
TALLOC_FREE(smb_fname_tmp);
return size;
}
示例2: set_create_timespec_ea
NTSTATUS set_create_timespec_ea(connection_struct *conn,
const struct smb_filename *psmb_fname,
struct timespec create_time)
{
struct smb_filename *smb_fname;
uint32_t dosmode;
int ret;
if (!lp_store_dos_attributes(SNUM(conn))) {
return NT_STATUS_OK;
}
smb_fname = synthetic_smb_fname(talloc_tos(), psmb_fname->base_name,
NULL, &psmb_fname->st);
if (smb_fname == NULL) {
return NT_STATUS_NO_MEMORY;
}
dosmode = dos_mode(conn, smb_fname);
smb_fname->st.st_ex_btime = create_time;
ret = file_set_dosmode(conn, smb_fname, dosmode, NULL, false);
if (ret == -1) {
map_nt_error_from_unix(errno);
}
DEBUG(10,("set_create_timespec_ea: wrote create time EA for file %s\n",
smb_fname_str_dbg(smb_fname)));
return NT_STATUS_OK;
}
示例3: file_name_hash
NTSTATUS file_name_hash(connection_struct *conn,
const char *name, uint32_t *p_name_hash)
{
char tmpbuf[PATH_MAX];
char *fullpath, *to_free;
ssize_t len;
TDB_DATA key;
/* Set the hash of the full pathname. */
len = full_path_tos(conn->connectpath, name, tmpbuf, sizeof(tmpbuf),
&fullpath, &to_free);
if (len == -1) {
return NT_STATUS_NO_MEMORY;
}
key = (TDB_DATA) { .dptr = (uint8_t *)fullpath, .dsize = len+1 };
*p_name_hash = tdb_jenkins_hash(&key);
DEBUG(10,("file_name_hash: %s hash 0x%x\n",
fullpath,
(unsigned int)*p_name_hash ));
TALLOC_FREE(to_free);
return NT_STATUS_OK;
}
/**
* The only way that the fsp->fsp_name field should ever be set.
*/
NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
const struct smb_filename *smb_fname_in)
{
struct smb_filename *smb_fname_new;
smb_fname_new = cp_smb_filename(fsp, smb_fname_in);
if (smb_fname_new == NULL) {
return NT_STATUS_NO_MEMORY;
}
TALLOC_FREE(fsp->fsp_name);
fsp->fsp_name = smb_fname_new;
return file_name_hash(fsp->conn,
smb_fname_str_dbg(fsp->fsp_name),
&fsp->name_hash);
}
const struct GUID *fsp_client_guid(const files_struct *fsp)
{
return &fsp->conn->sconn->client->connections->smb2.client.guid;
}
uint32_t fsp_lease_type(struct files_struct *fsp)
{
if (fsp->oplock_type == LEASE_OPLOCK) {
return fsp->lease->lease.lease_state;
}
return map_oplock_to_lease_type(fsp->oplock_type);
}
示例4: onefs_stream_prep_smb_fname
NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx,
const struct smb_filename *smb_fname_in,
struct smb_filename **smb_fname_out)
{
char *stream_name = NULL;
NTSTATUS status;
/*
* Only attempt to strip off the trailing :$DATA if there is an actual
* stream there. If it is the default stream, the smb_fname_out will
* just have a NULL stream so the base file is opened.
*/
if (smb_fname_in->stream_name &&
!is_ntfs_default_stream_smb_fname(smb_fname_in)) {
char *str_tmp = smb_fname_in->stream_name;
/* First strip off the leading ':' */
if (str_tmp[0] == ':') {
str_tmp++;
}
/* Create a new copy of the stream_name. */
stream_name = talloc_strdup(ctx, str_tmp);
if (stream_name == NULL) {
return NT_STATUS_NO_MEMORY;
}
/* Strip off the :$DATA if one exists. */
str_tmp = strrchr_m(stream_name, ':');
if (str_tmp) {
if (strcasecmp_m(str_tmp, ":$DATA") != 0) {
return NT_STATUS_INVALID_PARAMETER;
}
str_tmp[0] = '\0';
}
}
/*
* If there was a stream that wasn't the default stream the leading
* colon and trailing :$DATA has now been stripped off. Create a new
* smb_filename to pass back.
*/
status = create_synthetic_smb_fname(ctx, smb_fname_in->base_name,
stream_name, &smb_fname_in->st,
smb_fname_out);
TALLOC_FREE(stream_name);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("Failed to prep stream name for %s: %s\n",
*smb_fname_out ?
smb_fname_str_dbg(*smb_fname_out) : "NULL",
nt_errstr(status)));
}
return status;
}
示例5: dos_mode_msdfs
uint32_t dos_mode_msdfs(connection_struct *conn,
const struct smb_filename *smb_fname)
{
uint32_t result = 0;
DEBUG(8,("dos_mode_msdfs: %s\n", smb_fname_str_dbg(smb_fname)));
if (!VALID_STAT(smb_fname->st)) {
return 0;
}
/* First do any modifications that depend on the path name. */
/* hide files with a name starting with a . */
if (lp_hide_dot_files(SNUM(conn))) {
const char *p = strrchr_m(smb_fname->base_name, '/');
if (p) {
p++;
} else {
p = smb_fname->base_name;
}
/* Only . and .. are not hidden. */
if (p[0] == '.' && !((p[1] == '\0') ||
(p[1] == '.' && p[2] == '\0'))) {
result |= FILE_ATTRIBUTE_HIDDEN;
}
}
result |= dos_mode_from_sbuf(conn, smb_fname);
/* Optimization : Only call is_hidden_path if it's not already
hidden. */
if (!(result & FILE_ATTRIBUTE_HIDDEN) &&
IS_HIDDEN_PATH(conn, smb_fname->base_name)) {
result |= FILE_ATTRIBUTE_HIDDEN;
}
if (result == 0) {
result = FILE_ATTRIBUTE_NORMAL;
}
result = filter_mode_by_protocol(result);
/*
* Add in that it is a reparse point
*/
result |= FILE_ATTRIBUTE_REPARSE_POINT;
dos_mode_debug_print(__func__, result);
return(result);
}
示例6: audit_rename
static int audit_rename(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst)
{
int result;
result = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
if (lp_syslog() > 0) {
syslog(audit_syslog_priority(handle), "rename %s -> %s %s%s\n",
smb_fname_src->base_name,
smb_fname_dst->base_name,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
}
DEBUG(1, ("vfs_extd_audit: rename old: %s newname: %s %s %s\n",
smb_fname_str_dbg(smb_fname_src),
smb_fname_str_dbg(smb_fname_dst),
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
return result;
}
示例7: recycle_do_touch
/**
* Touch access or modify date
**/
static void recycle_do_touch(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
bool touch_mtime)
{
struct smb_filename *smb_fname_tmp = NULL;
struct smb_file_time ft;
NTSTATUS status;
int ret, err;
ZERO_STRUCT(ft);
status = copy_smb_filename(talloc_tos(), smb_fname, &smb_fname_tmp);
if (!NT_STATUS_IS_OK(status)) {
return;
}
if (SMB_VFS_STAT(handle->conn, smb_fname_tmp) != 0) {
DEBUG(0,("recycle: stat for %s returned %s\n",
smb_fname_str_dbg(smb_fname_tmp), strerror(errno)));
goto out;
}
/* atime */
ft.atime = timespec_current();
/* mtime */
ft.mtime = touch_mtime ? ft.atime : smb_fname_tmp->st.st_ex_mtime;
become_root();
ret = SMB_VFS_NEXT_NTIMES(handle, smb_fname_tmp, &ft);
err = errno;
unbecome_root();
if (ret == -1 ) {
DEBUG(0, ("recycle: touching %s failed, reason = %s\n",
smb_fname_str_dbg(smb_fname_tmp), strerror(err)));
}
out:
TALLOC_FREE(smb_fname_tmp);
}
示例8: fsp_set_smb_fname
/**
* The only way that the fsp->fsp_name field should ever be set.
*/
NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
const struct smb_filename *smb_fname_in)
{
struct smb_filename *smb_fname_new;
smb_fname_new = cp_smb_filename(fsp, smb_fname_in);
if (smb_fname_new == NULL) {
return NT_STATUS_NO_MEMORY;
}
TALLOC_FREE(fsp->fsp_name);
fsp->fsp_name = smb_fname_new;
return file_name_hash(fsp->conn,
smb_fname_str_dbg(fsp->fsp_name),
&fsp->name_hash);
}
示例9: cephwrap_open
static int cephwrap_open(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
{
int result = -ENOENT;
DBG_DEBUG("[CEPH] open(%p, %s, %p, %d, %d)\n", handle,
smb_fname_str_dbg(smb_fname), fsp, flags, mode);
if (smb_fname->stream_name) {
goto out;
}
result = ceph_open(handle->data, smb_fname->base_name, flags, mode);
out:
DBG_DEBUG("[CEPH] open(...) = %d\n", result);
WRAP_RETURN(result);
}
示例10: find_completed_open
static bool find_completed_open(files_struct *fsp,
int *p_fd,
int *p_errno)
{
struct aio_open_private_data *opd;
opd = find_open_private_data_by_mid(fsp->mid);
if (!opd) {
return false;
}
if (opd->in_progress) {
DEBUG(0,("find_completed_open: mid %llu "
"jobid %d still in progress for "
"file %s/%s. PANIC !\n",
(unsigned long long)opd->mid,
opd->jobid,
opd->dname,
opd->fname));
/* Disaster ! This is an open timeout. Just panic. */
smb_panic("find_completed_open - in_progress\n");
/* notreached. */
return false;
}
*p_fd = opd->ret_fd;
*p_errno = opd->ret_errno;
DEBUG(5,("find_completed_open: mid %llu returning "
"fd = %d, errno = %d (%s) "
"jobid (%d) for file %s\n",
(unsigned long long)opd->mid,
opd->ret_fd,
opd->ret_errno,
strerror(opd->ret_errno),
opd->jobid,
smb_fname_str_dbg(fsp->fsp_name)));
/* Now we can free the opd. */
TALLOC_FREE(opd);
return true;
}
示例11: audit_unlink
static int audit_unlink(vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
int result;
result = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
if (lp_syslog() > 0) {
syslog(audit_syslog_priority(handle), "unlink %s %s%s\n",
smb_fname->base_name,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
}
DEBUG(0, ("vfs_extd_audit: unlink %s %s %s\n",
smb_fname_str_dbg(smb_fname),
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
return result;
}
示例12: audit_open
static int audit_open(vfs_handle_struct *handle,
struct smb_filename *smb_fname, files_struct *fsp,
int flags, mode_t mode)
{
int result;
result = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
if (lp_syslog() > 0) {
syslog(audit_syslog_priority(handle), "open %s (fd %d) %s%s%s\n",
smb_fname->base_name, result,
((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "",
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
}
DEBUG(2, ("vfs_extd_audit: open %s %s %s\n",
smb_fname_str_dbg(smb_fname),
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
return result;
}
示例13: talloc_stackframe
/*
* Because there is no good way to guarantee that a new xattr will be
* created on file creation there might be no acl xattr on a file when
* trying to read the acl. In this case the acl xattr will get
* constructed at that time from the parent acl.
* If the parent ACL doesn't have an xattr either the call will
* recurse to the next parent directory until the share root is
* reached. If the share root doesn't contain an ACL xattr either a
* default ACL will be used.
* Also a default ACL will be set if a non inheriting ACL is encountered.
*
* Basic algorithm:
* read acl xattr blob
* if acl xattr blob doesn't exist
* stat current directory to know if it's a file or directory
* read acl xattr blob from parent dir
* acl xattr blob to smb nfs4 acl
* calculate inherited smb nfs4 acl
* without inheritance use default smb nfs4 acl
* smb nfs4 acl to acl xattr blob
* set acl xattr blob
* return smb nfs4 acl
* else
* acl xattr blob to smb nfs4 acl
*
* Todo: Really use mem_ctx after fixing interface of nfs4_acls
*/
static struct SMB4ACL_T *nfs4acls_inheritacl(vfs_handle_struct *handle,
const char *path,
TALLOC_CTX *mem_ctx)
{
char *parent_dir = NULL;
struct SMB4ACL_T *pparentacl = NULL;
struct SMB4ACL_T *pchildacl = NULL;
struct SMB4ACE_T *pace;
SMB_ACE4PROP_T ace;
bool isdir;
struct smb_filename *smb_fname = NULL;
NTSTATUS status;
int ret;
TALLOC_CTX *frame = talloc_stackframe();
DEBUG(10, ("nfs4acls_inheritacl invoked for %s\n", path));
smb_fname = synthetic_smb_fname(frame, path, NULL, NULL);
if (smb_fname == NULL) {
TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
ret = SMB_VFS_STAT(handle->conn, smb_fname);
if (ret == -1) {
DEBUG(0,("nfs4acls_inheritacl: failed to stat "
"directory %s. Error was %s\n",
smb_fname_str_dbg(smb_fname),
strerror(errno)));
TALLOC_FREE(frame);
return NULL;
}
isdir = S_ISDIR(smb_fname->st.st_ex_mode);
if (!parent_dirname(talloc_tos(),
path,
&parent_dir,
NULL)) {
TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
status = nfs4_get_nfs4_acl(handle, frame, parent_dir, &pparentacl);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)
&& strncmp(parent_dir, ".", 2) != 0) {
pparentacl = nfs4acls_inheritacl(handle, parent_dir,
frame);
}
else if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
pparentacl = nfs4acls_defaultacl(frame);
}
else if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(frame);
return NULL;
}
pchildacl = smb_create_smb4acl(mem_ctx);
if (pchildacl == NULL) {
DEBUG(0, ("talloc failed\n"));
TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
for (pace = smb_first_ace4(pparentacl); pace != NULL;
pace = smb_next_ace4(pace)) {
struct SMB4ACE_T *pchildace;
ace = *smb_get_ace4(pace);
if ((isdir && !(ace.aceFlags & SMB_ACE4_DIRECTORY_INHERIT_ACE)) ||
(!isdir && !(ace.aceFlags & SMB_ACE4_FILE_INHERIT_ACE))) {
DEBUG(10, ("non inheriting ace type: %d, iflags: %x, "
//.........这里部分代码省略.........
示例14: build_stream_path
static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
connection_struct *conn,
const char *orig_path,
struct smb_filename *smb_fname)
{
NTSTATUS status;
unsigned int i, num_streams = 0;
struct stream_struct *streams = NULL;
if (SMB_VFS_STAT(conn, smb_fname) == 0) {
DEBUG(10, ("'%s' exists\n", smb_fname_str_dbg(smb_fname)));
return NT_STATUS_OK;
}
if (errno != ENOENT) {
DEBUG(10, ("vfs_stat failed: %s\n", strerror(errno)));
status = map_nt_error_from_unix(errno);
goto fail;
}
/* Fall back to a case-insensitive scan of all streams on the file. */
status = vfs_streaminfo(conn, NULL, smb_fname->base_name, mem_ctx,
&num_streams, &streams);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
SET_STAT_INVALID(smb_fname->st);
return NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("vfs_streaminfo failed: %s\n", nt_errstr(status)));
goto fail;
}
for (i=0; i<num_streams; i++) {
DEBUG(10, ("comparing [%s] and [%s]: ",
smb_fname->stream_name, streams[i].name));
if (fname_equal(smb_fname->stream_name, streams[i].name,
conn->case_sensitive)) {
DEBUGADD(10, ("equal\n"));
break;
}
DEBUGADD(10, ("not equal\n"));
}
/* Couldn't find the stream. */
if (i == num_streams) {
SET_STAT_INVALID(smb_fname->st);
TALLOC_FREE(streams);
return NT_STATUS_OK;
}
DEBUG(10, ("case insensitive stream. requested: %s, actual: %s\n",
smb_fname->stream_name, streams[i].name));
TALLOC_FREE(smb_fname->stream_name);
smb_fname->stream_name = talloc_strdup(smb_fname, streams[i].name);
if (smb_fname->stream_name == NULL) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
SET_STAT_INVALID(smb_fname->st);
if (SMB_VFS_STAT(conn, smb_fname) == 0) {
DEBUG(10, ("'%s' exists\n", smb_fname_str_dbg(smb_fname)));
}
status = NT_STATUS_OK;
fail:
TALLOC_FREE(streams);
return status;
}
示例15: smb_fname_str_dbg
/**
* Return a debug string of the path name of an fsp using the talloc_tos().
*/
const char *fsp_str_dbg(const struct files_struct *fsp)
{
return smb_fname_str_dbg(fsp->fsp_name);
}