1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

configure configure.in: Added tests for fseek64 and ftell64.

config.h.in: Added fseek64 and ftell64.
includes.h: Added definition of SMB_BIG_INTEGER.
smb.h: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
access.c: Tidyup of dbug statement.
system.c: Added sys_fseek and sys_ftell. Changed mode calls to use mode_t.
asyncdns.c: Tidyup of comment.
loadparm.c: Tidyup of set_default_server_announce_type() function definition.
ldap.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
nispass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
smbpass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
smbpassfile.c: Use sys_fseek().
chgpasswd.c: Tidyup of debug statement.
dosmode.c: Changed mode calls to use mode_t.
ipc.c: Removal of dead code.
nttrans.c: Changed mode calls to use mode_t.
open.c: Changed mode calls to use mode_t.
pipes.c: Removal of dead code.
reply.c: Removal of dead code.
trans2.c: Removal of dead code. Changed mode calls to use mode_t.
Jeremy.
This commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent 9c8ecd994d
commit c381d32e3d
21 changed files with 100 additions and 91 deletions

View File

@ -163,7 +163,7 @@ AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam) AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64) AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64)
AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64) AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64)
AC_CHECK_FUNCS(bigcrypt getprpwnam setluid yp_get_default_domain getpwanam) AC_CHECK_FUNCS(fseek64 ftell64 bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
echo $ac_n "checking for long long ... $ac_c" echo $ac_n "checking for long long ... $ac_c"
AC_TRY_RUN([#include <stdio.h> AC_TRY_RUN([#include <stdio.h>

View File

@ -154,6 +154,9 @@
/* Define if you have the execl function. */ /* Define if you have the execl function. */
#undef HAVE_EXECL #undef HAVE_EXECL
/* Define if you have the fseek64 function. */
#undef HAVE_FSEEK64
/* Define if you have the fstat function. */ /* Define if you have the fstat function. */
#undef HAVE_FSTAT #undef HAVE_FSTAT
@ -163,6 +166,9 @@
/* Define if you have the fsync function. */ /* Define if you have the fsync function. */
#undef HAVE_FSYNC #undef HAVE_FSYNC
/* Define if you have the ftell64 function. */
#undef HAVE_FTELL64
/* Define if you have the ftruncate function. */ /* Define if you have the ftruncate function. */
#undef HAVE_FTRUNCATE #undef HAVE_FTRUNCATE

View File

@ -410,6 +410,12 @@
# endif # endif
#endif #endif
#if defined(HAVE_LONGLONG)
#define SMB_BIG_INTEGER unsigned long long
#else
#define SMB_BIG_INTEGER unsigned long
#endif
#ifndef MIN #ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b))
#endif #endif

View File

@ -160,18 +160,20 @@ int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf); int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
int sys_ftruncate(int fd, SMB_OFF_T offset); int sys_ftruncate(int fd, SMB_OFF_T offset);
SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence); SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
SMB_OFF_T sys_ftell(FILE *fp);
int dos_unlink(char *fname); int dos_unlink(char *fname);
int dos_open(char *fname,int flags,int mode); int dos_open(char *fname,int flags,mode_t mode);
DIR *dos_opendir(char *dname); DIR *dos_opendir(char *dname);
int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf); int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf);
int sys_waitpid(pid_t pid,int *status,int options); int sys_waitpid(pid_t pid,int *status,int options);
int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf); int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
int dos_mkdir(char *dname,int mode); int dos_mkdir(char *dname,mode_t mode);
int dos_rmdir(char *dname); int dos_rmdir(char *dname);
int dos_chdir(char *dname); int dos_chdir(char *dname);
int dos_utime(char *fname,struct utimbuf *times); int dos_utime(char *fname,struct utimbuf *times);
int dos_rename(char *from, char *to); int dos_rename(char *from, char *to);
int dos_chmod(char *fname,int mode); int dos_chmod(char *fname,mode_t mode);
char *dos_getwd(char *s); char *dos_getwd(char *s);
int sys_chown(char *fname,int uid,int gid); int sys_chown(char *fname,int uid,int gid);
int sys_chroot(char *dname); int sys_chroot(char *dname);
@ -1792,7 +1794,7 @@ int reply_nttrans(connection_struct *conn,
void fd_add_to_uid_cache(file_fd_struct *fd_ptr, uid_t u); void fd_add_to_uid_cache(file_fd_struct *fd_ptr, uid_t u);
uint16 fd_attempt_close(file_fd_struct *fd_ptr); uint16 fd_attempt_close(file_fd_struct *fd_ptr);
void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun, void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun,
int mode,int oplock_request, int *Access,int *action); mode_t mode,int oplock_request, int *Access,int *action);
int open_directory(files_struct *fsp,connection_struct *conn, int open_directory(files_struct *fsp,connection_struct *conn,
char *fname, int smb_ofun, int unixmode, int *action); char *fname, int smb_ofun, int unixmode, int *action);
BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op); BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op);

