summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-07-01 01:19:13 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-07-01 01:19:13 +0000
commitfb1429c1970bc123e191f0cb7cc764faf4b86998 (patch)
tree134dd0100da50a13931d0d82e0cfbeb435fe4e6e /source3/smbd
parentf3f5abbe2f3a494a5114908ba93d140e2accd031 (diff)
downloadsamba-fb1429c1970bc123e191f0cb7cc764faf4b86998.tar.gz
samba-fb1429c1970bc123e191f0cb7cc764faf4b86998.tar.bz2
samba-fb1429c1970bc123e191f0cb7cc764faf4b86998.zip
client.c: New print queue query code from Jeff C. Foster " <jfoste@wgc.woodward.com>
ipc.c: Added code for returning restricted lists of servers. loadparm.c: Changed default for force create mode to 000. Changed default maxmux to 50 to comply with NT. locking.c: Fixed silly crash bug with slow share mode code. nameannounce.c: Added code for returning restricted lists of servers. namedbserver.c: Added code for returning restricted lists of servers. nameelect.c: Added code for returning restricted lists of servers. namework.c: Added code for returning restricted lists of servers. nmbsync.c: Added code for returning restricted lists of servers. server.c: Added quota fix Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at> smb.h: Added define for COPYBUF_SIZE. system.c: Rename across filesystems Patch from Warren Birnbaum <warrenb@hpcvscdp.cv.hp.com> util.c: Minor fix for warning. (This used to be commit 1c6e433caa22813a699c9766847886eb59755f8b)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/ipc.c17
-rw-r--r--source3/smbd/server.c83
2 files changed, 77 insertions, 23 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 6b3953e6c8..7922e41623 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -770,6 +770,7 @@ static int get_server_info(uint32 servertype,
int count=0;
int alloced=0;
pstring line;
+ BOOL local_list_only;
strcpy(fname,lp_lockdir());
trim_string(fname,NULL,"/");
@@ -784,7 +785,10 @@ static int get_server_info(uint32 servertype,
}
/* request for everything is code for request all servers */
- if (servertype == SV_TYPE_ALL) servertype &= ~SV_TYPE_DOMAIN_ENUM;
+ if (servertype == SV_TYPE_ALL)
+ servertype &= ~(SV_TYPE_DOMAIN_ENUM|SV_TYPE_LOCAL_LIST_ONLY);
+
+ local_list_only = (servertype & SV_TYPE_LOCAL_LIST_ONLY);
DEBUG(4,("Servertype search: %8x\n",servertype));
@@ -821,6 +825,14 @@ static int get_server_info(uint32 servertype,
ok = False;
}
+ /* Filter the servers/domains we return based on what was asked for. */
+
+ /* Check to see if we are being asked for a local list only. */
+ if(local_list_only && ((s->type & SV_TYPE_LOCAL_LIST_ONLY) == 0)) {
+ DEBUG(4,("r: local list only"));
+ ok = False;
+ }
+
/* doesn't match up: don't want it */
if (!(servertype & s->type)) {
DEBUG(4,("r:serv type "));
@@ -839,6 +851,9 @@ static int get_server_info(uint32 servertype,
ok = False;
}
+ /* We should never return a server type with a SV_TYPE_LOCAL_LIST_ONLY set. */
+ s->type &= ~SV_TYPE_LOCAL_LIST_ONLY;
+
if (ok)
{
DEBUG(4,("**SV** %20s %8x %25s %15s\n",
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 203bdb8da8..8c40734ce4 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -603,6 +603,14 @@ static void disk_norm(int *bsize,int *dfree,int *dsize)
int disk_free(char *path,int *bsize,int *dfree,int *dsize)
{
char *df_command = lp_dfree_command();
+ int dfree_retval;
+#ifdef QUOTAS
+ int dfreeq_retval;
+ int dfreeq = 0;
+ int bsizeq = *bsize;
+ int dsizeq = *dsize;
+#endif
+
#ifndef NO_STATFS
#ifdef USE_STATVFS
struct statvfs fs;
@@ -615,15 +623,6 @@ int disk_free(char *path,int *bsize,int *dfree,int *dsize)
#endif
#endif
-#ifdef QUOTAS
- if (disk_quotas(path, bsize, dfree, dsize))
- {
- disk_norm(bsize,dfree,dsize);
- return(((*bsize)/1024)*(*dfree));
- }
-#endif
-
-
/* possibly use system() to get the result */
if (df_command && *df_command)
{
@@ -639,22 +638,42 @@ int disk_free(char *path,int *bsize,int *dfree,int *dsize)
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
{
- FILE *f = fopen(outfile,"r");
- *dsize = 0;
- *dfree = 0;
- *bsize = 1024;
- if (f)
- {
- fscanf(f,"%d %d %d",dsize,dfree,bsize);
- fclose(f);
- }
- else
- DEBUG(0,("Can't open %s\n",outfile));
+ FILE *f = fopen(outfile,"r");
+ *dsize = 0;
+ *dfree = 0;
+ *bsize = 1024;
+ if (f)
+ {
+ fscanf(f,"%d %d %d",dsize,dfree,bsize);
+ fclose(f);
+ }
+ else
+ DEBUG(0,("Can't open %s\n",outfile));
}
unlink(outfile);
disk_norm(bsize,dfree,dsize);
- return(((*bsize)/1024)*(*dfree));
+ dfree_retval = ((*bsize)/1024)*(*dfree);
+#ifdef QUOTAS
+ /* Ensure we return the min value between the users quota and
+ what's free on the disk. Thanks to Albrecht Gebhardt
+ <albrecht.gebhardt@uni-klu.ac.at> for this fix.
+ */
+ if (disk_quotas(path, &bsizeq, &dfreeq, &dsizeq))
+ {
+ disk_norm(&bsizeq, &dfreeq, &dsizeq);
+ dfreeq_retval = ((bsizeq)/1024)*(dfreeq);
+ dfree_retval = ( dfree_retval < dfreeq_retval ) ?
+ dfree_retval : dfreeq_retval ;
+ /* maybe dfree and dfreeq are calculated using different bsizes
+ so convert dfree from bsize into bsizeq */
+ *dfree = ((*dfree) * (*bsize)) / (bsizeq);
+ *dfree = ( *dfree < dfreeq ) ? *dfree : dfreeq ;
+ *bsize = bsizeq;
+ *dsize = dsizeq;
+ }
+#endif
+ return(dfree_retval);
}
#ifdef NO_STATFS
@@ -724,7 +743,27 @@ if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024;
*dsize = 20*1024*1024/(*bsize);
*dfree = MAX(1,*dfree);
}
- return(((*bsize)/1024)*(*dfree));
+ dfree_retval = ((*bsize)/1024)*(*dfree);
+#ifdef QUOTAS
+ /* Ensure we return the min value between the users quota and
+ what's free on the disk. Thanks to Albrecht Gebhardt
+ <albrecht.gebhardt@uni-klu.ac.at> for this fix.
+ */
+ if (disk_quotas(path, &bsizeq, &dfreeq, &dsizeq))
+ {
+ disk_norm(&bsizeq, &dfreeq, &dsizeq);
+ dfreeq_retval = ((bsizeq)/1024)*(dfreeq);
+ dfree_retval = ( dfree_retval < dfreeq_retval ) ?
+ dfree_retval : dfreeq_retval ;
+ /* maybe dfree and dfreeq are calculated using different bsizes
+ so convert dfree from bsize into bsizeq */
+ *dfree = ((*dfree) * (*bsize)) / (bsizeq);
+ *dfree = ( *dfree < dfreeq ) ? *dfree : dfreeq ;
+ *bsize = bsizeq;
+ *dsize = dsizeq;
+ }
+#endif
+ return(dfree_retval);
#endif
}