diff options
author | Samba Release Account <samba-bugs@samba.org> | 1997-07-01 01:19:13 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1997-07-01 01:19:13 +0000 |
commit | fb1429c1970bc123e191f0cb7cc764faf4b86998 (patch) | |
tree | 134dd0100da50a13931d0d82e0cfbeb435fe4e6e /source3/smbd/server.c | |
parent | f3f5abbe2f3a494a5114908ba93d140e2accd031 (diff) | |
download | samba-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/server.c')
-rw-r--r-- | source3/smbd/server.c | 83 |
1 files changed, 61 insertions, 22 deletions
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 } |