1833759 Members
2413 Online
110063 Solutions
New Discussion

Re: connecting from c

 
SOLVED
Go to solution
Piotr Kirklewski
Super Advisor

connecting from c

Hi there

I'm connecting to my database server from c program almost fine except the MYSQL server complains that my host has no permission. This is a production server so I don't want to mess with the server to much.
I need to change my tcp/ip headers to pretend the connection is comming from the loclahost.
Does anyone knows how to do that ?
Regards
PEter
Jesus is the King
9 REPLIES 9
Steven Schweda
Honored Contributor
Solution

Re: connecting from c

> I need to change my tcp/ip headers to
> pretend [...]

I doubt that.

If you pretend that you're coming from
"localhost", why wouldn't the MYSQL server
send its replies back to "localhost" instead
of to "my host"?

> [...] so I don't want to mess with the
> server to much.

Why not set up another server with which you
_can_ mess.
Andrey Chipalyuk
Frequent Advisor

Re: connecting from c

You must set grant of privileges in MySQL for you host where you connects from your c program.
Piotr Kirklewski
Super Advisor

Re: connecting from c

Ok
Ho can I pretend that my address is different - i know it's possible - proxy ?
Jesus is the King
rick jones
Honored Contributor

Re: connecting from c

You would have to install a "proxy" (most likely a customer one you wrote yourself that accepted a tcp connection from your system and then opened one to the MySQL server and then passed bytes back and forth each way) on the/a machine that the MySQL server is willing to communicate with, and then speak to the "proxy" from your system.

There may be some way to get that to happen with ssh or netcat but I don't know the syntax myself.
there is no rest for the wicked yet the virtuous have no pillows
Bill Hassell
Honored Contributor

Re: connecting from c

So you want to pretend that you are an authorized host to connect to a database? In most companies, that would be defined as unauthorized access to company data, similar to 'borrowing' another login and password. hostname authorization is part of almost every major database product.


Bill Hassell, sysadmin
Andrey Chipalyuk
Frequent Advisor

Re: connecting from c

To pretend ip addresses there is network address translation protocol (NAT protocol). For example, NAT can allow to translate all incoming connections on host from you address to localhost address of host.
rick jones
Honored Contributor

Re: connecting from c

However if you attempt to pretend to be the IP of another live system, I suspect you will run into all sorts of protocol issues - having two systems purporting to be the same system rarely works well... So, it is best to treat root cause and get permissions to access the server from your system as it is.
there is no rest for the wicked yet the virtuous have no pillows
Steven Schweda
Honored Contributor

Re: connecting from c

> [...] In most companies, that would be
> defined as unauthorized access to company
> data, [...]

And any organization which won't let you
access the data-base server from some other
system, but which will let you install some
proxy server on that data-base server so that
you can do what they won't let you do, needs
to have its head examined.
Piotr Kirklewski
Super Advisor

Re: connecting from c

Thanks guys
Thread closed
Jesus is the King