diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/challenge.c | 61 | ||||
-rw-r--r-- | source3/smbd/dfs.c | 255 | ||||
-rw-r--r-- | source3/smbd/vfs-wrap.c | 304 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 379 |
4 files changed, 0 insertions, 999 deletions
diff --git a/source3/smbd/challenge.c b/source3/smbd/challenge.c deleted file mode 100644 index cbb34e6395..0000000000 --- a/source3/smbd/challenge.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - Password and authentication handling - Copyright (C) Andrew Tridgell 1992-1998 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" - -extern int DEBUGLEVEL; - -/* Data to do lanman1/2 password challenge. */ -static unsigned char saved_challenge[8]; -static BOOL challenge_sent=False; - -/******************************************************************* -Get the next challenge value - no repeats. -********************************************************************/ -void generate_next_challenge(char *challenge) -{ - unsigned char buf[8]; - generate_random_buffer(buf,8,False); - memcpy(saved_challenge, buf, 8); - memcpy(challenge,buf,8); - challenge_sent = True; -} - -/******************************************************************* -set the last challenge sent, usually from a password server -********************************************************************/ -BOOL set_challenge(unsigned char *challenge) -{ - memcpy(saved_challenge,challenge,8); - challenge_sent = True; - return(True); -} - -/******************************************************************* -get the last challenge sent -********************************************************************/ -BOOL last_challenge(unsigned char *challenge) -{ - if (!challenge_sent) return False; - memcpy(challenge,saved_challenge,8); - return(True); -} - diff --git a/source3/smbd/dfs.c b/source3/smbd/dfs.c deleted file mode 100644 index 55433f2c47..0000000000 --- a/source3/smbd/dfs.c +++ /dev/null @@ -1,255 +0,0 @@ - -#include "includes.h" - -extern int DEBUGLEVEL; - -dfs_internal dfs_struct; -extern pstring global_myname; - -/**************************************************************************** -read a line and split it -****************************************************************************/ -static BOOL parse_dfs_text_entry(char *line, dfs_internal_table *buf) -{ -#define MAXTOK 4 - char *tok[MAXTOK+1]; - int count = 0; - - tok[count] = strtok(line,":"); - - /* strip the comment lines */ - if (tok[0][0] == '#') return (False); - count++; - - while ( ((tok[count] = strtok(NULL,":")) != NULL ) && count < MAXTOK) - { - count++; - } - - DEBUG(7,("Found [%d] tokens\n", count)); - - if (count > 1) { - StrnCpy(buf->localpath, tok[0], sizeof(buf->localpath)-1); - StrnCpy(buf->sharename, tok[1], sizeof(buf->sharename)-1); -/* - strupper(buf->localpath); - strupper(buf->sharename); -*/ - buf->localpath_length = strlen(buf->localpath); - buf->sharename_length = strlen(buf->sharename); - } - else - return (False); - - if (count > 2) - buf->proximity = atoi(tok[2]); - else - buf->proximity = 0; - - if (count > 3) - buf->type = atoi(tok[3]); - else - buf->type = 2; - - DEBUGADD(7,("localpath: [%s]\n", buf->localpath)); - DEBUGADD(7,("sharename: [%s]\n", buf->sharename)); - return True; -} - -/**************************************************************************** -mangle the localpath and store it. -****************************************************************************/ -static void mangle_dfs_path(dfs_internal_table *buf) -{ - char *p; - char *mp; - char *q; - int mlen; - - fstring temp; - - p = buf->localpath; - mp = buf->mangledpath; - mlen = sizeof(buf->mangledpath); - - ZERO_STRUCTP(mp); - DEBUG(2, ("DFS name is: [%s]\n", buf->localpath)); - - /* copy the head: \server-name\ */ - q = strchr(p + 1, '\\'); - safe_strcpy(mp, p, mlen); - p = q + 1; - - while (q != NULL) - { - q = strchr(p, '\\'); - - safe_strcpy(temp, p, sizeof(temp)); - - if (!is_8_3(temp, True)) - { - mangle_name_83(temp); - } - - safe_strcat(mp, temp, mlen); - - if (q != NULL) - { - safe_strcat(mp, "\\", mlen); - } - p = q + 1; - } - -/* - strupper(mp); -*/ - buf->mangledpath_length = strlen(mp); - DEBUGADD(2, ("DFS mangled name is: [%s]\n", mp)); -} - -/**************************************************************************** -initialisation de la table dfs en memoire au demarrage de samba -****************************************************************************/ -BOOL init_dfs_table(void) -{ - char *file = lp_dfs_map(); - int num_lines = 0; - int total = 0; - FILE *f; - pstring line; - int i; - - dfs_internal_table *entry; - - entry = NULL; - dfs_struct.ready = False; - - if (*file == '\0') { - DEBUG(0,("No DFS map, Samba is running in NON DFS mode\n")); - return False; - } - - f = sys_fopen(file, "r"); - if (!f) { - DEBUG(0,("No DFS map file, Samba is running in NON DFS mode\n")); - return False; - } - - while ( fgets(line, sizeof(pstring), f) ) - { - entry = Realloc(entry,sizeof(dfs_internal_table)*(total+1)); - if (! entry) - { - total = 0; - break; - } - - if ( parse_dfs_text_entry(line, &(entry[total]) ) ) - { - total++; - } - num_lines++; - } - dfs_struct.size = total; - dfs_struct.table = entry; - fclose(f); - - /* we have the file in memory */ - /* now initialise the mangled names */ - for (i = 0; i < total; i++) - { - mangle_dfs_path(&(entry[i])); - } - - dfs_struct.ready = True; - DEBUG(0,("Samba is DFS aware now!\n")); - return True; -} - -static BOOL check_dfs_path(int search_len, const char *search_path, - int path_len, const char* fullpath, - const char* sharename, - const char* share_path, size_t share_len, - char *localpath, size_t local_plen) -{ - if (StrnCaseCmp(search_path, fullpath, search_len) != 0) - { - return False; - } - - DEBUG(2,("found one linked to [%s]. share_path: %s\n", - sharename, share_path)); - - if (StrnCaseCmp(fullpath, share_path, share_len) == 0) - { - safe_strcpy(localpath, fullpath + share_len, local_plen); - } - else - { - localpath[0] = 0; - } - - return True; -} - -/**************************************************************************** - check if a path name is a DFS branch -****************************************************************************/ -int under_dfs(connection_struct *conn, const char *path, - char *local_path, size_t local_plen) -{ - fstring fullpath; - pstring share_path; - int i; - int snum; - - int path_len; - int share_len; - - dfs_internal_table *list = dfs_struct.table; - - snum = SNUM(conn); - snprintf(share_path, sizeof(share_path), "\\%s\\%s", - global_myname, lp_servicename(snum)); - share_len = strlen(share_path); - - if (path[0] != '\\') - { - snprintf(fullpath, sizeof(fullpath), "%s\\%s", - share_path, path); - } - else - { - safe_strcpy(fullpath, path, sizeof(fullpath)); - } - - path_len = strlen(fullpath); - - DEBUG(2,("DFS looking for: [%s]\n", fullpath)); - - for (i = 0; i < dfs_struct.size; i++) - { - DEBUG(6,("checking against [%s][%d]\n", list[i].localpath,i)); - - if (check_dfs_path(list[i].localpath_length, - list[i].localpath, - path_len, fullpath, - list[i].sharename, - share_path, share_len, - local_path, local_plen)) - { - return True; - } - - if (check_dfs_path(list[i].mangledpath_length, - list[i].mangledpath, - path_len, fullpath, - list[i].sharename, - share_path, share_len, - local_path, local_plen)) - { - return True; - } - } - return False; -} diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c deleted file mode 100644 index 3493c23178..0000000000 --- a/source3/smbd/vfs-wrap.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - Wrap disk only vfs functions to sidestep dodgy compilers. - Copyright (C) Tim Potter 1998 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" - -/* Check for NULL pointer parameters in vfswrap_* functions */ - -#define VFS_CHECK_NULL - -/* We don't want to have NULL function pointers lying around. Someone - is sure to try and execute them. These stubs are used to prevent - this possibility. */ - -int vfswrap_dummy_connect(struct vfs_connection_struct *conn, char *service, - char *user) -{ - return 0; /* Return >= 0 for success */ -} - -void vfswrap_dummy_disconnect(void) -{ -} - -/* Disk operations */ - -SMB_BIG_UINT vfswrap_disk_free(char *path, SMB_BIG_UINT *bsize, - SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) -{ - SMB_BIG_UINT result; - -#ifdef VFS_CHECK_NULL - if ((path == NULL) || (bsize == NULL) || (dfree == NULL) || - (dsize == NULL)) { - - smb_panic("NULL pointer passed to vfswrap_disk_free() function\n"); - } -#endif - - result = sys_disk_free(path, bsize, dfree, dsize); - return result; -} - -/* Directory operations */ - -DIR *vfswrap_opendir(char *fname) -{ - DIR *result; - -#ifdef VFS_CHECK_NULL - if (fname == NULL) { - smb_panic("NULL pointer passed to vfswrap_opendir()\n"); - } -#endif - - result = opendir(fname); - return result; -} - -struct dirent *vfswrap_readdir(DIR *dirp) -{ - struct dirent *result; - -#ifdef VFS_CHECK_NULL - if (dirp == NULL) { - smb_panic("NULL pointer passed to vfswrap_readdir()\n"); - } -#endif - - result = readdir(dirp); - return result; -} - -int vfswrap_mkdir(char *path, mode_t mode) -{ - int result; - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_mkdir()\n"); - } -#endif - - result = mkdir(path, mode); - return result; -} - -int vfswrap_rmdir(char *path) -{ - int result; - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_rmdir()\n"); - } -#endif - - result = rmdir(path); - return result; -} - -int vfswrap_closedir(DIR *dirp) -{ - int result; - -#ifdef VFS_CHECK_NULL - if (dirp == NULL) { - smb_panic("NULL pointer passed to vfswrap_closedir()\n"); - } -#endif - - result = closedir(dirp); - return result; -} - -/* File operations */ - -int vfswrap_open(char *fname, int flags, mode_t mode) -{ - int result; - -#ifdef VFS_CHECK_NULL - if (fname == NULL) { - smb_panic("NULL pointer passed to vfswrap_open()\n"); - } -#endif - - result = sys_open(fname, flags, mode); - return result; -} - -int vfswrap_close(int fd) -{ - int result; - - result = close(fd); - return result; -} - -ssize_t vfswrap_read(int fd, char *data, size_t n) -{ - ssize_t result; - -#ifdef VFS_CHECK_NULL - if (data == NULL) { - smb_panic("NULL pointer passed to vfswrap_read()\n"); - } -#endif - - result = read(fd, data, n); - return result; -} - -ssize_t vfswrap_write(int fd, char *data, size_t n) -{ - ssize_t result; - -#ifdef VFS_CHECK_NULL - if (data == NULL) { - smb_panic("NULL pointer passed to vfswrap_write()\n"); - } -#endif - - result = write(fd, data, n); - return result; -} - -SMB_OFF_T vfswrap_lseek(int filedes, SMB_OFF_T offset, int whence) -{ - SMB_OFF_T result; - - result = sys_lseek(filedes, offset, whence); - return result; -} - -int vfswrap_rename(char *old, char *new) -{ - int result; - -#ifdef VFS_CHECK_NULL - if ((old == NULL) || (new == NULL)) { - smb_panic("NULL pointer passed to vfswrap_rename()\n"); - } -#endif - - result = rename(old, new); - return result; -} - -void vfswrap_sync_file(int fd) -{ - sys_sync_file(fd); -} - -int vfswrap_stat(char *fname, SMB_STRUCT_STAT *sbuf) -{ - int result; - -#ifdef VFS_CHECK_NULL - if ((fname == NULL) || (sbuf == NULL)) { - smb_panic("NULL pointer passed to vfswrap_stat()\n"); - } -#endif - - result = sys_stat(fname, sbuf); - return result; -} - -int vfswrap_fstat(int fd, SMB_STRUCT_STAT *sbuf) -{ - int result; - -#ifdef VFS_CHECK_NULL - if (sbuf == NULL) { - smb_panic("NULL pointer passed to vfswrap_fstat()\n"); - } -#endif - - result = sys_fstat(fd, sbuf); - return result; -} - -int vfswrap_lstat(char *path, - SMB_STRUCT_STAT *sbuf) -{ - int result; - -#ifdef VFS_CHECK_NULL - if ((path == NULL) || (sbuf == NULL)) { - smb_panic("NULL pointer passed to vfswrap_lstat()\n"); - } -#endif - - result = sys_lstat(path, sbuf); - return result; -} - -BOOL vfswrap_fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, - int type) -{ - BOOL result; - - result = fcntl_lock(fd, op, offset, count, type); - return result; -} - -int vfswrap_unlink(char *path) -{ - int result; - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_unlink()\n"); - } -#endif - - result = unlink(path); - return result; -} - -int vfswrap_chmod(char *path, mode_t mode) -{ - int result; - -#ifdef VFS_CHECK_NULL - if (path == NULL) { - smb_panic("NULL pointer passed to vfswrap_chmod()\n"); - } -#endif - - result = chmod(path, mode); - return result; -} - -int vfswrap_utime(char *path, struct utimbuf *times) -{ - int result; - -#ifdef VFS_CHECK_NULL - if ((path == NULL) || (times == NULL)) { - smb_panic("NULL pointer passed to vfswrap_utime()\n"); - } -#endif - - result = utime(path, times); - return result; -} diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c deleted file mode 100644 index 95bb4c9414..0000000000 --- a/source3/smbd/vfs.c +++ /dev/null @@ -1,379 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - VFS initialisation and support functions - Copyright (C) Tim Potter 1999 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#ifdef HAVE_LIBDL -#include <dlfcn.h> -#endif - -extern int DEBUGLEVEL; - -/* Some structures to help us initialise the vfs operations table */ - -struct vfs_syminfo { - char *name; - void *fptr; -}; - -/* Default vfs hooks. WARNING: The order of these initialisers is - very important. They must be in the same order as defined in - vfs.h. Change at your own peril. */ - -struct vfs_ops default_vfs_ops = { - - /* Disk operations */ - - vfswrap_dummy_connect, - vfswrap_dummy_disconnect, - vfswrap_disk_free, - - /* Directory operations */ - - vfswrap_opendir, - vfswrap_readdir, - vfswrap_mkdir, - vfswrap_rmdir, - vfswrap_closedir, - - /* File operations */ - - vfswrap_open, - vfswrap_close, - vfswrap_read, - vfswrap_write, - vfswrap_lseek, - vfswrap_rename, - vfswrap_sync_file, - vfswrap_stat, - vfswrap_fstat, - vfswrap_lstat, - vfswrap_fcntl_lock, - vfswrap_unlink, - vfswrap_chmod, - vfswrap_utime -}; - -/**************************************************************************** - initialise default vfs hooks -****************************************************************************/ -int vfs_init_default(connection_struct *conn) -{ - DEBUG(3, ("Initialising default vfs hooks\n")); - - memcpy(&conn->vfs_ops, &default_vfs_ops, sizeof(conn->vfs_ops)); - return True; -} - -/**************************************************************************** - initialise custom vfs hooks -****************************************************************************/ -#ifdef HAVE_LIBDL -BOOL vfs_init_custom(connection_struct *conn) -{ - void *handle; - struct vfs_ops *ops, *(*fptr)(struct vfs_options *options); - - DEBUG(3, ("Initialising custom vfs hooks from %s\n", - lp_vfsobj(SNUM(conn)))); - - /* Open object file */ - - handle = dlopen(lp_vfsobj(SNUM(conn)), RTLD_NOW); - if (!handle) { - DEBUG(0, ("Error opening %s: %s\n", lp_vfsobj(SNUM(conn)), - dlerror())); - return False; - } - - /* Get handle on vfs_init() symbol */ - - fptr = dlsym(handle, "vfs_init"); - if (fptr == NULL) { - DEBUG(0, ("No vfs_init() symbol found in %s\n", - lp_vfsobj(SNUM(conn)))); - return False; - } - - dlclose(handle); - - /* Initialise vfs_ops structure */ - - if ((ops = fptr(lp_vfsoptions(SNUM(conn)))) == NULL) { - return False; - } - - /* Fill in unused operations with default (disk based) ones. - There's probably a neater way to do this then a whole bunch of - if statements. */ - - memcpy(&conn->vfs_ops, ops, sizeof(conn->vfs_ops)); - - if (conn->vfs_ops.connect == NULL) { - conn->vfs_ops.connect = default_vfs_ops.connect; - } - - if (conn->vfs_ops.disconnect == NULL) { - conn->vfs_ops.disconnect = default_vfs_ops.disconnect; - } - - if (conn->vfs_ops.disk_free == NULL) { - conn->vfs_ops.disk_free = default_vfs_ops.disk_free; - } - - if (conn->vfs_ops.opendir == NULL) { - conn->vfs_ops.opendir = default_vfs_ops.opendir; - } - - if (conn->vfs_ops.readdir == NULL) { - conn->vfs_ops.readdir = default_vfs_ops.readdir; - } - - if (conn->vfs_ops.mkdir == NULL) { - conn->vfs_ops.mkdir = default_vfs_ops.mkdir; - } - - if (conn->vfs_ops.rmdir == NULL) { - conn->vfs_ops.rmdir = default_vfs_ops.rmdir; - } - - if (conn->vfs_ops.closedir == NULL) { - conn->vfs_ops.closedir = default_vfs_ops.closedir; - } - - if (conn->vfs_ops.open == NULL) { - conn->vfs_ops.open = default_vfs_ops.open; - } - - if (conn->vfs_ops.close == NULL) { - conn->vfs_ops.close = default_vfs_ops.close; - } - - if (conn->vfs_ops.read == NULL) { - conn->vfs_ops.read = default_vfs_ops.read; - } - - if (conn->vfs_ops.write == NULL) { - conn->vfs_ops.write = default_vfs_ops.write; - } - - if (conn->vfs_ops.lseek == NULL) { - conn->vfs_ops.lseek = default_vfs_ops.lseek; - } - - if (conn->vfs_ops.rename == NULL) { - conn->vfs_ops.rename = default_vfs_ops.rename; - } - - if (conn->vfs_ops.sync == NULL) { - conn->vfs_ops.sync = default_vfs_ops.sync; - } - - if (conn->vfs_ops.stat == NULL) { - conn->vfs_ops.stat = default_vfs_ops.stat; - } - - if (conn->vfs_ops.fstat == NULL) { - conn->vfs_ops.fstat = default_vfs_ops.fstat; - } - - if (conn->vfs_ops.lstat == NULL) { - conn->vfs_ops.lstat = default_vfs_ops.lstat; - } - - if (conn->vfs_ops.lock == NULL) { - conn->vfs_ops.lock = default_vfs_ops.lock; - } - - if (conn->vfs_ops.unlink == NULL) { - conn->vfs_ops.unlink = default_vfs_ops.unlink; - } - - if (conn->vfs_ops.chmod == NULL) { - conn->vfs_ops.chmod = default_vfs_ops.chmod; - } - - if (conn->vfs_ops.utime == NULL) { - conn->vfs_ops.utime = default_vfs_ops.utime; - } - - return True; -} -#endif - -/******************************************************************* - check if a vfs file exists -********************************************************************/ -BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf) -{ - SMB_STRUCT_STAT st; - if (!sbuf) sbuf = &st; - - if (conn->vfs_ops.stat(fname,sbuf) != 0) - return(False); - - return(S_ISREG(sbuf->st_mode)); -} - -/**************************************************************************** - write data to a fd on the vfs -****************************************************************************/ -ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N) -{ - size_t total=0; - ssize_t ret; - int fd = fsp->fd_ptr->fd; - - while (total < N) - { - ret = fsp->conn->vfs_ops.write(fd,buffer + total,N - total); - - if (ret == -1) return -1; - if (ret == 0) return total; - - total += ret; - } - return (ssize_t)total; -} - -/**************************************************************************** -transfer some data between two file_struct's -****************************************************************************/ -SMB_OFF_T vfs_transfer_file(int in_fd, files_struct *in_fsp, - int out_fd, files_struct *out_fsp, - SMB_OFF_T n, char *header, int headlen, int align) -{ - static char *buf=NULL; - static int size=0; - char *buf1,*abuf; - SMB_OFF_T total = 0; - - DEBUG(4,("vfs_transfer_file n=%.0f (head=%d) called\n",(double)n,headlen)); - - /* Check we have at least somewhere to read from */ - - SMB_ASSERT((in_fd != -1) || (in_fsp != NULL)); - - if (size == 0) { - size = lp_readsize(); - size = MAX(size,1024); - } - - while (!buf && size>0) { - buf = (char *)Realloc(buf,size+8); - if (!buf) size /= 2; - } - - if (!buf) { - DEBUG(0,("Can't allocate transfer buffer!\n")); - exit(1); - } - - abuf = buf + (align%8); - - if (header) - n += headlen; - - while (n > 0) - { - int s = (int)MIN(n,(SMB_OFF_T)size); - int ret,ret2=0; - - ret = 0; - - if (header && (headlen >= MIN(s,1024))) { - buf1 = header; - s = headlen; - ret = headlen; - headlen = 0; - header = NULL; - } else { - buf1 = abuf; - } - - if (header && headlen > 0) - { - ret = MIN(headlen,size); - memcpy(buf1,header,ret); - headlen -= ret; - header += ret; - if (headlen <= 0) header = NULL; - } - - if (s > ret) { - ret += in_fsp ? - in_fsp->conn->vfs_ops.read(in_fsp->fd_ptr->fd,buf1+ret,s-ret) : read(in_fd,buf1+ret,s-ret); - } - - if (ret > 0) - { - if (out_fsp) { - ret2 = out_fsp->conn->vfs_ops.write(out_fsp->fd_ptr->fd,buf1,ret); - } else { - ret2= (out_fd != -1) ? write_data(out_fd,buf1,ret) : ret; - } - } - - if (ret2 > 0) total += ret2; - /* if we can't write then dump excess data */ - if (ret2 != ret) - vfs_transfer_file(in_fd, in_fsp, -1,NULL,n-(ret+headlen),NULL,0,0); - - if (ret <= 0 || ret2 != ret) - return(total); - n -= ret; - } - return(total); -} - -/******************************************************************* -a vfs_readdir wrapper which just returns the file name -********************************************************************/ -char *vfs_readdirname(connection_struct *conn, void *p) -{ - struct dirent *ptr; - char *dname; - - if (!p) return(NULL); - - ptr = (struct dirent *)conn->vfs_ops.readdir(p); - if (!ptr) return(NULL); - - dname = ptr->d_name; - -#ifdef NEXT2 - if (telldir(p) < 0) return(NULL); -#endif - -#ifdef HAVE_BROKEN_READDIR - /* using /usr/ucb/cc is BAD */ - dname = dname - 2; -#endif - - { - static pstring buf; - memcpy(buf, dname, NAMLEN(ptr)+1); - unix_to_dos(buf, True); - dname = buf; - } - - unix_to_dos(dname, True); - return(dname); -} |