diff options
author | Tim Potter <tpot@samba.org> | 2002-08-02 03:57:40 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-08-02 03:57:40 +0000 |
commit | 0efda5cc2160f5b0b8b6cc5d1d4a29539239239e (patch) | |
tree | 1f83529767e904bfda3fb2f42e38facf088ff9d3 | |
parent | dcb4aec62757f63a252e0116b874d712681f85fd (diff) | |
download | samba-0efda5cc2160f5b0b8b6cc5d1d4a29539239239e.tar.gz samba-0efda5cc2160f5b0b8b6cc5d1d4a29539239239e.tar.xz samba-0efda5cc2160f5b0b8b6cc5d1d4a29539239239e.zip |
Merge of print notify fixes from APPLIANCE_HEAD.
(This used to be commit 7bf9ca6ca36fa319a57eab05567d49a003237bb5)
-rw-r--r-- | source3/printing/notify.c | 11 | ||||
-rw-r--r-- | source3/smbd/connection.c | 5 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 17 |
3 files changed, 27 insertions, 6 deletions
diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 21e28d0ca7..1b2b7805e5 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -65,18 +65,17 @@ again: /* Send message */ - tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); + tdb = conn_tdb_ctx(); if (!tdb) { DEBUG(3, ("Failed to open connections database in send_spoolss_notify2_msg\n")); - return; + goto done; } + + message_send_all(tdb, MSG_PRINTER_NOTIFY2, buf, buflen, False, NULL); - message_send_all(tdb, MSG_PRINTER_NOTIFY2, buf, - buflen, False, NULL); - +done: SAFE_FREE(buf); - tdb_close(tdb); } static void send_notify_field_values(const char *printer_name, uint32 type, diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index c9815dbf8c..b53ef9fb3f 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -29,6 +29,11 @@ static TDB_CONTEXT *tdb; TDB_CONTEXT *conn_tdb_ctx(void) { + if (!tdb) { + tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, + O_RDWR | O_CREAT, 0644); + } + return tdb; } diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 65519e8888..300e5479e5 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -223,6 +223,23 @@ static void register_all(void) message_register(MSG_POOL_USAGE, pool_usage_cb); } +/* This guy is here so we can link printing/notify.c to the smbcontrol + binary without having to pull in tons of other crap. */ + +TDB_CONTEXT *conn_tdb_ctx(void) +{ + static TDB_CONTEXT *tdb; + + if (tdb) + return tdb; + + tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0); + + if (!tdb) + DEBUG(3, ("Failed to open connections database in send_spoolss_notify2_msg\n")); + + return tdb; +} /**************************************************************************** do command |