diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-03-01 16:39:35 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-03-01 16:39:35 +0100 |
commit | 09ac816b36e45fd537af2f7fe7c57a11f5c744f5 (patch) | |
tree | 4d5d44c27a2395a39efc62359f6e4b6976f2ba2e /source3/printing | |
parent | 235244f4cc707130dd130afce88bde49606bd501 (diff) | |
parent | 54bc27e9374742d37b1ed9012d1cfe8f5ace6d40 (diff) | |
download | samba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.tar.gz samba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.tar.bz2 samba-09ac816b36e45fd537af2f7fe7c57a11f5c744f5.zip |
Merge branch 'master' of git://git.samba.org/samba into teventfix
Conflicts:
lib/tevent/pytevent.c
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/notify.c | 4 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 98 | ||||
-rw-r--r-- | source3/printing/printfsp.c | 3 | ||||
-rw-r--r-- | source3/printing/printing.c | 6 | ||||
-rw-r--r-- | source3/printing/tests/vlp.c | 2 |
5 files changed, 54 insertions, 59 deletions
diff --git a/source3/printing/notify.c b/source3/printing/notify.c index d478b86f91..e19212eea8 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -397,8 +397,10 @@ void notify_printer_status_byname(const char *sharename, uint32 status) { /* Printer status stored in value1 */ + int snum = print_queue_snum(sharename); + send_notify_field_values(sharename, PRINTER_NOTIFY_TYPE, - PRINTER_NOTIFY_STATUS, 0, + PRINTER_NOTIFY_STATUS, snum, status, 0, 0); } diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index ad3a95826a..d8658e9280 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1381,7 +1381,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr goto error_exit; } old_create_time = st.st_mtime; - DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", old_create_time)); + DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", + (long)old_create_time)); } } close_file(NULL, fsp, NORMAL_CLOSE); @@ -1432,7 +1433,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr goto error_exit; } new_create_time = st.st_mtime; - DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", new_create_time)); + DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", + (long)new_create_time)); } } close_file(NULL, fsp, NORMAL_CLOSE); @@ -3423,8 +3425,8 @@ WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action) goto done; switch (action) { - case SPOOL_DS_PUBLISH: - case SPOOL_DS_UPDATE: + case DSPRINT_PUBLISH: + case DSPRINT_UPDATE: /* set the DsSpooler info and attributes */ if (!(map_nt_printer_info2_to_dsspooler(printer->info_2))) { win_rc = WERR_NOMEM; @@ -3433,7 +3435,7 @@ WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action) printer->info_2->attributes |= PRINTER_ATTRIBUTE_PUBLISHED; break; - case SPOOL_DS_UNPUBLISH: + case DSPRINT_UNPUBLISH: printer->info_2->attributes ^= PRINTER_ATTRIBUTE_PUBLISHED; break; default: @@ -3467,11 +3469,11 @@ WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action) } switch (action) { - case SPOOL_DS_PUBLISH: - case SPOOL_DS_UPDATE: + case DSPRINT_PUBLISH: + case DSPRINT_UPDATE: win_rc = nt_printer_publish_ads(ads, printer); break; - case SPOOL_DS_UNPUBLISH: + case DSPRINT_UNPUBLISH: win_rc = nt_printer_unpublish_ads(ads, printer); break; } @@ -5408,11 +5410,12 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) { SEC_DESC_BUF *new_secdesc_ctr = NULL; SEC_DESC_BUF *old_secdesc_ctr = NULL; - prs_struct ps; - bool prs_init_done = false; TALLOC_CTX *mem_ctx = NULL; TDB_DATA kbuf; + TDB_DATA dbuf; + DATA_BLOB blob; WERROR status; + NTSTATUS nt_status; mem_ctx = talloc_init("nt_printing_setsec"); if (mem_ctx == NULL) @@ -5474,26 +5477,19 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) /* Store the security descriptor in a tdb */ - if (!prs_init(&ps, - (uint32_t)ndr_size_security_descriptor(new_secdesc_ctr->sd, - NULL, 0) - + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL) ) { - status = WERR_NOMEM; - goto out; - } - - - prs_init_done = true; - - if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr, - &ps, 1)) { - status = WERR_BADFUNC; + nt_status = marshall_sec_desc_buf(mem_ctx, new_secdesc_ctr, + &blob.data, &blob.length); + if (!NT_STATUS_IS_OK(nt_status)) { + status = ntstatus_to_werror(nt_status); goto out; } kbuf = make_printers_secdesc_tdbkey(mem_ctx, sharename ); - if (tdb_prs_store(tdb_printers, kbuf, &ps)==0) { + dbuf.dptr = (unsigned char *)blob.data; + dbuf.dsize = blob.length; + + if (tdb_trans_store(tdb_printers, kbuf, dbuf, TDB_REPLACE)==0) { status = WERR_OK; } else { DEBUG(1,("Failed to store secdesc for %s\n", sharename)); @@ -5501,12 +5497,10 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) } /* Free malloc'ed memory */ + talloc_free(blob.data); out: - if (prs_init_done) { - prs_mem_free(&ps); - } if (mem_ctx) talloc_destroy(mem_ctx); return status; @@ -5602,47 +5596,45 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx) bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **secdesc_ctr) { - prs_struct ps; TDB_DATA kbuf; + TDB_DATA dbuf; + DATA_BLOB blob; char *temp; + NTSTATUS status; if (strlen(sharename) > 2 && (temp = strchr(sharename + 2, '\\'))) { sharename = temp + 1; } - ZERO_STRUCT(ps); - /* Fetch security descriptor from tdb */ - kbuf = make_printers_secdesc_tdbkey(ctx, sharename ); - - if (tdb_prs_fetch(tdb_printers, kbuf, &ps, ctx)!=0 || - !sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) { - - prs_mem_free(&ps); - - DEBUG(4,("using default secdesc for %s\n", sharename)); + kbuf = make_printers_secdesc_tdbkey(ctx, sharename); - if (!(*secdesc_ctr = construct_default_printer_sdb(ctx))) { - return False; - } - - /* Save default security descriptor for later */ + dbuf = tdb_fetch(tdb_printers, kbuf); + if (dbuf.dptr) { - if (!prs_init(&ps, (uint32_t)ndr_size_security_descriptor((*secdesc_ctr)->sd, NULL, 0) + - sizeof(SEC_DESC_BUF), ctx, MARSHALL)) - return False; + status = unmarshall_sec_desc_buf(ctx, dbuf.dptr, dbuf.dsize, + secdesc_ctr); + SAFE_FREE(dbuf.dptr); - if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) { - tdb_prs_store(tdb_printers, kbuf, &ps); + if (NT_STATUS_IS_OK(status)) { + return true; } + } - prs_mem_free(&ps); - - return True; + *secdesc_ctr = construct_default_printer_sdb(ctx); + if (!*secdesc_ctr) { + return false; } - prs_mem_free(&ps); + status = marshall_sec_desc_buf(ctx, *secdesc_ctr, + &blob.data, &blob.length); + if (NT_STATUS_IS_OK(status)) { + dbuf.dptr = (unsigned char *)blob.data; + dbuf.dsize = blob.length; + tdb_trans_store(tdb_printers, kbuf, dbuf, TDB_REPLACE); + talloc_free(blob.data); + } /* If security descriptor is owned by S-1-1-0 and winbindd is up, this security descriptor has been created when winbindd was diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c index b485711f91..243b8ea03b 100644 --- a/source3/printing/printfsp.c +++ b/source3/printing/printfsp.c @@ -88,7 +88,6 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn, void print_fsp_end(files_struct *fsp, enum file_close_type close_type) { uint32 jobid; - fstring sharename; if (fsp->fh->private_options & FILE_DELETE_ON_CLOSE) { /* @@ -102,7 +101,7 @@ void print_fsp_end(files_struct *fsp, enum file_close_type close_type) string_free(&fsp->fsp_name); } - if (!rap_to_pjobid(fsp->rap_print_jobid, sharename, &jobid)) { + if (!rap_to_pjobid(fsp->rap_print_jobid, NULL, &jobid)) { DEBUG(3,("print_fsp_end: Unable to convert RAP jobid %u to print jobid.\n", (unsigned int)fsp->rap_print_jobid )); return; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 7179184b73..fc3667ea3a 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -117,7 +117,9 @@ bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid) if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) ) { struct rap_jobid_key *jinfo = (struct rap_jobid_key*)data.dptr; - fstrcpy( sharename, jinfo->sharename ); + if (sharename != NULL) { + fstrcpy( sharename, jinfo->sharename ); + } *pjobid = jinfo->jobid; DEBUG(10,("rap_to_pjobid: jobid %u maps to RAP jobid %u\n", (unsigned int)*pjobid, (unsigned int)rap_jobid)); @@ -447,7 +449,7 @@ static const struct { { LPQ_PAPEROUT, JOB_STATUS_PAPEROUT }, { LPQ_PRINTED, JOB_STATUS_PRINTED }, { LPQ_DELETED, JOB_STATUS_DELETED }, - { LPQ_BLOCKED, JOB_STATUS_BLOCKED }, + { LPQ_BLOCKED, JOB_STATUS_BLOCKED_DEVQ }, { LPQ_USER_INTERVENTION, JOB_STATUS_USER_INTERVENTION }, { -1, 0 } }; diff --git a/source3/printing/tests/vlp.c b/source3/printing/tests/vlp.c index 15459889e9..286e4a4b39 100644 --- a/source3/printing/tests/vlp.c +++ b/source3/printing/tests/vlp.c @@ -168,7 +168,7 @@ static int lpq_command(int argc, char **argv) job_list[i].size, (i == 0 && job_list[i].status == LPQ_QUEUED) ? LPQ_SPOOLING : job_list[i].status, - job_list[i].submit_time, job_list[i].owner, + (long int)job_list[i].submit_time, job_list[i].owner, job_list[i].jobname); job_count++; } |