Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/printing/notify.c

    r740 r988  
    3636        struct spoolss_notify_msg *msg;
    3737        struct timeval tv;
    38         uint8 *buf;
     38        uint8_t *buf;
    3939        size_t buflen;
    4040} *notify_queue_head = NULL;
     
    6363{
    6464        int snum = lp_servicenumber(qname);
    65         if (snum == -1 || !lp_print_ok(snum))
     65        if (snum == -1 || !lp_printable(snum))
    6666                return -1;
    6767        return snum;
     
    8484{
    8585        struct spoolss_notify_msg *msg = q->msg;
    86         uint8 *buf = NULL;
     86        uint8_t *buf = NULL;
    8787        size_t buflen = 0, len;
    8888
     
    9595
    9696        len += tdb_pack(buf + len, buflen - len, "ddddddd",
    97                         (uint32)q->tv.tv_sec, (uint32)q->tv.tv_usec,
     97                        (uint32_t)q->tv.tv_sec, (uint32_t)q->tv.tv_usec,
    9898                        msg->type, msg->field, msg->id, msg->len, msg->flags);
    9999
     
    108108
    109109        if (buflen != len) {
    110                 buf = (uint8 *)TALLOC_REALLOC(send_ctx, buf, len);
     110                buf = (uint8_t *)TALLOC_REALLOC(send_ctx, buf, len);
    111111                if (!buf)
    112112                        return False;
     
    195195                                   pid_to_procid(pid_list[i]),
    196196                                   MSG_PRINTER_NOTIFY2 | MSG_FLAG_LOWPRIORITY,
    197                                    (uint8 *)buf, offset);
     197                                   (uint8_t *)buf, offset);
    198198
    199199                if ((timeout != 0) && timeval_expired(&end_time)) {
     
    255255       
    256256        if ( from->len ) {
    257                 to->notify.data = (char *)TALLOC_MEMDUP(send_ctx, from->notify.data, from->len );
     257                to->notify.data = (char *)talloc_memdup(send_ctx, from->notify.data, from->len );
    258258                if ( !to->notify.data ) {
    259                         DEBUG(0,("copy_notify2_msg: TALLOC_MEMDUP() of size [%d] failed!\n", from->len ));
     259                        DEBUG(0,("copy_notify2_msg: talloc_memdup() of size [%d] failed!\n", from->len ));
    260260                        return False;
    261261                }
     
    306306        /* Store the message on the pending queue. */
    307307
    308         pnqueue = TALLOC_P(send_ctx, struct notify_queue);
     308        pnqueue = talloc(send_ctx, struct notify_queue);
    309309        if (!pnqueue) {
    310310                DEBUG(0,("send_spoolss_notify2_msg: Out of memory.\n"));
     
    314314        /* allocate a new msg structure and copy the fields */
    315315       
    316         if ( !(pnqueue->msg = TALLOC_P(send_ctx, SPOOLSS_NOTIFY_MSG)) ) {
     316        if ( !(pnqueue->msg = talloc(send_ctx, SPOOLSS_NOTIFY_MSG)) ) {
    317317                DEBUG(0,("send_spoolss_notify2_msg: talloc() of size [%lu] failed!\n",
    318318                        (unsigned long)sizeof(SPOOLSS_NOTIFY_MSG)));
     
    332332         */
    333333
    334         DLIST_ADD_END(notify_queue_head, pnqueue, struct notify_queue *);
     334        DLIST_ADD_END(notify_queue_head, pnqueue);
    335335        num_messages++;
    336336
     
    346346static void send_notify_field_values(struct tevent_context *ev,
    347347                                     struct messaging_context *msg_ctx,
    348                                      const char *sharename, uint32 type,
    349                                      uint32 field, uint32 id, uint32 value1,
    350                                      uint32 value2, uint32 flags)
     348                                     const char *sharename, uint32_t type,
     349                                     uint32_t field, uint32_t id, uint32_t value1,
     350                                     uint32_t value2, uint32_t flags)
    351351{
    352352        struct spoolss_notify_msg *msg;
     
    358358                return;
    359359
    360         msg = TALLOC_P(send_ctx, struct spoolss_notify_msg);
     360        msg = talloc_zero(send_ctx, struct spoolss_notify_msg);
    361361        if (!msg)
    362362                return;
    363 
    364         ZERO_STRUCTP(msg);
    365363
    366364        fstrcpy(msg->printer, sharename);
     
    377375static void send_notify_field_buffer(struct tevent_context *ev,
    378376                                     struct messaging_context *msg_ctx,
    379                                      const char *sharename, uint32 type,
    380                                      uint32 field, uint32 id, uint32 len,
     377                                     const char *sharename, uint32_t type,
     378                                     uint32_t field, uint32_t id, uint32_t len,
    381379                                     const char *buffer)
    382380{
     
    389387                return;
    390388
    391         msg = TALLOC_P(send_ctx, struct spoolss_notify_msg);
     389        msg = talloc_zero(send_ctx, struct spoolss_notify_msg);
    392390        if (!msg)
    393391                return;
    394 
    395         ZERO_STRUCTP(msg);
    396392
    397393        fstrcpy(msg->printer, sharename);
     
    400396        msg->id = id;
    401397        msg->len = len;
    402         msg->notify.data = CONST_DISCARD(char *,buffer);
     398        msg->notify.data = discard_const_p(char, buffer);
    403399
    404400        send_spoolss_notify2_msg(ev, msg_ctx, msg);
     
    409405void notify_printer_status_byname(struct tevent_context *ev,
    410406                                  struct messaging_context *msg_ctx,
    411                                   const char *sharename, uint32 status)
     407                                  const char *sharename, uint32_t status)
    412408{
    413409        /* Printer status stored in value1 */
     
    422418void notify_printer_status(struct tevent_context *ev,
    423419                           struct messaging_context *msg_ctx,
    424                            int snum, uint32 status)
    425 {
    426         const char *sharename = lp_servicename(snum);
     420                           int snum, uint32_t status)
     421{
     422        const char *sharename = lp_servicename(talloc_tos(), snum);
    427423
    428424        if (sharename)
     
    432428void notify_job_status_byname(struct tevent_context *ev,
    433429                              struct messaging_context *msg_ctx,
    434                               const char *sharename, uint32 jobid,
    435                               uint32 status,
    436                               uint32 flags)
     430                              const char *sharename, uint32_t jobid,
     431                              uint32_t status,
     432                              uint32_t flags)
    437433{
    438434        /* Job id stored in id field, status in value1 */
     
    446442void notify_job_status(struct tevent_context *ev,
    447443                       struct messaging_context *msg_ctx,
    448                        const char *sharename, uint32 jobid, uint32 status)
     444                       const char *sharename, uint32_t jobid, uint32_t status)
    449445{
    450446        notify_job_status_byname(ev, msg_ctx, sharename, jobid, status, 0);
     
    453449void notify_job_total_bytes(struct tevent_context *ev,
    454450                            struct messaging_context *msg_ctx,
    455                             const char *sharename, uint32 jobid,
    456                             uint32 size)
     451                            const char *sharename, uint32_t jobid,
     452                            uint32_t size)
    457453{
    458454        /* Job id stored in id field, status in value1 */
     
    466462void notify_job_total_pages(struct tevent_context *ev,
    467463                            struct messaging_context *msg_ctx,
    468                             const char *sharename, uint32 jobid,
    469                             uint32 pages)
     464                            const char *sharename, uint32_t jobid,
     465                            uint32_t pages)
    470466{
    471467        /* Job id stored in id field, status in value1 */
     
    479475void notify_job_username(struct tevent_context *ev,
    480476                         struct messaging_context *msg_ctx,
    481                          const char *sharename, uint32 jobid, char *name)
     477                         const char *sharename, uint32_t jobid, char *name)
    482478{
    483479        send_notify_field_buffer(
     
    489485void notify_job_name(struct tevent_context *ev,
    490486                     struct messaging_context *msg_ctx,
    491                      const char *sharename, uint32 jobid, char *name)
     487                     const char *sharename, uint32_t jobid, char *name)
    492488{
    493489        send_notify_field_buffer(
     
    499495void notify_job_submitted(struct tevent_context *ev,
    500496                          struct messaging_context *msg_ctx,
    501                           const char *sharename, uint32 jobid,
     497                          const char *sharename, uint32_t jobid,
    502498                          time_t submitted)
    503499{
     
    512508                           int snum, const char *driver_name)
    513509{
    514         const char *sharename = lp_servicename(snum);
     510        const char *sharename = lp_servicename(talloc_tos(), snum);
    515511
    516512        send_notify_field_buffer(
     
    524520                            int snum, const char *comment)
    525521{
    526         const char *sharename = lp_servicename(snum);
     522        const char *sharename = lp_servicename(talloc_tos(), snum);
    527523
    528524        send_notify_field_buffer(
     
    536532                              int snum, const char *share_name)
    537533{
    538         const char *sharename = lp_servicename(snum);
     534        const char *sharename = lp_servicename(talloc_tos(), snum);
    539535
    540536        send_notify_field_buffer(
     
    548544                                int snum, const char *printername)
    549545{
    550         const char *sharename = lp_servicename(snum);
     546        const char *sharename = lp_servicename(talloc_tos(), snum);
    551547
    552548        send_notify_field_buffer(
     
    560556                         int snum, const char *port_name)
    561557{
    562         const char *sharename = lp_servicename(snum);
     558        const char *sharename = lp_servicename(talloc_tos(), snum);
    563559
    564560        send_notify_field_buffer(
     
    572568                             int snum, const char *location)
    573569{
    574         const char *sharename = lp_servicename(snum);
     570        const char *sharename = lp_servicename(talloc_tos(), snum);
    575571
    576572        send_notify_field_buffer(
     
    584580                            int snum, const char *sepfile)
    585581{
    586         const char *sharename = lp_servicename(snum);
     582        const char *sharename = lp_servicename(talloc_tos(), snum);
    587583
    588584        send_notify_field_buffer(
     
    595591void notify_printer_byname(struct tevent_context *ev,
    596592                           struct messaging_context *msg_ctx,
    597                            const char *printername, uint32 change,
     593                           const char *printername, uint32_t change,
    598594                           const char *value)
    599595{
     
    633629        tdb = pdb->tdb;
    634630
    635         if (tdb_read_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) {
     631        if (tdb_read_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) != 0) {
    636632                DEBUG(0,("print_notify_pid_list: Failed to lock printer %s database\n",
    637633                                        printername));
     
    651647
    652648        if (num_pids) {
    653                 if ((pid_list = TALLOC_ARRAY(mem_ctx, pid_t, num_pids)) == NULL) {
     649                if ((pid_list = talloc_array(mem_ctx, pid_t, num_pids)) == NULL) {
    654650                        ret = False;
    655651                        goto done;
Note: See TracChangeset for help on using the changeset viewer.