1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-05 12:22:11 +03:00

Use VFS operations for file I/O.

This commit is contained in:
Tim Potter
-
parent 15805164fe
commit cfddbdb624
7 changed files with 126 additions and 110 deletions

View File

@ -148,7 +148,7 @@ int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *
if (!st) { if (!st) {
st = &st1; st = &st1;
if (dos_stat(fname,st)) return(-1); if (conn->vfs_ops.stat(dos_to_unix(fname,False),st)) return(-1);
} }
if (S_ISDIR(st->st_mode)) dosmode |= aDIR; if (S_ISDIR(st->st_mode)) dosmode |= aDIR;
@ -186,7 +186,7 @@ int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *
unixmode |= tmp; unixmode |= tmp;
} }
return(dos_chmod(fname,unixmode)); return(conn->vfs_ops.chmod(fname,unixmode));
} }
@ -202,7 +202,7 @@ int file_utime(connection_struct *conn, char *fname, struct utimbuf *times)
errno = 0; errno = 0;
if(dos_utime(fname, times) == 0) if(conn->vfs_ops.utime(dos_to_unix(fname, False), times) == 0)
return 0; return 0;
if((errno != EPERM) && (errno != EACCES)) if((errno != EPERM) && (errno != EACCES))
@ -217,7 +217,7 @@ int file_utime(connection_struct *conn, char *fname, struct utimbuf *times)
(as DOS does). (as DOS does).
*/ */
if(dos_stat(fname,&sb) != 0) if(conn->vfs_ops.stat(dos_to_unix(fname,False),&sb) != 0)
return -1; return -1;
/* Check if we have write access. */ /* 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)))) { current_user.ngroups,current_user.groups)))) {
/* We are allowed to become root and change the filetime. */ /* We are allowed to become root and change the filetime. */
become_root(False); become_root(False);
ret = dos_utime(fname, times); ret = conn->vfs_ops.utime(dos_to_unix(fname, False), times);
unbecome_root(False); unbecome_root(False);
} }
} }

View File

