summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/configure.in4
-rw-r--r--source3/include/config.h.in6
-rw-r--r--source3/include/includes.h6
-rw-r--r--source3/include/proto.h10
-rw-r--r--source3/include/smb.h4
-rw-r--r--source3/lib/access.c2
-rw-r--r--source3/lib/system.c32
-rw-r--r--source3/nmbd/asyncdns.c2
-rw-r--r--source3/param/loadparm.c2
-rw-r--r--source3/passdb/ldap.c8
-rw-r--r--source3/passdb/nispass.c8
-rw-r--r--source3/passdb/smbpass.c14
-rw-r--r--source3/passdb/smbpassfile.c4
-rw-r--r--source3/smbd/chgpasswd.c4
-rw-r--r--source3/smbd/dosmode.c2
-rw-r--r--source3/smbd/ipc.c24
-rw-r--r--source3/smbd/nttrans.c9
-rw-r--r--source3/smbd/open.c10
-rw-r--r--source3/smbd/pipes.c3
-rw-r--r--source3/smbd/reply.c30
-rw-r--r--source3/smbd/trans2.c7
21 files changed, 100 insertions, 91 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 8656eed90d..543450f0f6 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -36,7 +36,7 @@ AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
-AC_CHECK_HEADERS(stropts.h poll.h)
+AC_CHECK_HEADERS(stropts.h poll.h )
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
@@ -163,7 +163,7 @@ AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
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(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"
AC_TRY_RUN([#include <stdio.h>
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index 615666b7ff..2934d438dc 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -154,6 +154,9 @@
/* Define if you have the execl function. */
#undef HAVE_EXECL
+/* Define if you have the fseek64 function. */
+#undef HAVE_FSEEK64
+
/* Define if you have the fstat function. */
#undef HAVE_FSTAT
@@ -163,6 +166,9 @@
/* Define if you have the fsync function. */
#undef HAVE_FSYNC
+/* Define if you have the ftell64 function. */
+#undef HAVE_FTELL64
+
/* Define if you have the ftruncate function. */
#undef HAVE_FTRUNCATE
diff --git a/source3/include/includes.h b/source3/include/includes.h
index f0271906a5..d8da84bd4e 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -410,6 +410,12 @@
# endif
#endif
+#if defined(HAVE_LONGLONG)
+#define SMB_BIG_INTEGER unsigned long long
+#else
+#define SMB_BIG_INTEGER unsigned long
+#endif
+
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f2b74b4076..6ddc92824d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -160,18 +160,20 @@ int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
int sys_ftruncate(int fd, SMB_OFF_T offset);
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_open(char *fname,int flags,int mode);
+int dos_open(char *fname,int flags,mode_t mode);
DIR *dos_opendir(char *dname);
int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf);
int sys_waitpid(pid_t pid,int *status,int options);
int 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_chdir(char *dname);
int dos_utime(char *fname,struct utimbuf *times);
int dos_rename(char *from, char *to);
-int dos_chmod(char *fname,int mode);
+int dos_chmod(char *fname,mode_t mode);
char *dos_getwd(char *s);
int sys_chown(char *fname,int uid,int gid);
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);
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,
- 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,
char *fname, int smb_ofun, int unixmode, int *action);
BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 412b1f3383..aa963f9163 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -708,8 +708,8 @@ struct passdb_ops {
*/
void *(*startsmbpwent)(BOOL);
void (*endsmbpwent)(void *);
- unsigned long (*getsmbpwpos)(void *);
- BOOL (*setsmbpwpos)(void *, unsigned long);
+ SMB_BIG_INTEGER (*getsmbpwpos)(void *);
+ BOOL (*setsmbpwpos)(void *, SMB_BIG_INTEGER);
/*
* smb password database query functions.
diff --git a/source3/lib/access.c b/source3/lib/access.c
index 2e1eb8df55..31f9db4e55 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -31,7 +31,7 @@ static int masked_match(char *tok, char *slash, char *s)
*slash = '/';
if (net == 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 ((addr & mask) == net);
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 215bfd0c1d..c3d97e0350 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -205,6 +205,32 @@ SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
}
/*******************************************************************
+ 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.
********************************************************************/
int dos_unlink(char *fname)
@@ -216,7 +242,7 @@ int dos_unlink(char *fname)
/*******************************************************************
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));
}
@@ -261,7 +287,7 @@ int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf)
/*******************************************************************
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));
}
@@ -413,7 +439,7 @@ int dos_rename(char *from, char *to)
/*******************************************************************
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));
}
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 8f28f515ea..3054ad7353 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -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,
struct name_record **n)
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index c8ab2d411b..276cb13c8e 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -2542,7 +2542,7 @@ char *volume_label(int snum)
/*******************************************************************
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 |
SV_TYPE_SERVER_UNIX | SV_TYPE_PRINTQ_SERVER);
diff --git a/source3/passdb/ldap.c b/source3/passdb/ldap.c
index ea25f48605..e58e339df6 100644
--- a/source3/passdb/ldap.c
+++ b/source3/passdb/ldap.c
@@ -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.
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;
}
/*************************************************************************
- 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.
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;
}
diff --git a/source3/passdb/nispass.c b/source3/passdb/nispass.c
index d397f1bf40..50b7dd2a2e 100644
--- a/source3/passdb/nispass.c
+++ b/source3/passdb/nispass.c
@@ -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.
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;
}
/*************************************************************************
- 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.
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;
}
diff --git a/source3/passdb/smbpass.c b/source3/passdb/smbpass.c
index f758b7bbc4..34de513476 100644
--- a/source3/passdb/smbpass.c
+++ b/source3/passdb/smbpass.c
@@ -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.
*************************************************************************/
-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.
*************************************************************************/
-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.
*/
while (!feof(fp)) {
- pwd_seekpos = (SMB_OFF_T)ftell(fp);
+ pwd_seekpos = sys_ftell(fp);
linebuf[0] = '\0';
diff --git a/source3/passdb/smbpassfile.c b/source3/passdb/smbpassfile.c
index dcb69eb43a..8542ad081d 100644
--- a/source3/passdb/smbpassfile.c
+++ b/source3/passdb/smbpassfile.c
@@ -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;
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",
strerror(errno) ));
return False;
@@ -298,7 +298,7 @@ BOOL set_trust_account_password( unsigned char *md4_new_pwd)
char linebuf[64];
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",
strerror(errno) ));
return False;
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 68cbe9b35b..4dc6d29e3c 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -302,12 +302,12 @@ static BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequenc
/* allocate a pseudo-terminal device */
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);
}
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);
return(False);
}
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 1336e27281..c2c9cc2373 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -144,7 +144,7 @@ int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *
SMB_STRUCT_STAT st1;
int mask=0;
int tmp;
- int unixmode;
+ mode_t unixmode;
if (!st) {
st = &st1;
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 61d9aa8bdd..ce300dc810 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -784,7 +784,7 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn,
char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
char *QueueName = p;
- int uLevel,cbBuf;
+ int uLevel;
int count=0;
int snum;
char* str3;
@@ -797,7 +797,6 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn,
p = skip_string(p,1);
uLevel = SVAL(p,0);
- cbBuf = SVAL(p,2);
str3 = p + 4;
/* remove any trailing username */
@@ -2670,7 +2669,7 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para
char *str1 = param+2;
char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
- int uLevel,cbBuf;
+ int uLevel;
int count;
int i;
int snum;
@@ -2680,7 +2679,6 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para
print_status_struct status;
uLevel = SVAL(p,2);
- cbBuf = SVAL(p,4);
bzero(&desc,sizeof(desc));
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 *p = skip_string(str2,1);
char* name = p;
- int uLevel,cbBuf;
+ int uLevel;
int count;
int i, succnt=0;
int snum;
@@ -2748,7 +2746,6 @@ static BOOL api_WPrintJobEnumerate(connection_struct *conn,uint16 vuid, char *pa
p = skip_string(p,1);
uLevel = SVAL(p,0);
- cbBuf = SVAL(p,2);
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 *p = skip_string(str2,1);
char* PrinterName = p;
- int uLevel,cbBuf;
+ int uLevel;
struct pack_desc desc;
int snum;
@@ -2861,7 +2858,6 @@ static BOOL api_WPrintDestGetInfo(connection_struct *conn,uint16 vuid, char *par
p = skip_string(p,1);
uLevel = SVAL(p,0);
- cbBuf = SVAL(p,2);
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 *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
- int uLevel,cbBuf;
+ int uLevel;
int queuecnt;
int i, n, succnt=0;
struct pack_desc desc;
@@ -2920,7 +2916,6 @@ static BOOL api_WPrintDestEnum(connection_struct *conn,uint16 vuid, char *param,
bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0);
- cbBuf = SVAL(p,2);
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 *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
- int uLevel,cbBuf;
+ int uLevel;
int succnt;
struct pack_desc desc;
bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0);
- cbBuf = SVAL(p,2);
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 *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
- int uLevel,cbBuf;
+ int uLevel;
int succnt;
struct pack_desc desc;
bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0);
- cbBuf = SVAL(p,2);
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 *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
- int uLevel,cbBuf;
+ int uLevel;
int succnt;
struct pack_desc desc;
bzero(&desc,sizeof(desc));
uLevel = SVAL(p,0);
- cbBuf = SVAL(p,2);
DEBUG(3,("WPrintPortEnum uLevel=%d\n",uLevel));
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 95adc5ccb7..d6d60c45cd 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -417,8 +417,9 @@ int reply_ntcreate_and_X(connection_struct *conn,
/* Breakout the oplock request bits so we can set the
reply bits separately. */
int oplock_request = 0;
- int unixmode, pnum = -1;
- int fmode=0,mtime=0,rmode=0;
+ mode_t unixmode;
+ int pnum = -1;
+ int fmode=0,rmode=0;
SMB_OFF_T file_len = 0;
SMB_STRUCT_STAT sbuf;
int smb_action = 0;
@@ -619,7 +620,6 @@ int reply_ntcreate_and_X(connection_struct *conn,
fmode = dos_mode(conn,fname,&sbuf);
if(fmode == 0)
fmode = FILE_ATTRIBUTE_NORMAL;
- mtime = sbuf.st_mtime;
if (!fsp->is_directory && (fmode & aDIR)) {
close_file(fsp,False);
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
reply bits separately. */
int oplock_request = 0;
- int unixmode, pnum = -1;
+ mode_t unixmode;
+ int pnum = -1;
int fmode=0,mtime=0,rmode=0;
off_t file_len = 0;
SMB_STRUCT_STAT sbuf;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 42b0fba425..ad4dd9f52f 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -31,7 +31,7 @@ extern uint16 oplock_port;
/****************************************************************************
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);
@@ -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.
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);
@@ -268,7 +268,7 @@ static void check_for_pipe(char *fname)
open a file
****************************************************************************/
static void open_file(files_struct *fsp,connection_struct *conn,
- char *fname1,int flags,int mode, SMB_STRUCT_STAT *sbuf)
+ char *fname1,int flags,mode_t mode, SMB_STRUCT_STAT *sbuf)
{
extern struct current_user current_user;
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
****************************************************************************/
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 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",
- flags,flags2,mode));
+ flags,flags2,(int)mode));
open_file(fsp,conn,fname,flags|(flags2&~(O_TRUNC)),mode,file_existed ? &sbuf : 0);
if (!fsp->open && flags==O_RDWR && errno!=ENOENT && fcbopen)
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 97df3abfc3..15d395b29a 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -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 nread = -1;
char *data;
- BOOL ok = False;
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);
- ok = True;
-
if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess));
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 38c39efad6..d7f29b60c6 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -453,9 +453,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
int gid;
int uid;
int smb_bufsize;
- int smb_mpxmax;
- int smb_vc_num;
- uint32 smb_sesskey;
int smb_apasslen = 0;
pstring smb_apasswd;
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_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) {
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;
SMB_OFF_T size = 0;
time_t mtime=0;
- int unixmode;
+ mode_t unixmode;
int rmode=0;
SMB_STRUCT_STAT sbuf;
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);
#endif
int smb_ofun = SVAL(inbuf,smb_vwv8);
- int unixmode;
+ mode_t unixmode;
SMB_OFF_T size=0;
int fmode=0,mtime=0,rmode=0;
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;
char *header = outbuf;
ssize_t ret=0;
- int fd;
- char *fname;
files_struct *fsp;
/*
@@ -1818,12 +1810,8 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
_smb_setlen(header,0);
transfer_file(0,Client,(SMB_OFF_T)0,header,4,0);
return(-1);
- } else {
- fd = fsp->fd_ptr->fd;
- fname = fsp->fsp_name;
}
-
if (!is_locked(fsp,conn,maxcount,startpos, F_RDLCK))
{
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 (!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 */
if ((nread-predict) > 0)
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);
}
if (ret != nread+4)
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 */
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);
ssize_t nread = -1;
char *data;
- BOOL ok = False;
/* If it's an IPC, pass off the pipe handler. */
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))
return(ERROR(ERRDOS,ERRlock));
nread = read_file(fsp,data,startpos,smb_maxcnt);
- ok = True;
if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess));
@@ -2718,9 +2704,6 @@ int reply_printqueue(connection_struct *conn,
int outsize = set_message(outbuf,2,3,True);
int max_count = SVAL(inbuf,smb_vwv0);
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
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;
SMB_OFF_T startpos;
int outsize;
- size_t mincount, maxcount;
+ size_t maxcount;
int max_per_packet;
size_t tcount;
int pad;
@@ -3740,7 +3723,6 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length,
startpos = IVAL(inbuf,smb_vwv1);
maxcount = SVAL(inbuf,smb_vwv3);
- mincount = SVAL(inbuf,smb_vwv4);
data = smb_buf(outbuf);
pad = ((long)data)%4;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 87d1ea27d0..fb93fd9e10 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -199,7 +199,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf,
int16 namelen = strlen(pname)+1;
pstring fname;
- int unixmode;
+ mode_t unixmode;
SMB_OFF_T size=0;
int fmode=0,mtime=0,rmode;
SMB_INO_T inode = 0;
@@ -307,14 +307,13 @@ static int get_lanman2_dir_entry(connection_struct *conn,
pstring mask;
pstring pathreal;
pstring fname;
- BOOL matched;
char *p, *pdata = *ppdata;
uint32 reskey=0;
int prev_dirpos=0;
int mode=0;
SMB_OFF_T size = 0;
uint32 len;
- uint32 mdate=0, adate=0, cdate=0;
+ time_t mdate=0, adate=0, cdate=0;
char *nameptr;
BOOL isrootdir = (strequal(conn->dirpath,"./") ||
strequal(conn->dirpath,".") ||
@@ -361,8 +360,6 @@ static int get_lanman2_dir_entry(connection_struct *conn,
if (!dname)
return(False);
- matched = False;
-
pstrcpy(fname,dname);
if(mask_match(fname, mask, case_sensitive, True))