summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-12-13 18:56:48 +0000
committerJim McDonough <jmcd@samba.org>2002-12-13 18:56:48 +0000
commitbfd8043a403dfed84bc568685580703a8470738d (patch)
tree7d04b1610585d4a88f73ddd2a5aeb1a6351b45f1 /source3/printing
parent8569cc567f11f022d923e6f027bbf931d77a45f1 (diff)
downloadsamba-bfd8043a403dfed84bc568685580703a8470738d.tar.gz
samba-bfd8043a403dfed84bc568685580703a8470738d.tar.bz2
samba-bfd8043a403dfed84bc568685580703a8470738d.zip
More printer publishing code.
- Add published attribute to info2, needed for win clients to work properly - Return proper info on getprinter 7 This means you can now look at the sharing tab of a printer and get correct info about whether it is published or not, and change it. (This used to be commit adda04379ee46f105436262663652f3f576fa3cf)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index cdcca6bbfe..532ab0794c 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -2540,7 +2540,8 @@ static BOOL map_nt_printer_info2_to_dsspooler(NT_PRINTER_INFO_LEVEL_2 *info2)
map_dword_into_ctr(ctr, SPOOL_REG_PRIORITY, info2->priority);
map_bool_into_ctr(ctr, SPOOL_REG_PRINTKEEPPRINTEDJOBS,
- (info2->attributes & 0x100));
+ (info2->attributes &
+ PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS));
switch (info2->attributes & 0x3) {
case 0:
@@ -2583,11 +2584,12 @@ WERROR nt_printer_publish(int snum, int action)
if (!W_ERROR_IS_OK(win_rc))
return win_rc;
- if ((SPOOL_DS_PUBLISH == action) || (SPOOL_DS_UPDATE == action) ||
- (SPOOL_DS_REPUBLISH == action)) {
+ if ((SPOOL_DS_PUBLISH == action) || (SPOOL_DS_UPDATE == action)) {
if (!(map_nt_printer_info2_to_dsspooler(printer->info_2)))
return WERR_NOMEM;
+ printer->info_2->attributes |= PRINTER_ATTRIBUTE_PUBLISHED;
+
win_rc = mod_a_printer(*printer, 2);
if (!W_ERROR_IS_OK(win_rc)) {
DEBUG(3, ("nt_printer_publish: err %d saving data\n",
@@ -2600,13 +2602,22 @@ WERROR nt_printer_publish(int snum, int action)
&printer->info_2->data);
ads_mod_str(ctx, &mods, SPOOL_REG_PRINTERNAME,
lp_servicename(snum));
+ } else {
+ printer->info_2->attributes ^= PRINTER_ATTRIBUTE_PUBLISHED;
+ win_rc = mod_a_printer(*printer, 2);
+ if (!W_ERROR_IS_OK(win_rc)) {
+ DEBUG(3, ("nt_printer_publish: err %d saving data\n",
+ W_ERROR_V(win_rc)));
+ free_a_printer(&printer, 2);
+ return win_rc;
+ }
}
ads = ads_init(NULL, NULL, lp_ads_server());
ads_rc = ads_connect(ads);
- if ((SPOOL_DS_UNPUBLISH == action) || (SPOOL_DS_REPUBLISH == action)) {
+ if (SPOOL_DS_UNPUBLISH == action) {
ads_rc = ads_find_printer_on_server(ads, &res,
printer->info_2->sharename, global_myname());
if (ADS_ERR_OK(ads_rc) && ads_count_replies(ads, res)) {
@@ -2617,8 +2628,7 @@ WERROR nt_printer_publish(int snum, int action)
}
}
- if ((SPOOL_DS_PUBLISH == action) || (SPOOL_DS_UPDATE == action) ||
- (SPOOL_DS_REPUBLISH == action)) {
+ if ((SPOOL_DS_PUBLISH == action) || (SPOOL_DS_UPDATE == action)) {
ads_find_machine_acct(ads, &res, global_myname());
srv_dn = ldap_get_dn(ads->ld, res);
ads_msgfree(ads, res);