# Ruby milter and C code

**URL:** <https://www.ruby-forum.com/t/ruby-milter-and-c-code/127248>\
**Category:** Ruby\
**Created:** [January 27, 2008, 12:30am UTC](https://www.ruby-forum.com/t/ruby-milter-and-c-code/127248 "2008-01-27T00:30:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barjunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@barjunk](https://www.ruby-forum.com/u/barjunk)\
**Post date:** [January 27, 2008, 12:30am UTC](https://www.ruby-forum.com/t/ruby-milter-and-c-code/127248/1 "2008-01-27T00:30:56Z")

</div>

I’ve been looking at the code at:

[http://ruby-asp.rubyforge.org/svn/trunk/ruby-sendmail-milter/milter.c](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.

---

<div class="post-metadata">

**Author:** ![barjunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@barjunk](https://www.ruby-forum.com/u/barjunk)\
**Post date:** [January 31, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/ruby-milter-and-c-code/127248/2 "2008-01-31T19:11:10Z")

</div>

On Jan 26, 2:29 pm, barjunk [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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:in `synchronize’  
(eval):3:in `at_tracing' /usr/lib/ruby/gems/1.8/gems/ruby-debug-base-0.9.3/lib/ruby- debug-base.rb:42:in `at\_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.
