#include "includes.h"
+/* Check for NULL pointer parameters in vfswrap_* functions */
+
+#define VFS_CHECK_NULL
+
/* We don't want to have NULL function pointers lying around. Someone
is sure to try and execute them. These stubs are used to prevent
this possibility. */
int vfswrap_dummy_connect(struct vfs_connection_struct *conn, char *service,
char *user)
{
- /* Do nothing */
+ return 0; /* Return >= 0 for success */
}
void vfswrap_dummy_disconnect(void)
{
- /* Do nothing a bit more */
}
/* Disk operations */
{
SMB_BIG_UINT result;
+#ifdef VFS_CHECK_NULL
+ if ((path == NULL) || (bsize == NULL) || (dfree == NULL) ||
+ (dsize == NULL)) {
+
+ smb_panic("NULL pointer passed to vfswrap_disk_free() function\n");
+ }
+#endif
+
result = sys_disk_free(path, bsize, dfree, dsize);
return result;
}
{
DIR *result;
+#ifdef VFS_CHECK_NULL
+ if (fname == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_opendir()\n");
+ }
+#endif
+
result = opendir(fname);
return result;
}
{
struct dirent *result;
+#ifdef VFS_CHECK_NULL
+ if (dirp == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_readdir()\n");
+ }
+#endif
+
result = readdir(dirp);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if (path == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_mkdir()\n");
+ }
+#endif
+
result = mkdir(path, mode);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if (path == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_rmdir()\n");
+ }
+#endif
+
result = rmdir(path);
return result;
}
int vfswrap_closedir(DIR *dirp)
{
int result;
-
+
+#ifdef VFS_CHECK_NULL
+ if (dirp == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_closedir()\n");
+ }
+#endif
+
result = closedir(dirp);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if (fname == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_open()\n");
+ }
+#endif
+
result = sys_open(fname, flags, mode);
return result;
}
{
ssize_t result;
+#ifdef VFS_CHECK_NULL
+ if (data == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_read()\n");
+ }
+#endif
+
result = read(fd, data, n);
return result;
}
{
ssize_t result;
+#ifdef VFS_CHECK_NULL
+ if (data == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_write()\n");
+ }
+#endif
+
result = write(fd, data, n);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if ((old == NULL) || (new == NULL)) {
+ smb_panic("NULL pointer passed to vfswrap_rename()\n");
+ }
+#endif
+
result = rename(old, new);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if ((fname == NULL) || (sbuf == NULL)) {
+ smb_panic("NULL pointer passed to vfswrap_stat()\n");
+ }
+#endif
+
result = sys_stat(fname, sbuf);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if (sbuf == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_fstat()\n");
+ }
+#endif
+
result = sys_fstat(fd, sbuf);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if ((path == NULL) || (sbuf == NULL)) {
+ smb_panic("NULL pointer passed to vfswrap_lstat()\n");
+ }
+#endif
+
result = sys_lstat(path, sbuf);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if (path == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_unlink()\n");
+ }
+#endif
+
result = unlink(path);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if (path == NULL) {
+ smb_panic("NULL pointer passed to vfswrap_chmod()\n");
+ }
+#endif
+
result = chmod(path, mode);
return result;
}
{
int result;
+#ifdef VFS_CHECK_NULL
+ if ((path == NULL) || (times == NULL)) {
+ smb_panic("NULL pointer passed to vfswrap_utime()\n");
+ }
+#endif
+
result = utime(path, times);
return result;
}