diff options
author | Simo Sorce <idra@samba.org> | 2010-04-26 13:51:33 -0400 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2010-07-27 10:27:10 -0400 |
commit | 017a305fede73b3f61517f38dec2bf706e2648df (patch) | |
tree | d88daf74cb44e35041fc76e795063c95852eaaa4 /source3/printing | |
parent | afc4a387628e00376a118fbd9aeeec0694201e6f (diff) | |
download | samba-017a305fede73b3f61517f38dec2bf706e2648df.tar.gz samba-017a305fede73b3f61517f38dec2bf706e2648df.tar.bz2 samba-017a305fede73b3f61517f38dec2bf706e2648df.zip |
s3-printing: Convert print_time_access_check.
use spoolss_PrintInfo2 and winreg calls
Signed-off-by: Jim McDonough <jmcd@samba.org>
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 22 | ||||
-rw-r--r-- | source3/printing/printing.c | 2 |
2 files changed, 16 insertions, 8 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 52ced155f4..a36e40be77 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -5101,30 +5101,38 @@ bool print_access_check(struct auth_serversupplied_info *server_info, int snum, Check the time parameters allow a print operation. *****************************************************************************/ -bool print_time_access_check(const char *servicename) +bool print_time_access_check(struct auth_serversupplied_info *server_info, + const char *servicename) { - NT_PRINTER_INFO_LEVEL *printer = NULL; + struct spoolss_PrinterInfo2 *pinfo2 = NULL; + WERROR result; bool ok = False; time_t now = time(NULL); struct tm *t; uint32 mins; - if (!W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, servicename))) + result = winreg_get_printer(NULL, server_info, + NULL, servicename, &pinfo2); + if (!W_ERROR_IS_OK(result)) { return False; + } - if (printer->info_2->starttime == 0 && printer->info_2->untiltime == 0) + if (pinfo2->starttime == 0 && pinfo2->untiltime == 0) { ok = True; + } t = gmtime(&now); mins = (uint32)t->tm_hour*60 + (uint32)t->tm_min; - if (mins >= printer->info_2->starttime && mins <= printer->info_2->untiltime) + if (mins >= pinfo2->starttime && mins <= pinfo2->untiltime) { ok = True; + } - free_a_printer(&printer, 2); + TALLOC_FREE(pinfo2); - if (!ok) + if (!ok) { errno = EACCES; + } return ok; } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index e0cca8854e..5def9cd0d1 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -2430,7 +2430,7 @@ uint32 print_job_start(struct auth_serversupplied_info *server_info, int snum, return (uint32)-1; } - if (!print_time_access_check(lp_servicename(snum))) { + if (!print_time_access_check(server_info, lp_servicename(snum))) { DEBUG(3, ("print_job_start: job start denied by time check\n")); release_print_db(pdb); return (uint32)-1; |