summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/printing/nt_printing.c22
-rw-r--r--source3/printing/printing.c2
3 files changed, 18 insertions, 9 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 02bc54c5b0..4d0536832c 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4792,7 +4792,8 @@ void map_printer_permissions(struct security_descriptor *sd);
void map_job_permissions(struct security_descriptor *sd);
bool print_access_check(struct auth_serversupplied_info *server_info, int snum,
int access_type);
-bool print_time_access_check(const char *servicename);
+bool print_time_access_check(struct auth_serversupplied_info *server_info,
+ const char *servicename);
char* get_server_name( Printer_entry *printer );
/* The following definitions come from printing/pcap.c */
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;