]> git.samba.org - samba.git/commit
s3:param: Fix segfault trying to add pcap printer without a [printers] share
authorAndreas Schneider <asn@samba.org>
Fri, 19 Mar 2021 12:40:37 +0000 (13:40 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 19 Mar 2021 18:56:33 +0000 (18:56 +0000)
commitec4794b5d9e12903b8ed0f96fb4e75e4458f4e53
tree431ee4df78bafc417fb49cc11a754d8abbaeb1cb
parentbda0599087b32a0435d3a80e1f7063a6b60d976b
s3:param: Fix segfault trying to add pcap printer without a [printers] share

 #0  0x00007fb264e75bea in __GI___wait4 (pid=21966, stat_loc=stat_loc@entry=0x7ffdf83a9bc8, options=options@entry=0, usage=usage@entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
         sc_ret = -512
         sc_ret = <optimized out>
 #1  0x00007fb264e75bab in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc@entry=0x7ffdf83a9bc8, options=options@entry=0) at waitpid.c:38
 No locals.
 #2  0x00007fb264df33a3 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
         __result = <optimized out>
         _buffer = {
           __routine = 0x7fb264df35d0 <cancel_handler>,
           __arg = 0x7ffdf83a9bd0,
           __canceltype = 0,
           __prev = 0x0
         }
         _avail = 1
         cancel_args = {
           quit = 0x7fb264f6f200 <quit>,
           intr = 0x7fb264f6f2a0 <intr>,
           pid = 21966
         }
         status = -1
         ret = 0
         pid = 21966
         sa = {
           __sigaction_handler = {
             sa_handler = 0x1,
             sa_sigaction = 0x1
           },
           sa_mask = {
             __val = {[0] = 65536, [1] = 94088581545700, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0, [7] = 1703897678, [8] = 140404174928432, [9] = 140404179009536, [10] = 0, [11] = 140728768044480, [12] = 140404185491504, [13] = 18446744073709551615, [14] = 100, [15] = 140404180125856}
           },
           sa_flags = 0,
           sa_restorer = 0x7ffdf83a9df0
         }
         omask = {
           __val = {[0] = 7296, [1] = 140404179695051, [2] = 94088578316976, [3] = 140404180018176, [4] = 140404180017664, [5] = 140404185449449, [6] = 140728768044176, [7] = 140404185448599, [8] = 140404185458050, [9] = 100, [10] = 140404180125856, [11] = 7322926704, [12] = 140728768044432, [13] = 140404185491192, [14] = 112, [15] = 100}
         }
         reset = {
           __val = {[0] = 6, [1] = 5372865792, [2] = 94088581545600, [3] = 140728768044624, [4] = 100, [5] = 100, [6] = 101, [7] = 94088581545600, [8] = 140728768044288, [9] = 140404173470464, [10] = 140406703357952, [11] = 94088581545600, [12] = 94088581545600, [13] = 94088581545600, [14] = 94088581545600, [15] = 94088581545700}
         }
         spawn_attr = {
           __flags = 12,
           __pgrp = 0,
           __sd = {
             __val = {[0] = 6, [1] = 5372865792, [2] = 94088581545600, [3] = 140728768044624, [4] = 100, [5] = 100, [6] = 101, [7] = 94088581545600, [8] = 140728768044288, [9] = 140404173470464, [10] = 140406703357952, [11] = 94088581545600, [12] = 94088581545600, [13] = 94088581545600, [14] = 94088581545600, [15] = 94088581545700}
           },
           __ss = {
             __val = {[0] = 7296, [1] = 140404179695051, [2] = 94088578316976, [3] = 140404180018176, [4] = 140404180017664, [5] = 140404185449449, [6] = 140728768044176, [7] = 140404185448599, [8] = 140404185458050, [9] = 100, [10] = 140404180125856, [11] = 7322926704, [12] = 140728768044432, [13] = 140404185491192, [14] = 112, [15] = 100}
           },
           __sp = {
             sched_priority = 0
           },
           __policy = 0,
           __pad = {[0] = 0 <repeats 16 times>}
         }
 #3  0x00007fb2654289f6 in smb_panic_s3 (why=0x7ffdf83a9fd0 "Signal 11: Segmentation fault") at ../../source3/lib/util.c:839
         lp_sub = 0x7fb265461a60 <s3_global_substitution>
         cmd = 0x5592b47afe30 "/home/asn/workspace/projects/samba/selftest/gdb_backtrace 21964"
         result = 32690
         __FUNCTION__ = "smb_panic_s3"
 #4  0x00007fb2658f6f09 in smb_panic (why=0x7ffdf83a9fd0 "Signal 11: Segmentation fault") at ../../lib/util/fault.c:197
 No locals.
 #5  0x00007fb2658f6a39 in fault_report (sig=11) at ../../lib/util/fault.c:81
         counter = 1
         signal_string = "Signal 11: Segmentation fault\000\000\000\000\240:\370\375\177\000\000\000m?@/\214؊\377\245:\370\375\177\000\000\000m?@/\214؊\000\242:\370\375\177", '\000' <repeats 11 times>, "\242:\370\375\177\000\000\351C\231e\262\177\000\000`\240:\370\375\177\000\000\002:\231e\262\177\000\000Р:\370\375\177\000\000\a\000\000\000\061\000\000"
 #6  0x00007fb2658f6a4e in sig_fault (sig=11) at ../../lib/util/fault.c:92
 No locals.
 #7  <signal handler called>
 No locals.
 #8  0x00007fb2653762b4 in copy_service (pserviceDest=0x5592b4657940, pserviceSource=0x0, pcopymapDest=0x0) at ../../lib/param/loadparm.c:896
         src_ptr = 0x1
         dest_ptr = 0x5592b4657941
         i = 1
         bcopyall = true
         data = 0x5592b44a9020
 #9  0x00007fb2653e1e16 in add_a_service (pservice=0x0, name=0x5592b4476130 "laserjet1102w") at ../../source3/param/loadparm.c:1486
         i = 13
         tsp = 0x5592b44a9020
         __FUNCTION__ = "add_a_service"
 #10 0x00007fb2653e2846 in lp_add_printer (pszPrintername=0x5592b4476130 "laserjet1102w", iDefaultService=-1) at ../../source3/param/loadparm.c:1666
         comment = 0x7fb2654339ec "From Printcap"
         i = 21906
         __FUNCTION__ = "lp_add_printer"
 #11 0x00007fb2653e59b8 in lp_add_one_printer (name=0x5592b4476130 "laserjet1102w", comment=0x5592b512d5a0 "HP LaserJet Professional p 1102w, hpcups 3.19.6, requires proprietary plugin", location=0x5592b4476200 "", pdata=0x0) at ../../source3/param/loadparm.c:2988
         printers = -1
         i = 1700139171
 #12 0x00007fb26556112f in printer_list_exec_fn (rec=0x7ffdf83aa7e0, private_data=0x7ffdf83aa9f0) at ../../source3/printing/printer_list.c:446
         state = 0x7ffdf83aa9f0
         time_h = 0
         time_l = 17286
         name = 0x5592b4476130 "laserjet1102w"
         comment = 0x5592b512d5a0 "HP LaserJet Professional p 1102w, hpcups 3.19.6, requires proprietary plugin"
         location = 0x5592b4476200 ""
         ret = 100
         key = {
           dptr = 0x5592b456fdd0 "PRINTERLIST/PRN/LASERJET1102W",
           dsize = 30
         }
         value = {
           dptr = 0x5592b456fdee "",
           dsize = 100
         }
         __FUNCTION__ = "printer_list_exec_fn"
 #13 0x00007fb2646fc747 in db_tdb_traverse_read_func (tdb=0x5592b5377090, kbuf=..., dbuf=..., private_data=0x7ffdf83aa920) at ../../lib/dbwrap/dbwrap_tdb.c:399
         ctx = 0x7ffdf83aa920
         rec = {
           db = 0x5592b4957500,
           key = {
             dptr = 0x5592b456fdd0 "PRINTERLIST/PRN/LASERJET1102W",
             dsize = 30
           },
           value = {
             dptr = 0x5592b456fdee "",
             dsize = 100
           },
           value_valid = true,
           storev = 0x7fb2646fc672 <db_tdb_storev_deny>,
           delete_rec = 0x7fb2646fc68b <db_tdb_delete_deny>,
           private_data = 0x5592b5249b50
         }
 #14 0x00007fb26372c08d in ?? () from /usr/lib64/libtdb.so.1
 No symbol table info available.
 #15 0x00007fb26372c21d in tdb_traverse_read () from /usr/lib64/libtdb.so.1
 No symbol table info available.
 #16 0x00007fb2646fc7b7 in db_tdb_traverse_read (db=0x5592b4957500, f=0x7fb265561001 <printer_list_exec_fn>, private_data=0x7ffdf83aa9f0) at ../../lib/dbwrap/dbwrap_tdb.c:413
         db_ctx = 0x5592b5249b50
         ctx = {
           db = 0x5592b4957500,
           f = 0x7fb265561001 <printer_list_exec_fn>,
           private_data = 0x7ffdf83aa9f0
         }
 #17 0x00007fb2646f83ad in dbwrap_traverse_read (db=0x5592b4957500, f=0x7fb265561001 <printer_list_exec_fn>, private_data=0x7ffdf83aa9f0, count=0x0) at ../../lib/dbwrap/dbwrap.c:412
         ret = 0
 #18 0x00007fb265560d9b in printer_list_traverse (fn=0x7fb265561001 <printer_list_exec_fn>, private_data=0x7ffdf83aa9f0, read_only=true) at ../../source3/printing/printer_list.c:328
         db = 0x5592b4957500
         status = {
           v = 0
         }
 #19 0x00007fb2655611cc in printer_list_read_run_fn (fn=0x7fb2653e5970 <lp_add_one_printer>, private_data=0x0) at ../../source3/printing/printer_list.c:464
         state = {
           fn = 0x7fb2653e5970 <lp_add_one_printer>,
           private_data = 0x0,
           status = {
             v = 0
           }
         }
         status = {
           v = 0
         }
 #20 0x00007fb26555c9e6 in load_printers () at ../../source3/printing/load.c:86
         status = {
           v = 0
         }
         __func__ = "load_printers"
 #21 0x00007fb265599457 in delete_and_reload_printers () at ../../source3/smbd/server_reload.c:80
         n_services = -130372992
         pnum = 12
         snum = 12
         pname = 0x5592b55626f0 "\340=\277\264\222U"
         ok = true
         pcap_last_update = 17286
         frame = 0x5592b4797d70
         lp_sub = 0x7fb265461a60 <s3_global_substitution>
         __FUNCTION__ = "delete_and_reload_printers"
 #22 0x00007fb2655404d7 in delete_and_reload_printers_full (ev=0x5592b44a6940, msg_ctx=0x5592b44a92c0) at ../../source3/printing/queue_process.c:131
         session_info = 0x5592b55626f0
         pinfo2 = 0x0
         lp_sub = 0x7fb265461a60 <s3_global_substitution>
         n_services = 13
         pnum = -1
         snum = 13
         pname = 0x5592b45003d0 "\240\247F\264\222U"
         sname = 0x7ffdf83aab00 "\200\253:\370\375\177"
         status = {
           v = 0
         }
         __FUNCTION__ = "delete_and_reload_printers_full"
 #23 0x00007fb265540523 in reload_pcap_change_notify (ev=0x5592b44a6940, msg_ctx=0x5592b44a92c0) at ../../source3/printing/queue_process.c:150
 No locals.
 #24 0x00007fb265555855 in cups_async_callback (event_ctx=0x5592b44a6940, event=0x5592b5562570, flags=1, p=0x5592b4a9b160) at ../../source3/printing/print_cups.c:571
         frame = 0x5592b4e26960
         cb_args = 0x5592b4a9b160
         tmp_pcap_cache = 0x5592b45003d0
         ret_ok = true
         pcap_data = {
           status = {
             v = 0
           },
           count = 1,
           printers = 0x5592b5393800
         }
         pcap_blob = {
           data = 0x5592b47a48e0 "\001",
           length = 157
         }
         ndr_ret = NDR_ERR_SUCCESS
         i = 1
         __FUNCTION__ = "cups_async_callback"
 #25 0x00007fb26548b88c in tevent_common_invoke_fd_handler (fde=0x5592b5562570, flags=1, removed=0x0) at ../../lib/tevent/tevent_fd.c:138
         handler_ev = 0x5592b44a6940
 #26 0x00007fb265496148 in epoll_event_loop (epoll_ev=0x5592b4a30eb0, tvalp=0x7ffdf83aac50) at ../../lib/tevent/tevent_epoll.c:736
         fde = 0x5592b5562570
         flags = 1
         mpx_fde = 0x0
         ret = 1
         i = 0
         events = {[0] = {
             events = 17,
             data = {
               ptr = 0x5592b5562570,
               fd = -1252645520,
               u32 = 3042321776,
               u64 = 94088595907952
             }
           }}
         timeout = 750000
         wait_errno = 0
 #27 0x00007fb26549678f in epoll_event_loop_once (ev=0x5592b44a6940, location=0x7fb2657c54e0 "../../source3/printing/queue_process.c:424") at ../../lib/tevent/tevent_epoll.c:937
         epoll_ev = 0x5592b4a30eb0
         tval = {
           tv_sec = 749,
           tv_usec = 999054
         }
         panic_triggered = false
 #28 0x00007fb2654930fa in std_event_loop_once (ev=0x5592b44a6940, location=0x7fb2657c54e0 "../../source3/printing/queue_process.c:424") at ../../lib/tevent/tevent_standard.c:110
         glue_ptr = 0x5592b44aa700
         glue = 0x5592b44aa700
         ret = 21906
 #29 0x00007fb26548aaf7 in _tevent_loop_once (ev=0x5592b44a6940, location=0x7fb2657c54e0 "../../source3/printing/queue_process.c:424") at ../../lib/tevent/tevent.c:772
         ret = 21906
         nesting_stack_ptr = 0x0
 #30 0x00007fb26548ae1e in tevent_common_loop_wait (ev=0x5592b44a6940, location=0x7fb2657c54e0 "../../source3/printing/queue_process.c:424") at ../../lib/tevent/tevent.c:895
         ret = 32690
 #31 0x00007fb26549319c in std_event_loop_wait (ev=0x5592b44a6940, location=0x7fb2657c54e0 "../../source3/printing/queue_process.c:424") at ../../lib/tevent/tevent_standard.c:141
         glue_ptr = 0x5592b44aa700
         glue = 0x5592b44aa700
         ret = 32690
 #32 0x00007fb26548aec1 in _tevent_loop_wait (ev=0x5592b44a6940, location=0x7fb2657c54e0 "../../source3/printing/queue_process.c:424") at ../../lib/tevent/tevent.c:914
 No locals.
 #33 0x00007fb265541028 in start_background_queue (ev=0x5592b44a6940, msg_ctx=0x5592b44a92c0, logfile=0x0) at ../../source3/printing/queue_process.c:424
         fde = 0x5592b53bcee0
         ret = 21906
         status = {
           v = 0
         }
         pid = 0
         state = 0x5592b4bf3d50
         pause_pipe = {[0] = -1, [1] = 48}
         __FUNCTION__ = "start_background_queue"
 #34 0x00007fb265541154 in printing_subsystem_init (ev_ctx=0x5592b44a6940, msg_ctx=0x5592b44a92c0, dce_ctx=0x5592b44ae3e0, start_daemons=true, background_queue=true) at ../../source3/printing/queue_process.c:457
         pid = -1
 #35 0x00005592b436b820 in main (argc=5, argv=0x7ffdf83ab2e8) at ../../source3/smbd/server.c:2131
         bgq = true
         ok = false
         is_daemon = true
         interactive = false
         Fork = false
         no_process_group = false
         log_stdout = true
         ports = 0x0
         profile_level = 0x0
         opt = -1
         pc = 0x5592b4496df0
         print_build_options = false
         main_server_id = {
           pid = 21931,
           task_id = 0,
           vnn = 4294967295,
           unique_id = 7715839874465799134
         }
         OPT_DAEMON = OPT_DAEMON
         OPT_INTERACTIVE = OPT_INTERACTIVE
         OPT_FORK = OPT_FORK
         OPT_NO_PROCESS_GROUP = OPT_NO_PROCESS_GROUP
         OPT_LOG_STDOUT = OPT_LOG_STDOUT
         long_options = {[0] = {
             longName = 0x0,
             shortName = 0 '\000',
             argInfo = 4,
             arg = 0x7fb2650d9400 <poptHelpOptions>,
             val = 0,
             descrip = 0x5592b43732e1 "Help options:",
             argDescrip = 0x0
           }, [1] = {
             longName = 0x5592b43732ef "daemon",
             shortName = 68 'D',
             argInfo = 0,
             arg = 0x0,
             val = 1000,
             descrip = 0x5592b43732f6 "Become a daemon (default)",
             argDescrip = 0x0
           }, [2] = {
             longName = 0x5592b4373310 "interactive",
             shortName = 105 'i',
             argInfo = 0,
             arg = 0x0,
             val = 1001,
             descrip = 0x5592b4373320 "Run interactive (not a daemon) and log to stdout",
             argDescrip = 0x0
           }, [3] = {
             longName = 0x5592b4373351 "foreground",
             shortName = 70 'F',
             argInfo = 0,
             arg = 0x0,
             val = 1002,
             descrip = 0x5592b4373360 "Run daemon in foreground (for daemontools, etc.)",
             argDescrip = 0x0
           }, [4] = {
             longName = 0x5592b4373391 "no-process-group",
             shortName = 0 '\000',
             argInfo = 0,
             arg = 0x0,
             val = 1003,
             descrip = 0x5592b43733a8 "Don't create a new process group",
             argDescrip = 0x0
           }, [5] = {
             longName = 0x5592b43733c9 "log-stdout",
             shortName = 83 'S',
             argInfo = 0,
             arg = 0x0,
             val = 1004,
             descrip = 0x5592b43733d4 "Log to stdout",
             argDescrip = 0x0
           }, [6] = {
             longName = 0x5592b43733e2 "build-options",
             shortName = 98 'b',
             argInfo = 0,
             arg = 0x0,
             val = 98,
             descrip = 0x5592b43733f0 "Print build options",
             argDescrip = 0x0
           }, [7] = {
             longName = 0x5592b4373404 "port",
             shortName = 112 'p',
             argInfo = 1,
             arg = 0x7ffdf83ab158,
             val = 0,
             descrip = 0x5592b4373409 "Listen on the specified ports",
             argDescrip = 0x0
           }, [8] = {
             longName = 0x5592b4373427 "profiling-level",
             shortName = 80 'P',
             argInfo = 1,
             arg = 0x7ffdf83ab150,
             val = 0,
             descrip = 0x5592b4373437 "Set profiling level",
             argDescrip = 0x5592b437344b "PROFILE_LEVEL"
           }, [9] = {
             longName = 0x0,
             shortName = 0 '\000',
             argInfo = 4,
             arg = 0x7fb2654a8140 <popt_common_samba>,
             val = 0,
             descrip = 0x5592b4373459 "Common samba options:",
             argDescrip = 0x0
           }, [10] = {
             longName = 0x0,
             shortName = 0 '\000',
             argInfo = 0,
             arg = 0x0,
             val = 0,
             descrip = 0x0,
             argDescrip = 0x0
           }}
         parent = 0x5592b44addf0
         frame = 0x5592b448d6b0
         status = {
           v = 0
         }
         ev_ctx = 0x5592b44a6940
         msg_ctx = 0x5592b44a92c0
         dce_ctx = 0x5592b44ae3e0
         server_id = {
           pid = 21931,
           task_id = 0,
           vnn = 4294967295,
           unique_id = 5659117256920205400
         }
         se = 0x5592b44c0f90
         profiling_level = 0
         np_dir = 0x5592b4f2bdc0 "/home/asn/workspace/projects/samba/st/fl2003dc/ncalrpc/np"
         lp_sub = 0x7fb265461a60 <s3_global_substitution>
         smbd_shim_fns = {
           send_stat_cache_delete_message = 0x7fb26563ba6e <smbd_send_stat_cache_delete_message>,
           change_to_root_user = 0x7fb265613e99 <smbd_change_to_root_user>,
           become_authenticated_pipe_user = 0x7fb265613f4b <smbd_become_authenticated_pipe_user>,
           unbecome_authenticated_pipe_user = 0x7fb265614067 <smbd_unbecome_authenticated_pipe_user>,
           contend_level2_oplocks_begin = 0x7fb2656bb8df <smbd_contend_level2_oplocks_begin>,
           contend_level2_oplocks_end = 0x7fb2656bb902 <smbd_contend_level2_oplocks_end>,
           become_root = 0x7fb2656142cc <smbd_become_root>,
           unbecome_root = 0x7fb2656142f5 <smbd_unbecome_root>,
           exit_server = 0x7fb2656add55 <smbd_exit_server>,
           exit_server_cleanly = 0x7fb2656add72 <smbd_exit_server_cleanly>
         }
         __FUNCTION__ = "main"
         __func__ = "main"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 19 18:56:33 UTC 2021 on sn-devel-184
source3/printing/load.c