/**
* There are actually legitimate callers of this such as functions that
- * enumerate streams using the SMB_VFS_STREAMINFO interface and then want to
+ * enumerate streams using the vfs_streaminfo interface and then want to
* operate on each stream.
*/
NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
}
/**
- * Return a debug string using the talloc_tos(). This can only be called from
- * DEBUG() macros due to the debut_ctx().
+ * 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);
}
+/**
+ * Create a debug string for the fnum of an fsp.
+ *
+ * This is allocated to talloc_tos() or a string constant
+ * in certain corner cases. The returned string should
+ * hence not be free'd directly but only via the talloc stack.
+ */
+const char *fsp_fnum_dbg(const struct files_struct *fsp)
+{
+ char *str;
+
+ if (fsp == NULL) {
+ return "fnum [fsp is NULL]";
+ }
+
+ if (fsp->fnum == FNUM_FIELD_INVALID) {
+ return "fnum [invalid value]";
+ }
+
+ str = talloc_asprintf(talloc_tos(), "fnum %llu",
+ (unsigned long long)fsp->fnum);
+ if (str == NULL) {
+ DEBUG(1, ("%s: talloc_asprintf failed\n", __FUNCTION__));
+ return "fnum [talloc failed!]";
+ }
+
+ return str;
+}
+
NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
const struct smb_filename *smb_fname_in,
struct smb_filename **smb_fname_out)
return false;
}
- return StrCaseCmp(smb_fname->stream_name, "::$DATA") == 0;
+ return strcasecmp_m(smb_fname->stream_name, "::$DATA") == 0;
}