[Pkg-dspam-misc] Patch to include a directory with files with
parameters.
Matthijs Mohlmann
matthijs at cacholong.nl
Wed Nov 9 10:08:59 UTC 2005
Hi,
I have created an initial patch (doesn't work yet... because pointers
and references that are hitting me)
Please take a look and please please tel me what I'm doing wrong :)
The read_config is called from dspam.c and some other files, I moved the
file read function to a separate one and give a reference to the struct
as parameter. At that point I made a check for the Include parameter and
if found I call dirread function with a reference to the struct as
parameter. For every file in that specific directory I do a call to
fileread with the reference of that struct. Well you see some recursive
loop but that should work. Now my problem is a segmentation fault when
it tries to read the first parameter.
Well further tracking down the problem gives me that the config struct
is NULL while I am calloc it. I also include a proof of concept so you
don't have to compile dspam everytime.
http://www.cacholong.nl/~matthijs/debpkg/testdspam.tgz
(an easy makefile is included to compile it, patch is already applied in
this test)
And here a gdb backtrace:
#0 0x080487b0 in _ds_add_attribute (config=0x0, key=0xbfa13f34 "Home",
val=0xbfa13f39 "/var/spool/dspam\n") at config_shared.c:73
attr = 0x0
i = 0
#1 0x08048ecd in fileread (path=0x0, attrib=0xbfa14378) at
read_config.c:183
ptr = 0x0
file = (FILE *) 0x804b210
attrib_size = 128
num_root = 1
buffer = "Home\000/var/spool/dspam\n\000 the base directory to
be used for DSPAM
storage\n\000\024\uffff\uffff\uffff\177\uffff\uffff\006\000\000\000\000\000\000\000<\t\u0737\000\uffff\uffff\uffff\uffff\177\uffff\uffff\uffff\206\uffff\uffff\uffff\uffff\uffff\uffff\210@\uffff\uffff\uffff\uffff\uffff\uffff\n\uffff\uffff\uffff\uffff\177\uffff\uffff
\003\000\000\210@\uffff\uffffU\uffff\uffff\uffff\uffff\201\uffff\uffff\000
\uffff\uffff\b\205\uffff\uffff\000\000\000\000\000\000\000\000X\204\004\b\uffff!\uffff\uffff\202%\uffff\uffff\020\200\uffff\uffff\a\000\000\000\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\214\177\uffff\uffff<'\uffff\uffff\uffffn\u0737\223Z\u0737"...
a = 0xbfa13f34 "Home"
c = 0x0
v = 0xbfa13f39 "/var/spool/dspam\n"
bufptr = 0xbfa13f4a ""
#2 0x08048f6f in read_config (path=0x0) at read_config.c:202
attrib = (config_t *) 0x804b008
ptr = 0xb7e1a60e
attrib_size = 128
num_root = 0
#3 0x080486fe in main (argc=1, argv=0xbfa14444) at main.c:8
config = 0xb7f17cc0
Regards,
Matthijs Mohlmann
More information about the Pkg-dspam-misc
mailing list