summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-01 20:11:54 +0000
committerJeremy Allison <jra@samba.org>1998-09-01 20:11:54 +0000
commit18556274139cc5a00593471bd745354d98a35303 (patch)
treeb10b897359416e4c67bcaff75a5f21eefe20c996 /source3/smbd
parent6f53e2097d60d4b67f0859065cfa0fe01d63e28f (diff)
downloadsamba-18556274139cc5a00593471bd745354d98a35303.tar.gz
samba-18556274139cc5a00593471bd745354d98a35303.tar.bz2
samba-18556274139cc5a00593471bd745354d98a35303.zip
More abstraction of file system data types, to move to a 64
bit file interface for the NT SMB's. Created a new define, SMB_STRUCT_STAT that currently is defined to be struct stat - this wil change to a user defined type containing 64 bit info when the correct wrappers are written for 64 bit stat(), fstat() and lstat() calls. Also changed all sys_xxxx() calls that were previously just wrappers to the same call prefixed by a dos_to_unix() call into dos_xxxx() calls. This makes it explicit when a pathname translation is being done, and when it is not. Now, all sys_xxx() calls are meant to be wrappers to mask OS differences, and not silently converting filenames on the fly. Jeremy. (This used to be commit 28aa182dbffaa4ffd86047e608400de4b26e80eb)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/dir.c8
-rw-r--r--source3/smbd/dosmode.c20
-rw-r--r--source3/smbd/fileio.c4
-rw-r--r--source3/smbd/filename.c18
-rw-r--r--source3/smbd/files.c2
-rw-r--r--source3/smbd/groupname.c2
-rw-r--r--source3/smbd/ipc.c2
-rw-r--r--source3/smbd/nttrans.c14
-rw-r--r--source3/smbd/open.c30
-rw-r--r--source3/smbd/predict.c2
-rw-r--r--source3/smbd/quotas.c12
-rw-r--r--source3/smbd/reply.c60
-rw-r--r--source3/smbd/trans2.c24
13 files changed, 99 insertions, 99 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 42ed68f713..7c81b826d1 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -408,7 +408,7 @@ void *dptr_fetch_lanman2(int dptr_num)
/****************************************************************************
check a filetype for being valid
****************************************************************************/
-BOOL dir_check_ftype(connection_struct *conn,int mode,struct stat *st,int dirtype)
+BOOL dir_check_ftype(connection_struct *conn,int mode,SMB_STRUCT_STAT *st,int dirtype)
{
if (((mode & ~dirtype) & (aHIDDEN | aSYSTEM | aDIR)) != 0)
return False;
@@ -422,7 +422,7 @@ BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,in
{
char *dname;
BOOL found = False;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
pstring path;
pstring pathreal;
BOOL isrootdir;
@@ -471,7 +471,7 @@ BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,in
pstrcpy(pathreal,path);
pstrcat(path,fname);
pstrcat(pathreal,dname);
- if (sys_stat(pathreal,&sbuf) != 0)
+ if (dos_stat(pathreal,&sbuf) != 0)
{
DEBUG(5,("Couldn't stat 1 [%s]\n",path));
continue;
@@ -519,7 +519,7 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
{
Dir *dirp;
char *n;
- void *p = sys_opendir(name);
+ void *p = dos_opendir(name);
int used=0;
if (!p) return(NULL);
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index da7fdfb973..1336e27281 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -75,7 +75,7 @@ mode_t unix_mode(connection_struct *conn,int dosmode)
/****************************************************************************
change a unix mode to a dos mode
****************************************************************************/
-int dos_mode(connection_struct *conn,char *path,struct stat *sbuf)
+int dos_mode(connection_struct *conn,char *path,SMB_STRUCT_STAT *sbuf)
{
int result = 0;
@@ -139,16 +139,16 @@ int dos_mode(connection_struct *conn,char *path,struct stat *sbuf)
/*******************************************************************
chmod a file - but preserve some bits
********************************************************************/
-int dos_chmod(connection_struct *conn,char *fname,int dosmode,struct stat *st)
+int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *st)
{
- struct stat st1;
+ SMB_STRUCT_STAT st1;
int mask=0;
int tmp;
int unixmode;
if (!st) {
st = &st1;
- if (sys_stat(fname,st)) return(-1);
+ if (dos_stat(fname,st)) return(-1);
}
if (S_ISDIR(st->st_mode)) dosmode |= aDIR;
@@ -186,23 +186,23 @@ int dos_chmod(connection_struct *conn,char *fname,int dosmode,struct stat *st)
unixmode |= tmp;
}
- return(sys_chmod(fname,unixmode));
+ return(dos_chmod(fname,unixmode));
}
/*******************************************************************
-Wrapper around sys_utime that possibly allows DOS semantics rather
+Wrapper around dos_utime that possibly allows DOS semantics rather
than POSIX.
*******************************************************************/
int file_utime(connection_struct *conn, char *fname, struct utimbuf *times)
{
extern struct current_user current_user;
- struct stat sb;
+ SMB_STRUCT_STAT sb;
int ret = -1;
errno = 0;
- if(sys_utime(fname, times) == 0)
+ if(dos_utime(fname, times) == 0)
return 0;
if((errno != EPERM) && (errno != EACCES))
@@ -217,7 +217,7 @@ int file_utime(connection_struct *conn, char *fname, struct utimbuf *times)
(as DOS does).
*/
- if(sys_stat(fname,&sb) != 0)
+ if(dos_stat(fname,&sb) != 0)
return -1;
/* Check if we have write access. */
@@ -230,7 +230,7 @@ int file_utime(connection_struct *conn, char *fname, struct utimbuf *times)
current_user.ngroups,current_user.groups)))) {
/* We are allowed to become root and change the filetime. */
become_root(False);
- ret = sys_utime(fname, times);
+ ret = dos_utime(fname, times);
unbecome_root(False);
}
}
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 971d309ff9..047c84f35f 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -102,12 +102,12 @@ int write_file(files_struct *fsp,char *data,int n)
}
if (!fsp->modified) {
- struct stat st;
+ SMB_STRUCT_STAT st;
fsp->modified = True;
if (fstat(fsp->fd_ptr->fd,&st) == 0) {
int dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st);
if (MAP_ARCHIVE(fsp->conn) && !IS_DOS_ARCHIVE(dosmode)) {
- dos_chmod(fsp->conn,fsp->fsp_name,dosmode | aARCH,&st);
+ file_chmod(fsp->conn,fsp->fsp_name,dosmode | aARCH,&st);
}
}
}
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 9112828092..3bc69210b9 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -231,7 +231,7 @@ static void stat_cache_add( char *full_orig_name, char *orig_translated_path)
Return True if we translated (and did a scuccessful stat on) the entire name.
*****************************************************************************/
-static BOOL stat_cache_lookup( char *name, char *dirpath, char **start, struct stat *pst)
+static BOOL stat_cache_lookup( char *name, char *dirpath, char **start, SMB_STRUCT_STAT *pst)
{
stat_cache_entry *scp;
stat_cache_entry *longest_hit = NULL;
@@ -275,7 +275,7 @@ static BOOL stat_cache_lookup( char *name, char *dirpath, char **start, struct s
* and then promote it to the top.
*/
- if(sys_stat( longest_hit->translated_name, pst) != 0) {
+ if(dos_stat( longest_hit->translated_name, pst) != 0) {
/*
* Discard this entry.
*/
@@ -322,9 +322,9 @@ of a pathname does not exist.
****************************************************************************/
BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
- BOOL *bad_path, struct stat *pst)
+ BOOL *bad_path, SMB_STRUCT_STAT *pst)
{
- struct stat st;
+ SMB_STRUCT_STAT st;
char *start, *end, *orig_start;
pstring dirpath;
pstring orig_path;
@@ -335,7 +335,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
*dirpath = 0;
*bad_path = False;
if(pst)
- memset( (char *)pst, '\0', sizeof(struct stat));
+ memset( (char *)pst, '\0', sizeof(SMB_STRUCT_STAT));
if(saved_last_component)
*saved_last_component = 0;
@@ -406,7 +406,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
* stat the name - if it exists then we are all done!
*/
- if (sys_stat(name,&st) == 0) {
+ if (dos_stat(name,&st) == 0) {
stat_cache_add(orig_path, name);
DEBUG(5,("conversion finished %s -> %s\n",orig_path, name));
if(pst)
@@ -459,7 +459,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
/*
* Check if the name exists up to this point.
*/
- if (sys_stat(name, &st) == 0) {
+ if (dos_stat(name, &st) == 0) {
/*
* It exists. it must either be a directory or this must be
* the last part of the path for it to be OK.
@@ -611,8 +611,8 @@ BOOL check_name(char *name,connection_struct *conn)
#ifdef S_ISLNK
if (!lp_symlinks(SNUM(conn)))
{
- struct stat statbuf;
- if ( (sys_lstat(name,&statbuf) != -1) &&
+ SMB_STRUCT_STAT statbuf;
+ if ( (dos_lstat(name,&statbuf) != -1) &&
(S_ISLNK(statbuf.st_mode)) )
{
DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name));
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index d098677fba..341d9946ec 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -117,7 +117,7 @@ files_struct *file_new(void )
fd support routines - attempt to find an already open file by dev
and inode - increments the ref_count of the returned file_fd_struct *.
****************************************************************************/
-file_fd_struct *fd_get_already_open(struct stat *sbuf)
+file_fd_struct *fd_get_already_open(SMB_STRUCT_STAT *sbuf)
{
file_fd_struct *fd_ptr;
diff --git a/source3/smbd/groupname.c b/source3/smbd/groupname.c
index 3183c5c83c..6616d0d157 100644
--- a/source3/smbd/groupname.c
+++ b/source3/smbd/groupname.c
@@ -68,7 +68,7 @@ void load_groupname_map(void)
static time_t groupmap_file_last_modified = (time_t)0;
static BOOL initialized = False;
char *groupname_map_file = lp_groupname_map();
- struct stat st;
+ SMB_STRUCT_STAT st;
FILE *fp;
char *s;
pstring buf;
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 7c0a51f785..e3b39e6eb2 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -1985,7 +1985,7 @@ static BOOL api_PrintJobInfo(connection_struct *conn,uint16 vuid,char *param,cha
!become_service(fconn,True))
break;
- if (sys_rename(fsp->fsp_name,name) == 0) {
+ if (dos_rename(fsp->fsp_name,name) == 0) {
string_set(&fsp->fsp_name,name);
}
break;
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index fbcc19e77d..9e507aa4d2 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -416,7 +416,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
int unixmode, pnum = -1;
int fmode=0,mtime=0,rmode=0;
off_t file_len = 0;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
int smb_action = 0;
BOOL bad_path = False;
files_struct *fsp=NULL;
@@ -596,7 +596,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
}
if(fsp->is_directory) {
- if(sys_stat(fsp->fsp_name, &sbuf) != 0) {
+ if(dos_stat(fsp->fsp_name, &sbuf) != 0) {
close_directory(fsp);
restore_case_semantics(file_attributes);
return(ERROR(ERRDOS,ERRnoaccess));
@@ -701,7 +701,7 @@ static int call_nt_transact_create(connection_struct *conn,
int unixmode, pnum = -1;
int fmode=0,mtime=0,rmode=0;
off_t file_len = 0;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
int smb_action = 0;
BOOL bad_path = False;
files_struct *fsp = NULL;
@@ -1084,7 +1084,7 @@ void process_pending_change_notify_queue(time_t t)
*/
while((cnbp != NULL) && (cnbp->next_check_time <= t)) {
- struct stat st;
+ SMB_STRUCT_STAT st;
files_struct *fsp = cnbp->fsp;
connection_struct *conn = cnbp->conn;
uint16 vuid = (lp_security() == SEC_SHARE) ? UID_FIELD_INVALID :
@@ -1121,7 +1121,7 @@ void process_pending_change_notify_queue(time_t t)
continue;
}
- if(sys_stat(fsp->fsp_name, &st) < 0) {
+ if(dos_stat(fsp->fsp_name, &st) < 0) {
DEBUG(0,("process_pending_change_notify_queue: Unable to stat directory %s. \
Error was %s.\n", fsp->fsp_name, strerror(errno) ));
/*
@@ -1171,7 +1171,7 @@ static int call_nt_transact_notify_change(connection_struct *conn,
char *setup = *ppsetup;
files_struct *fsp;
change_notify_buf *cnbp;
- struct stat st;
+ SMB_STRUCT_STAT st;
fsp = file_fsp(setup,4);
@@ -1200,7 +1200,7 @@ static int call_nt_transact_notify_change(connection_struct *conn,
* Store the current timestamp on the directory we are monitoring.
*/
- if(sys_stat(fsp->fsp_name, &st) < 0) {
+ if(dos_stat(fsp->fsp_name, &st) < 0) {
DEBUG(0,("call_nt_transact_notify_change: Unable to stat name = %s. \
Error was %s\n", fsp->fsp_name, strerror(errno) ));
free((char *)cnbp);
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 1a16a25c0a..76e88c2e85 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -29,18 +29,18 @@ extern uint16 oplock_port;
/****************************************************************************
-fd support routines - attempt to do a sys_open
+fd support routines - attempt to do a dos_open
****************************************************************************/
static int fd_attempt_open(char *fname, int flags, int mode)
{
- int fd = sys_open(fname,flags,mode);
+ int fd = dos_open(fname,flags,mode);
/* Fix for files ending in '.' */
if((fd == -1) && (errno == ENOENT) &&
(strchr(fname,'.')==NULL))
{
pstrcat(fname,".");
- fd = sys_open(fname,flags,mode);
+ fd = dos_open(fname,flags,mode);
}
#if (defined(ENAMETOOLONG) && defined(HAVE_PATHCONF))
@@ -71,7 +71,7 @@ static int fd_attempt_open(char *fname, int flags, int mode)
char tmp = p[max_len];
p[max_len] = '\0';
- if ((fd = sys_open(fname,flags,mode)) == -1)
+ if ((fd = dos_open(fname,flags,mode)) == -1)
p[max_len] = tmp;
}
}
@@ -127,7 +127,7 @@ Save the already open fd (we cannot close due to POSIX file locking braindamage.
****************************************************************************/
static void fd_attempt_reopen(char *fname, int mode, file_fd_struct *fd_ptr)
{
- int fd = sys_open( fname, O_RDWR, mode);
+ int fd = dos_open( fname, O_RDWR, mode);
if(fd == -1)
return;
@@ -266,11 +266,11 @@ static void check_for_pipe(char *fname)
open a file
****************************************************************************/
static void open_file(files_struct *fsp,connection_struct *conn,
- char *fname1,int flags,int mode, struct stat *sbuf)
+ char *fname1,int flags,int mode, SMB_STRUCT_STAT *sbuf)
{
extern struct current_user current_user;
pstring fname;
- struct stat statbuf;
+ SMB_STRUCT_STAT statbuf;
file_fd_struct *fd_ptr;
int accmode = (flags & (O_RDONLY | O_WRONLY | O_RDWR));
@@ -324,7 +324,7 @@ static void open_file(files_struct *fsp,connection_struct *conn,
* open fd table.
*/
if(sbuf == 0) {
- if(sys_stat(fname, &statbuf) < 0) {
+ if(dos_stat(fname, &statbuf) < 0) {
if(errno != ENOENT) {
DEBUG(3,("Error doing stat on file %s (%s)\n",
fname,strerror(errno)));
@@ -452,7 +452,7 @@ static void open_file(files_struct *fsp,connection_struct *conn,
fd_attempt_close(fd_ptr);
fsp->fd_ptr = 0;
if(fd_ptr->ref_count == 0)
- sys_unlink(fname);
+ dos_unlink(fname);
errno = ENOSPC;
return;
}
@@ -591,7 +591,7 @@ void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int
int flags=0;
int flags2=0;
int deny_mode = (share_mode>>4)&7;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
BOOL file_existed = file_exist(fname,&sbuf);
BOOL share_locked = False;
BOOL fcbopen = False;
@@ -856,14 +856,14 @@ int open_directory(files_struct *fsp,connection_struct *conn,
char *fname, int smb_ofun, int unixmode, int *action)
{
extern struct current_user current_user;
- struct stat st;
+ SMB_STRUCT_STAT st;
if (smb_ofun & 0x10) {
/*
* Create the directory.
*/
- if(sys_mkdir(fname, unixmode) < 0) {
+ if(dos_mkdir(fname, unixmode) < 0) {
DEBUG(0,("open_directory: unable to create %s. Error was %s\n",
fname, strerror(errno) ));
return -1;
@@ -875,7 +875,7 @@ int open_directory(files_struct *fsp,connection_struct *conn,
* Check that it *was* a directory.
*/
- if(sys_stat(fname, &st) < 0) {
+ if(dos_stat(fname, &st) < 0) {
DEBUG(0,("open_directory: unable to stat name = %s. Error was %s\n",
fname, strerror(errno) ));
return -1;
@@ -991,7 +991,7 @@ BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op)
int ret = False;
share_mode_entry *old_shares = 0;
int num_share_modes;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
int token;
int pid = getpid();
SMB_DEV_T dev;
@@ -1000,7 +1000,7 @@ BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op)
if(!lp_share_modes(SNUM(conn)))
return True;
- if (sys_stat(fname,&sbuf) == -1) return(True);
+ if (dos_stat(fname,&sbuf) == -1) return(True);
dev = sbuf.st_dev;
inode = sbuf.st_ino;
diff --git a/source3/smbd/predict.c b/source3/smbd/predict.c
index 6f6a4ca655..6e423c8eff 100644
--- a/source3/smbd/predict.c
+++ b/source3/smbd/predict.c
@@ -66,7 +66,7 @@ int read_predict(int fd,int offset,char *buf,char **ptr,int num)
if (ret == num) {
predict_skip = True;
} else {
- struct stat rp_stat;
+ SMB_STRUCT_STAT rp_stat;
/* Find the end of the file - ensure we don't
read predict beyond it. */
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index dbdbd49921..7f1cd5ce79 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -51,7 +51,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
uid_t euser_id;
int r;
struct dqblk D;
- struct stat S;
+ SMB_STRUCT_STAT S;
FILE *fp;
struct mntent *mnt;
int devno;
@@ -135,7 +135,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
{
struct mntent *mnt;
FILE *fd;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
dev_t devno ;
static dev_t devno_cached = 0 ;
static pstring name;
@@ -255,7 +255,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
static pstring name;
#endif
FILE *fd;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
dev_t devno ;
static dev_t devno_cached = 0 ;
int found ;
@@ -377,7 +377,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
uid_t user_id, euser_id;
int r, save_errno;
struct dqblk D;
- struct stat S;
+ SMB_STRUCT_STAT S;
euser_id = geteuid();
user_id = getuid();
@@ -433,7 +433,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
int r;
struct dqblk D;
struct fs_disk_quota F;
- struct stat S;
+ SMB_STRUCT_STAT S;
FILE *fp;
struct mntent *mnt;
int devno;
@@ -573,7 +573,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
struct dqblk D;
#if !defined(__FreeBSD__) && !defined(AIX) && !defined(__OpenBSD__)
char dev_disk[256];
- struct stat S;
+ SMB_STRUCT_STAT S;
/* find the block device file */
if ((stat(path, &S)<0) ||
(devnm(S_IFBLK, S.st_dev, dev_disk, 256, 0)<0)) return (False);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index e30c31776c..a3164bd67d 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -751,7 +751,7 @@ int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
pstring name;
BOOL ok = False;
BOOL bad_path = False;
- struct stat st;
+ SMB_STRUCT_STAT st;
pstrcpy(name,smb_buf(inbuf) + 1);
unix_convert(name,conn,0,&bad_path,&st);
@@ -806,7 +806,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
{
pstring fname;
int outsize = 0;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
BOOL ok = False;
int mode=0;
uint32 size=0;
@@ -829,7 +829,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
else
if (check_name(fname,conn))
{
- if (VALID_STAT(sbuf) || sys_stat(fname,&sbuf) == 0)
+ if (VALID_STAT(sbuf) || dos_stat(fname,&sbuf) == 0)
{
mode = dos_mode(conn,fname,&sbuf);
size = sbuf.st_size;
@@ -886,7 +886,7 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
BOOL ok=False;
int mode;
time_t mtime;
- struct stat st;
+ SMB_STRUCT_STAT st;
BOOL bad_path = False;
pstrcpy(fname,smb_buf(inbuf) + 1);
@@ -898,7 +898,7 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if (VALID_STAT_OF_DIR(st) || directory_exist(fname,NULL))
mode |= aDIR;
if (check_name(fname,conn))
- ok = (dos_chmod(conn,fname,mode,NULL) == 0);
+ ok = (file_chmod(conn,fname,mode,NULL) == 0);
if (ok)
ok = set_filetime(conn,fname,mtime);
@@ -1248,7 +1248,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
time_t mtime=0;
int unixmode;
int rmode=0;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
BOOL bad_path = False;
files_struct *fsp;
int oplock_request = CORE_OPLOCK_REQUEST(inbuf);
@@ -1345,7 +1345,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
int smb_ofun = SVAL(inbuf,smb_vwv8);
int unixmode;
int size=0,fmode=0,mtime=0,rmode=0;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
int smb_action = 0;
BOOL bad_path = False;
files_struct *fsp;
@@ -1638,12 +1638,12 @@ check if a user is allowed to delete a file
********************************************************************/
static BOOL can_delete(char *fname,connection_struct *conn, int dirtype)
{
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
int fmode;
if (!CAN_WRITE(conn)) return(False);
- if (sys_lstat(fname,&sbuf) != 0) return(False);
+ if (dos_lstat(fname,&sbuf) != 0) return(False);
fmode = dos_mode(conn,fname,&sbuf);
if (fmode & aDIR) return(False);
if (!lp_delete_readonly(SNUM(conn))) {
@@ -1700,7 +1700,7 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if (!has_wild) {
pstrcat(directory,"/");
pstrcat(directory,mask);
- if (can_delete(directory,conn,dirtype) && !sys_unlink(directory)) count++;
+ if (can_delete(directory,conn,dirtype) && !dos_unlink(directory)) count++;
if (!count) exists = file_exist(directory,NULL);
} else {
void *dirptr = NULL;
@@ -1731,7 +1731,7 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
error = ERRnoaccess;
slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname);
if (!can_delete(fname,conn,dirtype)) continue;
- if (!sys_unlink(fname)) count++;
+ if (!dos_unlink(fname)) count++;
DEBUG(3,("reply_unlink : doing unlink on %s\n",fname));
}
CloseDir(dirptr);
@@ -1813,7 +1813,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
int sizeneeded = startpos + maxcount;
if (size < sizeneeded) {
- struct stat st;
+ SMB_STRUCT_STAT st;
if (fstat(fsp->fd_ptr->fd,&st) == 0)
size = st.st_size;
if (!fsp->can_write)
@@ -2787,7 +2787,7 @@ int reply_mkdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
unix_convert(directory,conn,0,&bad_path,NULL);
if (check_name(directory, conn))
- ret = sys_mkdir(directory,unix_mode(conn,aDIR));
+ ret = dos_mkdir(directory,unix_mode(conn,aDIR));
if (ret < 0)
{
@@ -2822,7 +2822,7 @@ static BOOL recursive_rmdir(char *directory)
while((dname = ReadDirName(dirptr)))
{
pstring fullname;
- struct stat st;
+ SMB_STRUCT_STAT st;
if((strcmp(dname, ".") == 0) || (strcmp(dname, "..")==0))
continue;
@@ -2838,7 +2838,7 @@ static BOOL recursive_rmdir(char *directory)
pstrcat(fullname, "/");
pstrcat(fullname, dname);
- if(sys_lstat(fullname, &st) != 0)
+ if(dos_lstat(fullname, &st) != 0)
{
ret = True;
break;
@@ -2851,13 +2851,13 @@ static BOOL recursive_rmdir(char *directory)
ret = True;
break;
}
- if(sys_rmdir(fullname) != 0)
+ if(dos_rmdir(fullname) != 0)
{
ret = True;
break;
}
}
- else if(sys_unlink(fullname) != 0)
+ else if(dos_unlink(fullname) != 0)
{
ret = True;
break;
@@ -2884,7 +2884,7 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
{
dptr_closepath(directory,SVAL(inbuf,smb_pid));
- ok = (sys_rmdir(directory) == 0);
+ ok = (dos_rmdir(directory) == 0);
if(!ok && (errno == ENOTEMPTY) && lp_veto_files(SNUM(conn)))
{
/* Check to see if the only thing in this directory are
@@ -2914,7 +2914,7 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
while ((dname = ReadDirName(dirptr)))
{
pstring fullname;
- struct stat st;
+ SMB_STRUCT_STAT st;
if((strcmp(dname, ".") == 0) || (strcmp(dname, "..")==0))
continue;
@@ -2929,7 +2929,7 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
pstrcat(fullname, "/");
pstrcat(fullname, dname);
- if(sys_lstat(fullname, &st) != 0)
+ if(dos_lstat(fullname, &st) != 0)
break;
if(st.st_mode & S_IFDIR)
{
@@ -2938,15 +2938,15 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
if(recursive_rmdir(fullname) != 0)
break;
}
- if(sys_rmdir(fullname) != 0)
+ if(dos_rmdir(fullname) != 0)
break;
}
- else if(sys_unlink(fullname) != 0)
+ else if(dos_unlink(fullname) != 0)
break;
}
CloseDir(dirptr);
/* Retry the rmdir */
- ok = (sys_rmdir(directory) == 0);
+ ok = (dos_rmdir(directory) == 0);
}
else
CloseDir(dirptr);
@@ -3047,11 +3047,11 @@ check if a user is allowed to rename a file
********************************************************************/
static BOOL can_rename(char *fname,connection_struct *conn)
{
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
if (!CAN_WRITE(conn)) return(False);
- if (sys_lstat(fname,&sbuf) != 0) return(False);
+ if (dos_lstat(fname,&sbuf) != 0) return(False);
if (!check_file_sharing(conn,fname,True)) return(False);
return(True);
@@ -3171,13 +3171,13 @@ int rename_internals(connection_struct *conn,
*/
if(resolve_wildcards(directory,newname) &&
can_rename(directory,conn) &&
- !sys_rename(directory,newname))
+ !dos_rename(directory,newname))
count++;
} else {
if (resolve_wildcards(directory,newname) &&
can_rename(directory,conn) &&
!file_exist(newname,NULL) &&
- !sys_rename(directory,newname))
+ !dos_rename(directory,newname))
count++;
}
@@ -3232,7 +3232,7 @@ int rename_internals(connection_struct *conn,
continue;
}
- if (!sys_rename(fname,destname))
+ if (!dos_rename(fname,destname))
count++;
DEBUG(3,("rename_internals: doing rename on %s -> %s\n",fname,destname));
}
@@ -3284,7 +3284,7 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
int count,BOOL target_is_directory)
{
int Access,action;
- struct stat st;
+ SMB_STRUCT_STAT st;
int ret=0;
files_struct *fsp1,*fsp2;
pstring dest;
@@ -3940,7 +3940,7 @@ int reply_setattrE(connection_struct *conn, char *inbuf,char *outbuf, int dum_si
****************************************************************************/
int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
int outsize = 0;
int mode;
files_struct *fsp = file_fsp(inbuf,smb_vwv0);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 3a851cfa8b..8871d568dd 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -202,7 +202,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf,
int unixmode;
int size=0,fmode=0,mtime=0,rmode;
SMB_INO_T inode = 0;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
int smb_action = 0;
BOOL bad_path = False;
files_struct *fsp;
@@ -302,7 +302,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
{
char *dname;
BOOL found = False;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
pstring mask;
pstring pathreal;
pstring fname;
@@ -376,7 +376,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
if(needslash)
pstrcat(pathreal,"/");
pstrcat(pathreal,dname);
- if (sys_stat(pathreal,&sbuf) != 0)
+ if (dos_stat(pathreal,&sbuf) != 0)
{
DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",pathreal,strerror(errno)));
continue;
@@ -1062,13 +1062,13 @@ static int call_trans2qfsinfo(connection_struct *conn,
char *params = *pparams;
uint16 info_level = SVAL(params,0);
int data_len;
- struct stat st;
+ SMB_STRUCT_STAT st;
char *vname = volume_label(SNUM(conn));
int snum = SNUM(conn);
DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level));
- if(sys_stat(".",&st)!=0) {
+ if(dos_stat(".",&st)!=0) {
DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n", strerror(errno)));
return (ERROR(ERRSRV,ERRinvdevice));
}
@@ -1203,7 +1203,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
int mode=0;
int size=0;
unsigned int data_size;
- struct stat sbuf;
+ SMB_STRUCT_STAT sbuf;
pstring fname1;
char *fname;
char *p;
@@ -1229,7 +1229,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
fname = &fname1[0];
pstrcpy(fname,&params[6]);
unix_convert(fname,conn,0,&bad_path,&sbuf);
- if (!check_name(fname,conn) || (!VALID_STAT(sbuf) && sys_stat(fname,&sbuf))) {
+ if (!check_name(fname,conn) || (!VALID_STAT(sbuf) && dos_stat(fname,&sbuf))) {
DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno)));
if((errno == ENOENT) && bad_path)
{
@@ -1434,7 +1434,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
int mode=0;
int size=0;
struct utimbuf tvs;
- struct stat st;
+ SMB_STRUCT_STAT st;
pstring fname1;
char *fname;
int fd = -1;
@@ -1473,7 +1473,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
return(UNIXERROR(ERRDOS,ERRbadpath));
}
- if(!VALID_STAT(st) && sys_stat(fname,&st)!=0) {
+ if(!VALID_STAT(st) && dos_stat(fname,&st)!=0) {
DEBUG(3,("stat of %s failed (%s)\n", fname, strerror(errno)));
if((errno == ENOENT) && bad_path)
{
@@ -1601,7 +1601,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
}
/* check the mode isn't different, before changing it */
- if (mode != dos_mode(conn, fname, &st) && dos_chmod(conn, fname, mode, NULL))
+ if (mode != dos_mode(conn, fname, &st) && file_chmod(conn, fname, mode, NULL))
{
DEBUG(2,("chmod of %s failed (%s)\n", fname, strerror(errno)));
return(ERROR(ERRDOS,ERRnoaccess));
@@ -1611,7 +1611,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
{
if (fd == -1)
{
- fd = sys_open(fname,O_RDWR,0);
+ fd = dos_open(fname,O_RDWR,0);
if (fd == -1)
{
return(ERROR(ERRDOS,ERRbadpath));
@@ -1653,7 +1653,7 @@ static int call_trans2mkdir(connection_struct *conn,
unix_convert(directory,conn,0,&bad_path,NULL);
if (check_name(directory,conn))
- ret = sys_mkdir(directory,unix_mode(conn,aDIR));
+ ret = dos_mkdir(directory,unix_mode(conn,aDIR));
if(ret < 0)
{