Ruby milter and C code

I’ve been looking at the code at:

http://ruby-asp.rubyforge.org/svn/trunk/ruby-sendmail-milter/milter.c

and although it doesn’t work as presented, I was able to get it
working.

As I was going through the code I found a section like this:

pRbTSendmailMilter->xFilterName = STR2CSTR( filter );
pRbTSendmailMilter->xConnectString = STR2CSTR( conn );

and from what the 1.8.4 README.EXT file says is that these have been
deprecated. I’m
fairly new to C and I’m not exactly sure what this is doing. However,
it seems like I
should be able to just replace this with StringValueCStr.

Is there anything else that some of you more experienced C programmers
can see that might
also be a problem?

I wondered if the LHash stuff was needed with the newer version of
ruby as well.

Thanks for any advice.

Mike B.

On Jan 26, 2:29 pm, barjunk [email protected] wrote:

pRbTSendmailMilter->xConnectString = STR2CSTR( conn );

I wondered if the LHash stuff was needed with the newer version of
ruby as well.

Thanks for any advice.

Mike B.

Another problem as occurred while trying to use this code. I’ve been
getting a stack error so decided to use rdebug to see what I could
find out. During that process, I got this:

Call #1 :: ruby_stack_check = 0 / ruby_stack_length = 2691
Call #2 :: ruby_stack_check = 1 / ruby_stack_length = 35706191
Tracing(1):./sample.rb:11 print “my_connect:\n”
my_connect:
Tracing(1):./sample.rb:12 print " + hostname: #{hostname}\n"

  • hostname: localhost
    INTERNAL ERROR!!! stack level too deep
    /usr/lib/ruby/gems/1.8/gems/ruby-debug-0.9.3/cli/ruby-debug/
    processor.rb:73:in print' /usr/lib/ruby/gems/1.8/gems/ruby-debug-0.9.3/cli/ruby-debug/ processor.rb:60:in__at_tracing’
    (eval):5:in at_tracing' /usr/lib/ruby/1.8/thread.rb:135:insynchronize’
    (eval):3:in at_tracing' /usr/lib/ruby/gems/1.8/gems/ruby-debug-base-0.9.3/lib/ruby- debug-base.rb:42:inat_tracing’
    ./sample.rb:13:in `xxfi_connect’
    ./sample.rb:106
    /usr/lib/ruby/gems/1.8/gems/ruby-debug-0.9.3/bin/rdebug:136
    /usr/bin/rdebug:16 + callback completed.
    Tracing(1):./sample.rb:15 Sendmail::Milter::SMFIS_CONTINUE
    Call #3 :: ruby_stack_check = 1 / ruby_stack_length = 35706191

The interesting thing is that the program didn’t stop…it continues
to run.

The function at hand is supposed to be a registered callback.

Any ideas on what I might do to figure this out?

Mike B.