summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/ipc.c4
-rw-r--r--source3/smbd/quotas.c94
-rw-r--r--source3/smbd/reply.c8
-rw-r--r--source3/smbd/server.c4
4 files changed, 54 insertions, 56 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 8b9fb485ae..6b3953e6c8 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -1964,9 +1964,9 @@ static BOOL api_RNetUserGetInfo(int cnum,uint16 vuid, char *param,char *data,
/* get NIS home of a previously validated user - simeon */
user_struct *vuser = get_valid_user_struct(vuid);
DEBUG(3,(" Username of UID %d is %s\n", vuser->uid, vuser->name));
- #if (defined(NETGROUP) && defined(AUTOMOUNT))
+#if (defined(NETGROUP) && defined(AUTOMOUNT))
DEBUG(3,(" HOMESHR for %s is %s\n", vuser->name, vuser->home_share));
- #endif
+#endif
*rparam_len = 6;
*rparam = REALLOC(*rparam,*rparam_len);
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index eba76d4c74..a1d29bcd12 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -33,47 +33,43 @@ extern int DEBUGLEVEL;
#ifdef LINUX
-#ifdef __KERNEL__
-# undef __KERNEL__
-# include <sys/quota.h>
-# define __KERNEL__
-#else
-# include <sys/quota.h>
-#endif
+#include <sys/types.h>
+#include <asm/types.h>
+#include <sys/quota.h>
#include <mntent.h>
+#include <linux/unistd.h>
+
+_syscall4(int, quotactl, int, cmd, const char *, special, int, id, caddr_t, addr);
/****************************************************************************
try to get the disk space from disk quotas (LINUX version)
****************************************************************************/
-/*
-If you didn't make the symlink to the quota package, too bad :(
-*/
-#include "quota/quotactl.c"
-#include "quota/hasquota.c"
+
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
{
uid_t euser_id;
+ int r;
+ char dev_disk[256];
struct dqblk D;
struct stat S;
- dev_t devno ;
- struct mntent *mnt;
FILE *fp;
- int found ;
- int qcmd, fd ;
- char *qfpathname;
+ struct mntent *mnt;
+ int devno;
+ int found;
/* find the block device file */
- if ( stat(path, &S) == -1 )
+ if ( stat(path, &S) == -1 ) {
return(False) ;
+ }
devno = S.st_dev ;
fp = setmntent(MOUNTED,"r");
found = False ;
- while ((mnt = getmntent(fp)) != (struct mntent *) 0) {
+ while ((mnt = getmntent(fp))) {
if ( stat(mnt->mnt_dir,&S) == -1 )
continue ;
if (S.st_dev == devno) {
@@ -83,48 +79,42 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
}
endmntent(fp) ;
- if ( ! found )
- return(False) ;
-
- qcmd = QCMD(Q_GETQUOTA, USRQUOTA);
-
- if (hasmntopt(mnt, MNTOPT_NOAUTO) || hasmntopt(mnt, MNTOPT_NOQUOTA))
- return(False) ;
-
- if (!hasquota(mnt, USRQUOTA, &qfpathname))
- return(False) ;
-
- euser_id = geteuid();
- seteuid(0);
-
- if (quotactl(qcmd, mnt->mnt_fsname, euser_id, (caddr_t)&D) != 0) {
- if ((fd = open(qfpathname, O_RDONLY)) < 0) {
- seteuid(euser_id);
+ if (!found) {
return(False);
}
- lseek(fd, (long) dqoff(euser_id), L_SET);
- switch (read(fd, &D, sizeof(struct dqblk))) {
- case 0:/* EOF */
- memset((caddr_t)&D, 0, sizeof(struct dqblk));
- break;
- case sizeof(struct dqblk): /* OK */
- break;
- default: /* ERROR */
- close(fd);
+
+ euser_id=geteuid();
+ seteuid(0);
+ r=quotactl(QCMD(Q_GETQUOTA,USRQUOTA), mnt->mnt_fsname, euser_id, (caddr_t)&D);
seteuid(euser_id);
- return(False);
+
+ /* Use softlimit to determine disk space, except when it has been exceeded */
+ *bsize = 1024;
+ if (r)
+ {
+ if (errno == EDQUOT)
+ {
+ *dfree =0;
+ *dsize =D.dqb_curblocks;
+ return (True);
}
+ else return(False);
}
- seteuid(euser_id);
- *bsize=1024;
-
- if (D.dqb_bsoftlimit==0)
- return(False);
- if ((D.dqb_curblocks>D.dqb_bsoftlimit)||(D.dqb_curinodes>D.dqb_isoftlimit))
+ /* Use softlimit to determine disk space, except when it has been exceeded */
+ if (
+ (D.dqb_bsoftlimit && D.dqb_curblocks>=D.dqb_bsoftlimit) ||
+ (D.dqb_bhardlimit && D.dqb_curblocks>=D.dqb_bhardlimit) ||
+ (D.dqb_isoftlimit && D.dqb_curinodes>=D.dqb_isoftlimit) ||
+ (D.dqb_ihardlimit && D.dqb_curinodes>=D.dqb_ihardlimit)
+ )
{
*dfree = 0;
*dsize = D.dqb_curblocks;
}
+ else if (D.dqb_bsoftlimit==0 && D.dqb_bhardlimit==0)
+ {
+ return(False);
+ }
else {
*dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
*dsize = D.dqb_bsoftlimit;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 530ce84895..8af4536c19 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -513,7 +513,7 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
if (!done_sesssetup)
max_send = MIN(max_send,smb_bufsize);
- DEBUG(0,(" Client requested max send size of %d\n", max_send));
+ DEBUG(1,(" Client requested max send size of %d\n", max_send));
done_sesssetup = True;
@@ -2156,11 +2156,17 @@ int reply_echo(char *inbuf,char *outbuf)
cnum = SVAL(inbuf,smb_tid);
+ /* According to the latest CIFS spec we shouldn't
+ care what the TID is.
+ */
+
+#if 0
if (cnum != 0xFFFF && !OPEN_CNUM(cnum))
{
DEBUG(4,("Invalid cnum in echo (%d)\n",cnum));
return(ERROR(ERRSRV,ERRinvnid));
}
+#endif
/* copy any incoming data back out */
if (data_len > 0)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 299ae07aa3..a44745496b 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -4036,7 +4036,7 @@ static void usage(char *pname)
setup_logging(argv[0],False);
- charset_initialise();
+ charset_initialise(-1);
/* make absolutely sure we run as root - to handle cases whre people
are crazy enough to have it setuid */
@@ -4151,6 +4151,8 @@ static void usage(char *pname)
if (!reload_services(False))
return(-1);
+ charset_initialise(lp_client_code_page());
+
strcpy(myworkgroup, lp_workgroup());
#ifndef NO_SIGNAL_TEST