@ -441,7 +441,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
* stat the name - if it exists then we are all done! * stat the name - if it exists then we are all done!
*/ */
if (dos_stat(name,&st) == 0) { if (conn->vfs_ops.stat(name,&st) == 0) {
stat_cache_add(orig_path, name); stat_cache_add(orig_path, name);
DEBUG(5,("conversion finished %s -> %s\n",orig_path, name)); DEBUG(5,("conversion finished %s -> %s\n",orig_path, name));
if(pst) if(pst)
@ -509,7 +509,8 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
/* /*
* Check if the name exists up to this point. * Check if the name exists up to this point.
*/ */
if (dos_stat(name, &st) == 0) {
if (conn->vfs_ops.stat(name, &st) == 0) {
/* /*
* It exists. it must either be a directory or this must be * It exists. it must either be a directory or this must be
* the last part of the path for it to be OK. * the last part of the path for it to be OK.
@ -661,7 +662,7 @@ BOOL check_name(char *name,connection_struct *conn)
if (!lp_symlinks(SNUM(conn))) if (!lp_symlinks(SNUM(conn)))
{ {
SMB_STRUCT_STAT statbuf; SMB_STRUCT_STAT statbuf;
if ( (dos_lstat(name,&statbuf) != -1) && if ( (conn->vfs_ops.lstat(dos_to_unix(name,False),&statbuf) != -1) &&
(S_ISLNK(statbuf.st_mode)) ) (S_ISLNK(statbuf.st_mode)) )
{ {
DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name)); DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name));

View File

@ -340,13 +340,12 @@ void file_sync_all(connection_struct *conn)
for (fsp=Files;fsp;fsp=next) { for (fsp=Files;fsp;fsp=next) {
next=fsp->next; next=fsp->next;
if (fsp->open && (conn == fsp->conn) && (fsp->fd_ptr != NULL)) { if (fsp->open && (conn == fsp->conn) && (fsp->fd_ptr != NULL)){
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
} }
} }
} }
/**************************************************************************** /****************************************************************************
free up a fd_ptr free up a fd_ptr
****************************************************************************/ ****************************************************************************/

View File

@ -2005,7 +2005,7 @@ static BOOL api_PrintJobInfo(connection_struct *conn,uint16 vuid,char *param,cha
!become_service(fconn,True)) !become_service(fconn,True))
break; break;
if (dos_rename(fsp->fsp_name,name) == 0) { if (conn->vfs_ops.rename(dos_to_unix(fsp->fsp_name,False),name) == 0) {
string_set(&fsp->fsp_name,name); string_set(&fsp->fsp_name,name);
} }
break; break;

View File

@ -700,8 +700,8 @@ int reply_ntcreate_and_X(connection_struct *conn,
if(create_options & FILE_DIRECTORY_FILE) { if(create_options & FILE_DIRECTORY_FILE) {
oplock_request = 0; oplock_request = 0;
open_directory(fsp, conn, fname, smb_ofun, open_directory(fsp, conn, fname, smb_ofun, unixmode,
unixmode, &smb_action); &smb_action);
restore_case_semantics(file_attributes); restore_case_semantics(file_attributes);
@ -727,7 +727,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
* before issuing an oplock break request to * before issuing an oplock break request to
* our client. JRA. */ * our client. JRA. */
open_file_shared(fsp,conn,fname,smb_open_mode, open_file_shared(fsp,conn,fname,smb_open_mode,
smb_ofun,unixmode, smb_ofun,unixmode,
oplock_request,&rmode,&smb_action); oplock_request,&rmode,&smb_action);
@ -751,7 +751,9 @@ int reply_ntcreate_and_X(connection_struct *conn,
if(errno == EISDIR) { if(errno == EISDIR) {
oplock_request = 0; oplock_request = 0;
open_directory(fsp, conn, fname, smb_ofun, unixmode, &smb_action); open_directory(fsp, conn, fname,
smb_ofun, unixmode,
&smb_action);
if(!fsp->open) { if(!fsp->open) {
file_free(fsp); file_free(fsp);
@ -774,13 +776,15 @@ int reply_ntcreate_and_X(connection_struct *conn,
} }
if(fsp->is_directory) { if(fsp->is_directory) {
if(dos_stat(fsp->fsp_name, &sbuf) != 0) { if(fsp->conn->vfs_ops.stat(dos_to_unix(fsp->fsp_name, False),
&sbuf) != 0) {
close_directory(fsp); close_directory(fsp);
restore_case_semantics(file_attributes); restore_case_semantics(file_attributes);
return(ERROR(ERRDOS,ERRnoaccess)); return(ERROR(ERRDOS,ERRnoaccess));
} }
} else { } else {
if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) { if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf)
!= 0) {
close_file(fsp,False); close_file(fsp,False);
restore_case_semantics(file_attributes); restore_case_semantics(file_attributes);
return(ERROR(ERRDOS,ERRnoaccess)); return(ERROR(ERRDOS,ERRnoaccess));
@ -1006,8 +1010,8 @@ static int call_nt_transact_create(connection_struct *conn,
* Ordinary file case. * Ordinary file case.
*/ */
open_file_shared(fsp,conn,fname,smb_open_mode,smb_ofun,unixmode, open_file_shared(fsp,conn,fname,smb_open_mode,smb_ofun,
oplock_request,&rmode,&smb_action); unixmode,oplock_request,&rmode,&smb_action);
if (!fsp->open) { if (!fsp->open) {
if((errno == ENOENT) && bad_path) { if((errno == ENOENT) && bad_path) {
@ -1021,7 +1025,7 @@ static int call_nt_transact_create(connection_struct *conn,
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
} }
if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) { if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fsp,False); close_file(fsp,False);
restore_case_semantics(file_attributes); restore_case_semantics(file_attributes);
@ -1329,7 +1333,7 @@ void process_pending_change_notify_queue(time_t t)
continue; continue;
} }
if(dos_stat(fsp->fsp_name, &st) < 0) { if(fsp->conn->vfs_ops.stat(dos_to_unix(fsp->fsp_name, False), &st) < 0) {
DEBUG(0,("process_pending_change_notify_queue: Unable to stat directory %s. \ DEBUG(0,("process_pending_change_notify_queue: Unable to stat directory %s. \
Error was %s.\n", fsp->fsp_name, strerror(errno) )); Error was %s.\n", fsp->fsp_name, strerror(errno) ));
/* /*
@ -1408,7 +1412,7 @@ static int call_nt_transact_notify_change(connection_struct *conn,
* Store the current timestamp on the directory we are monitoring. * Store the current timestamp on the directory we are monitoring.
*/ */
if(dos_stat(fsp->fsp_name, &st) < 0) { if(fsp->conn->vfs_ops.stat(dos_to_unix(fsp->fsp_name, False), &st) < 0) {
DEBUG(0,("call_nt_transact_notify_change: Unable to stat name = %s. \ DEBUG(0,("call_nt_transact_notify_change: Unable to stat name = %s. \
Error was %s\n", fsp->fsp_name, strerror(errno) )); Error was %s\n", fsp->fsp_name, strerror(errno) ));
free((char *)cnbp); free((char *)cnbp);

View File

@ -625,7 +625,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
domain,skip_string(p,1),skip_string(p,2))); domain,skip_string(p,1),skip_string(p,2)));
} }
DEBUG(3,("sesssetupX:name=[%s]\n",user)); DEBUG(3,("sesssetupX:name=[%s]\n",user));
/* If name ends in $ then I think it's asking about whether a */ /* If name ends in $ then I think it's asking about whether a */
@ -648,7 +647,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
} }
strlower(user); strlower(user);
/* /*
* In share level security, only overwrite sesssetup_use if * In share level security, only overwrite sesssetup_use if
* it's a non null-session share. Helps keep %U and %G * it's a non null-session share. Helps keep %U and %G
@ -657,7 +655,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
if((lp_security() != SEC_SHARE) || (*user && !guest)) if((lp_security() != SEC_SHARE) || (*user && !guest))
pstrcpy(sesssetup_user,user); pstrcpy(sesssetup_user,user);
reload_services(True); reload_services(True);
/* /*
@ -668,7 +665,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
pstrcpy( orig_user, user); pstrcpy( orig_user, user);
map_nt_and_unix_username(domain, user); map_nt_and_unix_username(domain, user);
add_session_user(user); add_session_user(user);
@ -758,7 +755,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
} }
} }
/* it's ok - setup a reply */ /* it's ok - setup a reply */
if (Protocol < PROTOCOL_NT1) { if (Protocol < PROTOCOL_NT1) {
set_message(outbuf,3,0,True); set_message(outbuf,3,0,True);
@ -897,7 +893,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
unix_convert(fname,conn,0,&bad_path,&sbuf); unix_convert(fname,conn,0,&bad_path,&sbuf);
if (check_name(fname,conn)) if (check_name(fname,conn))
{ {
if (VALID_STAT(sbuf) || dos_stat(fname,&sbuf) == 0) if (VALID_STAT(sbuf) || conn->vfs_ops.stat(dos_to_unix(fname,False),&sbuf) == 0)
{ {
mode = dos_mode(conn,fname,&sbuf); mode = dos_mode(conn,fname,&sbuf);
size = sbuf.st_size; size = sbuf.st_size;
@ -998,7 +994,7 @@ int reply_dskattr(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz
int outsize = 0; int outsize = 0;
SMB_BIG_UINT dfree,dsize,bsize; SMB_BIG_UINT dfree,dsize,bsize;
sys_disk_free(".",&bsize,&dfree,&dsize); conn->vfs_ops.disk_free(".",&bsize,&dfree,&dsize);
outsize = set_message(outbuf,5,0,True); outsize = set_message(outbuf,5,0,True);
@ -1346,8 +1342,9 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
unixmode = unix_mode(conn,aARCH); unixmode = unix_mode(conn,aARCH);
open_file_shared(fsp,conn,fname,share_mode,(FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), open_file_shared(fsp, conn, fname, share_mode,
unixmode, oplock_request,&rmode,NULL); (FILE_FAIL_IF_NOT_EXIST | FILE_EXISTS_OPEN),
unixmode, oplock_request, &rmode, NULL);
if (!fsp->open) if (!fsp->open)
{ {
@ -1360,7 +1357,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
} }
if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) { if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fsp,False); close_file(fsp,False);
return(ERROR(ERRDOS,ERRnoaccess)); return(ERROR(ERRDOS,ERRnoaccess));
} }
@ -1450,8 +1447,8 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
unixmode = unix_mode(conn,smb_attr | aARCH); unixmode = unix_mode(conn,smb_attr | aARCH);
open_file_shared(fsp,conn,fname,smb_mode,smb_ofun,unixmode, open_file_shared(fsp, conn, fname, smb_mode, smb_ofun, unixmode,
oplock_request, &rmode,&smb_action); oplock_request, &rmode, &smb_action);
if (!fsp->open) if (!fsp->open)
{ {
@ -1464,7 +1461,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
} }
if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) { if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fsp,False); close_file(fsp,False);
return(ERROR(ERRDOS,ERRnoaccess)); return(ERROR(ERRDOS,ERRnoaccess));
} }
@ -1601,8 +1598,9 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
} }
/* Open file in dos compatibility share mode. */ /* Open file in dos compatibility share mode. */
open_file_shared(fsp,conn,fname,SET_DENY_MODE(DENY_FCB)|SET_OPEN_MODE(DOS_OPEN_FCB), open_file_shared(fsp, conn, fname,
ofun, unixmode, oplock_request, NULL, NULL); SET_DENY_MODE(DENY_FCB)|SET_OPEN_MODE(DOS_OPEN_FCB),
ofun, unixmode, oplock_request, NULL, NULL);
if (!fsp->open) if (!fsp->open)
{ {
@ -1673,8 +1671,10 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
/* Open file in dos compatibility share mode. */ /* Open file in dos compatibility share mode. */
/* We should fail if file exists. */ /* We should fail if file exists. */
open_file_shared(fsp,conn,fname2,SET_DENY_MODE(DENY_FCB)|SET_OPEN_MODE(DOS_OPEN_FCB), open_file_shared(fsp,conn,fname2,
(FILE_CREATE_IF_NOT_EXIST|FILE_EXISTS_FAIL), unixmode, oplock_request, NULL, NULL); SET_DENY_MODE(DENY_FCB)|SET_OPEN_MODE(DOS_OPEN_FCB),
(FILE_CREATE_IF_NOT_EXIST | FILE_EXISTS_FAIL),
unixmode, oplock_request, NULL, NULL);
if (!fsp->open) if (!fsp->open)
{ {
@ -1717,7 +1717,7 @@ static BOOL can_delete(char *fname,connection_struct *conn, int dirtype)
if (!CAN_WRITE(conn)) return(False); if (!CAN_WRITE(conn)) return(False);
if (dos_lstat(fname,&sbuf) != 0) return(False); if (conn->vfs_ops.lstat(fname,&sbuf) != 0) return(False);
fmode = dos_mode(conn,fname,&sbuf); fmode = dos_mode(conn,fname,&sbuf);
if (fmode & aDIR) return(False); if (fmode & aDIR) return(False);
if (!lp_delete_readonly(SNUM(conn))) { if (!lp_delete_readonly(SNUM(conn))) {
@ -1774,10 +1774,10 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if (!has_wild) { if (!has_wild) {
pstrcat(directory,"/"); pstrcat(directory,"/");
pstrcat(directory,mask); pstrcat(directory,mask);
if (can_delete(directory,conn,dirtype) && !dos_unlink(directory)) if (can_delete(directory,conn,dirtype) && !conn->vfs_ops.unlink(directory))
count++; count++;
if (!count) if (!count)
exists = dos_file_exist(directory,NULL); exists = vfs_file_exist(conn,dos_to_unix(directory,False),NULL);
} else { } else {
void *dirptr = NULL; void *dirptr = NULL;
char *dname; char *dname;
@ -1807,7 +1807,7 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
error = ERRnoaccess; error = ERRnoaccess;
slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname); slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname);
if (!can_delete(fname,conn,dirtype)) continue; if (!can_delete(fname,conn,dirtype)) continue;
if (!dos_unlink(fname)) count++; if (!conn->vfs_ops.unlink(fname)) count++;
DEBUG(3,("reply_unlink : doing unlink on %s\n",fname)); DEBUG(3,("reply_unlink : doing unlink on %s\n",fname));
} }
CloseDir(dirptr); CloseDir(dirptr);
@ -1900,7 +1900,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
if (size < sizeneeded) if (size < sizeneeded)
{ {
SMB_STRUCT_STAT st; SMB_STRUCT_STAT st;
if (sys_fstat(fsp->fd_ptr->fd,&st) == 0) if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&st) == 0)
size = st.st_size; size = st.st_size;
if (!fsp->can_write) if (!fsp->can_write)
fsp->size = size; fsp->size = size;
@ -1924,11 +1924,11 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
#if USE_READ_PREDICTION #if USE_READ_PREDICTION
if (!fsp->can_write) if (!fsp->can_write)
predict = read_predict(fsp->fd_ptr->fd,startpos,header+4,NULL,nread); predict = read_predict(fsp, fsp->fd_ptr->fd,startpos,header+4,NULL,nread);
#endif /* USE_READ_PREDICTION */ #endif /* USE_READ_PREDICTION */
if ((nread-predict) > 0) { if ((nread-predict) > 0) {
if(seek_file(fsp,startpos + predict) == -1) { if(conn->vfs_ops.seek(fsp,startpos + predict) == -1) {
DEBUG(0,("reply_readbraw: ERROR: seek_file failed.\n")); DEBUG(0,("reply_readbraw: ERROR: seek_file failed.\n"));
ret = 0; ret = 0;
seek_fail = True; seek_fail = True;
@ -1936,7 +1936,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
} }
if(!seek_fail) if(!seek_fail)
ret = (ssize_t)transfer_file(fsp->fd_ptr->fd,Client, ret = (ssize_t)vfs_transfer_file(-1, fsp->fd_ptr->fd, Client, NULL,
(SMB_OFF_T)(nread-predict),header,4+predict, (SMB_OFF_T)(nread-predict),header,4+predict,
startpos+predict); startpos+predict);
} }
@ -2039,8 +2039,9 @@ int reply_read(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
if (is_locked(fsp,conn,numtoread,startpos, F_RDLCK)) if (is_locked(fsp,conn,numtoread,startpos, F_RDLCK))
return(ERROR(ERRDOS,ERRlock)); return(ERROR(ERRDOS,ERRlock));
if (numtoread > 0) if (numtoread > 0) {
nread = read_file(fsp,data,startpos,numtoread); nread = read_file(fsp,data,startpos,numtoread);
}
if (nread < 0) if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
@ -2092,15 +2093,15 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
if (is_locked(fsp,conn,smb_maxcnt,startpos, F_RDLCK)) if (is_locked(fsp,conn,smb_maxcnt,startpos, F_RDLCK))
return(ERROR(ERRDOS,ERRlock)); return(ERROR(ERRDOS,ERRlock));
nread = read_file(fsp,data,startpos,smb_maxcnt); nread = read_file(fsp,data,smb_maxcnt);
if (nread < 0) if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
SSVAL(outbuf,smb_vwv5,nread); SSVAL(outbuf,smb_vwv5,nread);
SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf)); SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
SSVAL(smb_buf(outbuf),-2,nread); SSVAL(smb_buf(outbuf),-2,nread);
DEBUG( 3, ( "readX fnum=%d min=%d max=%d nread=%d\n", DEBUG( 3, ( "readX fnum=%d min=%d max=%d nread=%d\n",
fsp->fnum, smb_mincnt, smb_maxcnt, nread ) ); fsp->fnum, smb_mincnt, smb_maxcnt, nread ) );
@ -2184,8 +2185,9 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
tcount,nwritten,numtowrite)); tcount,nwritten,numtowrite));
} }
nwritten = transfer_file(Client,fsp->fd_ptr->fd,(SMB_OFF_T)numtowrite,NULL,0, nwritten = vfs_transfer_file(Client, NULL, -1, fsp,
startpos+nwritten); (SMB_OFF_T)numtowrite,NULL,0,
startpos+nwritten);
total_written += nwritten; total_written += nwritten;
/* Set up outbuf to return the correct return */ /* Set up outbuf to return the correct return */
@ -2199,7 +2201,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
} }
if (lp_syncalways(SNUM(conn)) || write_through) if (lp_syncalways(SNUM(conn)) || write_through)
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
DEBUG(3,("writebraw2 fnum=%d start=%.0f num=%d wrote=%d\n", DEBUG(3,("writebraw2 fnum=%d start=%.0f num=%d wrote=%d\n",
fsp->fnum, (double)startpos, numtowrite, total_written)); fsp->fnum, (double)startpos, numtowrite, total_written));
@ -2249,7 +2251,7 @@ int reply_writeunlock(connection_struct *conn, char *inbuf,char *outbuf, int dum
nwritten = write_file(fsp,data,numtowrite); nwritten = write_file(fsp,data,numtowrite);
if (lp_syncalways(SNUM(conn))) if (lp_syncalways(SNUM(conn)))
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0))
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
@ -2302,7 +2304,7 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,i
nwritten = write_file(fsp,data,numtowrite); nwritten = write_file(fsp,data,numtowrite);
if (lp_syncalways(SNUM(conn))) if (lp_syncalways(SNUM(conn)))
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0))
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
@ -2386,7 +2388,7 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng
fsp->fnum, numtowrite, nwritten)); fsp->fnum, numtowrite, nwritten));
if (lp_syncalways(SNUM(conn)) || write_through) if (lp_syncalways(SNUM(conn)) || write_through)
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
return chain_reply(inbuf,outbuf,length,bufsize); return chain_reply(inbuf,outbuf,length,bufsize);
} }
@ -2418,7 +2420,7 @@ int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
umode = SEEK_SET; break; umode = SEEK_SET; break;
} }
if((res = sys_lseek(fsp->fd_ptr->fd,startpos,umode)) == -1) if((res = conn->vfs_ops.lseek(fsp->fd_ptr->fd,startpos,umode)) == -1)
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
fsp->pos = res; fsp->pos = res;
@ -2448,7 +2450,7 @@ int reply_flush(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
if (!fsp) { if (!fsp) {
file_sync_all(conn); file_sync_all(conn);
} else { } else {
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
} }
DEBUG(3,("flush\n")); DEBUG(3,("flush\n"));
@ -2914,7 +2916,8 @@ int reply_mkdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
unix_convert(directory,conn,0,&bad_path,NULL); unix_convert(directory,conn,0,&bad_path,NULL);
if (check_name(directory, conn)) if (check_name(directory, conn))
ret = dos_mkdir(directory,unix_mode(conn,aDIR)); ret = conn->vfs_ops.mkdir(dos_to_unix(directory,False),
unix_mode(conn,aDIR));
if (ret < 0) if (ret < 0)
{ {
@ -2937,11 +2940,11 @@ int reply_mkdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
Static function used by reply_rmdir to delete an entire directory Static function used by reply_rmdir to delete an entire directory
tree recursively. tree recursively.
****************************************************************************/ ****************************************************************************/
static BOOL recursive_rmdir(char *directory) static BOOL recursive_rmdir(connection_struct *conn, char *directory)
{ {
char *dname = NULL; char *dname = NULL;
BOOL ret = False; BOOL ret = False;
void *dirptr = OpenDir(NULL, directory, False); void *dirptr = OpenDir(conn, directory, False);
if(dirptr == NULL) if(dirptr == NULL)
return True; return True;
@ -2965,7 +2968,7 @@ static BOOL recursive_rmdir(char *directory)
pstrcat(fullname, "/"); pstrcat(fullname, "/");
pstrcat(fullname, dname); pstrcat(fullname, dname);
if(dos_lstat(fullname, &st) != 0) if(conn->vfs_ops.lstat(fullname, &st) != 0)
{ {
ret = True; ret = True;
break; break;
@ -2973,18 +2976,18 @@ static BOOL recursive_rmdir(char *directory)
if(st.st_mode & S_IFDIR) if(st.st_mode & S_IFDIR)
{ {
if(recursive_rmdir(fullname)!=0) if(recursive_rmdir(conn, fullname)!=0)
{ {
ret = True; ret = True;
break; break;
} }
if(dos_rmdir(fullname) != 0) if(conn->vfs_ops.rmdir(dos_to_unix(fullname,False)) != 0)
{ {
ret = True; ret = True;
break; break;
} }
} }
else if(dos_unlink(fullname) != 0) else if(conn->vfs_ops.unlink(dos_to_unix(fullname,False)) != 0)
{ {
ret = True; ret = True;
break; break;
@ -3011,7 +3014,7 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
{ {
dptr_closepath(directory,SVAL(inbuf,smb_pid)); dptr_closepath(directory,SVAL(inbuf,smb_pid));
ok = (dos_rmdir(directory) == 0); ok = (conn->vfs_ops.rmdir(dos_to_unix(directory,False)) == 0);
if(!ok && (errno == ENOTEMPTY) && lp_veto_files(SNUM(conn))) if(!ok && (errno == ENOTEMPTY) && lp_veto_files(SNUM(conn)))
{ {
/* Check to see if the only thing in this directory are /* Check to see if the only thing in this directory are
@ -3056,24 +3059,25 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
pstrcat(fullname, "/"); pstrcat(fullname, "/");
pstrcat(fullname, dname); pstrcat(fullname, dname);
if(dos_lstat(fullname, &st) != 0) if(conn->vfs_ops.lstat(fullname, &st) != 0)
break; break;
if(st.st_mode & S_IFDIR) if(st.st_mode & S_IFDIR)
{ {
if(lp_recursive_veto_delete(SNUM(conn))) if(lp_recursive_veto_delete(SNUM(conn)))
{ {
if(recursive_rmdir(fullname) != 0) DEBUG(0, ("ERROR: recursive_rmdir()\n"));
if(recursive_rmdir(conn, fullname) != 0)
break; break;
} }
if(dos_rmdir(fullname) != 0) if(conn->vfs_ops.rmdir(dos_to_unix(fullname,False)) != 0)
break; break;
} }
else if(dos_unlink(fullname) != 0) else if(conn->vfs_ops.unlink(dos_to_unix(fullname,False)) != 0)
break; break;
} }
CloseDir(dirptr); CloseDir(dirptr);
/* Retry the rmdir */ /* Retry the rmdir */
ok = (dos_rmdir(directory) == 0); ok = (conn->vfs_ops.rmdir(dos_to_unix(directory,False)) == 0);
} }
else else
CloseDir(dirptr); CloseDir(dirptr);
@ -3178,7 +3182,7 @@ static BOOL can_rename(char *fname,connection_struct *conn)
if (!CAN_WRITE(conn)) return(False); if (!CAN_WRITE(conn)) return(False);
if (dos_lstat(fname,&sbuf) != 0) return(False); if (conn->vfs_ops.lstat(fname,&sbuf) != 0) return(False);
if (!check_file_sharing(conn,fname,True)) return(False); if (!check_file_sharing(conn,fname,True)) return(False);
return(True); return(True);
@ -3298,21 +3302,23 @@ int rename_internals(connection_struct *conn,
*/ */
if(resolve_wildcards(directory,newname) && if(resolve_wildcards(directory,newname) &&
can_rename(directory,conn) && can_rename(directory,conn) &&
!dos_rename(directory,newname)) !conn->vfs_ops.rename(dos_to_unix(directory,False),
newname))
count++; count++;
} else { } else {
if (resolve_wildcards(directory,newname) && if (resolve_wildcards(directory,newname) &&
can_rename(directory,conn) && can_rename(directory,conn) &&
!dos_file_exist(newname,NULL) && !vfs_file_exist(conn,dos_to_unix(newname,False),NULL) &&
!dos_rename(directory,newname)) !conn->vfs_ops.rename(dos_to_unix(directory,False),
newname))
count++; count++;
} }
DEBUG(3,("rename_internals: %s doing rename on %s -> %s\n",(count != 0) ? "succeeded" : "failed", DEBUG(3,("rename_internals: %s doing rename on %s -> %s\n",(count != 0) ? "succeeded" : "failed",
directory,newname)); directory,newname));
if (!count) exists = dos_file_exist(directory,NULL); if (!count) exists = vfs_file_exist(conn,dos_to_unix(directory,False),NULL);
if (!count && exists && dos_file_exist(newname,NULL)) { if (!count && exists && vfs_file_exist(conn,dos_to_unix(newname,False),NULL)) {
exists = True; exists = True;
error = ERRrename; error = ERRrename;
} }
@ -3353,13 +3359,13 @@ int rename_internals(connection_struct *conn,
continue; continue;
} }
if (!replace_if_exists && dos_file_exist(destname,NULL)) { if (!replace_if_exists && vfs_file_exist(conn,dos_to_unix(destname,False),NULL)) {
DEBUG(6,("dos_file_exist %s\n", destname)); DEBUG(6,("file_exist %s\n", destname));
error = 183; error = 183;
continue; continue;
} }
if (!dos_rename(fname,destname)) if (!conn->vfs_ops.rename(dos_to_unix(fname,False),destname))
count++; count++;
DEBUG(3,("rename_internals: doing rename on %s -> %s\n",fname,destname)); DEBUG(3,("rename_internals: doing rename on %s -> %s\n",fname,destname));
} }
@ -3428,15 +3434,16 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
pstrcat(dest,p); pstrcat(dest,p);
} }
if (!dos_file_exist(src,&st)) if (!vfs_file_exist(conn,dos_to_unix(src,False),&st))
return(False); return(False);
fsp1 = file_new(); fsp1 = file_new();
if (!fsp1) if (!fsp1)
return(False); return(False);
open_file_shared(fsp1,conn,src,SET_DENY_MODE(DENY_NONE)|SET_OPEN_MODE(DOS_OPEN_RDONLY), open_file_shared(fsp1, conn, src,
(FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),0,0,&Access,&action); SET_DENY_MODE(DENY_NONE) | SET_OPEN_MODE(DOS_OPEN_RDONLY),
(FILE_FAIL_IF_NOT_EXIST | FILE_EXISTS_OPEN), 0, 0, &Access, &action);
if (!fsp1->open) { if (!fsp1->open) {
file_free(fsp1); file_free(fsp1);
@ -3451,8 +3458,9 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
close_file(fsp1,False); close_file(fsp1,False);
return(False); return(False);
} }
open_file_shared(fsp2,conn,dest,SET_DENY_MODE(DENY_NONE)|SET_OPEN_MODE(DOS_OPEN_WRONLY), open_file_shared(fsp2, conn, dest,
ofun,st.st_mode,0,&Access,&action); SET_DENY_MODE(DENY_NONE) | SET_OPEN_MODE(DOS_OPEN_WRONLY),
ofun, st.st_mode, 0, &Access, &action);
if (!fsp2->open) { if (!fsp2->open) {
close_file(fsp1,False); close_file(fsp1,False);
@ -3461,7 +3469,7 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
} }
if ((ofun&3) == 1) { if ((ofun&3) == 1) {
if(sys_lseek(fsp2->fd_ptr->fd,0,SEEK_END) == -1) { if(conn->vfs_ops.lseek(fsp2->fd_ptr->fd,0,SEEK_END) == -1) {
DEBUG(0,("copy_file: error - sys_lseek returned error %s\n", DEBUG(0,("copy_file: error - sys_lseek returned error %s\n",
strerror(errno) )); strerror(errno) ));
/* /*
@ -3473,8 +3481,7 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
} }
if (st.st_size) if (st.st_size)
ret = transfer_file(fsp1->fd_ptr->fd, ret = vfs_transfer_file(-1, fsp1, -1, fsp2, st.st_size, NULL, 0, 0);
fsp2->fd_ptr->fd,st.st_size,NULL,0,0);
close_file(fsp1,False); close_file(fsp1,False);
close_file(fsp2,False); close_file(fsp2,False);
@ -3558,7 +3565,7 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
if (resolve_wildcards(directory,newname) && if (resolve_wildcards(directory,newname) &&
copy_file(directory,newname,conn,ofun, copy_file(directory,newname,conn,ofun,
count,target_is_directory)) count++; count,target_is_directory)) count++;
if (!count) exists = dos_file_exist(directory,NULL); if (!count) exists = vfs_file_exist(conn,dos_to_unix(directory,False),NULL);
} else { } else {
void *dirptr = NULL; void *dirptr = NULL;
char *dname; char *dname;
@ -3862,7 +3869,7 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length,
{ {
size_t N = MIN(max_per_packet,tcount-total_read); size_t N = MIN(max_per_packet,tcount-total_read);
nread = read_file(fsp,data,startpos,N); nread = read_file(fsp,data,N);
if (nread <= 0) nread = 0; if (nread <= 0) nread = 0;
@ -3925,7 +3932,7 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
nwritten = write_file(fsp,data,numtowrite); nwritten = write_file(fsp,data,numtowrite);
if(lp_syncalways(SNUM(conn)) || write_through) if(lp_syncalways(SNUM(conn)) || write_through)
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
if(nwritten < (ssize_t)numtowrite) if(nwritten < (ssize_t)numtowrite)
return(UNIXERROR(ERRHRD,ERRdiskfull)); return(UNIXERROR(ERRHRD,ERRdiskfull));
@ -4038,7 +4045,7 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz
nwritten = write_file(fsp,data,numtowrite); nwritten = write_file(fsp,data,numtowrite);
if(lp_syncalways(SNUM(conn)) || write_through) if(lp_syncalways(SNUM(conn)) || write_through)
sync_file(conn,fsp); conn->vfs_ops.sync(conn, fsp);
if (nwritten < (ssize_t)numtowrite) if (nwritten < (ssize_t)numtowrite)
{ {
@ -4143,7 +4150,7 @@ int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int dum_si
CHECK_ERROR(fsp); CHECK_ERROR(fsp);
/* Do an fstat on this file */ /* Do an fstat on this file */
if(sys_fstat(fsp->fd_ptr->fd, &sbuf)) if(fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd, &sbuf))
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
mode = dos_mode(conn,fsp->fsp_name,&sbuf); mode = dos_mode(conn,fsp->fsp_name,&sbuf);

View File

@ -247,7 +247,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf,
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
} }
if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) { if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fsp,False); close_file(fsp,False);
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
} }
@ -374,7 +374,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
if(needslash) if(needslash)
pstrcat(pathreal,"/"); pstrcat(pathreal,"/");
pstrcat(pathreal,dname); pstrcat(pathreal,dname);
if (dos_stat(pathreal,&sbuf) != 0) if (conn->vfs_ops.stat(dos_to_unix(pathreal,False),&sbuf) != 0)
{ {
DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",pathreal,strerror(errno))); DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",pathreal,strerror(errno)));
continue; continue;
@ -1072,7 +1072,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level)); DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level));
if(dos_stat(".",&st)!=0) { if(conn->vfs_ops.stat(".",&st)!=0) {
DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n", strerror(errno))); DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n", strerror(errno)));
return (ERROR(ERRSRV,ERRinvdevice)); return (ERROR(ERRSRV,ERRinvdevice));
} }
@ -1085,7 +1085,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
{ {
SMB_BIG_UINT dfree,dsize,bsize; SMB_BIG_UINT dfree,dsize,bsize;
data_len = 18; data_len = 18;
sys_disk_free(".",&bsize,&dfree,&dsize); conn->vfs_ops.disk_free(".",&bsize,&dfree,&dsize);
SIVAL(pdata,l1_idFileSystem,st.st_dev); SIVAL(pdata,l1_idFileSystem,st.st_dev);
SIVAL(pdata,l1_cSectorUnit,bsize/512); SIVAL(pdata,l1_cSectorUnit,bsize/512);
SIVAL(pdata,l1_cUnit,dsize); SIVAL(pdata,l1_cUnit,dsize);
@ -1158,7 +1158,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
{ {
SMB_BIG_UINT dfree,dsize,bsize; SMB_BIG_UINT dfree,dsize,bsize;
data_len = 24; data_len = 24;
sys_disk_free(".",&bsize,&dfree,&dsize); conn->vfs_ops.disk_free(".",&bsize,&dfree,&dsize);
SIVAL(pdata,0,dsize); SIVAL(pdata,0,dsize);
SIVAL(pdata,8,dfree); SIVAL(pdata,8,dfree);
SIVAL(pdata,16,bsize/512); SIVAL(pdata,16,bsize/512);
@ -1254,7 +1254,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
*/ */
fname = fsp->fsp_name; fname = fsp->fsp_name;
unix_convert(fname,conn,0,&bad_path,&sbuf); unix_convert(fname,conn,0,&bad_path,&sbuf);
if (!check_name(fname,conn) || (!VALID_STAT(sbuf) && dos_stat(fname,&sbuf))) { if (!check_name(fname,conn) || (!VALID_STAT(sbuf) &&
conn->vfs_ops.stat(dos_to_unix(fname,False),&sbuf))) {
DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno))); DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno)));
if((errno == ENOENT) && bad_path) if((errno == ENOENT) && bad_path)
{ {
@ -1271,11 +1272,11 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
CHECK_ERROR(fsp); CHECK_ERROR(fsp);
fname = fsp->fsp_name; fname = fsp->fsp_name;
if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) { if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
DEBUG(3,("fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno))); DEBUG(3,("fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
return(UNIXERROR(ERRDOS,ERRbadfid)); return(UNIXERROR(ERRDOS,ERRbadfid));
} }
if((pos = sys_lseek(fsp->fd_ptr->fd,0,SEEK_CUR)) == -1) if((pos = fsp->conn->vfs_ops.lseek(fsp->fd_ptr->fd,0,SEEK_CUR)) == -1)
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
delete_pending = fsp->fd_ptr->delete_on_close; delete_pending = fsp->fd_ptr->delete_on_close;
@ -1286,7 +1287,9 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
fname = &fname1[0]; fname = &fname1[0];
pstrcpy(fname,&params[6]); pstrcpy(fname,&params[6]);
unix_convert(fname,conn,0,&bad_path,&sbuf); unix_convert(fname,conn,0,&bad_path,&sbuf);
if (!check_name(fname,conn) || (!VALID_STAT(sbuf) && dos_stat(fname,&sbuf))) { if (!check_name(fname,conn) ||
(!VALID_STAT(sbuf) && conn->vfs_ops.stat(dos_to_unix(fname,False),
&sbuf))) {
DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno))); DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno)));
if((errno == ENOENT) && bad_path) if((errno == ENOENT) && bad_path)
{ {
@ -1514,7 +1517,8 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
*/ */
fname = fsp->fsp_name; fname = fsp->fsp_name;
unix_convert(fname,conn,0,&bad_path,&st); unix_convert(fname,conn,0,&bad_path,&st);
if (!check_name(fname,conn) || (!VALID_STAT(st) && dos_stat(fname,&st))) { if (!check_name(fname,conn) || (!VALID_STAT(st) &&
conn->vfs_ops.stat(dos_to_unix(fname,False),&st))) {
DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno))); DEBUG(3,("fileinfo of %s failed (%s)\n",fname,strerror(errno)));
if((errno == ENOENT) && bad_path) if((errno == ENOENT) && bad_path)
{ {
@ -1533,7 +1537,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
fname = fsp->fsp_name; fname = fsp->fsp_name;
fd = fsp->fd_ptr->fd; fd = fsp->fd_ptr->fd;
if (sys_fstat(fd,&st) != 0) { if (fsp->conn->vfs_ops.fstat(fd,&st) != 0) {
DEBUG(3,("fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno))); DEBUG(3,("fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
return(UNIXERROR(ERRDOS,ERRbadfid)); return(UNIXERROR(ERRDOS,ERRbadfid));
} }
@ -1554,7 +1558,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
return(UNIXERROR(ERRDOS,ERRbadpath)); return(UNIXERROR(ERRDOS,ERRbadpath));
} }
if(!VALID_STAT(st) && dos_stat(fname,&st)!=0) { if(!VALID_STAT(st) && conn->vfs_ops.stat(dos_to_unix(fname,False),&st)!=0) {
DEBUG(3,("stat of %s failed (%s)\n", fname, strerror(errno))); DEBUG(3,("stat of %s failed (%s)\n", fname, strerror(errno)));
if((errno == ENOENT) && bad_path) if((errno == ENOENT) && bad_path)
{ {
@ -1771,7 +1775,6 @@ dev = %x, inode = %.0f\n", iterate_fsp->fnum, (unsigned int)dev, (double)inode))
* goes away. * goes away.
*/ */
fsp->fd_ptr->delete_on_close = delete_on_close; fsp->fd_ptr->delete_on_close = delete_on_close;
unlock_share_entry(fsp->conn, dev, inode, token); unlock_share_entry(fsp->conn, dev, inode, token);
DEBUG(10, ("call_trans2setfilepathinfo: %s delete on close flag for fnum = %d, file %s\n", DEBUG(10, ("call_trans2setfilepathinfo: %s delete on close flag for fnum = %d, file %s\n",
@ -1834,6 +1837,7 @@ dev = %x, inode = %.0f\n", iterate_fsp->fnum, (unsigned int)dev, (double)inode))
{ {
if (fd == -1) if (fd == -1)
{ {
DEBUG(0, ("@@@ 23 @@@\n"));
fd = dos_open(fname,O_RDWR,0); fd = dos_open(fname,O_RDWR,0);
if (fd == -1) if (fd == -1)
{ {
@ -1876,7 +1880,8 @@ static int call_trans2mkdir(connection_struct *conn,
unix_convert(directory,conn,0,&bad_path,NULL); unix_convert(directory,conn,0,&bad_path,NULL);
if (check_name(directory,conn)) if (check_name(directory,conn))
ret = dos_mkdir(directory,unix_mode(conn,aDIR)); ret = conn->vfs_ops.mkdir(dos_to_unix(directory,False),
unix_mode(conn,aDIR));
if(ret < 0) if(ret < 0)
{ {