View File

@ -708,8 +708,8 @@ struct passdb_ops {
*/ */
void *(*startsmbpwent)(BOOL); void *(*startsmbpwent)(BOOL);
void (*endsmbpwent)(void *); void (*endsmbpwent)(void *);
unsigned long (*getsmbpwpos)(void *); SMB_BIG_INTEGER (*getsmbpwpos)(void *);
BOOL (*setsmbpwpos)(void *, unsigned long); BOOL (*setsmbpwpos)(void *, SMB_BIG_INTEGER);
/* /*
* smb password database query functions. * smb password database query functions.

View File

@ -31,7 +31,7 @@ static int masked_match(char *tok, char *slash, char *s)
*slash = '/'; *slash = '/';
if (net == INADDR_NONE || if (net == INADDR_NONE ||
(mask = interpret_addr(slash + 1)) == INADDR_NONE) { (mask = interpret_addr(slash + 1)) == INADDR_NONE) {
DEBUG(0,("access: bad net/mask access control: %s", tok)); DEBUG(0,("access: bad net/mask access control: %s\n", tok));
return (False); return (False);
} }
return ((addr & mask) == net); return ((addr & mask) == net);

View File

@ -204,6 +204,32 @@ SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
#endif #endif
} }
/*******************************************************************
An fseek() wrapper that will deal with 64 bit filesizes.
********************************************************************/
int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence)
{
#if defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEK64)
return fseek64(fp, offset, whence);
#else
return fseek(fp, offset, whence);
#endif
}
/*******************************************************************
An ftell() wrapper that will deal with 64 bit filesizes.
********************************************************************/
SMB_OFF_T sys_ftell(FILE *fp)
{
#if defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELL64)
return (SMB_OFF_T)ftell64(fp);
#else
return (SMB_OFF_T)ftell(fp);
#endif
}
/******************************************************************* /*******************************************************************
just a unlink wrapper that calls dos_to_unix. just a unlink wrapper that calls dos_to_unix.
********************************************************************/ ********************************************************************/
@ -216,7 +242,7 @@ int dos_unlink(char *fname)
/******************************************************************* /*******************************************************************
a simple open() wrapper that calls dos_to_unix. a simple open() wrapper that calls dos_to_unix.
********************************************************************/ ********************************************************************/
int dos_open(char *fname,int flags,int mode) int dos_open(char *fname,int flags,mode_t mode)
{ {
return(open(dos_to_unix(fname,False),flags,mode)); return(open(dos_to_unix(fname,False),flags,mode));
} }
@ -261,7 +287,7 @@ int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf)
/******************************************************************* /*******************************************************************
mkdir() gets a wrapper that calls dos_to_unix. mkdir() gets a wrapper that calls dos_to_unix.
********************************************************************/ ********************************************************************/
int dos_mkdir(char *dname,int mode) int dos_mkdir(char *dname,mode_t mode)
{ {
return(mkdir(dos_to_unix(dname,False),mode)); return(mkdir(dos_to_unix(dname,False),mode));
} }
@ -413,7 +439,7 @@ int dos_rename(char *from, char *to)
/******************************************************************* /*******************************************************************
for chmod - call dos_to_unix. for chmod - call dos_to_unix.
********************************************************************/ ********************************************************************/
int dos_chmod(char *fname,int mode) int dos_chmod(char *fname,mode_t mode)
{ {
return(chmod(dos_to_unix(fname,False),mode)); return(chmod(dos_to_unix(fname,False),mode));
} }

View File

@ -313,7 +313,7 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
/*************************************************************************** /***************************************************************************
we use this then we can't do async DNS lookups we use this when we can't do async DNS lookups
****************************************************************************/ ****************************************************************************/
BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question, BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
struct name_record **n) struct name_record **n)

View File

