summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/ipc.c8
-rw-r--r--source3/smbd/password.c6
-rw-r--r--source3/smbd/quotas.c55
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/smbd/server.c2
5 files changed, 53 insertions, 22 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 34210f2db7..3b2c55dc46 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -467,7 +467,7 @@ static void fill_printjob_info(int cnum, int snum, int uLevel,
time_t t = queue->time;
/* the client expects localtime */
- t += GMT_TO_LOCAL*TimeDiff(t);
+ t -= TimeDiff(t);
PACKI(desc,"W",((snum%0xFF)<<8) | (queue->job%0xFF)); /* uJobId */
if (uLevel == 1) {
@@ -479,7 +479,7 @@ static void fill_printjob_info(int cnum, int snum, int uLevel,
PACKI(desc,"W",n+1); /* uPosition */
PACKI(desc,"W",queue->status); /* fsStatus */
PACKS(desc,"z",""); /* pszStatus */
- PACKI(desc,"D",queue->time); /* ulSubmitted */
+ PACKI(desc,"D",t); /* ulSubmitted */
PACKI(desc,"D",queue->size); /* ulSize */
PACKS(desc,"z",queue->file); /* pszComment */
}
@@ -488,7 +488,7 @@ static void fill_printjob_info(int cnum, int snum, int uLevel,
PACKS(desc,"z",queue->user); /* pszUserName */
PACKI(desc,"W",n+1); /* uPosition */
PACKI(desc,"W",queue->status); /* fsStatus */
- PACKI(desc,"D",queue->time); /* ulSubmitted */
+ PACKI(desc,"D",t); /* ulSubmitted */
PACKI(desc,"D",queue->size); /* ulSize */
PACKS(desc,"z","Samba"); /* pszComment */
PACKS(desc,"z",queue->file); /* pszDocument */
@@ -1289,7 +1289,7 @@ static BOOL api_NetRemoteTOD(int cnum,int uid, char *param,char *data,
/* the client expects to get localtime, not GMT, in this bit
(I think, this needs testing) */
- t = LocalTime(&unixdate,GMT_TO_LOCAL);
+ t = LocalTime(&unixdate);
SIVAL(p,4,0); /* msecs ? */
CVAL(p,8) = t->tm_hour;
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 6031daf5f1..b8111fc739 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -287,15 +287,13 @@ static void update_protected_database( char *user, BOOL result)
#ifdef OSF1_ENH_SEC
struct pr_passwd *mypasswd;
time_t starttime;
- long tz;
mypasswd = getprpwnam (user);
starttime = time (NULL);
- tz = mktime ( localtime ( &starttime ) );
if (result)
{
- mypasswd->ufld.fd_slogin = tz;
+ mypasswd->ufld.fd_slogin = starttime;
mypasswd->ufld.fd_nlogins = 0;
putprpwnam(user,mypasswd);
@@ -304,7 +302,7 @@ static void update_protected_database( char *user, BOOL result)
}
else
{
- mypasswd->ufld.fd_ulogin = tz;
+ mypasswd->ufld.fd_ulogin = starttime;
mypasswd->ufld.fd_nlogins = mypasswd->ufld.fd_nlogins + 1;
if ( mypasswd->ufld.fd_max_tries != 0 && mypasswd->ufld.fd_nlogins > mypasswd->ufld.fd_max_tries )
{
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index 32c9fc35d3..81f2dcaab5 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -1,3 +1,4 @@
+#ifdef QUOTAS
/*
Unix SMB/Netbios implementation.
Version 1.9.
@@ -19,12 +20,28 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "includes.h"
+/*
+ * This is one of the most system dependent parts of Samba, and its
+ * done a litle differently. Each system has its own way of doing
+ * things :-(
+ */
+
+#include "includes.h"
-#ifdef QUOTAS
#ifdef LINUX
+
+#ifdef __KERNEL__
+# undef __KERNEL__
+# include <sys/quota.h>
+# define __KERNEL__
+#else
+# include <sys/quota.h>
+#endif
+
+#include <mntent.h>
+
/****************************************************************************
try to get the disk space from disk quotas (LINUX version)
****************************************************************************/
@@ -115,6 +132,10 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
}
#elif defined(CRAY)
+
+#include <sys/quota.h>
+#include <mntent.h>
+
/****************************************************************************
try to get the disk space from disk quotas (CRAY VERSION)
****************************************************************************/
@@ -214,6 +235,7 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
#elif defined(SUNOS5)
+#include <devnm.h>
#include <fcntl.h>
#include <sys/fs/ufs_quota.h>
@@ -228,30 +250,33 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
struct dqblk D;
struct quotctl command;
int file;
+ int ret;
if((file=open(path, O_RDONLY))<0) return(False);
euser_id = geteuid();
user_id = getuid();
- setuid(0); /* Solaris seems to want to give info only to super-user */
- seteuid(0);
-
command.op = Q_GETQUOTA;
command.uid = euser_id;
command.addr = (caddr_t) &D;
- if(ioctl(file, Q_QUOTACTL, &command)<0)
- {
- close(file);
- DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
- return(False);
- }
- close(file);
+ setuid(0); /* Solaris seems to want to give info only to super-user */
+ seteuid(0);
+
+ ret = ioctl(file, Q_QUOTACTL, &command);
setuid(user_id); /* Restore the original UID status */
seteuid(euser_id);
+ if (ret < 0) {
+ close(file);
+ DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
+ return(False);
+ }
+ close(file);
+
+
/* Use softlimit to determine disk space. A user exceeding the quota is told
* that there's no space left. Writes might actually work for a bit if the
* hardlimit is set higher than softlimit. Effectively the disk becomes
@@ -275,6 +300,9 @@ DEBUG(5,("disk_quotas for path \"%s\" returning bsize %d, dfree %d, dsize %d\n"
#else
+#include <sys/quota.h>
+#include <devnm.h>
+
/****************************************************************************
try to get the disk space from disk quotas - default version
****************************************************************************/
@@ -327,4 +355,5 @@ static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
}
#endif
-#endif
+#endif /* QUOTAS */
+
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index b5fa86a8d7..68376baaf3 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1181,7 +1181,9 @@ static BOOL can_delete(char *fname,int cnum,int dirtype)
if (sys_lstat(fname,&sbuf) != 0) return(False);
fmode = dos_mode(cnum,fname,&sbuf);
if (fmode & aDIR) return(False);
- if (fmode & aRONLY) return(False);
+ if (!lp_delete_readonly(SNUM(cnum))) {
+ if (fmode & aRONLY) return(False);
+ }
if ((fmode & ~dirtype) & (aHIDDEN | aSYSTEM))
return(False);
if (!check_file_sharing(cnum,fname)) return(False);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 5ef92777b2..3140d3ff84 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -2456,6 +2456,8 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
int find_free_file(void )
{
int i;
+ /* we start at 1 here for an obscure reason I can't now remember,
+ but I think is important :-) */
for (i=1;i<MAX_OPEN_FILES;i++)
if (!Files[i].open)
return(i);