mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
Getting ready to add UNIX extensions in HEAD also.
Jeremy
(This used to be commit 6210d4aa19
)
This commit is contained in:
@ -81,6 +81,7 @@
|
|||||||
#undef WITH_MSDFS
|
#undef WITH_MSDFS
|
||||||
#undef WITH_LIBICONV
|
#undef WITH_LIBICONV
|
||||||
#undef HAVE_INO64_T
|
#undef HAVE_INO64_T
|
||||||
|
#undef HAVE_DEV64_T
|
||||||
#undef HAVE_STRUCT_FLOCK64
|
#undef HAVE_STRUCT_FLOCK64
|
||||||
#undef SIZEOF_INO_T
|
#undef SIZEOF_INO_T
|
||||||
#undef SIZEOF_OFF_T
|
#undef SIZEOF_OFF_T
|
||||||
|
608
source3/configure
vendored
608
source3/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -563,7 +563,7 @@ else
|
|||||||
RUNPROG=""
|
RUNPROG=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
|
AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
|
||||||
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
|
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
|
||||||
AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
|
AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
|
||||||
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
|
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
|
||||||
@ -873,6 +873,19 @@ if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
|
|||||||
AC_DEFINE(HAVE_INO64_T)
|
AC_DEFINE(HAVE_INO64_T)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
|
||||||
|
AC_TRY_RUN([
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
|
||||||
|
samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
|
||||||
|
if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
|
||||||
|
AC_DEFINE(HAVE_DEV64_T)
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
|
AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
|
||||||
AC_TRY_COMPILE([
|
AC_TRY_COMPILE([
|
||||||
#if defined(HAVE_UNISTD_H)
|
#if defined(HAVE_UNISTD_H)
|
||||||
|
@ -147,6 +147,7 @@
|
|||||||
#undef WITH_MSDFS
|
#undef WITH_MSDFS
|
||||||
#undef WITH_LIBICONV
|
#undef WITH_LIBICONV
|
||||||
#undef HAVE_INO64_T
|
#undef HAVE_INO64_T
|
||||||
|
#undef HAVE_DEV64_T
|
||||||
#undef HAVE_STRUCT_FLOCK64
|
#undef HAVE_STRUCT_FLOCK64
|
||||||
#undef SIZEOF_INO_T
|
#undef SIZEOF_INO_T
|
||||||
#undef SIZEOF_OFF_T
|
#undef SIZEOF_OFF_T
|
||||||
@ -602,6 +603,9 @@
|
|||||||
/* Define if you have the innetgr function. */
|
/* Define if you have the innetgr function. */
|
||||||
#undef HAVE_INNETGR
|
#undef HAVE_INNETGR
|
||||||
|
|
||||||
|
/* Define if you have the link function. */
|
||||||
|
#undef HAVE_LINK
|
||||||
|
|
||||||
/* Define if you have the llseek function. */
|
/* Define if you have the llseek function. */
|
||||||
#undef HAVE_LLSEEK
|
#undef HAVE_LLSEEK
|
||||||
|
|
||||||
@ -617,6 +621,12 @@
|
|||||||
/* Define if you have the memset function. */
|
/* Define if you have the memset function. */
|
||||||
#undef HAVE_MEMSET
|
#undef HAVE_MEMSET
|
||||||
|
|
||||||
|
/* Define if you have the mknod function. */
|
||||||
|
#undef HAVE_MKNOD
|
||||||
|
|
||||||
|
/* Define if you have the mknod64 function. */
|
||||||
|
#undef HAVE_MKNOD64
|
||||||
|
|
||||||
/* Define if you have the mktime function. */
|
/* Define if you have the mktime function. */
|
||||||
#undef HAVE_MKTIME
|
#undef HAVE_MKTIME
|
||||||
|
|
||||||
|
@ -523,7 +523,11 @@ typedef int socklen_t;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SMB_DEV_T
|
#ifndef SMB_DEV_T
|
||||||
#define SMB_DEV_T dev_t
|
# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)
|
||||||
|
# define SMB_DEV_T dev64_t
|
||||||
|
# else
|
||||||
|
# define SMB_DEV_T dev_t
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -235,6 +235,14 @@ Byte offset Type name description
|
|||||||
* Thursby MAC extensions....
|
* Thursby MAC extensions....
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MAC CIFS Extensions have the range 0x300 - 0x2FF reserved.
|
||||||
|
* Supposedly Microsoft have agreed to this.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MIN_MAC_INFO_LEVEL 0x300
|
||||||
|
#define MAX_MAC_INFO_LEVEL 0x3FF
|
||||||
|
|
||||||
#define SMB_MAC_QUERY_FS_INFO 0x301
|
#define SMB_MAC_QUERY_FS_INFO 0x301
|
||||||
|
|
||||||
#define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName))
|
#define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName))
|
||||||
@ -299,8 +307,52 @@ Byte offset Type name description
|
|||||||
#define SMB_FILE_TRACKING_INFORMATION 1036
|
#define SMB_FILE_TRACKING_INFORMATION 1036
|
||||||
#define SMB_FILE_MAXIMUM_INFORMATION 1037
|
#define SMB_FILE_MAXIMUM_INFORMATION 1037
|
||||||
|
|
||||||
|
/* UNIX CIFS Extensions - created by HP */
|
||||||
|
/*
|
||||||
|
* UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
|
||||||
|
* Supposedly Microsoft have agreed to this.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MIN_UNIX_INFO_LEVEL 0x200
|
||||||
|
#define MAX_UNIX_INFO_LEVEL 0x2FF
|
||||||
|
|
||||||
|
#define SMB_QUERY_FILE_UNIX_BASIC 0x200 /* UNIX File Info*/
|
||||||
|
#define SMB_SET_FILE_UNIX_BASIC 0x200
|
||||||
|
|
||||||
|
#define MODE_NO_CHANGE -1 /* file mode value which */
|
||||||
|
/* means "don't change it" */
|
||||||
|
|
||||||
|
/*
|
||||||
|
LARGE_INTEGER EndOfFile File size
|
||||||
|
LARGE_INTEGER Blocks Number of bytes used on disk (st_blocks).
|
||||||
|
LARGE_INTEGER CreationTime Creation time
|
||||||
|
LARGE_INTEGER LastAccessTime Last access time
|
||||||
|
LARGE_INTEGER LastModificationTime Last modification time
|
||||||
|
LARGE_INTEGER Uid Numeric user id for the owner
|
||||||
|
LARGE_INTEGER Gid Numeric group id of owner
|
||||||
|
ULONG Type Enumeration specifying the pathname type:
|
||||||
|
0 -- File
|
||||||
|
1 -- Directory
|
||||||
|
2 -- Symbolic link
|
||||||
|
3 -- Character device
|
||||||
|
4 -- Block device
|
||||||
|
5 -- FIFO (named pipe)
|
||||||
|
|
||||||
|
LARGE_INTEGER devmajor Major device number if type is device
|
||||||
|
LARGE_INTEGER devminor Minor device number if type is device
|
||||||
|
LARGE_INTEGER uniqueid This is a server-assigned unique id for the file. The client
|
||||||
|
will typically map this onto an inode number. The scope of
|
||||||
|
uniqueness is the share.
|
||||||
|
LARGE_INTEGER permissions Standard UNIX file permissions
|
||||||
|
LARGE_INTEGER nlinks The number of directory entries that map to this entry
|
||||||
|
(number of hard links)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SMB_QUERY_FILE_UNIX_LINK 0x201
|
||||||
|
#define SMB_SET_FILE_UNIX_LINK 0x201
|
||||||
|
#define SMB_SET_FILE_UNIX_HLINK 0x203
|
||||||
|
|
||||||
|
#define SMB_FIND_FILE_UNIX 0x202
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
* vfs_ops below. JRA.
|
* vfs_ops below. JRA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */
|
||||||
#define SMB_VFS_INTERFACE_VERSION 2
|
#define SMB_VFS_INTERFACE_VERSION 2
|
||||||
|
|
||||||
/* VFS operations structure */
|
/* VFS operations structure */
|
||||||
@ -49,36 +50,36 @@ struct security_descriptor_info;
|
|||||||
|
|
||||||
struct vfs_ops {
|
struct vfs_ops {
|
||||||
|
|
||||||
/* Disk operations */
|
/* Disk operations */
|
||||||
|
|
||||||
int (*connect)(struct connection_struct *conn, const char *service, const char *user);
|
int (*connect)(struct connection_struct *conn, const char *service, const char *user);
|
||||||
void (*disconnect)(struct connection_struct *conn);
|
void (*disconnect)(struct connection_struct *conn);
|
||||||
SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize,
|
SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize,
|
||||||
SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
|
SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
|
||||||
|
|
||||||
/* Directory operations */
|
/* Directory operations */
|
||||||
|
|
||||||
DIR *(*opendir)(struct connection_struct *conn, const char *fname);
|
DIR *(*opendir)(struct connection_struct *conn, const char *fname);
|
||||||
struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
|
struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
|
||||||
int (*mkdir)(struct connection_struct *conn, const char *path, mode_t mode);
|
int (*mkdir)(struct connection_struct *conn, const char *path, mode_t mode);
|
||||||
int (*rmdir)(struct connection_struct *conn, const char *path);
|
int (*rmdir)(struct connection_struct *conn, const char *path);
|
||||||
int (*closedir)(struct connection_struct *conn, DIR *dir);
|
int (*closedir)(struct connection_struct *conn, DIR *dir);
|
||||||
|
|
||||||
/* File operations */
|
/* File operations */
|
||||||
|
|
||||||
int (*open)(struct connection_struct *conn, const char *fname, int flags, mode_t mode);
|
int (*open)(struct connection_struct *conn, const char *fname, int flags, mode_t mode);
|
||||||
int (*close)(struct files_struct *fsp, int fd);
|
int (*close)(struct files_struct *fsp, int fd);
|
||||||
ssize_t (*read)(struct files_struct *fsp, int fd, void *data, size_t n);
|
ssize_t (*read)(struct files_struct *fsp, int fd, void *data, size_t n);
|
||||||
ssize_t (*write)(struct files_struct *fsp, int fd, const void *data, size_t n);
|
ssize_t (*write)(struct files_struct *fsp, int fd, const void *data, size_t n);
|
||||||
SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence);
|
SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence);
|
||||||
int (*rename)(struct connection_struct *conn, const char *old, const char *new);
|
int (*rename)(struct connection_struct *conn, const char *old, const char *new);
|
||||||
int (*fsync)(struct files_struct *fsp, int fd);
|
int (*fsync)(struct files_struct *fsp, int fd);
|
||||||
int (*stat)(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf);
|
int (*stat)(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf);
|
||||||
int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
|
int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
|
||||||
int (*lstat)(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf);
|
int (*lstat)(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf);
|
||||||
int (*unlink)(struct connection_struct *conn, const char *path);
|
int (*unlink)(struct connection_struct *conn, const char *path);
|
||||||
int (*chmod)(struct connection_struct *conn, const char *path, mode_t mode);
|
int (*chmod)(struct connection_struct *conn, const char *path, mode_t mode);
|
||||||
int (*fchmod)(struct files_struct *fsp, int fd, mode_t mode);
|
int (*fchmod)(struct files_struct *fsp, int fd, mode_t mode);
|
||||||
int (*chown)(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid);
|
int (*chown)(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid);
|
||||||
int (*fchown)(struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
|
int (*fchown)(struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
|
||||||
int (*chdir)(struct connection_struct *conn, const char *path);
|
int (*chdir)(struct connection_struct *conn, const char *path);
|
||||||
@ -88,6 +89,8 @@ struct vfs_ops {
|
|||||||
BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
|
BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
|
||||||
int (*symlink)(struct connection_struct *conn, const char *oldpath, const char *newpath);
|
int (*symlink)(struct connection_struct *conn, const char *oldpath, const char *newpath);
|
||||||
int (*readlink)(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz);
|
int (*readlink)(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz);
|
||||||
|
int (*link)(struct connection_struct *conn, const char *oldpath, const char *newpath);
|
||||||
|
int (*mknod)(struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev);
|
||||||
|
|
||||||
/* NT ACL operations. */
|
/* NT ACL operations. */
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
Version 1.9.
|
Version 1.9.
|
||||||
Samba system utilities
|
Samba system utilities
|
||||||
Copyright (C) Andrew Tridgell 1992-1998
|
Copyright (C) Andrew Tridgell 1992-1998
|
||||||
|
Copyright (C) Jeremy Allison 1998-2002
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -45,30 +46,30 @@
|
|||||||
int sys_usleep(long usecs)
|
int sys_usleep(long usecs)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_USLEEP
|
#ifndef HAVE_USLEEP
|
||||||
struct timeval tval;
|
struct timeval tval;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need this braindamage as the glibc usleep
|
* We need this braindamage as the glibc usleep
|
||||||
* is not SPEC1170 complient... grumble... JRA.
|
* is not SPEC1170 complient... grumble... JRA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(usecs < 0 || usecs > 1000000) {
|
if(usecs < 0 || usecs > 1000000) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_USLEEP
|
#if HAVE_USLEEP
|
||||||
usleep(usecs);
|
usleep(usecs);
|
||||||
return 0;
|
return 0;
|
||||||
#else /* HAVE_USLEEP */
|
#else /* HAVE_USLEEP */
|
||||||
/*
|
/*
|
||||||
* Fake it with select...
|
* Fake it with select...
|
||||||
*/
|
*/
|
||||||
tval.tv_sec = 0;
|
tval.tv_sec = 0;
|
||||||
tval.tv_usec = usecs/1000;
|
tval.tv_usec = usecs/1000;
|
||||||
select(0,NULL,NULL,NULL,&tval);
|
select(0,NULL,NULL,NULL,&tval);
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* HAVE_USLEEP */
|
#endif /* HAVE_USLEEP */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,9 +131,9 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf)
|
|||||||
int sys_ftruncate(int fd, SMB_OFF_T offset)
|
int sys_ftruncate(int fd, SMB_OFF_T offset)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FTRUNCATE64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FTRUNCATE64)
|
||||||
return ftruncate64(fd, offset);
|
return ftruncate64(fd, offset);
|
||||||
#else
|
#else
|
||||||
return ftruncate(fd, offset);
|
return ftruncate(fd, offset);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,9 +144,9 @@ int sys_ftruncate(int fd, SMB_OFF_T offset)
|
|||||||
SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
|
SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSEEK64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSEEK64)
|
||||||
return lseek64(fd, offset, whence);
|
return lseek64(fd, offset, whence);
|
||||||
#else
|
#else
|
||||||
return lseek(fd, offset, whence);
|
return lseek(fd, offset, whence);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,11 +157,11 @@ SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
|
|||||||
int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence)
|
int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEK64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEK64)
|
||||||
return fseek64(fp, offset, whence);
|
return fseek64(fp, offset, whence);
|
||||||
#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEKO64)
|
#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEKO64)
|
||||||
return fseeko64(fp, offset, whence);
|
return fseeko64(fp, offset, whence);
|
||||||
#else
|
#else
|
||||||
return fseek(fp, offset, whence);
|
return fseek(fp, offset, whence);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,11 +172,11 @@ int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence)
|
|||||||
SMB_OFF_T sys_ftell(FILE *fp)
|
SMB_OFF_T sys_ftell(FILE *fp)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELL64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELL64)
|
||||||
return (SMB_OFF_T)ftell64(fp);
|
return (SMB_OFF_T)ftell64(fp);
|
||||||
#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELLO64)
|
#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELLO64)
|
||||||
return (SMB_OFF_T)ftello64(fp);
|
return (SMB_OFF_T)ftello64(fp);
|
||||||
#else
|
#else
|
||||||
return (SMB_OFF_T)ftell(fp);
|
return (SMB_OFF_T)ftell(fp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,13 +187,13 @@ SMB_OFF_T sys_ftell(FILE *fp)
|
|||||||
int sys_creat(const char *path, mode_t mode)
|
int sys_creat(const char *path, mode_t mode)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_CREAT64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_CREAT64)
|
||||||
return creat64(path, mode);
|
return creat64(path, mode);
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
* If creat64 isn't defined then ensure we call a potential open64.
|
* If creat64 isn't defined then ensure we call a potential open64.
|
||||||
* JRA.
|
* JRA.
|
||||||
*/
|
*/
|
||||||
return sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
return sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,9 +204,9 @@ int sys_creat(const char *path, mode_t mode)
|
|||||||
int sys_open(const char *path, int oflag, mode_t mode)
|
int sys_open(const char *path, int oflag, mode_t mode)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OPEN64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OPEN64)
|
||||||
return open64(path, oflag, mode);
|
return open64(path, oflag, mode);
|
||||||
#else
|
#else
|
||||||
return open(path, oflag, mode);
|
return open(path, oflag, mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,9 +217,9 @@ int sys_open(const char *path, int oflag, mode_t mode)
|
|||||||
FILE *sys_fopen(const char *path, const char *type)
|
FILE *sys_fopen(const char *path, const char *type)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_FOPEN64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_FOPEN64)
|
||||||
return fopen64(path, type);
|
return fopen64(path, type);
|
||||||
#else
|
#else
|
||||||
return fopen(path, type);
|
return fopen(path, type);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,9 +230,28 @@ FILE *sys_fopen(const char *path, const char *type)
|
|||||||
SMB_STRUCT_DIRENT *sys_readdir(DIR *dirp)
|
SMB_STRUCT_DIRENT *sys_readdir(DIR *dirp)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_READDIR64)
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_READDIR64)
|
||||||
return readdir64(dirp);
|
return readdir64(dirp);
|
||||||
#else
|
#else
|
||||||
return readdir(dirp);
|
return readdir(dirp);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
An mknod() wrapper that will deal with 64 bit filesizes.
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_MKNOD) || defined(HAVE_MKNOD64)
|
||||||
|
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_MKNOD64) && defined(HAVE_DEV64_T)
|
||||||
|
return mknod64(path, mode, dev);
|
||||||
|
#else
|
||||||
|
return mknod(path, mode, dev);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
/* No mknod system call. */
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,24 +262,25 @@ The wait() calls vary between systems
|
|||||||
int sys_waitpid(pid_t pid,int *status,int options)
|
int sys_waitpid(pid_t pid,int *status,int options)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_WAITPID
|
#ifdef HAVE_WAITPID
|
||||||
return waitpid(pid,status,options);
|
return waitpid(pid,status,options);
|
||||||
#else /* HAVE_WAITPID */
|
#else /* HAVE_WAITPID */
|
||||||
return wait4(pid, status, options, NULL);
|
return wait4(pid, status, options, NULL);
|
||||||
#endif /* HAVE_WAITPID */
|
#endif /* HAVE_WAITPID */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
system wrapper for getwd
|
System wrapper for getwd
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
char *sys_getwd(char *s)
|
char *sys_getwd(char *s)
|
||||||
{
|
{
|
||||||
char *wd;
|
char *wd;
|
||||||
#ifdef HAVE_GETCWD
|
#ifdef HAVE_GETCWD
|
||||||
wd = (char *)getcwd(s, sizeof (pstring));
|
wd = (char *)getcwd(s, sizeof (pstring));
|
||||||
#else
|
#else
|
||||||
wd = (char *)getwd(s);
|
wd = (char *)getwd(s);
|
||||||
#endif
|
#endif
|
||||||
return wd;
|
return wd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
@ -290,6 +311,20 @@ int sys_readlink(const char *path, char *buf, size_t bufsiz)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
system wrapper for link
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
int sys_link(const char *oldpath, const char *newpath)
|
||||||
|
{
|
||||||
|
#ifndef HAVE_LINK
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
|
return link(oldpath, newpath);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
chown isn't used much but OS/2 doesn't have it
|
chown isn't used much but OS/2 doesn't have it
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
@ -330,39 +365,40 @@ A wrapper for gethostbyname() that tries avoids looking up hostnames
|
|||||||
in the root domain, which can cause dial-on-demand links to come up for no
|
in the root domain, which can cause dial-on-demand links to come up for no
|
||||||
apparent reason.
|
apparent reason.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct hostent *sys_gethostbyname(const char *name)
|
struct hostent *sys_gethostbyname(const char *name)
|
||||||
{
|
{
|
||||||
#ifdef REDUCE_ROOT_DNS_LOOKUPS
|
#ifdef REDUCE_ROOT_DNS_LOOKUPS
|
||||||
char query[256], hostname[256];
|
char query[256], hostname[256];
|
||||||
char *domain;
|
char *domain;
|
||||||
|
|
||||||
/* Does this name have any dots in it? If so, make no change */
|
/* Does this name have any dots in it? If so, make no change */
|
||||||
|
|
||||||
if (strchr_m(name, '.'))
|
if (strchr_m(name, '.'))
|
||||||
return(gethostbyname(name));
|
return(gethostbyname(name));
|
||||||
|
|
||||||
/* Get my hostname, which should have domain name
|
/* Get my hostname, which should have domain name
|
||||||
attached. If not, just do the gethostname on the
|
attached. If not, just do the gethostname on the
|
||||||
original string.
|
original string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gethostname(hostname, sizeof(hostname) - 1);
|
gethostname(hostname, sizeof(hostname) - 1);
|
||||||
hostname[sizeof(hostname) - 1] = 0;
|
hostname[sizeof(hostname) - 1] = 0;
|
||||||
if ((domain = strchr_m(hostname, '.')) == NULL)
|
if ((domain = strchr_m(hostname, '.')) == NULL)
|
||||||
return(gethostbyname(name));
|
return(gethostbyname(name));
|
||||||
|
|
||||||
/* Attach domain name to query and do modified query.
|
/* Attach domain name to query and do modified query.
|
||||||
If names too large, just do gethostname on the
|
If names too large, just do gethostname on the
|
||||||
original string.
|
original string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if((strlen(name) + strlen(domain)) >= sizeof(query))
|
if((strlen(name) + strlen(domain)) >= sizeof(query))
|
||||||
return(gethostbyname(name));
|
return(gethostbyname(name));
|
||||||
|
|
||||||
slprintf(query, sizeof(query)-1, "%s%s", name, domain);
|
slprintf(query, sizeof(query)-1, "%s%s", name, domain);
|
||||||
return(gethostbyname(query));
|
return(gethostbyname(query));
|
||||||
#else /* REDUCE_ROOT_DNS_LOOKUPS */
|
#else /* REDUCE_ROOT_DNS_LOOKUPS */
|
||||||
return(gethostbyname(name));
|
return(gethostbyname(name));
|
||||||
#endif /* REDUCE_ROOT_DNS_LOOKUPS */
|
#endif /* REDUCE_ROOT_DNS_LOOKUPS */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,33 +409,32 @@ struct hostent *sys_gethostbyname(const char *name)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static BOOL set_process_capability( uint32 cap_flag, BOOL enable )
|
static BOOL set_process_capability( uint32 cap_flag, BOOL enable )
|
||||||
{
|
{
|
||||||
if(cap_flag == KERNEL_OPLOCK_CAPABILITY)
|
if(cap_flag == KERNEL_OPLOCK_CAPABILITY) {
|
||||||
{
|
cap_t cap = cap_get_proc();
|
||||||
cap_t cap = cap_get_proc();
|
|
||||||
|
|
||||||
if (cap == NULL) {
|
if (cap == NULL) {
|
||||||
DEBUG(0,("set_process_capability: cap_get_proc failed. Error was %s\n",
|
DEBUG(0,("set_process_capability: cap_get_proc failed. Error was %s\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(enable)
|
if(enable)
|
||||||
cap->cap_effective |= CAP_NETWORK_MGT;
|
cap->cap_effective |= CAP_NETWORK_MGT;
|
||||||
else
|
else
|
||||||
cap->cap_effective &= ~CAP_NETWORK_MGT;
|
cap->cap_effective &= ~CAP_NETWORK_MGT;
|
||||||
|
|
||||||
if (cap_set_proc(cap) == -1) {
|
if (cap_set_proc(cap) == -1) {
|
||||||
DEBUG(0,("set_process_capability: cap_set_proc failed. Error was %s\n",
|
DEBUG(0,("set_process_capability: cap_set_proc failed. Error was %s\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
cap_free(cap);
|
cap_free(cap);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
cap_free(cap);
|
cap_free(cap);
|
||||||
|
|
||||||
DEBUG(10,("set_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
|
DEBUG(10,("set_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
|
||||||
}
|
}
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
@ -408,39 +443,39 @@ static BOOL set_process_capability( uint32 cap_flag, BOOL enable )
|
|||||||
|
|
||||||
static BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
|
static BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
|
||||||
{
|
{
|
||||||
if(cap_flag == KERNEL_OPLOCK_CAPABILITY)
|
if(cap_flag == KERNEL_OPLOCK_CAPABILITY) {
|
||||||
{
|
cap_t cap = cap_get_proc();
|
||||||
cap_t cap = cap_get_proc();
|
|
||||||
|
|
||||||
if (cap == NULL) {
|
if (cap == NULL) {
|
||||||
DEBUG(0,("set_inherited_process_capability: cap_get_proc failed. Error was %s\n",
|
DEBUG(0,("set_inherited_process_capability: cap_get_proc failed. Error was %s\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(enable)
|
if(enable)
|
||||||
cap->cap_inheritable |= CAP_NETWORK_MGT;
|
cap->cap_inheritable |= CAP_NETWORK_MGT;
|
||||||
else
|
else
|
||||||
cap->cap_inheritable &= ~CAP_NETWORK_MGT;
|
cap->cap_inheritable &= ~CAP_NETWORK_MGT;
|
||||||
|
|
||||||
if (cap_set_proc(cap) == -1) {
|
if (cap_set_proc(cap) == -1) {
|
||||||
DEBUG(0,("set_inherited_process_capability: cap_set_proc failed. Error was %s\n",
|
DEBUG(0,("set_inherited_process_capability: cap_set_proc failed. Error was %s\n",
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
cap_free(cap);
|
cap_free(cap);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
cap_free(cap);
|
cap_free(cap);
|
||||||
|
|
||||||
DEBUG(10,("set_inherited_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
|
DEBUG(10,("set_inherited_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
|
||||||
}
|
}
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
gain the oplock capability from the kernel if possible
|
Gain the oplock capability from the kernel if possible.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void oplock_set_capability(BOOL this_process, BOOL inherit)
|
void oplock_set_capability(BOOL this_process, BOOL inherit)
|
||||||
{
|
{
|
||||||
#if HAVE_KERNEL_OPLOCKS_IRIX
|
#if HAVE_KERNEL_OPLOCKS_IRIX
|
||||||
@ -456,12 +491,12 @@ void oplock_set_capability(BOOL this_process, BOOL inherit)
|
|||||||
long sys_random(void)
|
long sys_random(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_RANDOM)
|
#if defined(HAVE_RANDOM)
|
||||||
return (long)random();
|
return (long)random();
|
||||||
#elif defined(HAVE_RAND)
|
#elif defined(HAVE_RAND)
|
||||||
return (long)rand();
|
return (long)rand();
|
||||||
#else
|
#else
|
||||||
DEBUG(0,("Error - no random function available !\n"));
|
DEBUG(0,("Error - no random function available !\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,12 +507,12 @@ long sys_random(void)
|
|||||||
void sys_srandom(unsigned int seed)
|
void sys_srandom(unsigned int seed)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_SRANDOM)
|
#if defined(HAVE_SRANDOM)
|
||||||
srandom(seed);
|
srandom(seed);
|
||||||
#elif defined(HAVE_SRAND)
|
#elif defined(HAVE_SRAND)
|
||||||
srand(seed);
|
srand(seed);
|
||||||
#else
|
#else
|
||||||
DEBUG(0,("Error - no srandom function available !\n"));
|
DEBUG(0,("Error - no srandom function available !\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,10 +523,10 @@ void sys_srandom(unsigned int seed)
|
|||||||
int groups_max(void)
|
int groups_max(void)
|
||||||
{
|
{
|
||||||
#if defined(SYSCONF_SC_NGROUPS_MAX)
|
#if defined(SYSCONF_SC_NGROUPS_MAX)
|
||||||
int ret = sysconf(_SC_NGROUPS_MAX);
|
int ret = sysconf(_SC_NGROUPS_MAX);
|
||||||
return (ret == -1) ? NGROUPS_MAX : ret;
|
return (ret == -1) ? NGROUPS_MAX : ret;
|
||||||
#else
|
#else
|
||||||
return NGROUPS_MAX;
|
return NGROUPS_MAX;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,47 +537,47 @@ int groups_max(void)
|
|||||||
int sys_getgroups(int setlen, gid_t *gidset)
|
int sys_getgroups(int setlen, gid_t *gidset)
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_BROKEN_GETGROUPS)
|
#if !defined(HAVE_BROKEN_GETGROUPS)
|
||||||
return getgroups(setlen, gidset);
|
return getgroups(setlen, gidset);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
GID_T gid;
|
GID_T gid;
|
||||||
GID_T *group_list;
|
GID_T *group_list;
|
||||||
int i, ngroups;
|
int i, ngroups;
|
||||||
|
|
||||||
if(setlen == 0) {
|
if(setlen == 0) {
|
||||||
return getgroups(setlen, &gid);
|
return getgroups(setlen, &gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Broken case. We need to allocate a
|
* Broken case. We need to allocate a
|
||||||
* GID_T array of size setlen.
|
* GID_T array of size setlen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(setlen < 0) {
|
if(setlen < 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setlen == 0)
|
if (setlen == 0)
|
||||||
setlen = groups_max();
|
setlen = groups_max();
|
||||||
|
|
||||||
if((group_list = (GID_T *)malloc(setlen * sizeof(GID_T))) == NULL) {
|
if((group_list = (GID_T *)malloc(setlen * sizeof(GID_T))) == NULL) {
|
||||||
DEBUG(0,("sys_getgroups: Malloc fail.\n"));
|
DEBUG(0,("sys_getgroups: Malloc fail.\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ngroups = getgroups(setlen, group_list)) < 0) {
|
if((ngroups = getgroups(setlen, group_list)) < 0) {
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
SAFE_FREE(group_list);
|
SAFE_FREE(group_list);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < ngroups; i++)
|
for(i = 0; i < ngroups; i++)
|
||||||
gidset[i] = (gid_t)group_list[i];
|
gidset[i] = (gid_t)group_list[i];
|
||||||
|
|
||||||
SAFE_FREE(group_list);
|
SAFE_FREE(group_list);
|
||||||
return ngroups;
|
return ngroups;
|
||||||
#endif /* HAVE_BROKEN_GETGROUPS */
|
#endif /* HAVE_BROKEN_GETGROUPS */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,42 +591,42 @@ int sys_getgroups(int setlen, gid_t *gidset)
|
|||||||
int sys_setgroups(int setlen, gid_t *gidset)
|
int sys_setgroups(int setlen, gid_t *gidset)
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_BROKEN_GETGROUPS)
|
#if !defined(HAVE_BROKEN_GETGROUPS)
|
||||||
return setgroups(setlen, gidset);
|
return setgroups(setlen, gidset);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
GID_T *group_list;
|
GID_T *group_list;
|
||||||
int i ;
|
int i ;
|
||||||
|
|
||||||
if (setlen == 0)
|
if (setlen == 0)
|
||||||
return 0 ;
|
return 0 ;
|
||||||
|
|
||||||
if (setlen < 0 || setlen > groups_max()) {
|
if (setlen < 0 || setlen > groups_max()) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Broken case. We need to allocate a
|
* Broken case. We need to allocate a
|
||||||
* GID_T array of size setlen.
|
* GID_T array of size setlen.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if((group_list = (GID_T *)malloc(setlen * sizeof(GID_T))) == NULL) {
|
if((group_list = (GID_T *)malloc(setlen * sizeof(GID_T))) == NULL) {
|
||||||
DEBUG(0,("sys_setgroups: Malloc fail.\n"));
|
DEBUG(0,("sys_setgroups: Malloc fail.\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < setlen; i++)
|
for(i = 0; i < setlen; i++)
|
||||||
group_list[i] = (GID_T) gidset[i];
|
group_list[i] = (GID_T) gidset[i];
|
||||||
|
|
||||||
if(setgroups(setlen, group_list) != 0) {
|
if(setgroups(setlen, group_list) != 0) {
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
SAFE_FREE(group_list);
|
SAFE_FREE(group_list);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SAFE_FREE(group_list);
|
SAFE_FREE(group_list);
|
||||||
return 0 ;
|
return 0 ;
|
||||||
#endif /* HAVE_BROKEN_GETGROUPS */
|
#endif /* HAVE_BROKEN_GETGROUPS */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,6 +759,178 @@ struct passwd *sys_getpwuid(uid_t uid)
|
|||||||
return setup_pwret(getpwuid(uid));
|
return setup_pwret(getpwuid(uid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 /* NOT CURRENTLY USED - JRA */
|
||||||
|
/**************************************************************************
|
||||||
|
The following are the UNICODE versions of *all* system interface functions
|
||||||
|
called within Samba. Ok, ok, the exceptions are the gethostbyXX calls,
|
||||||
|
which currently are left as ascii as they are not used other than in name
|
||||||
|
resolution.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide stat. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wsys_stat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return sys_stat(unicode_to_unix(fname,wfname,sizeof(fname)), sbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide lstat. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wsys_lstat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return sys_lstat(unicode_to_unix(fname,wfname,sizeof(fname)), sbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide creat. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wsys_creat(const smb_ucs2_t *wfname, mode_t mode)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return sys_creat(unicode_to_unix(fname,wfname,sizeof(fname)), mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide open. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wsys_open(const smb_ucs2_t *wfname, int oflag, mode_t mode)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return sys_open(unicode_to_unix(fname,wfname,sizeof(fname)), oflag, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide fopen. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
FILE *wsys_fopen(const smb_ucs2_t *wfname, const char *type)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return sys_fopen(unicode_to_unix(fname,wfname,sizeof(fname)), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide opendir. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
DIR *wsys_opendir(const smb_ucs2_t *wfname)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return opendir(unicode_to_unix(fname,wfname,sizeof(fname)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide readdir. Return a structure pointer containing a wide filename.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
SMB_STRUCT_WDIRENT *wsys_readdir(DIR *dirp)
|
||||||
|
{
|
||||||
|
static SMB_STRUCT_WDIRENT retval;
|
||||||
|
SMB_STRUCT_DIRENT *dirval = sys_readdir(dirp);
|
||||||
|
|
||||||
|
if(!dirval)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The only POSIX defined member of this struct is d_name.
|
||||||
|
*/
|
||||||
|
|
||||||
|
unix_to_unicode(retval.d_name,dirval->d_name,sizeof(retval.d_name));
|
||||||
|
|
||||||
|
return &retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide getwd. Call sys_xxx and widen. Assumes s points to a wpstring.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
smb_ucs2_t *wsys_getwd(smb_ucs2_t *s)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
char *p = sys_getwd(fname);
|
||||||
|
|
||||||
|
if(!p)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return unix_to_unicode(s, p, sizeof(wpstring));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide chown. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wsys_chown(const smb_ucs2_t *wfname, uid_t uid, gid_t gid)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return chown(unicode_to_unix(fname,wfname,sizeof(fname)), uid, gid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide chroot. Just narrow and call sys_xxx.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wsys_chroot(const smb_ucs2_t *wfname)
|
||||||
|
{
|
||||||
|
pstring fname;
|
||||||
|
return chroot(unicode_to_unix(fname,wfname,sizeof(fname)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide getpwnam. Return a structure pointer containing wide names.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
SMB_STRUCT_WPASSWD *wsys_getpwnam(const smb_ucs2_t *wname)
|
||||||
|
{
|
||||||
|
static SMB_STRUCT_WPASSWD retval;
|
||||||
|
fstring name;
|
||||||
|
struct passwd *pwret = sys_getpwnam(unicode_to_unix(name,wname,sizeof(name)));
|
||||||
|
|
||||||
|
if(!pwret)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
unix_to_unicode(retval.pw_name, pwret->pw_name, sizeof(retval.pw_name));
|
||||||
|
retval.pw_passwd = pwret->pw_passwd;
|
||||||
|
retval.pw_uid = pwret->pw_uid;
|
||||||
|
retval.pw_gid = pwret->pw_gid;
|
||||||
|
unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos));
|
||||||
|
unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir));
|
||||||
|
unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell));
|
||||||
|
|
||||||
|
return &retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Wide getpwuid. Return a structure pointer containing wide names.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
SMB_STRUCT_WPASSWD *wsys_getpwuid(uid_t uid)
|
||||||
|
{
|
||||||
|
static SMB_STRUCT_WPASSWD retval;
|
||||||
|
struct passwd *pwret = sys_getpwuid(uid);
|
||||||
|
|
||||||
|
if(!pwret)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
unix_to_unicode(retval.pw_name, pwret->pw_name, sizeof(retval.pw_name));
|
||||||
|
retval.pw_passwd = pwret->pw_passwd;
|
||||||
|
retval.pw_uid = pwret->pw_uid;
|
||||||
|
retval.pw_gid = pwret->pw_gid;
|
||||||
|
unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos));
|
||||||
|
unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir));
|
||||||
|
unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell));
|
||||||
|
|
||||||
|
return &retval;
|
||||||
|
}
|
||||||
|
#endif /* NOT CURRENTLY USED - JRA */
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Extract a command into an arg list. Uses a static pstring for storage.
|
Extract a command into an arg list. Uses a static pstring for storage.
|
||||||
Caller frees returned arg list (which contains pointers into the static pstring).
|
Caller frees returned arg list (which contains pointers into the static pstring).
|
||||||
@ -905,6 +1112,7 @@ err_exit:
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Wrapper for pclose. Modified from the glibc sources.
|
Wrapper for pclose. Modified from the glibc sources.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int sys_pclose(int fd)
|
int sys_pclose(int fd)
|
||||||
{
|
{
|
||||||
int wstatus;
|
int wstatus;
|
||||||
|
@ -589,6 +589,36 @@ int vfswrap_readlink(connection_struct *conn, const char *path, char *buf, size_
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vfswrap_link(connection_struct *conn, const char *oldpath, const char *newpath)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
START_PROFILE(syscall_link);
|
||||||
|
|
||||||
|
#ifdef VFS_CHECK_NULL
|
||||||
|
if ((oldpath == NULL) || (newpath == NULL))
|
||||||
|
smb_panic("NULL pointer passed to vfswrap_link()\n");
|
||||||
|
#endif
|
||||||
|
result = sys_link(oldpath, newpath);
|
||||||
|
END_PROFILE(syscall_link);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int vfswrap_mknod(connection_struct *conn, const char *pathname, mode_t mode, SMB_DEV_T dev)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
START_PROFILE(syscall_mknod);
|
||||||
|
|
||||||
|
#ifdef VFS_CHECK_NULL
|
||||||
|
if (pathname == NULL)
|
||||||
|
smb_panic("NULL pointer passed to vfswrap_mknod()\n");
|
||||||
|
#endif
|
||||||
|
result = sys_mknod(pathname, mode, dev);
|
||||||
|
END_PROFILE(syscall_mknod);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
size_t vfswrap_fget_nt_acl(files_struct *fsp, int fd, SEC_DESC **ppdesc)
|
size_t vfswrap_fget_nt_acl(files_struct *fsp, int fd, SEC_DESC **ppdesc)
|
||||||
{
|
{
|
||||||
size_t result;
|
size_t result;
|
||||||
|
@ -72,6 +72,8 @@ static struct vfs_ops default_vfs_ops = {
|
|||||||
vfswrap_lock,
|
vfswrap_lock,
|
||||||
vfswrap_symlink,
|
vfswrap_symlink,
|
||||||
vfswrap_readlink,
|
vfswrap_readlink,
|
||||||
|
vfswrap_link,
|
||||||
|
vfswrap_mknod,
|
||||||
|
|
||||||
vfswrap_fget_nt_acl,
|
vfswrap_fget_nt_acl,
|
||||||
vfswrap_get_nt_acl,
|
vfswrap_get_nt_acl,
|
||||||
|
Reference in New Issue
Block a user