Skip to Content.
Sympa Menu

freetds - Re: [freetds] Server dumps core while reading login packet

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Steve Kirkendall <skirkendall AT dsl-only.net>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Server dumps core while reading login packet
  • Date: Wed, 14 Apr 2004 10:43:44 -0700

"James K. Lowden" <jklowden AT schemamania.org> wrote on Tuesday, Apr 13, 2004:
> On Tue, 13 Apr 2004, Steve Kirkendall <skirkendall AT dsl-only.net> wrote:
> > I'm trying to write a simple SQL server so Windows users can run Crystal
> > Reports on data in my company's Linux application.
>
> Welcome, Steve.
>
> > Last week I wrote the SQL interpreter,
>
> You may appreciate that's not a sentence I read every day....

Heh. It helps that a report writer should never change data. All of the
CREATE, DROP, INSERT, REMOVE, etc. operations go away, taking transactions
with them. My current plan is to support a full-featured SELECT operation
along with things like UNION, but almost nothing else.

At present, I've implemented SELECT on single tables. The hooks are in
place to support multiple tables; that will take about 1 more day. I want
to get the network interface working first though.

> I wonder if SQLite would be any use?
> http://www.hwaci.com/sw/sqlite/
>
> I would be fun to see our server implementation bolted in front of
> something moderately useful.

I don't think so. I'm only doing this to provide network access to the
files of our existing application. SQLite provide API access to its own
files. Not much functional overlap there.

I am intrigued by SQLite though, and from a weird perspective that you
might find interesting. I'm the author of a free vi clone (text editor)
named "Elvis", and the topic of extension languages sometimes comes up.
The most common suggestion is to have PERL be embedded in Elvis, and
although that will probably happen some day, I not very enthusiastic
about it. I've always considered PERL to be wonderful implementation of
a butt-ugly language. So I've been thinking about alternatives, and the
most interesting alternative I've invented is sort of a blend of SQL and
YACC/Lex. Each expression returns a stream of values; each value could
be a symbol, number, string, or record. A database table could emit a
stream of rows that way. SQL-like operators would combine the streams
in useful ways.

A language like that would be great for writing programs similar to
ctags and doxygen, as well as Web search engines. Compilers too -- I
would expect to write this language in this language, and have it
compile itself. Hopefully it would also work well for interactive
programs like text editors.

I think SQLite, or big chunks of it anyway, could be useful for this.

> > They crash while trying to read strings for the login packet.
>
> Brian wrote what's there, afaik. I probably runs only TDS 4.2. If you're
> trying something else, that could result in a segfault. Still, the unit
> test should oughta work.

On the Windows side, I'm testing with an old ODBC driver for MS SQL Server.
I told it to authorize by logging into the server, instead of using NT
authorization. By doing data dumps I have verified that it is indeed
sending an old Sybase-style login packet. The packet is big enough to be
split, but I don't think that's the problem.

I've looked at the DSTR values in the TDSLOGIN structure. They are not
being initialized anywhere, so they just have whatever random values
happened to be on the stack already. This morning, I tried initializing
them by calling tds_dstr_init() on them, and that prevents core dumps but
now it gets stuck in a select() call while reading the login. Maybe
while reading the second half of the split login packet? More tests
are needed.

> > Oh, one other little problem: The tsql program seems to ignore the
> > -pportnumber flag. I tried using -p1433 to make it use the same port
> > as MS SQL Server, but it insists on using port 4000.
>
> Look again at the man page. The port option is paired with the -H host
> option. It doesn't affect the -S servername option. It could reject -p
> -S, I suppose, but instead it just doesn't listen.

Okay, I understand. There's some weirdness in the FAQ then, for the
"What if I get a connection refused message?" question. It suggests
using "-U <hostmachine -p <port>" which I knew was wrong, but the next
line suggests "-S <servername> -p <port>", hence the confusion. I guess
both commands are wrong; they should have "-H <hostmachine> -p <port>"
and "-S <servername>" respectively.

--
Steve Kirkendall |A:It is confusing, since people don't read that way
kirkenda AT cs.pdx.edu |Q:Why is top-posting bad?
|A:It is adding comments to the top of a message
|Q:What is top-posting?



Archive powered by MHonArc 2.6.24.

Top of Page