Changeset 988 for vendor/current/source3/printing/notify.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/printing/notify.c
r740 r988 36 36 struct spoolss_notify_msg *msg; 37 37 struct timeval tv; 38 uint8 *buf;38 uint8_t *buf; 39 39 size_t buflen; 40 40 } *notify_queue_head = NULL; … … 63 63 { 64 64 int snum = lp_servicenumber(qname); 65 if (snum == -1 || !lp_print _ok(snum))65 if (snum == -1 || !lp_printable(snum)) 66 66 return -1; 67 67 return snum; … … 84 84 { 85 85 struct spoolss_notify_msg *msg = q->msg; 86 uint8 *buf = NULL;86 uint8_t *buf = NULL; 87 87 size_t buflen = 0, len; 88 88 … … 95 95 96 96 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, 98 98 msg->type, msg->field, msg->id, msg->len, msg->flags); 99 99 … … 108 108 109 109 if (buflen != len) { 110 buf = (uint8 *)TALLOC_REALLOC(send_ctx, buf, len);110 buf = (uint8_t *)TALLOC_REALLOC(send_ctx, buf, len); 111 111 if (!buf) 112 112 return False; … … 195 195 pid_to_procid(pid_list[i]), 196 196 MSG_PRINTER_NOTIFY2 | MSG_FLAG_LOWPRIORITY, 197 (uint8 *)buf, offset);197 (uint8_t *)buf, offset); 198 198 199 199 if ((timeout != 0) && timeval_expired(&end_time)) { … … 255 255 256 256 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 ); 258 258 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 )); 260 260 return False; 261 261 } … … 306 306 /* Store the message on the pending queue. */ 307 307 308 pnqueue = TALLOC_P(send_ctx, struct notify_queue);308 pnqueue = talloc(send_ctx, struct notify_queue); 309 309 if (!pnqueue) { 310 310 DEBUG(0,("send_spoolss_notify2_msg: Out of memory.\n")); … … 314 314 /* allocate a new msg structure and copy the fields */ 315 315 316 if ( !(pnqueue->msg = TALLOC_P(send_ctx, SPOOLSS_NOTIFY_MSG)) ) {316 if ( !(pnqueue->msg = talloc(send_ctx, SPOOLSS_NOTIFY_MSG)) ) { 317 317 DEBUG(0,("send_spoolss_notify2_msg: talloc() of size [%lu] failed!\n", 318 318 (unsigned long)sizeof(SPOOLSS_NOTIFY_MSG))); … … 332 332 */ 333 333 334 DLIST_ADD_END(notify_queue_head, pnqueue , struct notify_queue *);334 DLIST_ADD_END(notify_queue_head, pnqueue); 335 335 num_messages++; 336 336 … … 346 346 static void send_notify_field_values(struct tevent_context *ev, 347 347 struct messaging_context *msg_ctx, 348 const char *sharename, uint32 type,349 uint32 field, uint32 id, uint32 value1,350 uint32 value2, uint32flags)348 const char *sharename, uint32_t type, 349 uint32_t field, uint32_t id, uint32_t value1, 350 uint32_t value2, uint32_t flags) 351 351 { 352 352 struct spoolss_notify_msg *msg; … … 358 358 return; 359 359 360 msg = TALLOC_P(send_ctx, struct spoolss_notify_msg);360 msg = talloc_zero(send_ctx, struct spoolss_notify_msg); 361 361 if (!msg) 362 362 return; 363 364 ZERO_STRUCTP(msg);365 363 366 364 fstrcpy(msg->printer, sharename); … … 377 375 static void send_notify_field_buffer(struct tevent_context *ev, 378 376 struct messaging_context *msg_ctx, 379 const char *sharename, uint32 type,380 uint32 field, uint32 id, uint32len,377 const char *sharename, uint32_t type, 378 uint32_t field, uint32_t id, uint32_t len, 381 379 const char *buffer) 382 380 { … … 389 387 return; 390 388 391 msg = TALLOC_P(send_ctx, struct spoolss_notify_msg);389 msg = talloc_zero(send_ctx, struct spoolss_notify_msg); 392 390 if (!msg) 393 391 return; 394 395 ZERO_STRUCTP(msg);396 392 397 393 fstrcpy(msg->printer, sharename); … … 400 396 msg->id = id; 401 397 msg->len = len; 402 msg->notify.data = CONST_DISCARD(char *,buffer);398 msg->notify.data = discard_const_p(char, buffer); 403 399 404 400 send_spoolss_notify2_msg(ev, msg_ctx, msg); … … 409 405 void notify_printer_status_byname(struct tevent_context *ev, 410 406 struct messaging_context *msg_ctx, 411 const char *sharename, uint32 status)407 const char *sharename, uint32_t status) 412 408 { 413 409 /* Printer status stored in value1 */ … … 422 418 void notify_printer_status(struct tevent_context *ev, 423 419 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); 427 423 428 424 if (sharename) … … 432 428 void notify_job_status_byname(struct tevent_context *ev, 433 429 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) 437 433 { 438 434 /* Job id stored in id field, status in value1 */ … … 446 442 void notify_job_status(struct tevent_context *ev, 447 443 struct messaging_context *msg_ctx, 448 const char *sharename, uint32 jobid, uint32status)444 const char *sharename, uint32_t jobid, uint32_t status) 449 445 { 450 446 notify_job_status_byname(ev, msg_ctx, sharename, jobid, status, 0); … … 453 449 void notify_job_total_bytes(struct tevent_context *ev, 454 450 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) 457 453 { 458 454 /* Job id stored in id field, status in value1 */ … … 466 462 void notify_job_total_pages(struct tevent_context *ev, 467 463 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) 470 466 { 471 467 /* Job id stored in id field, status in value1 */ … … 479 475 void notify_job_username(struct tevent_context *ev, 480 476 struct messaging_context *msg_ctx, 481 const char *sharename, uint32 jobid, char *name)477 const char *sharename, uint32_t jobid, char *name) 482 478 { 483 479 send_notify_field_buffer( … … 489 485 void notify_job_name(struct tevent_context *ev, 490 486 struct messaging_context *msg_ctx, 491 const char *sharename, uint32 jobid, char *name)487 const char *sharename, uint32_t jobid, char *name) 492 488 { 493 489 send_notify_field_buffer( … … 499 495 void notify_job_submitted(struct tevent_context *ev, 500 496 struct messaging_context *msg_ctx, 501 const char *sharename, uint32 jobid,497 const char *sharename, uint32_t jobid, 502 498 time_t submitted) 503 499 { … … 512 508 int snum, const char *driver_name) 513 509 { 514 const char *sharename = lp_servicename( snum);510 const char *sharename = lp_servicename(talloc_tos(), snum); 515 511 516 512 send_notify_field_buffer( … … 524 520 int snum, const char *comment) 525 521 { 526 const char *sharename = lp_servicename( snum);522 const char *sharename = lp_servicename(talloc_tos(), snum); 527 523 528 524 send_notify_field_buffer( … … 536 532 int snum, const char *share_name) 537 533 { 538 const char *sharename = lp_servicename( snum);534 const char *sharename = lp_servicename(talloc_tos(), snum); 539 535 540 536 send_notify_field_buffer( … … 548 544 int snum, const char *printername) 549 545 { 550 const char *sharename = lp_servicename( snum);546 const char *sharename = lp_servicename(talloc_tos(), snum); 551 547 552 548 send_notify_field_buffer( … … 560 556 int snum, const char *port_name) 561 557 { 562 const char *sharename = lp_servicename( snum);558 const char *sharename = lp_servicename(talloc_tos(), snum); 563 559 564 560 send_notify_field_buffer( … … 572 568 int snum, const char *location) 573 569 { 574 const char *sharename = lp_servicename( snum);570 const char *sharename = lp_servicename(talloc_tos(), snum); 575 571 576 572 send_notify_field_buffer( … … 584 580 int snum, const char *sepfile) 585 581 { 586 const char *sharename = lp_servicename( snum);582 const char *sharename = lp_servicename(talloc_tos(), snum); 587 583 588 584 send_notify_field_buffer( … … 595 591 void notify_printer_byname(struct tevent_context *ev, 596 592 struct messaging_context *msg_ctx, 597 const char *printername, uint32 change,593 const char *printername, uint32_t change, 598 594 const char *value) 599 595 { … … 633 629 tdb = pdb->tdb; 634 630 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) { 636 632 DEBUG(0,("print_notify_pid_list: Failed to lock printer %s database\n", 637 633 printername)); … … 651 647 652 648 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) { 654 650 ret = False; 655 651 goto done;
Note:
See TracChangeset
for help on using the changeset viewer.