From e23f2b9cef8428bda51b413642d9720ba5c590d5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 4 Oct 1996 09:31:07 +0000 Subject: - changed the umask handling. We now set the umask to 0 and explicitly set the mode on all created files. I think this is a better policy. - change the debug levels on some items - fix a charset handling bug which affected foreign and extended charset users - no longer switch back to the original directory when idle, instead switch to / as the original directory may not be readable by ordinary users. - fix some bugs where the create mode of files was not being explicitly set (it was relying on the umask and using fopen). Not a big bug as it only affected obscure commands like the messaging ops. - got rid of the lock code in the lpq cache as its no longer needed - rewrote smbrun to be faster and to remove the security hole. We now don't actually need a external smbrun binary, its all done by smbd. - add a more explicit warning about uids and gids of -1 or 65535 (This used to be commit 5aa735c940ccdb6acae5f28449d484181c912e49) --- source3/printing/printing.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'source3/printing/printing.c') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index ad840d7f51..87552ab3ff 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -130,7 +130,7 @@ void print_file(int fnum) tempstr = build_print_command(cnum, PRINTCOMMAND(snum), syscmd, Files[fnum].name); if (tempstr != NULL) { - int ret = smbrun(syscmd,NULL); + int ret = smbrun(syscmd,NULL,False); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); } else @@ -923,7 +923,6 @@ int get_printqueue(int snum,int cnum,print_queue_struct **queue, struct stat sbuf; BOOL dorun=True; int cachetime = lp_lpqcachetime(); - int lfd = -1; *line = 0; check_lpq_cache(snum); @@ -954,20 +953,10 @@ int get_printqueue(int snum,int cnum,print_queue_struct **queue, DEBUG(3,("Using cached lpq output\n")); dorun = False; } - - if (dorun) { - lfd = file_lock(outfile,LPQ_LOCK_TIMEOUT); - if (lfd<0 || - (!fstat(lfd,&sbuf) && (time(NULL) - sbuf.st_mtime)= 0) file_unlock(lfd); return(0); } @@ -1006,12 +994,13 @@ int get_printqueue(int snum,int cnum,print_queue_struct **queue, fclose(f); - if (lfd >= 0) file_unlock(lfd); - - if (!cachetime) + if (!cachetime) { unlink(outfile); - else + } else { + /* we only expect this to succeed on trapdoor systems, on normal systems + the file is owned by root */ chmod(outfile,0666); + } return(count); } @@ -1047,7 +1036,7 @@ void del_printqueue(int cnum,int snum,int jobid) string_sub(syscmd,"%j",jobstr); standard_sub(cnum,syscmd); - ret = smbrun(syscmd,NULL); + ret = smbrun(syscmd,NULL,False); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); lpq_reset(snum); /* queue has changed */ } @@ -1085,7 +1074,7 @@ void status_printjob(int cnum,int snum,int jobid,int status) string_sub(syscmd,"%j",jobstr); standard_sub(cnum,syscmd); - ret = smbrun(syscmd,NULL); + ret = smbrun(syscmd,NULL,False); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); lpq_reset(snum); /* queue has changed */ } -- cgit