[freetds] ct_config set CS_IFILE property is not working?

James K. Lowden jklowden at freetds.org
Wed Jan 4 23:45:54 EST 2012


On Tue, 3 Jan 2012 09:07:31 +0100
dariusz ostolski <dariusz.ostolski at gmail.com> wrote:

> 1. Can You confirm that I cannot set custom path to interfaces file
> using ct_config?

Yes.  The FreeTDS function supports only three properties,  CS_IFILE
not among them.  

> 2. What alternatives do I have? I don't want to modify $SYBASE
> environment variable and I wouldn't like to use any function outside
> ct library?

USTL.  There's a static constant src/tds/config.c::interfaces_path.
Add to the case statement in ct_config, diddle just a bit with the
logic around config.c:1095:

		if (!sybase || !sybase[0])
			sybase = interfaces_path;

		...
		found = search_interface_file(login, sybase,
						"interfaces", server);

to something like:

	static const char default_interfaces_path[] = "/etc/freetds"; 
				// should be $PREFIX from configure
	/* interfaces_path can be set by ct_config CS_IFILE */
	const char *interfaces_path = default_interfaces_path;
	...
	if (interfaces_path == default_interfaces_path) {
		if (!sybase || !sybase[0])
			sybase = interfaces_path;
	} else {
			sybase = interfaces_path;
	}

and call it a day.  If you post such a patch, I'll include it in the
main branch.  

That's just a hack, though.  For extra credit, the path should be in
CS_CONTEXT.  

HTH.  

--jkl


More information about the FreeTDS mailing list