Ignore:
Timestamp:
Sep 30, 2007, 3:42:50 AM (18 years ago)
Author:
Paul Smedley
Message:

Update trunk to 3.2.0pre1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/printing/printing.c

    r1 r77  
    88   This program is free software; you can redistribute it and/or modify
    99   it under the terms of the GNU General Public License as published by
    10    the Free Software Foundation; either version 2 of the License, or
     10   the Free Software Foundation; either version 3 of the License, or
    1111   (at your option) any later version.
    1212   
     
    1717   
    1818   You should have received a copy of the GNU General Public License
    19    along with this program; if not, write to the Free Software
    20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    2120*/
    2221
     
    7776        fstrcpy( jinfo.sharename, sharename );
    7877        jinfo.jobid = jobid;
    79         key.dptr = (char*)&jinfo;
     78        key.dptr = (uint8 *)&jinfo;
    8079        key.dsize = sizeof(jinfo);
    8180
     
    9493                rap_jobid = ++next_rap_jobid;
    9594        SSVAL(buf,0,rap_jobid);
    96         data.dptr = (char*)buf;
     95        data.dptr = buf;
    9796        data.dsize = sizeof(rap_jobid);
    9897        tdb_store(rap_tdb, key, data, TDB_REPLACE);
     
    115114
    116115        SSVAL(buf,0,rap_jobid);
    117         key.dptr = (char*)buf;
     116        key.dptr = buf;
    118117        key.dsize = sizeof(rap_jobid);
    119118        data = tdb_fetch(rap_tdb, key);
     
    150149        fstrcpy( jinfo.sharename, sharename );
    151150        jinfo.jobid = jobid;
    152         key.dptr = (char*)&jinfo;
     151        key.dptr = (uint8 *)&jinfo;
    153152        key.dsize = sizeof(jinfo);
    154153
     
    167166        SAFE_FREE(data.dptr);
    168167        SSVAL(buf,0,rap_jobid);
    169         data.dptr = (char*)buf;
     168        data.dptr = buf;
    170169        data.dsize = sizeof(rap_jobid);
    171170        tdb_delete(rap_tdb, key);
     
    179178****************************************************************************/
    180179
    181 BOOL print_backend_init(void)
     180BOOL print_backend_init(struct messaging_context *msg_ctx)
    182181{
    183182        const char *sversion = "INFO/version";
     
    216215
    217216        /* do NT print initialization... */
    218         return nt_printing_init();
     217        return nt_printing_init(msg_ctx);
    219218}
    220219
     
    274273
    275274        SIVAL(&j, 0, jobid);
    276         ret.dptr = (char *)&j;
     275        ret.dptr = (uint8 *)&j;
    277276        ret.dsize = sizeof(j);
    278277        return ret;
     
    283282***********************************************************************/
    284283 
    285 int unpack_pjob( char* buf, int buflen, struct printjob *pjob )
     284int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob )
    286285{
    287286        int     len = 0;
     
    519518        BOOL                    ret = False;
    520519        struct tdb_print_db     *pdb = get_print_db_byname(sharename);
    521         char                    *buf = NULL;
     520        uint8                   *buf = NULL;
    522521        int                     len, newlen, buflen;
    523522       
     
    555554       
    556555                if (buflen != len) {
    557                         buf = (char *)SMB_REALLOC(buf, len);
     556                        buf = (uint8 *)SMB_REALLOC(buf, len);
    558557                        if (!buf) {
    559558                                DEBUG(0,("pjob_store: failed to enlarge buffer!\n"));
     
    868867                return (pid_t)-1;
    869868        slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", sharename);
    870         key.dptr = keystr;
    871         key.dsize = strlen(keystr);
     869        key = string_tdb_data(keystr);
    872870
    873871        data = tdb_fetch(pdb->tdb, key);
     
    906904
    907905        slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", sharename);
    908         key.dptr = keystr;
    909         key.dsize = strlen(keystr);
     906        key = string_tdb_data(keystr);
    910907       
    911908        DEBUG(5, ("set_updating_pid: %s updating lpq cache for print share %s\n",
     
    920917       
    921918        SIVAL( buffer, 0, updating_pid);
    922         data.dptr = (char *)buffer;
     919        data.dptr = buffer;
    923920        data.dsize = 4;         /* we always assume this is a 4 byte value */
    924921
     
    961958        size_t len;
    962959        size_t i;
    963         uint qcount;
     960        unsigned int qcount;
    964961
    965962        if (max_reported_jobs && (max_reported_jobs < pts->qcount))
     
    987984        }
    988985
    989         if ((data.dptr = (char *)SMB_MALLOC(data.dsize)) == NULL)
     986        if ((data.dptr = (uint8 *)SMB_MALLOC(data.dsize)) == NULL)
    990987                return;
    991988
     
    12341231        /* store the new queue status structure */
    12351232        slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename);
    1236         key.dptr = keystr;
    1237         key.dsize = strlen(keystr);
     1233        key = string_tdb_data(keystr);
    12381234
    12391235        status.qcount = qcount;
    1240         data.dptr = (char *)&status;
     1236        data.dptr = (uint8 *)&status;
    12411237        data.dsize = sizeof(status);
    12421238        tdb_store(pdb->tdb, key, data, TDB_REPLACE);   
     
    13521348this is the receive function of the background lpq updater
    13531349****************************************************************************/
    1354 static void print_queue_receive(int msg_type, struct process_id src,
    1355                                 void *buf, size_t msglen,
    1356                                 void *private_data)
     1350static void print_queue_receive(struct messaging_context *msg,
     1351                                void *private_data,
     1352                                uint32_t msg_type,
     1353                                struct server_id server_id,
     1354                                DATA_BLOB *data)
    13571355{
    13581356        fstring sharename;
     
    13611359        size_t len;
    13621360
    1363         len = tdb_unpack( (char *)buf, msglen, "fdPP",
     1361        len = tdb_unpack( (uint8 *)data->data, data->length, "fdPP",
    13641362                sharename,
    13651363                &printing_type,
     
    13981396                DEBUG(5,("start_background_queue: background LPQ thread started\n"));
    13991397
    1400                 claim_connection( NULL, "smbd lpq backend", 0, False,
     1398                claim_connection( NULL, "smbd lpq backend",
    14011399                        FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL);
    14021400
     
    14051403                }
    14061404
    1407                 message_register(MSG_PRINTER_UPDATE, print_queue_receive,
    1408                                  NULL);
     1405                messaging_register(smbd_messaging_context(), NULL,
     1406                                   MSG_PRINTER_UPDATE, print_queue_receive);
    14091407               
    14101408                DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n"));
     
    14281426                       
    14291427                        DEBUG(10,("start_background_queue: background LPQ thread got a message\n"));
    1430                         message_dispatch();
     1428                        message_dispatch(smbd_messaging_context());
    14311429
    14321430                        /* process any pending print change notify messages */
    14331431
    1434                         print_notify_send_messages(0);
     1432                        print_notify_send_messages(smbd_messaging_context(),
     1433                                                   0);
    14351434                }
    14361435        }
     
    14461445        fstring sharename;
    14471446        pstring lpqcommand, lprmcommand;
    1448         char *buffer = NULL;
     1447        uint8 *buffer = NULL;
    14491448        size_t len = 0;
    14501449        size_t newlen;
     
    15001499                lprmcommand );
    15011500
    1502         buffer = SMB_XMALLOC_ARRAY( char, len );
     1501        buffer = SMB_XMALLOC_ARRAY( uint8, len );
    15031502
    15041503        /* now pack the buffer */
     
    15381537        /* finally send the message */
    15391538       
    1540         message_send_pid(pid_to_procid(background_lpq_updater_pid),
    1541                  MSG_PRINTER_UPDATE, buffer, len, False);
     1539        messaging_send_buf(smbd_messaging_context(),
     1540                           pid_to_procid(background_lpq_updater_pid),
     1541                           MSG_PRINTER_UPDATE, (uint8 *)buffer, len);
    15421542
    15431543        SAFE_FREE( buffer );
     
    16081608        if (i == data.dsize) {
    16091609                /* We weren't in the list. Realloc. */
    1610                 data.dptr = (char *)SMB_REALLOC(data.dptr, data.dsize + 8);
     1610                data.dptr = (uint8 *)SMB_REALLOC(data.dptr, data.dsize + 8);
    16111611                if (!data.dptr) {
    16121612                        DEBUG(0,("print_notify_register_pid: Relloc fail for printer %s\n",
     
    23032303
    23042304        SIVAL(&store_jobid, 0, jobid);
    2305         data.dptr = (char *)&store_jobid;
     2305        data.dptr = (uint8 *)&store_jobid;
    23062306        data.dsize = 4;
    23072307
     
    27022702        ZERO_STRUCTP(status);
    27032703        slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename);
    2704         key.dptr = keystr;
    2705         key.dsize = strlen(keystr);
     2704        key = string_tdb_data(keystr);
     2705
    27062706        data = tdb_fetch(pdb->tdb, key);
    27072707        if (data.dptr) {
Note: See TracChangeset for help on using the changeset viewer.