@ -2542,7 +2542,7 @@ char *volume_label(int snum)
/******************************************************************* /*******************************************************************
Set the server type we will announce as via nmbd. Set the server type we will announce as via nmbd.
********************************************************************/ ********************************************************************/
static void set_default_server_announce_type() static void set_default_server_announce_type(void)
{ {
default_server_announce = (SV_TYPE_WORKSTATION | SV_TYPE_SERVER | default_server_announce = (SV_TYPE_WORKSTATION | SV_TYPE_SERVER |
SV_TYPE_SERVER_UNIX | SV_TYPE_PRINTQ_SERVER); SV_TYPE_SERVER_UNIX | SV_TYPE_PRINTQ_SERVER);

View File

@ -893,25 +893,25 @@ static void endldappwent(void *vp)
} }
/************************************************************************* /*************************************************************************
Return the current position in the ldap passwd list as an unsigned long. Return the current position in the ldap passwd list as an SMB_BIG_INTEGER.
This must be treated as an opaque token. This must be treated as an opaque token.
do not call this function directly. use passdb.c instead. do not call this function directly. use passdb.c instead.
*************************************************************************/ *************************************************************************/
static unsigned long getldappwpos(void *vp) static SMB_BIG_INTEGER getldappwpos(void *vp)
{ {
return 0; return 0;
} }
/************************************************************************* /*************************************************************************
Set the current position in the ldap passwd list from unsigned long. Set the current position in the ldap passwd list from SMB_BIG_INTEGER.
This must be treated as an opaque token. This must be treated as an opaque token.
do not call this function directly. use passdb.c instead. do not call this function directly. use passdb.c instead.
*************************************************************************/ *************************************************************************/
static BOOL setldappwpos(void *vp, unsigned long tok) static BOOL setldappwpos(void *vp, SMB_BIG_INTEGER tok)
{ {
return False; return False;
} }

View File

@ -223,25 +223,25 @@ static struct sam_passwd *getnisp21pwent(void *vp)
} }
/************************************************************************* /*************************************************************************
Return the current position in the nisplus passwd list as an unsigned long. Return the current position in the nisplus passwd list as an SMB_BIG_INTEGER.
This must be treated as an opaque token. This must be treated as an opaque token.
do not call this function directly. use passdb.c instead. do not call this function directly. use passdb.c instead.
*************************************************************************/ *************************************************************************/
static unsigned long getnisppwpos(void *vp) static SMB_BIG_INTEGER getnisppwpos(void *vp)
{ {
return 0; return 0;
} }
/************************************************************************* /*************************************************************************
Set the current position in the nisplus passwd list from unsigned long. Set the current position in the nisplus passwd list from SMB_BIG_INTEGER.
This must be treated as an opaque token. This must be treated as an opaque token.
do not call this function directly. use passdb.c instead. do not call this function directly. use passdb.c instead.
*************************************************************************/ *************************************************************************/
static BOOL setnisppwpos(void *vp, unsigned long tok) static BOOL setnisppwpos(void *vp, SMB_BIG_INTEGER tok)
{ {
return False; return False;
} }

View File

