diff options
author | Jim McDonough <jmcd@samba.org> | 2002-12-13 19:01:27 +0000 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2002-12-13 19:01:27 +0000 |
commit | 81a2a307392a12e5ec464e524d2948611e23b943 (patch) | |
tree | 5c5ed8973d98d535b5553f2a4f84307a8a3f03c0 /source3/printing | |
parent | 899b6e6d0facd1ef5865ce550fadd292514955d6 (diff) | |
download | samba-81a2a307392a12e5ec464e524d2948611e23b943.tar.gz samba-81a2a307392a12e5ec464e524d2948611e23b943.tar.xz samba-81a2a307392a12e5ec464e524d2948611e23b943.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 d57bddc9b22e809c79294c7eacbd5d0f115fe990)
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index cdcca6bbfed..532ab0794cd 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); |