diff options
author | Jeremy Allison <jra@samba.org> | 1998-09-01 20:11:54 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-09-01 20:11:54 +0000 |
commit | 18556274139cc5a00593471bd745354d98a35303 (patch) | |
tree | b10b897359416e4c67bcaff75a5f21eefe20c996 | |
parent | 6f53e2097d60d4b67f0859065cfa0fe01d63e28f (diff) | |
download | samba-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)
32 files changed, 196 insertions, 185 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 855d4cc2de..0b98d1f670 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1528,7 +1528,7 @@ static void do_mget(file_info *finfo) strlower(finfo->name); if (!directory_exist(finfo->name,NULL) && - sys_mkdir(finfo->name,0777) != 0) + dos_mkdir(finfo->name,0777) != 0) { DEBUG(0,("failed to create directory %s\n",CNV_LANG(finfo->name))); pstrcpy(cur_dir,saved_curdir); @@ -1536,7 +1536,7 @@ static void do_mget(file_info *finfo) return; } - if (sys_chdir(finfo->name) != 0) + if (dos_chdir(finfo->name) != 0) { DEBUG(0,("failed to chdir to directory %s\n",CNV_LANG(finfo->name))); pstrcpy(cur_dir,saved_curdir); @@ -1998,7 +1998,7 @@ static void cmd_put(char *dum_in, char *dum_out) dos_clean_name(rname); { - struct stat st; + SMB_STRUCT_STAT st; /* allow '-' to represent stdin jdblair, 24.jun.98 */ if (!file_exist(lname,&st) && @@ -2060,7 +2060,7 @@ static void cmd_mput(char *dum_in, char *dum_out) while (next_token(NULL,p,NULL,sizeof(buf))) { - struct stat st; + SMB_STRUCT_STAT st; pstring cmd; pstring tmpname; FILE *f; @@ -2816,10 +2816,10 @@ static void cmd_newer(char *dum_in, char *dum_out) { fstring buf; BOOL ok; - struct stat sbuf; + SMB_STRUCT_STAT sbuf; ok = next_token(NULL,buf,NULL,sizeof(buf)); - if (ok && (sys_stat(buf,&sbuf) == 0)) + if (ok && (dos_stat(buf,&sbuf) == 0)) { newer_than = sbuf.st_mtime; DEBUG(1,("Getting files newer than %s", @@ -2923,7 +2923,7 @@ static void cmd_lcd(char *dum_in, char *dum_out) pstring d; if (next_token(NULL,buf,NULL,sizeof(buf))) - sys_chdir(buf); + dos_chdir(buf); DEBUG(2,("the local directory is now %s\n",GetWd(d))); } diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 47903d20be..6642154683 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -440,7 +440,7 @@ Write two zero blocks at end of file ****************************************************************************/ static void dotareof(int f) { - struct stat stbuf; + SMB_STRUCT_STAT stbuf; /* Two zero blocks at end of file, write out full buffer */ (void) dozerobuf(f, TBLOCK); @@ -2462,10 +2462,10 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind) DEBUG(0,("Option N must be followed by valid file name\n")); return 0; } else { - struct stat stbuf; + SMB_STRUCT_STAT stbuf; extern time_t newer_than; - if (sys_stat(argv[Optind], &stbuf) == 0) { + if (dos_stat(argv[Optind], &stbuf) == 0) { newer_than = stbuf.st_mtime; DEBUG(1,("Getting files newer than %s", asctime(LocalTime(&newer_than)))); diff --git a/source3/client/smbmnt.c b/source3/client/smbmnt.c index 9f8eea1cac..9fb0dba99d 100644 --- a/source3/client/smbmnt.c +++ b/source3/client/smbmnt.c @@ -138,7 +138,7 @@ fullpath(const char *p) /* Check whether user is allowed to mount on the specified mount point */ static int -mount_ok(struct stat *st) +mount_ok(SMB_STRUCT_STAT *st) { if (!S_ISDIR(st->st_mode)) { @@ -165,7 +165,7 @@ main(int argc, char *argv[]) int fd, um; unsigned int flags; struct smb_mount_data data; - struct stat st; + SMB_STRUCT_STAT st; struct mntent ment; progname = argv[0]; diff --git a/source3/include/includes.h b/source3/include/includes.h index 8b7620e4f9..15112cb163 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -329,6 +329,17 @@ #define SMB_INO_T uint32 #endif +/* + * Type for stat structure. This will + * soon change to a user defined type + * once we wrap stat(), fstat() and lstat() + * for 64 bit file sizes. JRA. + */ + +#ifndef SMB_STRUCT_STAT +#define SMB_STRUCT_STAT struct stat +#endif + #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif diff --git a/source3/include/proto.h b/source3/include/proto.h index 3bc2a132a0..01ae342f98 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -165,18 +165,18 @@ int smbrun(char *cmd,char *outfile,BOOL shared); int sys_select(int maxfd, fd_set *fds,struct timeval *tval); int sys_select(int maxfd, fd_set *fds,struct timeval *tval); -int sys_unlink(char *fname); -int sys_open(char *fname,int flags,int mode); -DIR *sys_opendir(char *dname); -int sys_stat(char *fname,struct stat *sbuf); +int dos_unlink(char *fname); +int dos_open(char *fname,int flags,int mode); +DIR *dos_opendir(char *dname); +int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf); int sys_waitpid(pid_t pid,int *status,int options); -int sys_lstat(char *fname,struct stat *sbuf); -int sys_mkdir(char *dname,int mode); -int sys_rmdir(char *dname); -int sys_chdir(char *dname); -int sys_utime(char *fname,struct utimbuf *times); -int sys_rename(char *from, char *to); -int sys_chmod(char *fname,int mode); +int dos_lstat(char *fname,struct stat *sbuf); +int dos_mkdir(char *dname,int mode); +int dos_rmdir(char *dname); +int dos_chdir(char *dname); +int dos_utime(char *fname,struct utimbuf *times); +int dos_rename(char *from, char *to); +int dos_chmod(char *fname,int mode); char *sys_getwd(char *s); int sys_chown(char *fname,int uid,int gid); int sys_chroot(char *dname); @@ -199,7 +199,7 @@ time_t make_unix_date2(void *date_ptr); time_t make_unix_date3(void *date_ptr); char *http_timestring(time_t t); char *timestring(void ); -time_t get_create_time(struct stat *st,BOOL fake_dirs); +time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs); /*The following definitions come from lib/ufc.c */ @@ -227,9 +227,9 @@ char *StrCpy(char *dest,char *src); char *StrnCpy(char *dest,char *src,int n); void putip(void *dest,void *src); int name_mangle( char *In, char *Out, char name_type ); -BOOL file_exist(char *fname,struct stat *sbuf); +BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf); time_t file_modtime(char *fname); -BOOL directory_exist(char *dname,struct stat *st); +BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st); uint32 file_size(char *file_name); char *attrib_string(int mode); int StrCaseCmp(char *s, char *t); @@ -1977,7 +1977,7 @@ BOOL dptr_fill(char *buf1,unsigned int key); BOOL dptr_zero(char *buf); void *dptr_fetch(char *buf,int *num); void *dptr_fetch_lanman2(int dptr_num); -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); BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend); void *OpenDir(connection_struct *conn, char *name, BOOL use_veto); void CloseDir(void *p); @@ -1991,8 +1991,8 @@ void DirCacheFlush(int snum); /*The following definitions come from smbd/dosmode.c */ mode_t unix_mode(connection_struct *conn,int dosmode); -int dos_mode(connection_struct *conn,char *path,struct stat *sbuf); -int dos_chmod(connection_struct *conn,char *fname,int dosmode,struct stat *st); +int dos_mode(connection_struct *conn,char *path,SMB_STRUCT_STAT *sbuf); +int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *st); int file_utime(connection_struct *conn, char *fname, struct utimbuf *times); BOOL set_filetime(connection_struct *conn, char *fname, time_t mtime); @@ -2015,14 +2015,14 @@ BOOL fname_equal(char *name1, char *name2); BOOL mangled_equal(char *name1, char *name2); void print_stat_cache_statistics(void); 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); BOOL check_name(char *name,connection_struct *conn); BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL docache); /*The following definitions come from smbd/files.c */ files_struct *file_new(void ); -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_get_new(void); void file_close_conn(connection_struct *conn); void file_init(void); diff --git a/source3/lib/charset.c b/source3/lib/charset.c index abfa6fe787..55b76f2667 100644 --- a/source3/lib/charset.c +++ b/source3/lib/charset.c @@ -191,7 +191,7 @@ static codepage_p load_client_codepage( int client_codepage ) FILE *fp = NULL; unsigned int size; codepage_p cp_p = NULL; - struct stat st; + SMB_STRUCT_STAT st; DEBUG(5, ("load_client_codepage: loading codepage %d.\n", client_codepage)); diff --git a/source3/lib/debug.c b/source3/lib/debug.c index c20229fcde..f5a0eadb96 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -249,7 +249,7 @@ void force_check_log_size( void ) static void check_log_size( void ) { int maxlog; - struct stat st; + SMB_STRUCT_STAT st; if( debug_count++ < 100 || getuid() != 0 ) return; diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c index 5e87275ce8..c36cdd4b8c 100644 --- a/source3/lib/genrand.c +++ b/source3/lib/genrand.c @@ -56,7 +56,7 @@ static void do_filehash(char *fname, unsigned char *hash) static void do_dirrand(char *name, unsigned char *buf, int buf_len) { - void *dp = sys_opendir(name); + void *dp = dos_opendir(name); pstring fullname; int len_left; int fullname_len; @@ -81,12 +81,12 @@ static void do_dirrand(char *name, unsigned char *buf, int buf_len) char *p; while ((p = readdirname(dp))) { - struct stat st; + SMB_STRUCT_STAT st; if(strlen(p) <= len_left) pstrcpy(pos, p); - if(sys_stat(fullname,&st) == 0) { + if(dos_stat(fullname,&st) == 0) { SIVAL(buf, ((counter * 4)%(buf_len-4)), IVAL(buf,((counter * 4)%(buf_len-4))) ^ st.st_atime); counter++; diff --git a/source3/lib/netatalk.c b/source3/lib/netatalk.c index a11676b1e6..421d74f3c5 100644 --- a/source3/lib/netatalk.c +++ b/source3/lib/netatalk.c @@ -82,7 +82,7 @@ int ntalk_mkresdir(const char *fname) char fdir[255]; int i; int lastslash; - struct stat dirstats; + SMB_STRUCT_STAT dirstats; char appledouble[] = APPLEDOUBLE; /* find directory containing fname */ diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index fcb14378a0..56fcd68ec1 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -33,7 +33,7 @@ the child as it may leave the caller in a privilaged state. static BOOL setup_stdout_file(char *outfile,BOOL shared) { int fd; - struct stat st; + SMB_STRUCT_STAT st; mode_t mode = S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH; int flags = O_RDWR|O_CREAT|O_TRUNC|O_EXCL; diff --git a/source3/lib/system.c b/source3/lib/system.c index d569b80a74..d3612f8b25 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -141,36 +141,36 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval) /******************************************************************* -just a unlink wrapper +just a unlink wrapper that calls dos_to_unix. ********************************************************************/ -int sys_unlink(char *fname) +int dos_unlink(char *fname) { return(unlink(dos_to_unix(fname,False))); } /******************************************************************* -a simple open() wrapper +a simple open() wrapper that calls dos_to_unix. ********************************************************************/ -int sys_open(char *fname,int flags,int mode) +int dos_open(char *fname,int flags,int mode) { return(open(dos_to_unix(fname,False),flags,mode)); } /******************************************************************* -a simple opendir() wrapper +a simple opendir() wrapper that calls dos_to_unix ********************************************************************/ -DIR *sys_opendir(char *dname) +DIR *dos_opendir(char *dname) { return(opendir(dos_to_unix(dname,False))); } /******************************************************************* -and a stat() wrapper +and a stat() wrapper that calls dos_to_unix. ********************************************************************/ -int sys_stat(char *fname,struct stat *sbuf) +int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf) { return(stat(dos_to_unix(fname,False),sbuf)); } @@ -188,45 +188,45 @@ int sys_waitpid(pid_t pid,int *status,int options) } /******************************************************************* -don't forget lstat() +don't forget lstat() that calls dos_to_unix. ********************************************************************/ -int sys_lstat(char *fname,struct stat *sbuf) +int dos_lstat(char *fname,struct stat *sbuf) { return(lstat(dos_to_unix(fname,False),sbuf)); } /******************************************************************* -mkdir() gets a wrapper +mkdir() gets a wrapper that calls dos_to_unix. ********************************************************************/ -int sys_mkdir(char *dname,int mode) +int dos_mkdir(char *dname,int mode) { return(mkdir(dos_to_unix(dname,False),mode)); } /******************************************************************* -do does rmdir() +do does rmdir() - call dos_to_unix ********************************************************************/ -int sys_rmdir(char *dname) +int dos_rmdir(char *dname) { return(rmdir(dos_to_unix(dname,False))); } /******************************************************************* -I almost forgot chdir() +I almost forgot chdir() - call dos_to_unix. ********************************************************************/ -int sys_chdir(char *dname) +int dos_chdir(char *dname) { return(chdir(dos_to_unix(dname,False))); } /******************************************************************* -now for utime() +now for utime() - call dos_to_unix. ********************************************************************/ -int sys_utime(char *fname,struct utimbuf *times) +int dos_utime(char *fname,struct utimbuf *times) { /* if the modtime is 0 or -1 then ignore the call and return success */ @@ -344,9 +344,9 @@ static int copy_reg(char *source, const char *dest) } /******************************************************************* -for rename() +for rename() - call dos_to_unix. ********************************************************************/ -int sys_rename(char *from, char *to) +int dos_rename(char *from, char *to) { int rcode; pstring zfrom, zto; @@ -364,9 +364,9 @@ int sys_rename(char *from, char *to) } /******************************************************************* -for chmod +for chmod - call dos_to_unix. ********************************************************************/ -int sys_chmod(char *fname,int mode) +int dos_chmod(char *fname,int mode) { return(chmod(dos_to_unix(fname,False),mode)); } diff --git a/source3/lib/time.c b/source3/lib/time.c index 6eacf2a5ed..7b7ca51204 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -513,7 +513,7 @@ char *timestring(void ) structure. ****************************************************************************/ -time_t get_create_time(struct stat *st,BOOL fake_dirs) +time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs) { time_t ret, ret1; diff --git a/source3/lib/util.c b/source3/lib/util.c index 619d474d6d..4187787489 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -520,12 +520,12 @@ int name_mangle( char *In, char *Out, char name_type ) /******************************************************************* check if a file exists ********************************************************************/ -BOOL file_exist(char *fname,struct stat *sbuf) +BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf) { - struct stat st; + SMB_STRUCT_STAT st; if (!sbuf) sbuf = &st; - if (sys_stat(fname,sbuf) != 0) + if (dos_stat(fname,sbuf) != 0) return(False); return(S_ISREG(sbuf->st_mode)); @@ -536,9 +536,9 @@ check a files mod time ********************************************************************/ time_t file_modtime(char *fname) { - struct stat st; + SMB_STRUCT_STAT st; - if (sys_stat(fname,&st) != 0) + if (dos_stat(fname,&st) != 0) return(0); return(st.st_mtime); @@ -547,14 +547,14 @@ time_t file_modtime(char *fname) /******************************************************************* check if a directory exists ********************************************************************/ -BOOL directory_exist(char *dname,struct stat *st) +BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st) { - struct stat st2; + SMB_STRUCT_STAT st2; BOOL ret; if (!st) st = &st2; - if (sys_stat(dname,st) != 0) + if (dos_stat(dname,st) != 0) return(False); ret = S_ISDIR(st->st_mode); @@ -568,9 +568,9 @@ returns the size in bytes of the named file ********************************************************************/ uint32 file_size(char *file_name) { - struct stat buf; + SMB_STRUCT_STAT buf; buf.st_size = 0; - sys_stat(file_name,&buf); + dos_stat(file_name,&buf); return(buf.st_size); } @@ -1205,7 +1205,7 @@ int ChDir(char *path) if (*path == '/' && strcsequal(LastDir,path)) return(0); DEBUG(3,("chdir to %s\n",path)); - res = sys_chdir(path); + res = dos_chdir(path); if (!res) pstrcpy(LastDir,path); return(res); @@ -1233,7 +1233,7 @@ char *GetWd(char *str) { pstring s; static BOOL getwd_cache_init = False; - struct stat st, st2; + SMB_STRUCT_STAT st, st2; int i; *s = 0; @@ -3270,7 +3270,7 @@ int set_filelen(int fd, long len) #ifdef HAVE_FTRUNCATE_EXTEND return ftruncate(fd, len); #else - struct stat st; + SMB_STRUCT_STAT st; char c = 0; long currpos = lseek(fd, 0L, SEEK_CUR); diff --git a/source3/locking/locking_slow.c b/source3/locking/locking_slow.c index 0a766c9ab9..4c2ba43cd8 100644 --- a/source3/locking/locking_slow.c +++ b/source3/locking/locking_slow.c @@ -159,7 +159,7 @@ static BOOL slow_lock_share_entry(connection_struct *conn, do { - struct stat dummy_stat; + SMB_STRUCT_STAT dummy_stat; fd = (int)open(fname,read_only?O_RDONLY:(O_RDWR|O_CREAT), SHARE_FILE_MODE); @@ -221,7 +221,7 @@ static BOOL slow_unlock_share_entry(connection_struct *conn, { int fd = token; int ret = True; - struct stat sb; + SMB_STRUCT_STAT sb; pstring fname; if (read_only) return True; @@ -267,7 +267,7 @@ Read a share file into a buffer. ********************************************************************/ static int read_share_file(connection_struct *conn, int fd, char *fname, char **out, BOOL *p_new_file) { - struct stat sb; + SMB_STRUCT_STAT sb; char *buf; int size; @@ -680,7 +680,7 @@ static BOOL slow_set_share_mode(int token,files_struct *fsp, uint16 port, uint16 pstring fname; int fd = (int)token; int pid = (int)getpid(); - struct stat sb; + SMB_STRUCT_STAT sb; char *buf; int num_entries; int header_size; diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 0d806fccf7..e58d0d5b00 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -901,7 +901,7 @@ BOOL pdb_generate_machine_sid(void) char *p; pstring sid_file; fstring sid_string; - struct stat st; + SMB_STRUCT_STAT st; uchar raw_sid_data[12]; pstrcpy(sid_file, lp_smb_passwd_file()); @@ -911,7 +911,7 @@ BOOL pdb_generate_machine_sid(void) } if (!directory_exist(sid_file, NULL)) { - if (sys_mkdir(sid_file, 0700) != 0) { + if (dos_mkdir(sid_file, 0700) != 0) { DEBUG(0,("generate_machine_sid: can't create private directory %s : %s\n", sid_file, strerror(errno))); return False; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index fae4c1cc05..45a9515b51 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -112,7 +112,7 @@ void print_file(connection_struct *conn, files_struct *file) if (file_size(file->fsp_name) <= 0) { DEBUG(3,("Discarding null print job %s\n",file->fsp_name)); - sys_unlink(file->fsp_name); + dos_unlink(file->fsp_name); return; } @@ -1033,7 +1033,7 @@ int get_printqueue(int snum, fstring outfile; pstring line; FILE *f; - struct stat sbuf; + SMB_STRUCT_STAT sbuf; BOOL dorun=True; int cachetime = lp_lpqcachetime(); 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,¶ms[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) { diff --git a/source3/utils/make_smbcodepage.c b/source3/utils/make_smbcodepage.c index 155ed5aeb5..97dfb715b0 100644 --- a/source3/utils/make_smbcodepage.c +++ b/source3/utils/make_smbcodepage.c @@ -170,7 +170,7 @@ int do_compile(int codepage, char *input_file, char *output_file) char output_buf[CODEPAGE_HEADER_SIZE + 4 * MAXCODEPAGELINES]; int num_lines = 0; int i = 0; - struct stat st; + SMB_STRUCT_STAT st; /* Get the size of the input file. Read the entire thing into memory. */ if(stat((char *)input_file, &st)!= 0) @@ -310,7 +310,7 @@ definition file. File %s has %d.\n", prog_name, MAXCODEPAGELINES, input_file, nu int do_decompile( int codepage, char *input_file, char *output_file) { uint32 size = 0; - struct stat st; + SMB_STRUCT_STAT st; char header_buf[CODEPAGE_HEADER_SIZE]; char *buf = NULL; FILE *fp = NULL; diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index a5205878cc..d41e8b9f66 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -47,7 +47,7 @@ extern pstring myhostname; void do_global_checks(void) { - struct stat st; + SMB_STRUCT_STAT st; if (lp_security() > SEC_SHARE && lp_revalidate(-1)) { printf("WARNING: the 'revalidate' parameter is ignored in all but \ 'security=share' mode.\n"); diff --git a/source3/web/cgi.c b/source3/web/cgi.c index ce1038231b..9804f93adf 100644 --- a/source3/web/cgi.c +++ b/source3/web/cgi.c @@ -496,7 +496,7 @@ handle a file download ***************************************************************************/ static void cgi_download(char *file) { - struct stat st; + SMB_STRUCT_STAT st; char buf[1024]; int fd, l, i; char *p; |