@ -399,23 +399,23 @@ static struct sam_passwd *getsmbfile21pwent(void *vp)
} }
/************************************************************************* /*************************************************************************
Return the current position in the smbpasswd list as an unsigned long. Return the current position in the smbpasswd list as an SMB_BIG_INTEGER
This must be treated as an opaque token. This must be treated as an opaque token.
*************************************************************************/ *************************************************************************/
static unsigned long getsmbfilepwpos(void *vp) static SMB_BIG_INTEGER getsmbfilepwpos(void *vp)
{ {
return (unsigned long)ftell((FILE *)vp); return (SMB_BIG_INTEGER)sys_ftell((FILE *)vp);
} }
/************************************************************************* /*************************************************************************
Set the current position in the smbpasswd list from unsigned long. Set the current position in the smbpasswd list from an SMB_BIG_INTEGER.
This must be treated as an opaque token. This must be treated as an opaque token.
*************************************************************************/ *************************************************************************/
static BOOL setsmbfilepwpos(void *vp, unsigned long tok) static BOOL setsmbfilepwpos(void *vp, SMB_BIG_INTEGER tok)
{ {
return !fseek((FILE *)vp, tok, SEEK_SET); return !sys_fseek((FILE *)vp, (SMB_OFF_T)tok, SEEK_SET);
} }
/************************************************************************ /************************************************************************
@ -609,7 +609,7 @@ static BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
* Scan the file, a line at a time and check if the name matches. * Scan the file, a line at a time and check if the name matches.
*/ */
while (!feof(fp)) { while (!feof(fp)) {
pwd_seekpos = (SMB_OFF_T)ftell(fp); pwd_seekpos = sys_ftell(fp);
linebuf[0] = '\0'; linebuf[0] = '\0';

View File

@ -219,7 +219,7 @@ BOOL get_trust_account_password( unsigned char *ret_pwd, time_t *pass_last_set_t
*pass_last_set_time = (time_t)0; *pass_last_set_time = (time_t)0;
memset(ret_pwd, '\0', 16); memset(ret_pwd, '\0', 16);
if(fseek( mach_passwd_fp, 0L, SEEK_SET) == -1) { if(sys_fseek( mach_passwd_fp, (SMB_OFF_T)0, SEEK_SET) == -1) {
DEBUG(0,("get_trust_account_password: Failed to seek to start of file. Error was %s.\n", DEBUG(0,("get_trust_account_password: Failed to seek to start of file. Error was %s.\n",
strerror(errno) )); strerror(errno) ));
return False; return False;
@ -298,7 +298,7 @@ BOOL set_trust_account_password( unsigned char *md4_new_pwd)
char linebuf[64]; char linebuf[64];
int i; int i;
if(fseek( mach_passwd_fp, 0L, SEEK_SET) == -1) { if(sys_fseek( mach_passwd_fp, (SMB_OFF_T)0, SEEK_SET) == -1) {
DEBUG(0,("set_trust_account_password: Failed to seek to start of file. Error was %s.\n", DEBUG(0,("set_trust_account_password: Failed to seek to start of file. Error was %s.\n",
strerror(errno) )); strerror(errno) ));
return False; return False;

View File

@ -302,12 +302,12 @@ static BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequenc
/* allocate a pseudo-terminal device */ /* allocate a pseudo-terminal device */
if ((master = findpty (&slavedev)) < 0) { if ((master = findpty (&slavedev)) < 0) {
DEBUG(3,("Cannot Allocate pty for password change: %s",name)); DEBUG(3,("Cannot Allocate pty for password change: %s\n",name));
return(False); return(False);
} }
if ((pid = fork()) < 0) { if ((pid = fork()) < 0) {
DEBUG(3,("Cannot fork() child for password change: %s",name)); DEBUG(3,("Cannot fork() child for password change: %s\n",name));
close(master); close(master);
return(False); return(False);
} }

View File

@ -144,7 +144,7 @@ int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *
SMB_STRUCT_STAT st1; SMB_STRUCT_STAT st1;
int mask=0; int mask=0;
int tmp; int tmp;
int unixmode; mode_t unixmode;
if (!st) { if (!st) {
st = &st1; st = &st1;

View File

@ -784,7 +784,7 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn,
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
char *QueueName = p; char *QueueName = p;
int uLevel,cbBuf; int uLevel;
int count=0; int count=0;
int snum; int snum;
char* str3; char* str3;
@ -797,7 +797,6 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn,
p = skip_string(p,1); p = skip_string(p,1);
uLevel = SVAL(p,0); uLevel = SVAL(p,0);
cbBuf = SVAL(p,2);
str3 = p + 4; str3 = p + 4;
/* remove any trailing username */ /* remove any trailing username */
@ -2670,7 +2669,7 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para
char *str1 = param+2; char *str1 = param+2;
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
int uLevel,cbBuf; int uLevel;
int count; int count;
int i; int i;
int snum; int snum;
@ -2680,7 +2679,6 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para
print_status_struct status; print_status_struct status;
uLevel = SVAL(p,2); uLevel = SVAL(p,2);
cbBuf = SVAL(p,4);
bzero(&desc,sizeof(desc)); bzero(&desc,sizeof(desc));
bzero(&status,sizeof(status)); bzero(&status,sizeof(status));
@ -2735,7 +2733,7 @@ static BOOL api_WPrintJobEnumerate(connection_struct *conn,uint16 vuid, char *pa
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
char* name = p; char* name = p;
int uLevel,cbBuf; int uLevel;
int count; int count;
int i, succnt=0; int i, succnt=0;
int snum; int snum;
@ -2748,7 +2746,6 @@ static BOOL api_WPrintJobEnumerate(connection_struct *conn,uint16 vuid, char *pa
p = skip_string(p,1); p = skip_string(p,1);
uLevel = SVAL(p,0); uLevel = SVAL(p,0);
cbBuf = SVAL(p,2);
DEBUG(3,("WPrintJobEnumerate uLevel=%d name=%s\n",uLevel,name)); DEBUG(3,("WPrintJobEnumerate uLevel=%d name=%s\n",uLevel,name));
@ -2853,7 +2850,7 @@ static BOOL api_WPrintDestGetInfo(connection_struct *conn,uint16 vuid, char *par
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
char* PrinterName = p; char* PrinterName = p;
int uLevel,cbBuf; int uLevel;
struct pack_desc desc; struct pack_desc desc;
int snum; int snum;
@ -2861,7 +2858,6 @@ static BOOL api_WPrintDestGetInfo(connection_struct *conn,uint16 vuid, char *par
p = skip_string(p,1); p = skip_string(p,1);
uLevel = SVAL(p,0); uLevel = SVAL(p,0);
cbBuf = SVAL(p,2);
DEBUG(3,("WPrintDestGetInfo uLevel=%d PrinterName=%s\n",uLevel,PrinterName)); DEBUG(3,("WPrintDestGetInfo uLevel=%d PrinterName=%s\n",uLevel,PrinterName));
@ -2911,7 +2907,7 @@ static BOOL api_WPrintDestEnum(connection_struct *conn,uint16 vuid, char *param,
char *str1 = param+2; char *str1 = param+2;
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
int uLevel,cbBuf; int uLevel;
int queuecnt; int queuecnt;
int i, n, succnt=0; int i, n, succnt=0;
struct pack_desc desc; struct pack_desc desc;
@ -2920,7 +2916,6 @@ static BOOL api_WPrintDestEnum(connection_struct *conn,uint16 vuid, char *param,
bzero(&desc,sizeof(desc)); bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0); uLevel = SVAL(p,0);
cbBuf = SVAL(p,2);
DEBUG(3,("WPrintDestEnum uLevel=%d\n",uLevel)); DEBUG(3,("WPrintDestEnum uLevel=%d\n",uLevel));
@ -2969,14 +2964,13 @@ static BOOL api_WPrintDriverEnum(connection_struct *conn,uint16 vuid, char *para
char *str1 = param+2; char *str1 = param+2;
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
int uLevel,cbBuf; int uLevel;
int succnt; int succnt;
struct pack_desc desc; struct pack_desc desc;
bzero(&desc,sizeof(desc)); bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0); uLevel = SVAL(p,0);
cbBuf = SVAL(p,2);
DEBUG(3,("WPrintDriverEnum uLevel=%d\n",uLevel)); DEBUG(3,("WPrintDriverEnum uLevel=%d\n",uLevel));
@ -3014,14 +3008,13 @@ static BOOL api_WPrintQProcEnum(connection_struct *conn,uint16 vuid, char *param
char *str1 = param+2; char *str1 = param+2;
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
int uLevel,cbBuf; int uLevel;
int succnt; int succnt;
struct pack_desc desc; struct pack_desc desc;
bzero(&desc,sizeof(desc)); bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0); uLevel = SVAL(p,0);
cbBuf = SVAL(p,2);
DEBUG(3,("WPrintQProcEnum uLevel=%d\n",uLevel)); DEBUG(3,("WPrintQProcEnum uLevel=%d\n",uLevel));
@ -3060,14 +3053,13 @@ static BOOL api_WPrintPortEnum(connection_struct *conn,uint16 vuid, char *param,
char *str1 = param+2; char *str1 = param+2;
char *str2 = skip_string(str1,1); char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1); char *p = skip_string(str2,1);
int uLevel,cbBuf; int uLevel;
int succnt; int succnt;
struct pack_desc desc; struct pack_desc desc;
bzero(&desc,sizeof(desc)); bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0); uLevel = SVAL(p,0);
cbBuf = SVAL(p,2);
DEBUG(3,("WPrintPortEnum uLevel=%d\n",uLevel)); DEBUG(3,("WPrintPortEnum uLevel=%d\n",uLevel));

View File

@ -417,8 +417,9 @@ int reply_ntcreate_and_X(connection_struct *conn,
/* Breakout the oplock request bits so we can set the /* Breakout the oplock request bits so we can set the
reply bits separately. */ reply bits separately. */
int oplock_request = 0; int oplock_request = 0;
int unixmode, pnum = -1; mode_t unixmode;
int fmode=0,mtime=0,rmode=0; int pnum = -1;
int fmode=0,rmode=0;
SMB_OFF_T file_len = 0; SMB_OFF_T file_len = 0;
SMB_STRUCT_STAT sbuf; SMB_STRUCT_STAT sbuf;
int smb_action = 0; int smb_action = 0;
@ -619,7 +620,6 @@ int reply_ntcreate_and_X(connection_struct *conn,
fmode = dos_mode(conn,fname,&sbuf); fmode = dos_mode(conn,fname,&sbuf);
if(fmode == 0) if(fmode == 0)
fmode = FILE_ATTRIBUTE_NORMAL; fmode = FILE_ATTRIBUTE_NORMAL;
mtime = sbuf.st_mtime;
if (!fsp->is_directory && (fmode & aDIR)) { if (!fsp->is_directory && (fmode & aDIR)) {
close_file(fsp,False); close_file(fsp,False);
return(ERROR(ERRDOS,ERRnoaccess)); return(ERROR(ERRDOS,ERRnoaccess));
@ -710,7 +710,8 @@ static int call_nt_transact_create(connection_struct *conn,
/* Breakout the oplock request bits so we can set the /* Breakout the oplock request bits so we can set the
reply bits separately. */ reply bits separately. */
int oplock_request = 0; int oplock_request = 0;
int unixmode, pnum = -1; mode_t unixmode;
int pnum = -1;
int fmode=0,mtime=0,rmode=0; int fmode=0,mtime=0,rmode=0;
off_t file_len = 0; off_t file_len = 0;
SMB_STRUCT_STAT sbuf; SMB_STRUCT_STAT sbuf;

View File

@ -31,7 +31,7 @@ extern uint16 oplock_port;
/**************************************************************************** /****************************************************************************
fd support routines - attempt to do a dos_open fd support routines - attempt to do a dos_open
****************************************************************************/ ****************************************************************************/
static int fd_attempt_open(char *fname, int flags, int mode) static int fd_attempt_open(char *fname, int flags, mode_t mode)
{ {
int fd = dos_open(fname,flags,mode); int fd = dos_open(fname,flags,mode);
@ -125,7 +125,7 @@ static BOOL fd_is_in_uid_cache(file_fd_struct *fd_ptr, uid_t u)
fd support routines - attempt to re-open an already open fd as O_RDWR. fd support routines - attempt to re-open an already open fd as O_RDWR.
Save the already open fd (we cannot close due to POSIX file locking braindamage. 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) static void fd_attempt_reopen(char *fname, mode_t mode, file_fd_struct *fd_ptr)
{ {
int fd = dos_open( fname, O_RDWR, mode); int fd = dos_open( fname, O_RDWR, mode);
@ -268,7 +268,7 @@ static void check_for_pipe(char *fname)
open a file open a file
****************************************************************************/ ****************************************************************************/
static void open_file(files_struct *fsp,connection_struct *conn, static void open_file(files_struct *fsp,connection_struct *conn,
char *fname1,int flags,int mode, SMB_STRUCT_STAT *sbuf) char *fname1,int flags,mode_t mode, SMB_STRUCT_STAT *sbuf)
{ {
extern struct current_user current_user; extern struct current_user current_user;
pstring fname; pstring fname;
@ -688,7 +688,7 @@ static int check_share_mode( share_mode_entry *share, int deny_mode,
open a file with a share mode open a file with a share mode
****************************************************************************/ ****************************************************************************/
void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun, void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun,
int mode,int oplock_request, int *Access,int *action) mode_t mode,int oplock_request, int *Access,int *action)
{ {
int flags=0; int flags=0;
int flags2=0; int flags2=0;
@ -865,7 +865,7 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
} }
DEBUG(4,("calling open_file with flags=0x%X flags2=0x%X mode=0%o\n", DEBUG(4,("calling open_file with flags=0x%X flags2=0x%X mode=0%o\n",
flags,flags2,mode)); flags,flags2,(int)mode));
open_file(fsp,conn,fname,flags|(flags2&~(O_TRUNC)),mode,file_existed ? &sbuf : 0); open_file(fsp,conn,fname,flags|(flags2&~(O_TRUNC)),mode,file_existed ? &sbuf : 0);
if (!fsp->open && flags==O_RDWR && errno!=ENOENT && fcbopen) if (!fsp->open && flags==O_RDWR && errno!=ENOENT && fcbopen)

View File

@ -119,7 +119,6 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
int smb_mincnt = SVAL(inbuf,smb_vwv6); int smb_mincnt = SVAL(inbuf,smb_vwv6);
int nread = -1; int nread = -1;
char *data; char *data;
BOOL ok = False;
if (!p) return(ERROR(ERRDOS,ERRbadfid)); if (!p) return(ERROR(ERRDOS,ERRbadfid));
@ -128,8 +127,6 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
nread = read_pipe(p, data, smb_offs, smb_maxcnt); nread = read_pipe(p, data, smb_offs, smb_maxcnt);
ok = True;
if (nread < 0) if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));

View File

@ -453,9 +453,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
int gid; int gid;
int uid; int uid;
int smb_bufsize; int smb_bufsize;
int smb_mpxmax;
int smb_vc_num;
uint32 smb_sesskey;
int smb_apasslen = 0; int smb_apasslen = 0;
pstring smb_apasswd; pstring smb_apasswd;
int smb_ntpasslen = 0; int smb_ntpasslen = 0;
@ -472,9 +469,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
*smb_ntpasswd = 0; *smb_ntpasswd = 0;
smb_bufsize = SVAL(inbuf,smb_vwv2); smb_bufsize = SVAL(inbuf,smb_vwv2);
smb_mpxmax = SVAL(inbuf,smb_vwv3);
smb_vc_num = SVAL(inbuf,smb_vwv4);
smb_sesskey = IVAL(inbuf,smb_vwv5);
if (Protocol < PROTOCOL_NT1) { if (Protocol < PROTOCOL_NT1) {
smb_apasslen = SVAL(inbuf,smb_vwv7); smb_apasslen = SVAL(inbuf,smb_vwv7);
@ -1247,7 +1241,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
int share_mode; int share_mode;
SMB_OFF_T size = 0; SMB_OFF_T size = 0;
time_t mtime=0; time_t mtime=0;
int unixmode; mode_t unixmode;
int rmode=0; int rmode=0;
SMB_STRUCT_STAT sbuf; SMB_STRUCT_STAT sbuf;
BOOL bad_path = False; BOOL bad_path = False;
@ -1344,7 +1338,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
uint32 smb_time = make_unix_date3(inbuf+smb_vwv6); uint32 smb_time = make_unix_date3(inbuf+smb_vwv6);
#endif #endif
int smb_ofun = SVAL(inbuf,smb_vwv8); int smb_ofun = SVAL(inbuf,smb_vwv8);
int unixmode; mode_t unixmode;
SMB_OFF_T size=0; SMB_OFF_T size=0;
int fmode=0,mtime=0,rmode=0; int fmode=0,mtime=0,rmode=0;
SMB_STRUCT_STAT sbuf; SMB_STRUCT_STAT sbuf;
@ -1770,8 +1764,6 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
SMB_OFF_T startpos; SMB_OFF_T startpos;
char *header = outbuf; char *header = outbuf;
ssize_t ret=0; ssize_t ret=0;
int fd;
char *fname;
files_struct *fsp; files_struct *fsp;
/* /*
@ -1818,12 +1810,8 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
_smb_setlen(header,0); _smb_setlen(header,0);
transfer_file(0,Client,(SMB_OFF_T)0,header,4,0); transfer_file(0,Client,(SMB_OFF_T)0,header,4,0);
return(-1); return(-1);
} else {
fd = fsp->fd_ptr->fd;
fname = fsp->fsp_name;
} }
if (!is_locked(fsp,conn,maxcount,startpos, F_RDLCK)) if (!is_locked(fsp,conn,maxcount,startpos, F_RDLCK))
{ {
SMB_OFF_T size = fsp->size; SMB_OFF_T size = fsp->size;
@ -1855,19 +1843,19 @@ 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(fd,startpos,header+4,NULL,nread); predict = read_predict(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)
seek_file(fsp,startpos + predict); seek_file(fsp,startpos + predict);
ret = (ssize_t)transfer_file(fd,Client,(SMB_OFF_T)(nread-predict),header,4+predict, ret = (ssize_t)transfer_file(fsp->fd_ptr->fd,Client,(SMB_OFF_T)(nread-predict),header,4+predict,
startpos+predict); startpos+predict);
} }
if (ret != nread+4) if (ret != nread+4)
DEBUG(0,("ERROR: file read failure on %s at %d for %d bytes (%d)\n", DEBUG(0,("ERROR: file read failure on %s at %d for %d bytes (%d)\n",
fname,startpos,nread,ret)); fsp->fsp_name,startpos,nread,ret));
#else /* UNSAFE_READRAW */ #else /* UNSAFE_READRAW */
ret = read_file(fsp,header+4,startpos,nread); ret = read_file(fsp,header+4,startpos,nread);
@ -1993,7 +1981,6 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
size_t smb_mincnt = SVAL(inbuf,smb_vwv6); size_t smb_mincnt = SVAL(inbuf,smb_vwv6);
ssize_t nread = -1; ssize_t nread = -1;
char *data; char *data;
BOOL ok = False;
/* If it's an IPC, pass off the pipe handler. */ /* If it's an IPC, pass off the pipe handler. */
if (IS_IPC(conn)) if (IS_IPC(conn))
@ -2018,7 +2005,6 @@ 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,startpos,smb_maxcnt);
ok = True;
if (nread < 0) if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess)); return(UNIXERROR(ERRDOS,ERRnoaccess));
@ -2718,9 +2704,6 @@ int reply_printqueue(connection_struct *conn,
int outsize = set_message(outbuf,2,3,True); int outsize = set_message(outbuf,2,3,True);
int max_count = SVAL(inbuf,smb_vwv0); int max_count = SVAL(inbuf,smb_vwv0);
int start_index = SVAL(inbuf,smb_vwv1); int start_index = SVAL(inbuf,smb_vwv1);
uint16 vuid;
vuid = SVAL(inbuf,smb_uid);
/* we used to allow the client to get the cnum wrong, but that /* we used to allow the client to get the cnum wrong, but that
is really quite gross and only worked when there was only is really quite gross and only worked when there was only
@ -3722,7 +3705,7 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length,
char *data; char *data;
SMB_OFF_T startpos; SMB_OFF_T startpos;
int outsize; int outsize;
size_t mincount, maxcount; size_t maxcount;
int max_per_packet; int max_per_packet;
size_t tcount; size_t tcount;
int pad; int pad;
@ -3740,7 +3723,6 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length,
startpos = IVAL(inbuf,smb_vwv1); startpos = IVAL(inbuf,smb_vwv1);
maxcount = SVAL(inbuf,smb_vwv3); maxcount = SVAL(inbuf,smb_vwv3);
mincount = SVAL(inbuf,smb_vwv4);
data = smb_buf(outbuf); data = smb_buf(outbuf);
pad = ((long)data)%4; pad = ((long)data)%4;

View File

@ -199,7 +199,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf,
int16 namelen = strlen(pname)+1; int16 namelen = strlen(pname)+1;
pstring fname; pstring fname;
int unixmode; mode_t unixmode;
SMB_OFF_T size=0; SMB_OFF_T size=0;
int fmode=0,mtime=0,rmode; int fmode=0,mtime=0,rmode;
SMB_INO_T inode = 0; SMB_INO_T inode = 0;
@ -307,14 +307,13 @@ static int get_lanman2_dir_entry(connection_struct *conn,
pstring mask; pstring mask;
pstring pathreal; pstring pathreal;
pstring fname; pstring fname;
BOOL matched;
char *p, *pdata = *ppdata; char *p, *pdata = *ppdata;
uint32 reskey=0; uint32 reskey=0;
int prev_dirpos=0; int prev_dirpos=0;
int mode=0; int mode=0;
SMB_OFF_T size = 0; SMB_OFF_T size = 0;
uint32 len; uint32 len;
uint32 mdate=0, adate=0, cdate=0; time_t mdate=0, adate=0, cdate=0;
char *nameptr; char *nameptr;
BOOL isrootdir = (strequal(conn->dirpath,"./") || BOOL isrootdir = (strequal(conn->dirpath,"./") ||
strequal(conn->dirpath,".") || strequal(conn->dirpath,".") ||
@ -361,8 +360,6 @@ static int get_lanman2_dir_entry(connection_struct *conn,
if (!dname) if (!dname)
return(False); return(False);
matched = False;
pstrcpy(fname,dname); pstrcpy(fname,dname);
if(mask_match(fname, mask, case_sensitive, True)) if(mask_match(fname, mask, case_sensitive, True))